Re: template logic problem
| From: | Miguel Cruz | Date: | Mon, 13 May 2002 20:43:20 +0000 |
| Subject: | Re: template logic problem | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-97421@lists.php.net to get a copy of this message | ||
On Mon, 13 May 2002, list peters wrote:
> This is my first project with php after using cold fusion for the last few
> years! So far I have been pretty happy with php, but I have a problem with
> my application logic (not a php problem, but hoping for a sexy solution.)
>
> I am using a template system and including different content files depending
> on URL parameters.
>
> eg
>
> <html>
> <body>
> navigation
> <?php include file depending on url?>
> <body>
> </html>
>
> In the include file I have all the code i need.
>
> My problem is that for one page in the site I need to display a image in the
> navigation bar that is referenced from a database. The database query
> happens in the included file which is below the navigation in the html -
> This means i cant reference the image file name because the query hasnt
> happened.
What I'd do is change your include()d template to wrap a function around
the <HTML><BODY> stuff. Then you can call it once you have enough
information available, and pass in any variable elements like the name of
that rotating image. This will make your templating a whole lot more
flexible (you can now specify the <TITLE> on each page, for instance).
miguel