Reply to Re: include name from variable name? help?

Your name:

Reply:


Posted by Acrobatic on 12/03/07 14:51

This looks like Smarty templating... if you're using Smarty, then the
code would be something like:

{if $imageCat=="2"}
{php}
$imageCat = $smarty->get_template_vars('imageCat');
include ($imageCat . ".php");
{/php}
{/if}


Make sure you set the Smarty variable of $imageCat with
"$yourSmartyForm->assign('imageCat','2');


On Dec 2, 5:44 pm, atwiaw...@yahoo.com wrote:
> Hi
>
> This may be simple to solve, but I can't seem to do it :(
>
> I am trying to generate an include name on an image gallery page from
> a variable name.
> By this I mean I already have a numeric value set the variable
> $imageCat.
>
> What I want to do is pull in an external include file using the
> variable as the file name. So if $imageCat is set to 2 I want to bring
> in 2.html ($imageCat.html).
>
> I can hard code each include request as such:
>
> {if $imageCat=="2"}
> {php}
> include ("2.php");
> {/php}
> {/if}
>
> But I am dealing with oodles of categories so this file would be huge.
> A dynamic option would be very cool but I just can't seem to get my
> syntax right.
>
> If anyone could give me even a vague pointer; I would be sooooo
> greatful.
>
> Many thanks
>
> Mr M

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация