Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt Monday at 02:04 PM
linkmat Posted September 27, 2015 Posted September 27, 2015 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
flashpoint Posted September 27, 2015 Posted September 27, 2015 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.
linkmat Posted September 27, 2015 Author Posted September 27, 2015 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:
flashpoint Posted September 27, 2015 Posted September 27, 2015 Good you show me line 195 in block.php? Your code works just fine: http://instantgaming.net/test.php Here is what I did: Go to adminCP Press "Pages" Press "Add Page" Select "Manaul HTML" and press next Page Name: Whatever you want it to be Page filename: I assume you're doing a chat-related thing so lets say MyChat.php Press "Conent" Paste your PHP code in the content area Press Save Click the dropdown menu on your new page. So click the arrow down icon on your "MyChat.php" Press "Permissions" Select the permissions that you need and press Save! You're done, visit your website and go to MyDomain.com/MyChat.php Good Luck!
linkmat Posted September 27, 2015 Author Posted September 27, 2015 but the same Script on my page normal work and get the data. and on IPS and the line over there its all of my block .. atm
flashpoint Posted September 30, 2015 Posted September 30, 2015 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);
emilhem Posted September 30, 2015 Posted September 30, 2015 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.
Tom S. Posted September 30, 2015 Posted September 30, 2015 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"}
emilhem Posted September 30, 2015 Posted September 30, 2015 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/
Ugur Kaya Posted September 30, 2015 Posted September 30, 2015 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.
linkmat Posted September 30, 2015 Author Posted September 30, 2015 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 ...
linkmat Posted October 1, 2015 Author Posted October 1, 2015 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
Recommended Posts
Archived
This topic is now archived and is closed to further replies.