Jump to content

Template Titles


GiGalo

Recommended Posts

Here is my index page:

 

<?php include '../scrp/menu.php'; ?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
<title><?php echo $title; ?> </title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />

<meta name="description" content="dogue de bordeaux,dogue de bordeaux for sale,dogue de bordeaux stud,dogue de bordeaux stud service,dogue de bordeaux puppies,french mastiff,french mastiff stud,french mastiff puppies,french mastiffs,french mastiffs for sale, 
dogue de bordeaux mastiff,dogue de bordeaux mastiffs,dogue de bordeaux mastiffs for sale,dogue de bordeaux mastiff stud service,dogue de bordeaux mastiff puppies,dogue de bordeaux for sale Ohio,puppies for sale,stud service,bordeaux dogue,dogue de bordeaux" />
<meta name="keywords" content="Big Time Bordeaux, Bordeaux, Big Time" />
<meta name="author" content="Big Time Bordeaux" />

<link rel="stylesheet" type="text/css" href="../style/newStyle.css" media="screen" />
<script language="javascript" src="../scrp/jquery.min.js"></script>

<title><?php echo $title; ?> </title>

<script type="text/javascript">
        $(function(){
                $('.smallie').click(function(){
                        var url = $(this).attr("src");
                        url = url.replace("thumbs", "imgs"); // i assume your image names in thumbs and imgs folders are the same, hence I change just folder name
                        document.images.biggie.src = url;
                });
        });
        </script>
</head>

<body>
  <div id="wrapper">
    <div id="header">
      <?php include '../includes/header.php'; ?>
    </div> <!-- end #header -->

    <div id="nav"> 
     <?php generateMenu(); ?>  
    </div> <!-- end #nav -->

    <div id="content">
      <?php
        $default = 'home'; //Whatever default page you want to display if the file doesn't exist or you've just arrived to the home page.
        $page = isset($_GET['p']) ? $_GET['p'] : $default; //Checks if ?p is set, and puts the page in and if not, it goes to the default page.
        $page = basename($page); //Gets the page name only, and no directories.
         if (!file_exists('scrps/'.$page.'.php'))    { //Checks if the file doesn't exist
             $page = $default; //If it doesn't, it'll revert back to the default page
             //NOTE: Alternatively, you can make up a 404 page, and replace $default with whatever the page name is. Make sure it's still in the inc/ directory.
          }
          
       include('scrps/'.$page.'.php'); //And now it's on your page!
     ?>
    </div> <!-- end #content -->
    <div class="sidebar">
      <h3>Navigation</h3>
      <?php 
       generateMenu();
       include '../includes/sidebar.php'; 
      ?>
    </div> <!-- end #sidebar -->
    <div id="footer">
      <?php include '../includes/footer.php'; ?>
    </div> <!-- end #footer -->

  </div> <!-- End #wrapper -->
</body>
</html>

 

 

Here is my separate menus generator page:

<?php
$menu = array();
$menu['home'] = 'Home';
$menu['about'] = 'About';
$menu['gallery'] = 'Gallery';
$menu['contact'] = 'Contact';
//Add in the format of: $menu['page name'] = 'Page Title';
$title='Home'; //Default title
function generateMenu()    {
    global $menu,$default,$title;
   
    $p = isset($_GET['p']) ? $_GET['p'] : $default;
    foreach ($menu as $link=>$item)    {
        $class='';
        if ($link==$p)    {
            $class=' class="selected"';
            $title=$item;
        }
        echo '<a href="?p='.$link.'"'.$class.'>'.$item.'</a>';
    }
  
}
?> 

Link to comment
https://forums.phpfreaks.com/topic/260647-template-titles/#findComment-1335853
Share on other sites

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.