freebsdntu Posted December 13, 2007 Share Posted December 13, 2007 Hi, the design is like this. In a webpage,I have a left side navigator occupying about 20% of the width,the remain 80% on the right becomes the content part. Say in the navigation bar,there are several links, and I would like to display corresponding contents on the right depending on which link the user presses. How do I achieve this? I have heard of the Iframe approach, but my concern is the compatibility with browsers,is there an alternative way to achieve it in php? Thank you very much! Quote Link to comment Share on other sites More sharing options...
adam291086 Posted December 13, 2007 Share Posted December 13, 2007 You can set the url up to do something like www.yourdomain.com?page=1 www.yourdomain.com?page=2 www.yourdomain.com?page=3 Store all the page details in a database. The use the $_get function to get the page id. Then query the database on the page id and echo out all the information from the results. Quote Link to comment Share on other sites More sharing options...
freebsdntu Posted December 13, 2007 Author Share Posted December 13, 2007 Wow,that's nice,no wonder I see all those ?page= strings in many urls. I would definitely look into this. By the way,what actually does the ? symbol function there? Any good tutorials on this? Thank you very much! Quote Link to comment Share on other sites More sharing options...
adam291086 Posted December 13, 2007 Share Posted December 13, 2007 To be honest i dont know what the ? does. All i know is that you need it. Hopefully one of the gurus will know. Quote Link to comment Share on other sites More sharing options...
freebsdntu Posted December 13, 2007 Author Share Posted December 13, 2007 I just did a google search,if I understand it correctly,it should be implying the start of a query string. Back to the main issue,if I do that,I would have to load the entire page,don't I? What if I only want to load the content portion,rather then the link portion which is the same for all the pages? Quote Link to comment Share on other sites More sharing options...
adam291086 Posted December 13, 2007 Share Posted December 13, 2007 From what i understand the links will remain the same and dont reload. All that is changing is the query results. Therefore all thats changing is the content. So when you click a link. The query results will change automatically and that content will be displayed. You will on have one page for all your information. Quote Link to comment Share on other sites More sharing options...
freebsdntu Posted December 13, 2007 Author Share Posted December 13, 2007 Wow,that's great,can you give me some solid examples?Like how do I change the content? Quote Link to comment Share on other sites More sharing options...
adam291086 Posted December 13, 2007 Share Posted December 13, 2007 <?php include 'config.php'; //button stuff $search = adam $result = mysql_query("SELECT * FROM RTE WHERE Page_Group ='$search' ") or die(mysql_error()); while($row = mysql_fetch_array($result)) { $pagename = $row['Page_Name']; echo '<a href="http://adamplowman.co.uk/cycling/rte/rte.php?pagename='.urlencode($pagename).'">'. $pagename.'</a>'; echo "<br />"; } include 'closedb.php'; ?> That search my database for all the pages related to adam. It then creates a link with the name adam. then when the link is pressed the following code will be on that page. $result = mysql_query("SELECT * FROM RTE WHERE Page_Name = '$search'"); while($row = mysql_fetch_array($result)) { $text = $row['text']; $id= $row['text_id']; $title= $row['title']; $subtitle= $row['sub_heading']; } this select all the information about adam and sets it into a variable. Then in my html code i just do echo $text; Hope this helps Quote Link to comment Share on other sites More sharing options...
freebsdntu Posted December 13, 2007 Author Share Posted December 13, 2007 thank you,adam,that's very useful piece of information,I am gonna study it thoroughly.Thank you very much! Quote Link to comment Share on other sites More sharing options...
adam291086 Posted December 13, 2007 Share Posted December 13, 2007 it's ok. Just make sure you understand whats going on ect. Quote Link to comment 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.