Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.

Probably a stupid question

 
Post new topic   Reply to topic    Smarty Forum Index -> Smarty Development
View previous topic :: View next topic  
Author Message
JonathanATX
Smarty n00b


Joined: 26 Jul 2003
Posts: 3

PostPosted: Thu Oct 09, 2003 3:50 pm    Post subject: Probably a stupid question Reply with quote

I am working on my schools website and I'm using smarty to do it. They want the site to be easy to change and all that..and I think I need to call the templates from a db to make it all easier. I saw the documentation on this but, I don't understand this stuff:

// using resource from php script
$smarty->display("db:index.tpl");

{* using resource from within Smarty template *}
{include file="db:/extras/navigation.tpl"}

can anyone explain what the table will look like and what the stuff after the : means? Thank you.

-Jonathan
Back to top
View user's profile Send private message
messju
Administrator


Joined: 16 Apr 2003
Posts: 3336
Location: Oldenburg, Germany

PostPosted: Thu Oct 09, 2003 4:12 pm    Post subject: Reply with quote

"db" is the resource-type in the example. you can have multiple resource-types (with different type-names) in your templates. the stuff after "db:" is the resource-name. the name is passed as a parameter to your resource-handling functions. in the docs' example it's just a 3 column table with tpl_name (a string), tpl_timestamp (an int) and tpl_source (text) where the templates are stored.

i'm not sure if using resources makes it it easier. if you want the people allow to change the sites contents, but not the layout, you don't have to let them edit the templates you just have to let them edit the data that is displayed inside the templates. maybe you don't need resources in your case.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
JonathanATX
Smarty n00b


Joined: 26 Jul 2003
Posts: 3

PostPosted: Fri Oct 10, 2003 3:21 pm    Post subject: Reply with quote

If I had it my way, it would be like that. But the teacher is kind of stressing that every page be almost like having a bunch of flat html for the webmastering classes. But thank you for explaining that to me.

-Jonathan
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    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