diff --git a/FAQ b/FAQ index 5f962aa8..ed050afd 100644 --- a/FAQ +++ b/FAQ @@ -15,11 +15,6 @@ Q: Do you have a mailing list? Q: Can you change the mailing list so reply-to sends to the list and not the user? -HOWTO - -Q: How do I generate different cache files per template based on arguments - passed to the page? - TROUBLESHOOTING Q: Smarty doesn't work. @@ -49,6 +44,12 @@ Q: Can I use Macromedia's Dreamweaver to edit my templates? Q: Dreamweaver is urlencoding the template delimiters when they are in a SRC or HREF link. How do I get around this? +HOWTO + +Q: How do I generate different cache files per template based on arguments + passed to the page? +Q: How do I include cached template(s) within a non-cached template? + GENERAL ------- @@ -128,13 +129,6 @@ Q: Can you change the mailing list so Reply-To sends to the list and not the A: Yes we could, but no we won't. Use "Reply-All" in your e-mail client to send to the list. http://www.unicom.com/pw/reply-to-harmful.html - -HOWTO ------ -Q: How do I generate different cache files per template based on arguments - passed to the page? -A: Pass $REQUEST_URI as the cache_id when you display() or fetch() a page. - TROUBLESHOOTING --------------- @@ -218,3 +212,58 @@ Q: Dreamweaver is urlencoding the template delimiters when they are in a SRC or A: In Edit - Properties - Rewrite HTML you can specify if Dreamweaver should change special letters to %-equivalent or not. The default is on which produces this error. + +HOWTO +----- + +Q: How do I generate different cache files per template based on arguments + passed to the page? +A: Use your $REQUEST_URI as the cache_id when fetching the page: + + global $REQUEST_URI; // if not already present + $smarty->display('index.tpl',$REQUEST_URI); + + This will create a separate cache file for each unique URL when you call + index.tpl. See the documentation for display() and fetch() + +Q: How do I include cached template(s) within a non-cached template? +A: One way to do it: + + $smarty->caching = true; + $tpl1 = $smarty->fetch("internal1.tpl"); + $tpl2 = $smarty->fetch("internal2.tpl"); + $tpl3 = $smarty->fetch("internal3.tpl"); + + $smarty->assign("tpl1_contents",$tpl1); + $smarty->assign("tpl2_contents",$tpl2); + $smarty->assign("tpl3_contents",$tpl3); + + $smarty->caching = false; + $smarty->display('index.tpl'); + + index.tpl + --------- + + + + + + + +
{$tpl1_contents}{$tpl2_contents}{$tpl3_contents}
+ + + + + Another approach: + + You could write a custom insert function to fetch your internal + templates: + + + + + + + +
{insert name=fetch_tpl tpl="internal1.tpl"}{insert name=fetch_tpl tpl="internal2.tpl"}{insert name=fetch_tpl tpl="internal3.tpl"}
diff --git a/NEWS b/NEWS index 9e610e65..27c2fb4d 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,4 @@ + - fixed small bug in overlib (Monte, Duncan Forrest) - fixed a problem with compile_id usage. (Andrei) - fixed problem with using assigned vars with {include_php ...} filepath. (Monte) diff --git a/RESOURCES b/RESOURCES index 4dc4f6c2..2414de00 100644 --- a/RESOURCES +++ b/RESOURCES @@ -1,4 +1,5 @@ Smarty Resources on the Web: +(if you have something to add, e-mail monte@ispi.net) Home Page: http://www.phpinsider.com/php/code/Smarty diff --git a/Smarty.addons.php b/Smarty.addons.php index 63117a59..d23a5f6f 100644 --- a/Smarty.addons.php +++ b/Smarty.addons.php @@ -800,7 +800,7 @@ function smarty_func_overlib_init($args, &$smarty_obj) { \*======================================================================*/ function smarty_func_overlib($args, &$smarty_obj) { extract($args); - if (empty($text)) { + if (empty($text) && !isset($inarray) && empty($function)) { $smarty_obj->_trigger_error_msg("overlib: attribute 'text' required"); return false; } @@ -829,8 +829,8 @@ function smarty_func_overlib($args, &$smarty_obj) { if (!empty($above)) { echo ",ABOVE"; } if (!empty($below)) { echo ",BELOW"; } if (!empty($border)) { echo ",BORDER,'$border'"; } - if (!empty($offsetx)) { echo ",OFFSETX,'$offsetx'"; } - if (!empty($offsety)) { echo ",OFFSETY,'$offsetxy'"; } + if (!empty($offsetx)) { echo ",OFFSETX,$offsetx"; } + if (!empty($offsety)) { echo ",OFFSETY,$offsety"; } if (!empty($fgbackground)) { echo ",FGBACKGROUND,'$fgbackground'"; } if (!empty($bgbackground)) { echo ",BGBACKGROUND,'$bgbackground'"; } if (!empty($closetext)) { echo ",CLOSETEXT,'".str_replace("'","\'",$closetext)."'"; } @@ -840,7 +840,7 @@ function smarty_func_overlib($args, &$smarty_obj) { if (!empty($autostatuscap)) { echo ",AUTOSTATUSCAP"; } if (!empty($inarray)) { echo ",INARRAY,'$inarray'"; } if (!empty($caparray)) { echo ",CAPARRAY,'$caparray'"; } - if (!empty($capicaon)) { echo ",CAPICON,'$capicon'"; } + if (!empty($capicon)) { echo ",CAPICON,'$capicon'"; } if (!empty($snapx)) { echo ",SNAPX,'$snapx'"; } if (!empty($snapy)) { echo ",SNAPY,'$snapy'"; } if (!empty($fixx)) { echo ",FIXX,'$fixx'"; }