Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Calling Pages - methodology

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Smarty Development
View previous topic :: View next topic  
Author Message
kschuster
Smarty n00b


Joined: 27 Sep 2004
Posts: 2

PostPosted: Mon Sep 27, 2004 4:15 am    Post subject: Calling Pages - methodology Reply with quote

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
View user's profile Send private message
kills
Smarty Elite


Joined: 28 May 2004
Posts: 493

PostPosted: Mon Sep 27, 2004 6:18 am    Post subject: Re: Calling Pages - methodology Reply with quote

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
View user's profile Send private message
kschuster
Smarty n00b


Joined: 27 Sep 2004
Posts: 2

PostPosted: Tue Sep 28, 2004 2:44 am    Post subject: Reply with quote

Thanks,

What does your file structure look like? Where does this if statement sit and how/where does it get called
Back to top
View user's profile Send private message
jaey
Smarty Regular


Joined: 25 May 2004
Posts: 36
Location: Louisville, Kentucky, USA

PostPosted: Tue Sep 28, 2004 3:13 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Smarty Development All times are GMT
Page 1 of 1

 
Jump to:  
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
Protected by Anti-Spam ACP