Re: Dynamic Navigation w/PHP
| From: | Julio Nobrega Trabalhando | Date: | Mon, 19 Nov 2001 16:34:21 +0000 |
| Subject: | Re: Dynamic Navigation w/PHP | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-75122@lists.php.net to get a copy of this message | ||
Well, I don't really get what is your problem here. :-)
You said people must 'enable' pages to have it available. Is it not only a
matter of checking this 'enabled' flag? For example a database table with a
column named 'enabled', and others 'link' and 'text':
(example for mysql)
<?php
$sql = 'SELECT link, page FROM menu WHERE enabled = 1';
$res = mysql_query($sql);
while(list($link,$page) = mysql_fetch_array($res)) {
// Construct the menu
?>
<a href="<?php echo $link; ?>"><?php echo $text;
?></a><br/>
</php
}
?>
The only thing I see different is the 'enabled' at the $sql command,
telling only to select links that were selected to be show. I guess you
would also want to put 'AND user = $some_user' to select only links for a
previous autheticaded user.
--
Julio Nobrega
No matter where you go, &this.
"Mike Elkins" <mwelkins@dwyergroup.com> wrote in message
news:0A81AC3C2888D4119C9200A0C9A3179A1713C7@ramses...
> Hello All,
>
> I am looking for example code demonstrating the ability to dynamically
> modify website navigation based upon data in a database. Specifically what
I
> am trying to figure out is how to control what pages are available based
> upon whether they have been "enabled" in the database. I am developing a
> template driven website, with content controlled by the database which
> indicates what the customer has opted for. While ten pages might be
> available and part of the web site template, a given customer may have
only
> paid for four, thus when his site is hit, only those four pages will be
> available in the navigation elements. Should the customer care to request
an
> additional feature (page), simply accessing the database and enabling it
> would make it immediately available.
>
> Any suggestions or pointers would be greatly appreciated.
>
> Michael
>