mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 02:14:26 +02:00
updated overlib fixes
This commit is contained in:
73
FAQ
73
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
|
Q: Can you change the mailing list so reply-to sends to the list and not the
|
||||||
user?
|
user?
|
||||||
|
|
||||||
HOWTO
|
|
||||||
|
|
||||||
Q: How do I generate different cache files per template based on arguments
|
|
||||||
passed to the page?
|
|
||||||
|
|
||||||
TROUBLESHOOTING
|
TROUBLESHOOTING
|
||||||
|
|
||||||
Q: Smarty doesn't work.
|
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
|
Q: Dreamweaver is urlencoding the template delimiters when they are in a SRC or
|
||||||
HREF link. How do I get around this?
|
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
|
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
|
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
|
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
|
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
|
A: In Edit - Properties - Rewrite HTML you can specify if Dreamweaver should
|
||||||
change special letters to %-equivalent or not. The default is on which
|
change special letters to %-equivalent or not. The default is on which
|
||||||
produces this error.
|
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
|
||||||
|
---------
|
||||||
|
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<td>{$tpl1_contents}</td>
|
||||||
|
<td>{$tpl2_contents}</td>
|
||||||
|
<td>{$tpl3_contents}</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Another approach:
|
||||||
|
|
||||||
|
You could write a custom insert function to fetch your internal
|
||||||
|
templates:
|
||||||
|
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<td>{insert name=fetch_tpl tpl="internal1.tpl"}</td>
|
||||||
|
<td>{insert name=fetch_tpl tpl="internal2.tpl"}</td>
|
||||||
|
<td>{insert name=fetch_tpl tpl="internal3.tpl"}</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
1
NEWS
1
NEWS
@@ -1,3 +1,4 @@
|
|||||||
|
- fixed small bug in overlib (Monte, Duncan Forrest)
|
||||||
- fixed a problem with compile_id usage. (Andrei)
|
- fixed a problem with compile_id usage. (Andrei)
|
||||||
- fixed problem with using assigned vars with {include_php ...} filepath.
|
- fixed problem with using assigned vars with {include_php ...} filepath.
|
||||||
(Monte)
|
(Monte)
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
Smarty Resources on the Web:
|
Smarty Resources on the Web:
|
||||||
|
(if you have something to add, e-mail monte@ispi.net)
|
||||||
|
|
||||||
Home Page:
|
Home Page:
|
||||||
http://www.phpinsider.com/php/code/Smarty
|
http://www.phpinsider.com/php/code/Smarty
|
||||||
|
@@ -800,7 +800,7 @@ function smarty_func_overlib_init($args, &$smarty_obj) {
|
|||||||
\*======================================================================*/
|
\*======================================================================*/
|
||||||
function smarty_func_overlib($args, &$smarty_obj) {
|
function smarty_func_overlib($args, &$smarty_obj) {
|
||||||
extract($args);
|
extract($args);
|
||||||
if (empty($text)) {
|
if (empty($text) && !isset($inarray) && empty($function)) {
|
||||||
$smarty_obj->_trigger_error_msg("overlib: attribute 'text' required");
|
$smarty_obj->_trigger_error_msg("overlib: attribute 'text' required");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -829,8 +829,8 @@ function smarty_func_overlib($args, &$smarty_obj) {
|
|||||||
if (!empty($above)) { echo ",ABOVE"; }
|
if (!empty($above)) { echo ",ABOVE"; }
|
||||||
if (!empty($below)) { echo ",BELOW"; }
|
if (!empty($below)) { echo ",BELOW"; }
|
||||||
if (!empty($border)) { echo ",BORDER,'$border'"; }
|
if (!empty($border)) { echo ",BORDER,'$border'"; }
|
||||||
if (!empty($offsetx)) { echo ",OFFSETX,'$offsetx'"; }
|
if (!empty($offsetx)) { echo ",OFFSETX,$offsetx"; }
|
||||||
if (!empty($offsety)) { echo ",OFFSETY,'$offsetxy'"; }
|
if (!empty($offsety)) { echo ",OFFSETY,$offsety"; }
|
||||||
if (!empty($fgbackground)) { echo ",FGBACKGROUND,'$fgbackground'"; }
|
if (!empty($fgbackground)) { echo ",FGBACKGROUND,'$fgbackground'"; }
|
||||||
if (!empty($bgbackground)) { echo ",BGBACKGROUND,'$bgbackground'"; }
|
if (!empty($bgbackground)) { echo ",BGBACKGROUND,'$bgbackground'"; }
|
||||||
if (!empty($closetext)) { echo ",CLOSETEXT,'".str_replace("'","\'",$closetext)."'"; }
|
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($autostatuscap)) { echo ",AUTOSTATUSCAP"; }
|
||||||
if (!empty($inarray)) { echo ",INARRAY,'$inarray'"; }
|
if (!empty($inarray)) { echo ",INARRAY,'$inarray'"; }
|
||||||
if (!empty($caparray)) { echo ",CAPARRAY,'$caparray'"; }
|
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($snapx)) { echo ",SNAPX,'$snapx'"; }
|
||||||
if (!empty($snapy)) { echo ",SNAPY,'$snapy'"; }
|
if (!empty($snapy)) { echo ",SNAPY,'$snapy'"; }
|
||||||
if (!empty($fixx)) { echo ",FIXX,'$fixx'"; }
|
if (!empty($fixx)) { echo ",FIXX,'$fixx'"; }
|
||||||
|
Reference in New Issue
Block a user