wuzzle Posted August 2, 2006 Share Posted August 2, 2006 Alright here's my problem. I currently have a layout php called include.inc.php which holds this code:Echo "$SHTM<table border=1><tr><td>Cell 1</td><td>Cell 2</td></tr></table>$EHTML";?>Now my issue is when I want to include this layout into other pages whenever I add text to a new .php it puts it after the table, when I want it to go into either cell 1 or cell 2 of the table. Now I'm pretty sure the below code is correct, however I do not know what to put after the include("include.inc.php"); part in order to edit the certain cells. Any help would be amazing!<?PHPinclude("include.inc.php");?> Link to comment https://forums.phpfreaks.com/topic/16381-layout-template-help/ Share on other sites More sharing options...
onlyican Posted August 2, 2006 Share Posted August 2, 2006 an include (and require) add the script when it is calledmy include file could say "This is an include"If I have my page"This is text<br /><? include("myinclude.php"); ?><br />this is more textThe output would beThis is textthis is an includethis is more text Link to comment https://forums.phpfreaks.com/topic/16381-layout-template-help/#findComment-68170 Share on other sites More sharing options...
wuzzle Posted August 2, 2006 Author Share Posted August 2, 2006 Ok, but lets say my include file is my layout (so I can just change this one file to change every page) - I'm going to want to put it first in my php file, thus the:[code]<?phpinclude("include.inc.php");[/code]at the very start of code.What I need to know is how to insert text or other things in the middle of this include.inc.php file.-------------So an example (this is my include.php file)<?phpEcho "$SHTM<table border=1><tr><td>Cell 1</td><td>Cell 2</td></tr></table>$EHTML";?>My index page needs a welcome message and my layout is just a normal two cell table. I want to insert the word hello into the second cell by changing the /index.php file while leaving the include.inc.php file alone. And then another page (lets say index2.php needs to say another message in the cell 2, but only by changing the index2.php.index.php file:<?PHPinclude("include.inc.php");?> ??? ??? ??? (PS sorry I'm very noob at PHP and I hope this makes sense.) Link to comment https://forums.phpfreaks.com/topic/16381-layout-template-help/#findComment-68176 Share on other sites More sharing options...
AndyB Posted August 2, 2006 Share Posted August 2, 2006 Normally, what's in an included file [b]doesn't get changed[/b] significantly. A normal arrangement might be:[code]<?phpinclude("top_of_page_stuff.php");?><!-- your page content goes here--><?phpinclude("bottom_of_page_stuff.php");?>[/code]top of page stuff and bottom of page stuff act like 'wrappers' to the content. Link to comment https://forums.phpfreaks.com/topic/16381-layout-template-help/#findComment-68179 Share on other sites More sharing options...
onlyican Posted August 2, 2006 Share Posted August 2, 2006 You CANhave on your include<td>".$cell1."</td><td>".$cell2."</td>Then on your page BEFORE the include$cell1 = "This is the stuff that goes in cell 1";$cell2 = "This is what shows in cell 2";but Andy is sorta correctThe point of an include is you can change something, and every page changesFor exampleAll my websitesI have an include of navigationso I want to add a link or something, I change one file Link to comment https://forums.phpfreaks.com/topic/16381-layout-template-help/#findComment-68180 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.