Jump to content

some advice please re best way to put my bits of code together


gibbo1715

Recommended Posts

Hi All

 

reasonably new still to php/ my sql and i d like to know what the standard would be for the follows please

 

I intend to have a page with a tree view on the left, a text input area on the right and various content in the middle all called from a database.

 

When clicking on the treeview it will call the database and update the middle section with the content

 

Do we still use frames (As i used to in the distant past), do we uss css and have it all on one page with the treeview in one php file called fromn the index and the middle another and so on or is there a third way

 

thanks in advance, i d just like to comply with standards, i ve got the various bits working but im sure if i get this wrong it may impact on performance etc

 

thanks again

 

Gibbo

 

 

if your not wanting to reload entire page you can put the content section in a div tag and use ajax to change the conents of the div tag, this way your content will still get referenced by bots. Content placed inside frames or iframes does not get indexed.

Depending on your content you can;

 

use the "GET" method by doing the following;

 

your tree menu might look like;

 

<a href="mypage.php?Content=Page1">Page 1</a>
<a href="mypage.php?Content=Page2">Page 2</a>
<a href="mypage.php?Content=Page3">Page 3</a>

 

When you click on the link it will set the Content variable in the URL bar.

 

Then in your centre body <div> tag maybe;

 

<?php

$Content = $_GET['Content'];

if(isset($Content)) //if variable is set
{

$Content = mysql_real_escape_string($Content); // sanitises data before using in database

//select some content from some table where the content column equals the URL variable set by the link i.e. page1 

$sql = "SELECT whatever FROM mytable WHERE Content= '$Content'"; 

mysql_query($sql);

//....... now fetch and output the result
}
else
{
//do something if the Content variable is not set like display homepage for example 
}
?>

 

I don't know what your existing knowledge is like but if your up to scratch on HTML and have basic php knowledge then there's some building blocks!

 

sure, if you get stuck ill try and help.

 

just looking back it will be better if you change

 

$Content = $_GET['Content'];

if(isset($Content)) //if variable is set
{

 

to

 


if(isset($_GET['Content'])) //if variable is set
{

$Content = $_GET['Content'];

 

There are other ways to do what you want but try the above see how far you get!

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.