From c9bdfdf1e5ffb1a83cefdfb3df6f89fac8b86524 Mon Sep 17 00:00:00 2001 From: pete_morgan Date: Tue, 26 Sep 2006 23:29:02 +0000 Subject: [PATCH] Tidy up formatting and examples --- .../api-functions/api-append-by-ref.xml | 15 ++- .../programmers/api-functions/api-append.xml | 21 +++-- .../api-functions/api-assign-by-ref.xml | 16 ++-- .../programmers/api-functions/api-assign.xml | 24 +++-- .../api-functions/api-clear-all-assign.xml | 9 +- .../api-functions/api-clear-all-cache.xml | 11 ++- .../api-functions/api-clear-assign.xml | 10 +- .../api-functions/api-clear-cache.xml | 25 +++-- .../api-functions/api-clear-compiled-tpl.xml | 18 ++-- .../api-functions/api-clear-config.xml | 12 +-- .../api-functions/api-config-load.xml | 28 +++--- .../programmers/api-functions/api-display.xml | 31 ++++--- .../programmers/api-functions/api-fetch.xml | 27 +++--- .../api-functions/api-get-config-vars.xml | 16 ++-- .../api-get-registered-object.xml | 10 +- .../api-functions/api-get-template-vars.xml | 19 ++-- .../api-functions/api-is-cached.xml | 92 ++++++++++--------- .../api-functions/api-load-filter.xml | 21 +++-- .../api-functions/api-register-block.xml | 44 ++++----- .../api-register-compiler-function.xml | 40 ++------ .../api-functions/api-register-function.xml | 36 ++------ .../api-functions/api-register-modifier.xml | 46 +++------- .../api-functions/api-register-object.xml | 6 +- .../api-register-outputfilter.xml | 43 ++------- .../api-functions/api-register-postfilter.xml | 46 +++------- .../api-functions/api-register-prefilter.xml | 41 ++------- .../api-functions/api-register-resource.xml | 50 ++++++---- .../api-functions/api-template-exists.xml | 28 +++--- .../api-functions/api-trigger-error.xml | 13 +-- .../api-functions/api-unregister-block.xml | 6 +- .../api-unregister-compiler-function.xml | 7 +- .../api-functions/api-unregister-function.xml | 8 +- .../api-functions/api-unregister-modifier.xml | 6 +- .../api-functions/api-unregister-object.xml | 2 +- .../api-unregister-outputfilter.xml | 6 +- .../api-unregister-postfilter.xml | 6 +- .../api-unregister-prefilter.xml | 3 +- .../api-functions/api-unregister-resource.xml | 6 +- 38 files changed, 377 insertions(+), 471 deletions(-) diff --git a/docs/en/programmers/api-functions/api-append-by-ref.xml b/docs/en/programmers/api-functions/api-append-by-ref.xml index e0117d13..2f4a4de4 100644 --- a/docs/en/programmers/api-functions/api-append-by-ref.xml +++ b/docs/en/programmers/api-functions/api-append-by-ref.xml @@ -15,13 +15,15 @@ This is used to - append values to the templates by reference. + append() values + to the templates by reference. If you append a variable by reference then change its value, the appended value sees the change as well. For objects, - append_by_ref() also avoids an in-memory copy of the appended object. + append_by_ref() also avoids an in-memory copy of the + appended object. See the PHP manual on variable referencing for an in-depth - explanation. If you pass the optional third parameter of true, + explanation. If you pass the optional third parameter of &true;, the value will be merged with the current array instead of appended. ¬e.parameter.merge; @@ -38,8 +40,11 @@ $smarty->append_by_ref('Address', $address); - See also append() and - assign(). + See also + append(), + assign() + and + get_template_vars(). diff --git a/docs/en/programmers/api-functions/api-append.xml b/docs/en/programmers/api-functions/api-append.xml index f5f84dc1..4cc73612 100644 --- a/docs/en/programmers/api-functions/api-append.xml +++ b/docs/en/programmers/api-functions/api-append.xml @@ -22,7 +22,7 @@ If you append to a string value, it is converted to an array value and then appended to. You can explicitly pass name/value pairs, or associative arrays containing the name/value pairs. If you pass the optional third - parameter of true, the value will be merged with the current array + parameter of &true;, the value will be merged with the current array instead of appended. ¬e.parameter.merge; @@ -31,9 +31,16 @@ If you append append("Name", "Fred"); -$smarty->append("Address", $address); +// This is effectively the same as assign() +$smarty->append('foo', 'Fred'); +// After this line, foo will now be seen as an array in the template +$smarty->append('foo', 'Albert'); + +$array = array(1 => 'one', 2 => 'two'); +$smarty->append('X', $array); +$array2 = array(3 => 'three', 4 => 'four'); +// The following line will add a second element to the X array +$smarty->append('X', $array2); // passing an associative array $smarty->append(array('city' => 'Lincoln', 'state' => 'Nebraska')); @@ -42,10 +49,10 @@ $smarty->append(array('city' => 'Lincoln', 'state' => 'Nebraska')); See also - append_by_ref(), - assign() + append_by_ref(), + assign() and - get_template_vars() + get_template_vars() diff --git a/docs/en/programmers/api-functions/api-assign-by-ref.xml b/docs/en/programmers/api-functions/api-assign-by-ref.xml index 52b8b04d..d44686d4 100644 --- a/docs/en/programmers/api-functions/api-assign-by-ref.xml +++ b/docs/en/programmers/api-functions/api-assign-by-ref.xml @@ -13,7 +13,7 @@ mixedvar - This is used to assign() + This is used to assign() values to the templates by reference instead of making a copy. See the PHP manual on variable referencing for an explanation. @@ -24,7 +24,8 @@ If you assign a variable by reference then change its value, the assigned value sees the change as well. For objects, - assign_by_ref() also avoids an in-memory copy of the assigned object. + assign_by_ref() also avoids an in-memory copy of the + assigned object. See the PHP manual on variable referencing for an in-depth explanation. @@ -42,10 +43,13 @@ $smarty->assign_by_ref('Address', $address); - See also assign(), - clear_all_assign(), - append() - and {assign} + See also + assign(), + clear_all_assign(), + append(), + {assign} + and + get_template_vars(). diff --git a/docs/en/programmers/api-functions/api-assign.xml b/docs/en/programmers/api-functions/api-assign.xml index ca9efc5f..8bb906a1 100644 --- a/docs/en/programmers/api-functions/api-assign.xml +++ b/docs/en/programmers/api-functions/api-assign.xml @@ -32,6 +32,10 @@ $smarty->assign('Address', $address); // passing an associative array $smarty->assign(array('city' => 'Lincoln', 'state' => 'Nebraska')); +// passing an array +$myArray = array('no' => 10, 'label' => 'Peanuts'); +$smarty->assign('foo',$myArray); + // passing a row from a database (eg adodb) $sql = 'select id, name, email from contacts where contact ='.$id; $smarty->assign('contact', $db->getRow($sql)); @@ -39,7 +43,7 @@ $smarty->assign('contact', $db->getRow($sql)); ]]> - Access these in the template with + These are accessed in the template with assign('contact', $db->getRow($sql)); {$city} {$state} +{$foo.no}, {$foo.label} {$contact.id}, {$contact.name},{$contact.email} ]]> - For more complex array assignments see - {foreach} + To access more complex array assignments see + {foreach} and - {section} + {section} - See also assign_by_ref(), - get_template_vars(), - clear_assign(), - append() + See also + assign_by_ref(), + get_template_vars(), + clear_assign(), + append() and - {assign} + {assign} diff --git a/docs/en/programmers/api-functions/api-clear-all-assign.xml b/docs/en/programmers/api-functions/api-clear-all-assign.xml index 5cd33741..83ad88fc 100644 --- a/docs/en/programmers/api-functions/api-clear-all-assign.xml +++ b/docs/en/programmers/api-functions/api-clear-all-assign.xml @@ -35,10 +35,11 @@ print_r( $smarty->get_template_vars() ); See also - clear_assign(), - clear_config(), - assign() - and append() + clear_assign(), + clear_config(), + get_template_vars(), + assign() + and append() diff --git a/docs/en/programmers/api-functions/api-clear-all-cache.xml b/docs/en/programmers/api-functions/api-clear-all-cache.xml index 3f50ddf2..1e7d2e31 100644 --- a/docs/en/programmers/api-functions/api-clear-all-cache.xml +++ b/docs/en/programmers/api-functions/api-clear-all-cache.xml @@ -23,16 +23,19 @@ clear_all_cache(); + +// clears all files over one hour old +$smarty->clear_all_cache(3600); ?> ]]> See also - clear_cache(), - is_cached() - and - caching + clear_cache(), + is_cached() + and the + caching page. diff --git a/docs/en/programmers/api-functions/api-clear-assign.xml b/docs/en/programmers/api-functions/api-clear-assign.xml index e1565a1d..7ebf0b93 100644 --- a/docs/en/programmers/api-functions/api-clear-assign.xml +++ b/docs/en/programmers/api-functions/api-clear-assign.xml @@ -30,11 +30,11 @@ $smarty->clear_assign(array('Name', 'Address', 'Zip')); See also - clear_all_assign(), - clear_config(), - get_template_vars(), - assign() - and append() + clear_all_assign(), + clear_config(), + get_template_vars(), + assign() + and append() diff --git a/docs/en/programmers/api-functions/api-clear-cache.xml b/docs/en/programmers/api-functions/api-clear-cache.xml index 6a19cd2d..35509219 100644 --- a/docs/en/programmers/api-functions/api-clear-cache.xml +++ b/docs/en/programmers/api-functions/api-clear-cache.xml @@ -15,21 +15,30 @@ intexpire_time - + + + If you have multiple caches for a template, you can clear a specific cache by supplying the cache_id as the second parameter. + + You can also pass a $compile_id as a third parameter. - You can "group" templates - together so they can be removed as a group. See the + You can group templates together + so they can be removed as a group, see the caching section for more - information. As an optional fourth parameter, you can supply a + information. + + + As an optional fourth parameter, you can supply a minimum age in seconds the cache file must be before it will get cleared. - + + + clear_cache() @@ -39,16 +48,16 @@ $smarty->clear_cache('index.tpl'); // clear the cache for a particular cache id in an multiple-cache template -$smarty->clear_cache('index.tpl', 'CACHEID'); +$smarty->clear_cache('index.tpl', 'MY_CACHE_ID'); ?> ]]> See also - clear_all_cache() + clear_all_cache() and - caching. + caching section. diff --git a/docs/en/programmers/api-functions/api-clear-compiled-tpl.xml b/docs/en/programmers/api-functions/api-clear-compiled-tpl.xml index c212e89c..7531424d 100644 --- a/docs/en/programmers/api-functions/api-clear-compiled-tpl.xml +++ b/docs/en/programmers/api-functions/api-clear-compiled-tpl.xml @@ -17,12 +17,13 @@ This clears the compiled version of the specified template resource, or all compiled template files if one is not specified. - If you pass a $compile_id - only the compiled template for this - specific $compile_id - is cleared. if you pass an exp_time, then only - compiled templates older than exp_time seconds are cleared, by - default all compiled templates are cleared regardless of their age. + If you pass a + $compile_id + only the compiled template for this specific + $compile_id + is cleared. If you pass an exp_time, then only + compiled templates older than exp_time seconds are + cleared, by default all compiled templates are cleared regardless of their age. This function is for advanced use only, not normally needed. @@ -31,7 +32,7 @@ clear_compiled_tpl("index.tpl"); +$smarty->clear_compiled_tpl('index.tpl'); // clear entire compile directory $smarty->clear_compiled_tpl(); @@ -39,6 +40,9 @@ $smarty->clear_compiled_tpl(); ]]> + See also + clear_cache(). +