|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
kschuster Smarty n00b
Joined: 27 Sep 2004 Posts: 2
|
Posted: Mon Sep 27, 2004 4:15 am Post subject: Calling Pages - methodology |
|
|
Just getting into Smarty/PHP - - I have worked with template based sites before. I'm trying to see how people are calling pages from links.
I used to do this. I would include a page that contained all of the navigation logic from within the main template
the link <...index.php?page=about would call the about page. (Is this called one page?)
This would end up beoing a giant IF statement.
if page=about
include (/files/about.php")
elseif....
Does anyone do this? Any suggested best practices...
I used fusebox for cold fusion which accompishes this and more.
Thanks |
|
Back to top |
|
kills Smarty Elite
Joined: 28 May 2004 Posts: 493
|
Posted: Mon Sep 27, 2004 6:18 am Post subject: Re: Calling Pages - methodology |
|
|
kschuster wrote: | Just getting into Smarty/PHP - - I have worked with template based sites before. I'm trying to see how people are calling pages from links.
I used to do this. I would include a page that contained all of the navigation logic from within the main template
the link <...index.php?page=about would call the about page. (Is this called one page?)
This would end up beoing a giant IF statement.
if page=about
include (/files/about.php")
elseif....
Does anyone do this? Any suggested best practices...
I used fusebox for cold fusion which accompishes this and more.
Thanks |
i using something like this:
[php:1:f4a7099f32]
if ( $smarty->template_exists( $_GET['page']) {
$smarty->display( $_GET['page']);
} else {
$smarty->assign( "error", "No such Template!");
$smarty->display( "error.tpl");
}
[/php:1:f4a7099f32] |
|
Back to top |
|
kschuster Smarty n00b
Joined: 27 Sep 2004 Posts: 2
|
Posted: Tue Sep 28, 2004 2:44 am Post subject: |
|
|
Thanks,
What does your file structure look like? Where does this if statement sit and how/where does it get called |
|
Back to top |
|
jaey Smarty Regular
Joined: 25 May 2004 Posts: 36 Location: Louisville, Kentucky, USA
|
Posted: Tue Sep 28, 2004 3:13 am Post subject: |
|
|
kills wrote: | if ( $smarty->template_exists( $_GET['page']) {
$smarty->display( $_GET['page']);
} else {
$smarty->assign( "error", "No such Template!");
$smarty->display( "error.tpl");
} |
I would be careful using this code as it could be used to read arbitrary files on the server. For example: http://myserver/index.php?page=/etc/passwd |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|