Smarty eval - what is it for?

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Locked
Anastasis

Smarty eval - what is it for?

Post by Anastasis »

The default news module detail template includes the code:

Code: Select all

 {eval var=$entry->content}
to display the news content.

However just having:

Code: Select all

{$entry->content}
also displays the news content.

So what is "eval" for? The Smarty manual says:
{eval} is used to evaluate a variable as a template. This can be used for things like embedding temaplate tags/variables into variables or tags/variables into config file variables.

If you supply the special "assign" attribute, the output of the {eval} function will be assigned to this template variable instead of being output to the template.
but I don't understand how this works in practice although it looks like it could be useful. Is it? And what difference does it make in the news module detail template? It appears to have none.
Anastasis

Re: Smarty eval - what is it for?

Post by Anastasis »

Not that it is a show stopper but has anyone got any thoughts on this (see post above)?
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: Smarty eval - what is it for?

Post by calguy1000 »

the eval statement in the News module templates is designed so that you can put smarty expressions, etc in your summary and detail content.  This would be useful for (for example) allowing comments on News articles, adding {image} tags, or embedding pieces of albums, etc.  a whole world of stuff.

If you don't use any smarty stuff in your news summaries, or detail you can probably get away with leaving the eval statements out.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Anastasis

Re: Smarty eval - what is it for?

Post by Anastasis »

calguy1000 wrote: the eval statement in the News module templates is designed so that you can put smarty expressions, etc in your summary and detail content.  This would be useful for (for example) allowing comments on News articles, adding {image} tags, or embedding pieces of albums, etc.  a whole world of stuff.

If you don't use any smarty stuff in your news summaries, or detail you can probably get away with leaving the eval statements out.
Thanks - sounds useful although I don't really understand how this would work in practice. Are there any examples of this?
Locked

Return to “CMSMS Core”