|
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 |
ZuqR Smarty Rookie
Joined: 01 Dec 2007 Posts: 6
|
Posted: Sat Dec 01, 2007 12:42 pm Post subject: Separate admin templates and frontend templates. |
|
|
I´ve been searching and asked in you irc-channel without any answer.
I am building a a CMS and would like to separate my admintemplates and my regular templates.
themes->frontend->secretname
themes->admin->secretname
I have set my templatedir to:
$this->template_dir = CORE_ROOT.'\\themes\\frontend\\'.$theme.'\\';
But how could I add admin to that?
Thanks in advance |
|
Back to top |
|
master_kaos Smarty Regular
Joined: 02 Aug 2007 Posts: 54
|
Posted: Tue Dec 04, 2007 3:23 pm Post subject: |
|
|
when you do a display do something like this
Code: |
$this->template_dir = CORE_ROOT . '\\themes\\';
if($admin}
$smarty->display('admin\\' . $theme . '\\example.tpl');
else
$smarty->display('frontend\\'. $theme . '\\example.tpl');
|
How I usually do this though would be
Code: |
$this->template_dir = CORE_ROOT . '\\themes\\' . $theme . '\\';
if($admin)
$smarty->display('admin\\example.tpl');
else
$smarty->display('frontend\\example.tpl');
|
So I would have one theme folder, then have 2 subdirectories an admin and then a frontend. |
|
Back to top |
|
Ancient Smarty Pro
Joined: 07 Jul 2007 Posts: 196 Location: Omaha, Nebraska, United States of America
|
Posted: Wed Dec 05, 2007 2:44 am Post subject: |
|
|
in Smarty.class.php edit var templates_dir = 'themes';
What I recomend is basicly the opposite direction, I figured why create 2 folders instead just create one keep everything organized and because nobody will ever see the template_file names anyway.
What I perfer and recomend is:
themes/stylename/admin/
themes/stylename/ (where front end is)
won't really have to change anything, but create $style_path as a var for the style / theme name.
$style_name = "dark_black_ancient";
$smarty->display($style_name . '/' . 'admin' . '/' . 'template_name.tpl');
But what ever you desire.
then create the folders as master_kaos did.
/themes/admin/style_name/
/themes/frontend/style_name/
But the admin templates should only be called in the admin pages.
so if($admin) shouldn't be needed.
$smarty->display('admin' . '/' . $style_name . '/' . 'template_name.tpl'); _________________ Smarty all the way. |
|
Back to top |
|
ZuqR Smarty Rookie
Joined: 01 Dec 2007 Posts: 6
|
Posted: Sat Dec 22, 2007 4:36 pm Post subject: |
|
|
Thanks guys!
Works like a charm now. |
|
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
|