Re: best way to implement a navigation
| From: | TomHenry | Date: | Wed, 19 Jul 2000 02:14:46 +0000 |
| Subject: | Re: best way to implement a navigation | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-7198@lists.php.net to get a copy of this message | ||
If you are really _stuck_ on using a syntax as close to the <!--#NAVBAR--> style, then you could avail yourself of the PHP ASP tags feature.
And use the <%=$somevarname%> syntax, as I do for creating templates that manage site-wide content.
See PHP3Docs/language.basic-syntax.html
An example would be the following:
------------ NAVBAR.php3 ----------------
<?
// the NAVBAR.inc content could be constructed
// from some file (as below)
// -or- from a database query
// depending on the applications
/* --- make a NAVBAR.inc file with the following ---
<UL>
<LI><a href="index.html">Home</a>
<LI><a href="articles.html">Articles</a>
<LI><a href="contacts.html">Contacts</a>
</ul>
*/
$lines=file("NAVBAR.inc");
while(list($k,$v)=each($lines)){
$navbarhtml.=$v;
}
// ----------------------------------------------------------
// n.b. Everything above might be autoprepended to all pages
// and the individual pages would only need the PHP references
// to variables that you want embedded in the HTML
// ----------------------------------------------------------
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Using CONSTANTS for includes in templates </title>
</head>
<body>
<P><HR><P>
Using the short tag syntax:
<P>
<%=$navbarhtml%>
<P><HR><P>
</body>
</html>
-----------------------------------------------
Hope that helps,
Tom Henry
At 07:31 PM 7/18/00 -0400, Sam Carleton wrote:
I am sorry, I don't think I explained it correctly. The navbar example using mod_perl is such that you create a handler of some sort, in my case it handles all *.html files. The handler looks for the <!--NAVBAR-->. Once the handler finds that comment, it replaces the comment with the navbar.--------------------------------------------------------------------
Strategic Business Systems (978) 745-2332
http://BusinessWebs.com/
--------------------------------------------------------------------