Create a PHP page
#1
Posted 01 July 2012 - 09:47 AM
#2
Posted 02 July 2012 - 08:42 AM
It's simply that the PHP code you enter is eval'd, so typically you have to omit the open <?php tags. Otherwise, we've created many PHP pages on our main website and in various places on the company forums here (most of them are just quick staff things, not public pages).
Developer / Senior Support
If it sounds like fun, it's not allowed on the bus!

Invision Power Services, Inc.
#3
Posted 02 July 2012 - 01:25 PM
<?
$array = array('something here', 'Something here', 'Something here', 'Something here',);
$randkey = array_rand($array);
?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<title><?php echo $array[$randkey]; ?></title>
Now when I do that, I get the following error:
[b]Parse error[/b]: syntax error, unexpected '<' in [b]/applications_addon/ips/ccs/sources/pages.php(167) : eval()'d code[/b] on line [b]1[/b]
So how do I actually input the php tag for it to work correctly ?
CrossFire-Radio
DJ Fire - CEO
http://www.crossfire-radio.com
My Downloads
#4
Posted 02 July 2012 - 05:18 PM
$array = array('something here', 'Something here', 'Something here', 'Something here',);
$randkey = array_rand($array);
print "$array[$randkey]";
#5
Posted 02 July 2012 - 05:31 PM
I'm not clear what you mean. You can use "regular" PHP in the "raw" PHP pages (there's no difference).
It's simply that the PHP code you enter is eval'd, so typically you have to omit the open <?php tags. Otherwise, we've created many PHP pages on our main website and in various places on the company forums here (most of them are just quick staff things, not public pages).
There's a big difference to me the end user. On a regular PHP page I can use double quotes nearly anywhere. I can use dynamic javascript snippets etc. I literally had to go with Drupal for off forum site content rather than IP Content after trying off and on for a couple of years to get important php scripts to work. They are the biggest draw to my site.The PHP files could simply be cut and paste into Drupal and work instantly.
It would be great if there could be a selection (HTML, Raw PHP and ______ ) where the source code within that container worked like any other file that can be uploaded via FTP. Save them as html or php extensions etc.
#6
Posted 02 July 2012 - 10:50 PM
Is there a way to use both HTML and PHP together on the content page with out getting the errors?
Is it basically using alot of "echo" statements and such in order for it to work correctly?
CrossFire-Radio
DJ Fire - CEO
http://www.crossfire-radio.com
My Downloads
#7
Posted 02 July 2012 - 11:11 PM
I haven't had success with echo so I use print.
#8
Posted 03 July 2012 - 08:34 AM
I would convert your PHP code as so:
$array = array('something here', 'Something here', 'Something here', 'Something here',);
$randkey = array_rand($array);
print <<<EOF
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<title>{$array[$randkey]}</title>
EOF;Alternatively, you can use what you provided almost as is, however you have to remember as I said that it is being eval'd, and thus you need to change the php opening/closing tags to account for this. Here's an example that would probably work.
$array = array('something here', 'Something here', 'Something here', 'Something here',);
$randkey = array_rand($array);
?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<title><?php echo $array[$randkey]; ?></title>
<?phpWhile I didn't test it, you'll note that because it is being eval'd and the <?php tag is already open, I removed that at the beginning. Next, I let PHP close as you have it so the HTML can print out, BUT then I reopen the <?php tag once it's done so that the rest of the IP.Content code can continue to execute.
- CrossFire-Radio, IH_Jimbo, Nevo and 1 other like this
Developer / Senior Support
If it sounds like fun, it's not allowed on the bus!

Invision Power Services, Inc.
#9
Posted 03 July 2012 - 12:47 PM
Alternatively, you can use what you provided almost as is, however you have to remember as I said that it is being eval'd, and thus you need to change the php opening/closing tags to account for this. Here's an example that would probably work.
$array = array('something here', 'Something here', 'Something here', 'Something here',); $randkey = array_rand($array); ?> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <title><?php echo $array[$randkey]; ?></title> <?php
While I didn't test it, you'll note that because it is being eval'd and the <?php tag is already open, I removed that at the beginning. Next, I let PHP close as you have it so the HTML can print out, BUT then I reopen the <?php tag once it's done so that the rest of the IP.Content code can continue to execute.
I did the testing on this, and it works perfectly... Thanks so much Brandon
CrossFire-Radio
DJ Fire - CEO
http://www.crossfire-radio.com
My Downloads
#10
Posted 02 August 2012 - 03:01 AM
I created raw php page, to content wrote
<?php echo 'Hello World'; ?>
but I see nothing. What's wrong?
FreeSpace - FreeSpace Forum - Twitter - Facebook - WebMiesto
Axel Wers, on 28 Nov 2012 - 7:22 PM, said:
iArcade should be regular app in IP.Suite. Currently IPB looks much more social network than common forum. And games are very popular in social networks.
#11
Posted 02 August 2012 - 03:06 AM
I am probably dumb, but what is wrong on this?
I created raw php page, to content wrote<?php echo 'Hello World'; ?>
but I see nothing. What's wrong?
echo 'Hello World';the php tags
#12
Posted 02 August 2012 - 05:39 AM
Only big issue when I put php raw code to block
FreeSpace - FreeSpace Forum - Twitter - Facebook - WebMiesto
Axel Wers, on 28 Nov 2012 - 7:22 PM, said:
iArcade should be regular app in IP.Suite. Currently IPB looks much more social network than common forum. And games are very popular in social networks.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users












