Jump to content

How do I achieve this?Iframe?


freebsdntu

Recommended Posts

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!

Link to comment
Share on other sites

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.

 

 

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

 

 

Link to comment
Share on other sites

<?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

 

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.