[prev in list] [next in list] [prev in thread] [next in thread] 

List:       smarty-general
Subject:    [SMARTY] Include files modifying values passed to them
From:       "Mark Rogers" <mark () quarella ! co ! uk>
Date:       2004-04-17 16:39:50
Message-ID: 000d01c4249a$ae167f50$02000a0a () dellboy
[Download RAW message or body]

If I pass values to an included template, which changes them, those changes
are (quite rightly) lost when control returns to the calling template.

I have a situation where it would be very helpful for this not to be the
case, however. What is the easiest way to achieve this?

Eg, I want a mechanism where in the following example the second {$test}
shows 2:

    ---main.tpl---
    {assign var=test value=1}
    {$test}
    {include file="sub.tpl"}
    {$test}

    ---sub.tpl---
    {assign var=test value=2}

PS: I know this would not be a good thing in general! I'm assuming I should
write an alternative to {assign}, maybe {global} or something? Or can I
return a value from the included template somehow? Or pass a value by
reference to an included template?

Anyway, I'm sure I can find _a_ way to do it, I'd just appreciate
suggestions as to the _best_ way.

Mark Rogers

-- 
Smarty General Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic