View previous topic :: View next topic |
Author |
Message |
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Wed May 28, 2003 8:41 pm Post subject: |
|
|
eadz wrote: |
I havn't needed a compile id before, but IMHO I think this is a perfect use. If it's not supposed to be used in this situation, what situaltion is it supposed to be used in. |
compile_id is typically used when you want several compiled versions of the same template files, such as re-using templates for different languages. This minimizes the runtime processing, as opposed to using the same compiled files and dynamically building the language text.
There is nothing keeping you from using separate template_dir for each theme, but in my experience it is easier to stick with one template_dir and one compile_dir and let the templates handle which theme to display. This way you retain the ability of using compile_id for separate languages, the complexity at the application level is minimal and the templates are kept most flexible. Multiple template_dirs may also add an element of confusion for someone looking at the directory structure then looking at the template output and having to figure out how the application is swapping around the template_dir root.
Monte |
|
Back to top |
|
[SuB] Smarty Rookie
Joined: 18 Jun 2003 Posts: 5
|
Posted: Wed Jun 18, 2003 9:56 am Post subject: |
|
|
We are sourcing multipple the templates from a database structure, so I, without having actually got to the part of implementing this, I think setting the compile_id to the ID of the template set so the compiled templates don't overwrite each other. |
|
Back to top |
|
deixu Smarty Rookie
Joined: 27 Jun 2003 Posts: 9 Location: Wolfsburg, Germany
|
Posted: Fri Jun 27, 2003 11:34 pm Post subject: |
|
|
hi...
this is my approach for multiple themes:
Code: |
define(ROOT_PATH, "/home/www/testsite/html/");
class sysSmarty extends Smarty {
var $template_name = '';
function sysSmarty($template = "") {
if(!$this->set_template($template) && $template != "") {
die('Error: Template "'.$template.'" does not exist');
}
}
function set_template($template) {
if($template && file_exists(ROOT_PATH."templates/themes/".$template)) {
$this->Smarty();
$this->template_dir = ROOT_PATH.'templates/themes/'.$template;
$this->compile_dir = ROOT_PATH.'templates/compiled/'.$template;
$this->template_name = $template;
return 1;
} else {
return 0;
}
}
}
|
|
|
Back to top |
|
ZeroFill Smarty Rookie
Joined: 31 Aug 2003 Posts: 28
|
Posted: Sun Aug 31, 2003 6:57 am Post subject: |
|
|
cool. thanks for the code deixu, this'll really be handy , but in part of your code, did you mean to have the first if statement to be
Code: | if(!$this->set_template($template) || $template == "") { |
so it checks if a template was entered at all? |
|
Back to top |
|
JonBoy Smarty Rookie
Joined: 09 Oct 2003 Posts: 6 Location: Madison, Wisconsin, USA
|
Posted: Thu Oct 09, 2003 6:22 pm Post subject: CSS Stylesheets? |
|
|
I dunno about you, but I use the templating in Smarty to format table widths and arrange elements on the page. Then I use a selection of static CSS stylesheets to allow different users to select different colors and background sets for their personal view. |
|
Back to top |
|
BloodRath Smarty Rookie
Joined: 06 Jul 2003 Posts: 23 Location: France
|
Posted: Wed Nov 19, 2003 11:39 pm Post subject: theme |
|
|
just a stupid question but don't u think themes are definitely CSS domain ?
A look at css Zen Garden http://www.csszengarden.com/ could convince u
_________________ froggies forever.... |
|
Back to top |
|
andre Smarty Pro
Joined: 23 Apr 2003 Posts: 164 Location: Karlsruhe, Germany
|
Posted: Thu Nov 20, 2003 8:07 am Post subject: |
|
|
Very cool site, thanks for the tip! |
|
Back to top |
|
|