jaymc Posted June 29, 2009 Share Posted June 29, 2009 I'd like to see how other people design a dynamic website using php which will have its content changed via url get parameters such as www.site.com/?dir=a&page=1 Can anyone point me to a good tutorial that takes you through the correct way to go about this The way I currently do it is using a master index with header.inc php code to determine the content file/script to include footer.inc Quote Link to comment https://forums.phpfreaks.com/topic/164163-solved-dynamic-website-structure/ Share on other sites More sharing options...
Yesideez Posted June 29, 2009 Share Posted June 29, 2009 Can you give me an example? I can't seem to understand full what it is you're asking... Quote Link to comment https://forums.phpfreaks.com/topic/164163-solved-dynamic-website-structure/#findComment-866002 Share on other sites More sharing options...
Yesideez Posted June 29, 2009 Share Posted June 29, 2009 That's similar to what I use but I don't think there's a right and wrong way to do it - down to individual taste. What I do is make my template as a plain HTML file. This page has everything on it I want to display. Once completed I split it up into smaller include files and then make an index file and include them all back in. Quote Link to comment https://forums.phpfreaks.com/topic/164163-solved-dynamic-website-structure/#findComment-866005 Share on other sites More sharing options...
jaymc Posted June 29, 2009 Author Share Posted June 29, 2009 its the including page content bit Im asking about e.g <? include("header.inc"); // content here $dir = $_GET['dir'] $page = $_GET['page'] include("$dir/$page"); include("footer.inc"); ?> Thats how I do it at the moment, of course with security added in to ensure cant open what every dir/file they input. Im just wondering if thats the most logical way? Quote Link to comment https://forums.phpfreaks.com/topic/164163-solved-dynamic-website-structure/#findComment-866006 Share on other sites More sharing options...
aggrav8d Posted June 29, 2009 Share Posted June 29, 2009 jaymc, it really depends on what you're doing with the system and your personal philosophy. IMHO the best method is the one that lets you get the job done bug-free as fast as possible. flexibility and customizations are niceties. Quote Link to comment https://forums.phpfreaks.com/topic/164163-solved-dynamic-website-structure/#findComment-866007 Share on other sites More sharing options...
jaymc Posted June 29, 2009 Author Share Posted June 29, 2009 Here is a better insight on what I am probably going to design it like http://www.blinding-light.com/tutorials/read/7 Look at the screenshot of his directory structure and then of course the code used to build the page Is there any bad logic with this method? I get annoyed making things then getting stick on irc for not doing it the 'correct way' or most logical way this id prefer to design it the way the books/documentation advises. Quote Link to comment https://forums.phpfreaks.com/topic/164163-solved-dynamic-website-structure/#findComment-866009 Share on other sites More sharing options...
pkedpker Posted June 30, 2009 Share Posted June 30, 2009 I used to use <?php $modules = array( 'news' => 'news', 'forum' => 'forum', 'members' => 'members' 'register' => 'register', 'login' => 'login', 'logout' => 'logout' ); if (!isset($_GET['act'])) $act = 'news'; else $act = $_GET['act']; // Include the current module if (in_array($act, $modules)) include('modules/' . $act . '.php'); until today.. I started to use templating system.. p.s> its pretty funny everyday I come to phpfreaks with a problem.. half the new topics have similar problem to mines.. is it just me or does phpfreaks forum pick out problems similar to yours.. Quote Link to comment https://forums.phpfreaks.com/topic/164163-solved-dynamic-website-structure/#findComment-866031 Share on other sites More sharing options...
jaymc Posted June 30, 2009 Author Share Posted June 30, 2009 Yes sometimes hehe Why did you move from the method you have included as an example? Quote Link to comment https://forums.phpfreaks.com/topic/164163-solved-dynamic-website-structure/#findComment-866088 Share on other sites More sharing options...
pkedpker Posted June 30, 2009 Share Posted June 30, 2009 I moved back now . I wanted to make the code look more pretty then it is ATM.. so I wanted to try a template engine.. and after the template engine failed in both looking pretty and performance I reverted back to my old backup using this. When I used a template engine the processing speed went up a tenth of a speed (like 2 pages slower) and didn't even do function calls as my old script did.. so screw it.. Quote Link to comment https://forums.phpfreaks.com/topic/164163-solved-dynamic-website-structure/#findComment-866127 Share on other sites More sharing options...
jaymc Posted June 30, 2009 Author Share Posted June 30, 2009 yEh I'm not a fan of templates probs only useful if a lot of people working on development Quote Link to comment https://forums.phpfreaks.com/topic/164163-solved-dynamic-website-structure/#findComment-866533 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.