Jetheat Posted February 12, 2008 Share Posted February 12, 2008 I have a template page called template.php. It contains the header, left nav bar, right nav bar and the footer. So the only place available for content is the middle (inside a table). Now, I want relevant content displayed in the middle of this page depending on which link the user clicks on the nav bars. The content for each link will be contained in another file in another folder. So if the user clicks on the "about us" link, the php should display the contents of the /mainfolder/about.php file. So, in the middle of teh template page, I have placed some code which says: <!-- content --> <div id="content"> {{content}} </div> Now all I need to do is define what "content" is and call it, right? My about page consists of a lot of html. How do I get that whole page to display within the center of my template page and yet the user sees about.php in their address bar. Furthermore, my template.php references a stylesheet in the same folder. All the pages which are called into the middle of the template page are in other folders on my server and if they are requested, then the reference to the stylesheet is not there anymoe. How do I solve this? Appreciate the help. JH Quote Link to comment https://forums.phpfreaks.com/topic/90685-calling-content-from-another-page/ Share on other sites More sharing options...
Cognito Posted February 12, 2008 Share Posted February 12, 2008 My way would be to use a dynamic include - <? include("'$page'.'html"); ?> and then call yourdomain.co.uk/index.php?page=aboutus There might be a more sensible way to do this Im just an amateur Quote Link to comment https://forums.phpfreaks.com/topic/90685-calling-content-from-another-page/#findComment-464827 Share on other sites More sharing options...
Jetheat Posted February 13, 2008 Author Share Posted February 13, 2008 I have about 20-30 links on the main page. How do I deal with it if anyone clicks on those? I need a system for if anyone clicks on any link, it will show the relevant page within the center of my main page. How do I do this? JH Quote Link to comment https://forums.phpfreaks.com/topic/90685-calling-content-from-another-page/#findComment-465669 Share on other sites More sharing options...
digitalmartyr Posted February 13, 2008 Share Posted February 13, 2008 go check this out, follow this tutorial, and you can do it with a million links. http://marek.litomisky.com/2007/01/10/php-switch-navigation-with-mod_rewrite/ Quote Link to comment https://forums.phpfreaks.com/topic/90685-calling-content-from-another-page/#findComment-465685 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.