Re: [SMARTY] includes
| From: | messju mohr | Date: | Thu, 02 Sep 2004 16:17:43 +0000 |
| Subject: | Re: [SMARTY] includes | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-11759@lists.php.net to get a copy of this message | ||
On Thu, Sep 02, 2004 at 03:17:00PM +0100, pete M wrote:
> is there a more elegant way to code below..The variable companed is also
> tpart of the file name
>
> {if $report_type == 'general'}
> {include file="reports.general.inc.html"}
>
> {elseif $report_type == 'ppm'}
> {include file="reports.ppm.inc.html"}
>
> {elseif $report_type == 'finance'}
> {include file="reports.finance.inc.html"}
>
> {elseif $report_type == 'testing'}
> {include file="reports.testing.inc.html"}
> {/if}
sure:
{include file="reports.$report_type.inc.html"}
or (more explicit but equal)
{include file="reports.
$report_type.inc.html"}
you just have to make sure that $report_type is always valid.
> --
> Smarty General Mailing List (http://smarty.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php