Gossamer Forum
Quote Reply
new images
I believe I've got the 3 levels of new images figured out now. In http://www.postcards.com/...kSQL/Detailed/6.html , I believe all of the DaysOld parts need to be replaced with Days_Old.

Also, here's the way I set it up to be consistent with Bobsie's date ranges on the 2.0 mod:
Code:
<%if Days_Old < '15'%>
<%if Days_Old > '7'%>
<img src="http://run-down.com/images/new_7.gif" border="0" width="34" height="12" alt="New 8-14" align="absmiddle">
<%endif%>
<%endif%>

<%if Days_Old < '8'%>
<%if Days_Old > '2'%>
<img src="http://run-down.com/images/new_3.gif" border="0" width="34" height="12" alt="New 3-7" align="absmiddle">
<%endif%>
<%endif%>

<%if Days_Old < '3'%>
<%if Days_Old > '0'%>
<img src="http://run-down.com/images/new_1.gif" border="0" width="34" height="12" alt="New 0-2" align="absmiddle">
<%endif%>
<%endif%>
The only thing I'm not sure about yet is if that will pick up links that are zero days old, i.e. added the same day as it is built. The Days_Old apparently calculates anything over the build_new_cutoff as having a value of '0' which complicates the new comparison...

Another thing I noticed: I'm using page.cgi to make changes on the fly -- boy is that a great feature! Smile -- but I had to rebuild to get it to recognize a change from 7 to 14 in build_new_cutoff in Links.pm. Is this the way it's supposed to be?

I haven't gotten to addressing it yet, but there appears to be an inconsistency between link.html and subcategory.html. link.html only shows new links, whereas subcategory.html shows new and updated "links." Is there some reason for not using the same date calculation for both sections like it was done in the 2.0 mod?

Thanks,
Dan
Quote Reply
Re: new images In reply to
Scratch the last comment, I just missed the update tag in the original link.html...

Is there an easy way to turn <%if Has_New_Links eq 'Yes'%> in subcategory.html into a date range like in link.html for the 3 new graphics instead of just a single "new" text?

Thanks,
Dan
Quote Reply
Re: new images In reply to
Dan...

I came up with a (crazy??) idea back in links 2.0, and it works for Links SQL...

I just use the <%Days_Old%>.gif format... and put a couple of dozen 1.gif, 2.gif, etc files in my directory.

It's simple, fast, requires less processing, and you can change the date ranges simply by changing the graphics.

You just need a 0.gif ... max_days.gif

Works great!

(I think you can search for that in the FAQ and see a couple of different suggestions for this problem... I like mine Smile )

------------------
POSTCARDS.COM -- Everything Postcards on the Internet www.postcards.com
LinkSQL FAQ: www.postcards.com/FAQ/LinkSQL/








Quote Reply
Re: new images In reply to
I believe the link I posted above is one such solution you are referring to? I don't know if I can handle coming up with that many new images and keeping them visually discernable... Smile Right now, I've got "gold," "silver," and "bronze" new images, which fits the theme of my site.

Is that the method you are using for the SQL FAQ? Assuming you are using Links SQL for it, you appear to have the 2.0 style three levels of new graphics running on the home and category pages.

The part I'm unclear on is subcategory.html uses <%if Has_New_Links eq 'Yes'%> for the new tag on the home and subcategory links, whereas link.html uses <%if Days_Old < '3'%> for example. The method I posted above seems to work fine for the link.html generated items. As I understand it, Days_Old is for links and Has_New_Links is for categories/subcategories, right?

Am I missing something?

Thanks,
Dan
Quote Reply
Re: new images In reply to
All I did was make image 0.gif, 1.gif and 2.gif the same, image 3-7 the same, and 8-14 the same....

Redundant, but _very_ easy Smile

And, easy to upgrade later on if I want to make one day stand out, or split hairs... or even remove the dating, I sent the image to a 1x1 pixel file...


Days_old is the _NUMBER_ of days between today, and the day it was posted.

Has_new_links is simply a yes/no test that applies _ONLY_ to categories (a link can't have new links).

So, <%if Has_New_Links eq 'Yes'%>, then in a subcategory "Days_old" gives the MOST RECENT link added... and <%if Has_Changed_Links eq 'Yes'%> is obvious.

Code:
<font face=arial SIZE=2>
<dl>
<dt><a href="<%URL%>"><B><%Short_Name%></B></a> <small>(<%Number_of_Links%> )</small>
<%if Has_New_Links eq 'Yes'%><%if Days_Old < 15%> <img src=/FAQ/images/new_<%Days_Old%>.gif><%endif%><%endif%>
<%if Has_Changed_Links eq 'Yes'%><small><sup>update</sup></small><%endif%>
</dt>
<%if Description%><dd><%Description%></dd><%endif%>
</dl>
</font>

That is the code in my subcategory.html for the FAQ.




------------------
POSTCARDS.COM -- Everything Postcards on the Internet www.postcards.com
LinkSQL FAQ: www.postcards.com/FAQ/LinkSQL/








Quote Reply
Re: new images In reply to
Ah, that makes sense now. Thanks for the detailed explanation. That's not a bad idea for the way you named the same images for each possible new day. Makes for several extra images to potentially load, but at a mere 200 bytes a piece, that's probably not too big of a deal.

I didn't realize Days_Old also referred to the newest link within a category. That's the tidbit I was missing! Smile

Thanks,
Dan
Quote Reply
Re: new images In reply to
I must be missing something here. If I use your suggestion of a single "new" image for each day up to the max setting, my link.html looks basically like this:

<%if Days_Old < 15%>
<IMG SRC="/images/new<%Days_Old%>.gif">
<%endif%>

It doesn't seem to matter if 15 is that way or '15' -- is one or the other correct? I have the images named new0.gif -> new14.gif.

Anyway, this method appears to work for all of the truly new links, but the old links get a new.gif blank image added. I'm not sure what characteristic of Days_Old gives a non-existent value (note no number between new and .gif)?

Thanks,
Dan
Quote Reply
Re: new images In reply to
Furthermore,

<%if Has_New_Links eq 'Yes'%>
<%if Days_Old < 15%>
<IMG SRC="/images/new<%Days_Old%>.gif">
<%endif%>
<%endif%>

works fine in subcategory.html, as far as I can tell. Why would Days_Old be treated different between the two with regards to non-new links?

Dan
Quote Reply
Re: new images In reply to
Don't know why it would work differently, but I have it set up as:

Code:
<%if isNew%>
<img src=/FAQ/images/new_<%Days_Old%>.gif>
<%endif%>

Basically, since the "isNew" is already calculated, it should be faster than doing the test, which requires a bit of extra parsing/processing.



------------------
POSTCARDS.COM -- Everything Postcards on the Internet www.postcards.com
LinkSQL FAQ: www.postcards.com/FAQ/LinkSQL/








Quote Reply
Re: new images In reply to
Only Alex could provide the answer to that one Smile

Glad it's working.

------------------
POSTCARDS.COM -- Everything Postcards on the Internet www.postcards.com
LinkSQL FAQ: www.postcards.com/FAQ/LinkSQL/








Quote Reply
Re: new images In reply to
Thanks! What can I say, isNew works just fine for link.html. Curiosity still has me wondering why the difference, but I'm happy putting it into the "unsolved mystery" bin for now. Smile

Thanks again for the pointers.

Dan
Quote Reply
Re: new images In reply to
One thing that's a bit strange, using the isNew method in link.html seems to calculate a "new 15" even though the new cutoff is set to 14. I can either lower the new cutoff to 13 or add a new15.gif image, but I'd rather know why it's calculated that way. Smile

I haven't been building/updating the SQL test setup daily, so it's a little tough to keep an eye on what's actually happening with the new links, although I think page.cgi updates them accurately.

Dan
Quote Reply
Re: new images In reply to
Where is it doing that?

Code:
<%if Days_Old < 15%>

If you are using that sort of code, there is no way it could calculate a 15.gif unless there is a problem! '15' would fail the test, and not be displayed.

------------------
POSTCARDS.COM -- Everything Postcards on the Internet www.postcards.com
LinkSQL FAQ: www.postcards.com/FAQ/LinkSQL/








Quote Reply
Re: new images In reply to
I went with the method you suggested. I have link.html set up this way (image tag simplified from border/height/width/alt/etc.):

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

I was surprised to see a blank gif in place of a new image -- the image size settings created a "place holder" -- so I looked at the source data and it was calling new15.gif.

Dan