|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
Fenn Smarty Rookie
Joined: 28 May 2003 Posts: 11
|
Posted: Wed Feb 25, 2004 5:19 pm Post subject: Operaters |
|
|
While designing an updated template I ran into some minor snags caused by the fact that the comparision operaters < and > are the same as the HTML tag delimiters. I think maybe it would be an idea to replace variable operators that use < and > with some kind of nemonic. The current code is as follows:
Code: |
{if $striplist[row].days_ago<-1}{$striplist[row].days_ago|replace:'-':''} days away
{elseif $striplist[row].days_ago==-1}tomorrow
{elseif $striplist[row].days_ago==0}Today
{elseif $striplist[row].days_ago==1}Yesterday
{else}{$striplist[row].days_ago} days ago{/if}
|
As you can imagine, Dreamweaver doesn't like this very much and keeps trying to replace the < symbols with HTML entities. Life would be a lot easier if instead of < you couls use "lt" (less than) and instead of > you could use "gt" (greater than) |
|
Back to top |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Wed Feb 25, 2004 5:34 pm Post subject: Re: Operaters |
|
|
Fenn wrote: | Life would be a lot easier if instead of < you couls use "lt" (less than) and instead of > you could use "gt" (greater than) |
then just use "lt" and "gt". smarty supports them for ages |
|
Back to top |
|
Fenn Smarty Rookie
Joined: 28 May 2003 Posts: 11
|
Posted: Wed Feb 25, 2004 6:25 pm Post subject: |
|
|
OK, then I change my feature request to have that stuff IN THE DOCUMENTATION! The page on Math just says "you can use math with variables" and doesn't mention that. |
|
Back to top |
|
boots Administrator
Joined: 16 Apr 2003 Posts: 5611 Location: Toronto, Canada
|
Posted: Wed Feb 25, 2004 7:16 pm Post subject: |
|
|
It was actually added to the documentation about 3 months ago (details).
Note that it was added to the doc page for the "if" function and not for the math functionality.
Greets. |
|
Back to top |
|
Fenn Smarty Rookie
Joined: 28 May 2003 Posts: 11
|
Posted: Wed Feb 25, 2004 9:34 pm Post subject: |
|
|
Why is it on the page for if but not the page for math? That's going to lead to frustration, as I can attest to. People wanting help over what operaters are legal in math are not going to go to the page on if without, at the least, a note at the bottom of the page, something along the lines of "For more information on available operaters, consult the documentation on if".
Don't get me wrong, I do think Smarty is an excelent package but the documentation sucks. Just one link on the math page would have been all that was needed to avoid this. Or maybe having a seperate section on operaters that both if and math then link to. |
|
Back to top |
|
boots Administrator
Joined: 16 Apr 2003 Posts: 5611 Location: Toronto, Canada
|
Posted: Wed Feb 25, 2004 9:38 pm Post subject: |
|
|
Fenn wrote: | Why is it on the page for if but not the page for math? That's going to lead to frustration, as I can attest to. People wanting help over what operaters are legal in math are not going to go to the page on if without, at the least, a note at the bottom of the page, something along the lines of "For more information on available operaters, consult the documentation on if".
Don't get me wrong, I do think Smarty is an excelent package but the documentation sucks. |
Its not included with the section on math because it is not related to math functionality -- it is strictly related to the way "if" is processed. Your example is indeed concerned precisely with that. May I ask why you thought to look under "math" (instead of "if") and what alternative organization you may suggest? Perhaps there is a way to better present the material. |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|