kibanga 0 Newbie Poster

I have files of several with geographical information of several places and animals that i want to be accesed by through the menu. Here is an outline of my project; I have simplified it by taking only parts that are relavent for my questions below.

I have a PHP class defined as follows:

<?php//================================================= 
//mymain.php
class mysite
{   var $pagetitle;
    var $pagefile;
       
   function setsite($title,$contents)
        {
        $this->pagetitle=$title;
        $this->pagefile=$contents;
        }


    function menu()
      {
      include_once("mymenu.php");
      }
       
    function content()
      {
      $pagetitle=$this->pagetitle;
      $contentsfile=$this->pagefile;
      include_once("mycontents.php");
      }  
    
}
//=================================================
?>

The function menu calls a "mymenu.php" file to set up the menus. A typical setup of myenu.php is as follows:

<?php
 //=================================================
 // mymenu.php.
 ?>
 <div class="menu">
  <ul>
   <li class="Animals"><a href="..">Animals
    <table><tr><td>
    <ul>
          <li class="Elephants"><a href="..">Elephants</a></li>
          <li class="Lions"><a href="..">Lions</a></li>
          <li class="Zebras"><a href="..">Zebras</a></li>
   </ul>
   </td></tr></table></a>
   </li>
   <li class="Places"><a href="..">Places
   <table><tr><td>
    <ul>
          <li class="Brazil"><a href="..">Brazil</a></li>
          <li class="South Africa"><a href="..">South Africa</a></li>
          <li class="Malaysia"><a href="..">Malaysia</a></li>
    </ul>
    </td></tr></table></a>
    </li>
    </ul>
</div> 
?>

As it can be seen, this menufile is not complete; that is where my questions are. Before I pose my questions, let me finish up a few more codes.

Since function "content' in this class requires, "mycontents.php", is created it as follows:

<?php
 //=================================================
 // mycontents.php.
 ?>
  <h2><? echo $pagetitle;?></h2>
    <hr>
   </div>    
  <? 
include_once($contentsfile);
//=================================================
 ?>

Basically, this file displays the $pagetitle, and opens a $contentsfile. Someone may question this organisation but my actual file larger file requires it to be so.

Finally, I have my font code file as follows:

<?php
//=================================================
// mymain.php.
 
include_once("mysitecls.php");
$thissite = new mysite;
$thissite->setsite("My World Travels","mydefault_contents.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en">
<html>

<head>
<title><?echo $thissite->pagetitle?></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" media="all" type="text/css" href="far-mex.css" />
</head>

<body>
<div id="leftcol" >
 <? $thissite->menu(); ?>
</div>
<div id="leftcol" >
<? $thissite->content();?>
</div>

</body>
</html>
<?

?>

Basically it initilizes the class with a file tile of "My World Travels" where the file contents are in "mydefault_contents.php". After that the user through the menu selects what a topic to be displayed, each selection has to set up a string with for $pagetitle (i.e the title of the topic) and a string for the $pagefile (i.e. file name with details of the topic). This construction is in complete in the menufile shown above, which is the center of my questions:


I have three questions:

(1) For wathever url adress I put in the <a href=".."> tags, the menu keeps opening the root directory when viewed in in Netscape 8.1 (based on firefox); although it works quite well with Internet Explorer V 7.0.5296.0 (beta). My first question is, what makes my menu code fail in netscape while it works in internet explorer.

(2) How can I make my menu to establish the values of $pagetitle and $pagefile using the internal "setsite" function of 'mysite' class without opening another file which can replace my current screen. In fact I want the screen layout to remain intact, only the left pane of the screen is to be updated.

(3) After the the values of $pagetitle and $pagefile are set in the class, will that automatically cause the screen contents (in the left pane) to be updated?

I am not sure where my questions are clear, but this time I tried to post as much information as possible.

Any help will be highly appreciated.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.