This subject has probably been covered a hundred times, but I can't find a
clear answer on the web or in a newsgroup. I have a 650 page intranet site
that I am working on with categories and subcategories (each in their own
subsequent folders) and I am using PHP (4.1+) and MySQL for populating
links. There will be a dynamically populated menu from the database. The
users will be uploading files whose links will be added to the database
through a form.
I have the header, navigation, and footer sections in their own PHP/HTML
files to be included on page with the <?PHP include
("includes/filename.html"); ?>. This part is easy, but I have to create a
whole new page for each and every web page that includes this code. What I
need to do is have the basic .html page show up in the content section of
the current page when a person clicks a link in the navigation menu or
current page. Essentially I would want it to work like a framed page (<a
href: "linkedpage.html" target="content">, but I don't want to use frames or
iframes.
I would also like to have the page that was inserted be reflected as a URL
in the browser location for bookmarking, as well as have the page title be
automatically assigned. In my search on the web I find a lot of reference to
combining PHP and Javascript. I believe I've seen it done with Javascript
using the GetElementByID method, but it's been a while since I've written
Javascript.
I'm sure there is a simple basic way to format each link itself in just PHP.
Should I assign a variable to hold the value of the link? I assume it
includes having a <div id="content">. Should I format the link or the
content section with HTTP_REFERRER or use File_Include_Path or does this
have to do with fopen_wrapper? There are so many different things I've
seen, but nothing conclusive, that my head is spinning.
Thanks,
Chris
<?
if (isset($_GET['id'])) {
$id = $_GET['id'];
} else {
$id = 0;
}
?>
If you use this code, you need to link to a page like: <a
href="?page&id=20">Link</a>
If you want the title to change, just use <title><? echo (&id) ?> That
makes the title change into the ID
The same with link's ;)
I guess I'm not clear on how to generate the linking text into propogated
menu either. Can you clarify the use of & for me? Is it there to tell
the browser that it's an html ampersand? Wouldn't it need to use a
variable? (id=$pageid). The links table in the database will have the
pageID, pagename, pagetitle, category, subcategory, etc.
Thanks again,
Chris
"Rene Pot" <ren...@chello.nl> wrote in message
news:1ab9d$445e83e4$3ec2ab98$83...@news.chello.nl...
<?php
require_once "header.php";
// Set Default Page ($pageid)
if(!isset($pageid) || !file_exists($pageid.".php")) $pageid= "default";
if(file_exists($pageid.".php")){
include $pageid.".php";
}
require_once "footer.php";
?>
where pageid can be "words" or "numbers"
links are created by ....
echo "<a href='?pageid=".$linkid.">Link</a>";
--
----------------------------------------------------------------------------
http://www.myclubweb.co.uk - The Home of Club Websites
----------------------------------------------------------------------------
"Christina" <desi...@centurytel.net> wrote in message
news:2KydnQNgXqP...@centurytel.net...
Thanks again,
Chris
"MS" <nospamplae...@yahoo.co.uk> wrote in message
news:WKGdndoCFbe...@bt.com...
Step 1) index.php outputs the header.php (require_once "header.php";)
Step 2)
then index.php includes a file dependant upon $pageid
eg. $pageid = "profile"
therefore the profile.php page is included (if it exists)
Step 3)
index.php then outputs the footer (require_once "footer.php";)
Does that mean all called/inserted pages will have to be .php?
pages ending with .php do not need to contain any php code. (they can be
plain html) if they do contain php code... the code will be parsed.
What is the $linkid variable attached to?
$linkid is same as $pageid i just changed the name so you didn't get
confused... lol.. silly me.
$linkid would contain your page names... eg "profile" or "calendar" so that
when clicked it includes the profile.php page or calendar.php page...
"Christina" <desi...@centurytel.net> wrote in message
news:HomdnY1Rt63...@centurytel.net...
Thanks again...
Chris
"MS" <nospamplae...@yahoo.co.uk> wrote in message
news:lPqdnSwLhsO...@bt.com...