Jump to content

Problem to insert PHP Script in IP.Page

Featured Replies

Posted

Hi guys i wanna try to insert Raw php in my IP.Page but im not a realy good Scripter in php :(

and what i want to make its a List with  name of my room

	<label class="col_4">Selectionnez votre salon : </label>
         
            <!--ON APELLE LA PAGE POUR SELECT ROOM-->
 			<select name="listroom" size="1" id="listroom" class="col_5">
  			<?php
				try
					{
						$DB = new PDO('mysql:host=127.0.0.1;dbname=flashchat', 'root', '');	}
						catch (PDOException $e){
						echo 'la base ne fonctione pas';
					}
						$sql = 'SELECT name,room_id FROM room';
						$req = $DB->query($sql);
						while($d = $req->fetch(PDO::FETCH_OBJ)){
					?>
		<!-- DEBUT CODE -->
				<option value="<?php echo $d->room_id; ?>"> <?php echo $d->name; ?> </option>	
				<?php } ?> 	<!-- FIN CODE -->
				</select> 

in a other BDD then the one of my forum ... Someone can help me :(

 

can you show us the errors?

 

ini_set('display_errors',1);
ini_set('display_startup_errors',1);
error_reporting(-1);

 

Also quick recommendation: do not use root for anything like this.

  • Author

atm im working  on a test ... before enter the script on a live board :) and this is my error :(

 

( ! ) Parse error: syntax error, unexpected '<' in D:\wamp\www\support\applications\cms\sources\Blocks\Block.php(195) : eval()'d code on line 1
Call Stack
# Time Memory Function Location
1 0.0002 244680 {main}( ) ..\index.php:0
2 0.3363 10903552 IPS\_Dispatcher->run( ) ..\index.php:13
3 0.3778 11057096 IPS\cms\modulesront\pages\_page->execute( ) ..\Dispatcher.php:129
4 0.3778 11057320 IPS\Dispatcher\_Controller->execute( ) ..\page.php:33
5 0.3778 11057472 IPS\cms\modulesront\pages\_page->manage( ) ..\Controller.php:94
6 0.3778 11059520 IPS\cms\modulesront\pages\_page->view( ) ..\page.php:43
7 0.4631 11858864 IPS\cms\Pages\_Page->getHtmlContent( ) ..\page.php:95
8 0.5623 11866664 call_user_func:{D:\wamp\www\support\applications\cms\sources\Pages\Page.php:980} ( ) ..\Page.php:980
9 0.5624 11866696 IPS\Theme\content_pages_2( ) ..\Page.php:980
10 0.5640 12197232 IPS\cms\Blocks\_Block::display( )

..\Theme.php(3904) : eval()'d code:

Good you show me line 195 in block.php?

 

Your code works just fine: http://instantgaming.net/test.php

 

Here is what I did:

  1. Go to adminCP
  2. Press "Pages"
  3. Press "Add Page"
  4. Select "Manaul HTML" and press next
  5. Page Name: Whatever you want it to be
  6. Page filename: I assume you're doing a chat-related thing so lets say MyChat.php
  7. Press "Conent"
  8. Paste your PHP code in the content area
  9. Press Save
  10. Click the dropdown menu on your new page. So click the arrow down icon on your "MyChat.php"
  11. Press "Permissions"
  12. Select the permissions that you need
  13. and press Save!
  14. You're done, visit your website and go to MyDomain.com/MyChat.php

Good Luck!

  • Author

but the same Script on my page normal work :)  and get the data.

whatsupposedtobe.thumb.png.606aeb3d3da19

and on IPS

datanotrequired.thumb.png.fa47859144651f

and the line over there its all of my block .. atm :)

So is it working now, or you're still having that issue on post #1?

edit:

oh you're missing data.

Okay can you add these lines to the script on your ChatBox.php @IPS pages.

 

ini_set('display_errors',1);
ini_set('display_startup_errors',1);
error_reporting(-1);

PHP in IP.Pages has been disabled in IPS4.
You need to use template syntax. with curley brackets.

 

I'v so far not been able to make a single of our old php pages work in IPS 4, very unsure on how to solve dynamic content.

4 hours ago, emilhem said:

PHP in IP.Pages has been disabled in IPS4.
You need to use template syntax. with curley brackets.

 

I'v so far not been able to make a single of our old php pages work in IPS 4, very unsure on how to solve dynamic content.

You have two options I know of.

1. Create a custom block and add php code to that (you can use normal php code there). Then insert the block into the page.

2. Create a php file and upload it to your server. Then include it into your page with the code:

{insert="myfolders/myphpfile.php"}

 

This is the reply we got from IPS

You cannot use direct PHP in a Pages' HTML Content area, you will need to use template syntax.

For more information on this, please see: https://community.in...late-logic-r73/

or the methods I suggested....

On 27.9.2015,, linkmat said:

Hi guys i wanna try to insert Raw php in my IP.Page but im not a realy good Scripter in php :(

and what i want to make its a List with  name of my room


	<label class="col_4">Selectionnez votre salon : </label>
         
            <!--ON APELLE LA PAGE POUR SELECT ROOM-->
 			<select name="listroom" size="1" id="listroom" class="col_5">
  			<?php
				try
					{
						$DB = new PDO('mysql:host=127.0.0.1;dbname=flashchat', 'root', '');	}
						catch (PDOException $e){
						echo 'la base ne fonctione pas';
					}
						$sql = 'SELECT name,room_id FROM room';
						$req = $DB->query($sql);
						while($d = $req->fetch(PDO::FETCH_OBJ)){
					?>
		<!-- DEBUT CODE -->
				<option value="<?php echo $d->room_id; ?>"> <?php echo $d->name; ?> </option>	
				<?php } ?> 	<!-- FIN CODE -->
				</select> 

in a other BDD then the one of my forum ... Someone can help me :(

 

This is not recommendable i'd not do this.You should follow the syntax in ipb and organize your code.

  • Author
10 hours ago, Tom S. said:

You have two options I know of.

1. Create a custom block and add php code to that (you can use normal php code there). Then insert the block into the page.

2. Create a php file and upload it to your server. Then include it into your page with the code:


{insert="myfolders/myphpfile.php"}

 

Thanks i will try this ...

  • Author
On 2015-09-30, Ugur Kaya said:

This is not recommendable i'd not do this.You should follow the syntax in ipb and organize your code.

im a realy a newby in PHP if someone can help me to  organize my code for the syntax of ipb its will be apreciate

Archived

This topic is now archived and is closed to further replies.

Recently Browsing 0

  • No registered users viewing this page.