Reply to Re: [SMARTY] {php} and assign()

Your name:

Reply:


Posted by Evan Wagner on 07/17/05 23:15

That's not really what smarty was designed for. You want to seperate
your logic and presentation. For example, if you wanted to assign the
$data variable in smarty to fetch_some_date_from_db(); then you would
do it like this:

$smarty->assign('data', fetch_some_data_from_db());

And thus for you to show what fetch_some_data_from_db() has done you
would just need this in your template file:

{$data}

If you cannot understand this you need to at least read the crash
course on the Smarty site.

On 7/17/05, Fredrik Arild Takle <ftakle@go-publish.com> wrote:
> Hi there,
>
> inside a template I do the following
>
> {php}
> $data = fetch_some_data_from_db();
> {/php}
>
>
> <head>
> <title>Test</titel>
> </head>
> <body>
> {data}
> </body>
>
>
> My problem is how do I assign the $data variable?
>
> --
> Smarty General Mailing List (http://smarty.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

[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

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