Hello,
nice that you like new template override system, or not :)
Current implemented solution is universal, it works for all directory calls
( and php itself caches file system calls and oxconfig caches getDir
calls ).
For internal smarty includes we used callback
"default_template_handler_func" which calls
oxUtilsView::_smartyDefaultTemplateHandler().
Your smarty modifier approach works only for internal includes inside main
templates (not possible add custom start.tpl, details.tpl, etc...) plus
also mentioned future template update hell (I would suggest you to move
modifier functionality to extended
oxUtilsView::_smartyDefaultTemplateHandler ).
Cache in SESSION, hmm.. there is no session for first call, why not to cache
it globally?
I think more improvements can be done inside oxconfig::getDir method.
keep coding,
Alfonsas
--------------------------------------------------
From: <[email protected]>
Sent: Monday, November 02, 2009 1:24 PM
To: <[email protected]>
Subject: Re: [oxid-dev-general] sCustomTheme
<< to each [{include file="template"}] we have added a smarty modifier
[{include file="template"|tc_include}] that looks into tcTemplates and
return the new template. i think that a solution based on an array is more
cleaner and faster -> no look into file-system.>>
So you will also love template-updates....
To complicate things further, I have a third approach to this...
I have subclassed Smarty and I am checking in the "fetch"- and
"include"-Routines if an alternative version of the resource exists.
But I am doing this checking only once in an session, storing the
information on the resource in the $_SESSION, like
$_SESSION['override_template'][$resource_name]=$override_template_exists.
So I need to access the file-system only once per Session for each
resource
and I do not need to fiddle around with the template-files further...
-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von Sven
Tietje
Gesendet: Montag, 2. November 2009 12:08
An: [email protected]
Betreff: [oxid-dev-general] sCustomTheme
hi oxid-dev-team,
congratulations to oxid 4.2.0! many cool improvements and features. the
idea
of sCustomTheme is nice, but somehow quite dirty: so many looks into
file-system. the normal sTheme is somehow a fallback for templates that
are
not located in the sCustomTheme. if you just want to extend one file, i
think i do not have to explain any more ...:)
we have implemented a nearly "similar" solution some days before. i think
it`s more performant and clean. in the config.inc.php we just have added
an
array:
$this->tcTemplates = array(
'path/to/overwrite/template' => 'new/location'
);
to each [{include file="template"}] we have added a smarty modifier
[{include file="template"|tc_include}] that looks into tcTemplates and
return the new template. i think that a solution based on an array is more
cleaner and faster -> no look into file-system.
perhaps, we can combine our solutions?
of course, it`s no problem to make our solution open source :)
sven
_______________________________________________
dev-general mailing list
[email protected]
http://dir.gmane.org/gmane.comp.php.oxid.general
_______________________________________________
dev-general mailing list
[email protected]
http://dir.gmane.org/gmane.comp.php.oxid.general
_______________________________________________
dev-general mailing list
[email protected]
http://dir.gmane.org/gmane.comp.php.oxid.general