include_php options / best practices
| From: | Sarah Gray | Date: | Thu, 10 Jun 2004 23:52:46 +0000 |
| Subject: | include_php options / best practices | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-11441@lists.php.net to get a copy of this message | ||
Hi --
What would be a good way to have the output from two different .php
files on a given smarty template?
So that the whole page is displayed by $t->display('index.tpl')
where index.tpl includes header.tpl, footer.tpl, menus.tpl (see drawing
below)
But it would also have a changing template in the middle of the page
that would be
called depending on which menu option is selected. Kind of like how a
frameset would behave,
except not a frameset. (A big table). So in my drawing, user-selected
options are designated by **. Here
the user has clicked *reports*, which generated the reports sub menu,
and then clicked *eat report*.
___________________________________________
LOGO schedule | *reports* | tests |
(header.tpl) |
(menus.tpl) |
view report |
print report |
*eat report* *eat report content* |
(dynamic from menu) |
|
footer stuff here (footer.tpl)|
___________________________________________|
The idea is that *eat.report* would show up in the middle area -- but it
needs to call eat.report.php that
has lots of variables it assigns to eat.report.tpl, which then shows up
in the middle area. This area
is obviously the body of the application.
I could use
{include_php file="content.php" page=$smarty.get.pagevar}
where content.php would use the page var to redirect it's output to the
appropriate page
which will display the relevant template in the body area --
but include_php is being deprecated and I'm wondering what would be a
better way?
I looked at componentized templates, but don't think I could get away
from calling a php page.
In a nutshell this boils down to -- is it bad practice to include a php
file in a template,
if the sole purpose of that file is to call another template? And if it
is bad practice and will
be removed from smarty, is there a better way?
And if missing something obvious here, please remind me :)
Thanks,
Sarah