Gossamer Forum
Home : Products : Gossamer Links : Version 1.x :

New template parser -- 3-level new mod

Quote Reply
New template parser -- 3-level new mod
Alex,

Is this new template parser designed to replace the new-graphics mod?

Code:
<%if DaysOld > '7'%>
<img src=/new14.gif>
<%endif%>

<%if DaysOld < '8'%>
<%if DaysOld > '3'%>
<img src=/new7.gif>
<%endif%>
<%endif%>

<%if DaysOld < '4'%>
<%if DaysOld > '1'%>
<img src=/new2.gif>
<%endif%>
<%endif%>

<%if DaysOld = '1'%>
<img src ="/new1.gif>
<%endif%>

This could be simplified to be:

Code:
<%if DaysOld < '15'%>
<img src ="/new<%DaysOld%>.gif>
<%endif%>

Right?

And with a few extra images in the images directory, the amount of template processing is significantly reduced....
Quote Reply
Re: New template parser -- 3-level new mod In reply to
You could do that simplification as long as you had a new1.gif, new2.gif, ... , new15.gif. In which case you might as well just do:

<%if isNew%>
<img src="/images/new<%DaysOld%>.gif">
<%endif%>

=)

Cheers,

Alex
Quote Reply
Re: New template parser -- 3-level new mod In reply to
Actually...

That would work as long as your 'isNew' matched your number of graphics Smile It should, so yours is even simpler.

Unfortunately, because ratings are not discrete (9.43, 8.71 etc) you still need to have multiple <%if...%> tests ... but by simplifying the "new" and even the "pop" tests, there should be a significant speed savings using the <%DaysOld%>.gif tag vs the multiple tests.

This moved the "pop" graphic/text, "new" graphic/text and even the "ratings" graphic to the template level, and out of the nph-build routines -- right? "pop" is determined by the "rating" level, and new is determined by "DaysOld" and the ratings graphic is by value.



Quote Reply
Re: New template parser -- 3-level new mod In reply to
Alex,

Are you going to add the "DaysOld" value to LinkSQL? Right now you just test for the date as a >/< not as an actual value. For the <%if eq xx%> mod to work, the days_old has to be calculated.