|
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 |
mgm_03 Smarty Rookie
Joined: 07 Dec 2004 Posts: 23
|
Posted: Wed Dec 08, 2004 7:08 pm Post subject: Getting the gist of Smarty setup on MacOSX |
|
|
I'm slowly getting the gist of the Smarty setup. The actual templating framework looks fairly straightforward.
If I understand correctly, for every .php file there is a corresponding .tpl file. So, if I have 'products.php' (in the document root), there will be a 'products.tpl' in the 'templates' directory (outside the document root).
If my document root is:
Code: | /Library/WebServer/Documents/ |
The 4 smarty folders would go in :
Code: | /Library/WebServer/Smarty/ |
If I develop multiple sites on my laptop, I need separate groups of the 4 smarty folders, with each group going in one of the folders below:
Code: |
/Library/WebServer/Smarty/Site1/config/
/Library/WebServer/Smarty/Site1/cache/
/Library/WebServer/Smarty/Site1/templates/
/Library/WebServer/Smarty/Site1/templates_c/
/Library/WebServer/Smarty/Site2/ ...
/Library/WebServer/Smarty/Site3/ ...
|
And in:
Code: | /Library/WebServer/Documents/Site1/products.php |
I would create an 'includes' directory:
Code: | /Library/WebServer/Documents/Site1/includes/ |
Which contains 'setup.php' as described in the doc: "Extended Setup".
In 'products.php' :
Code: | require('includes/setup.php'); |
And, there must be: 'products.tpl' in the templates directory for when Smarty compiles the php file.
The cache dir now contains something like:
Code: | %%45^45E^45E480CD%%products.tpl.php |
While this all sounds remedial, if it's correct (hopefully) it might help others who are new to Smarty. |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Wed Dec 08, 2004 7:29 pm Post subject: Re: Getting the gist of Smarty setup on MacOSX |
|
|
mgm_03 wrote: | If I understand correctly, for every .php file there is a corresponding .tpl file. So, if I have 'products.php' (in the document root), there will be a 'products.tpl' in the 'templates' directory (outside the document root). |
Not quite right. For each .tpl file in the $template_dir, Smarty will create a corresponding .php file in the $compile_dir, but those .php files are nothing to concern yourself with for the most part.
The number of .php files that you have in your document root have no correlation to the number of .tpl files in your $template_dir. You could have only one .php file (that the browser accesses) which could display any number of template files (which in turn could include other template files.) |
|
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
|