Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Feaured Links Heading

Quote Reply
Feaured Links Heading
I have added an IsFeatured field to the Links DB, which can take the value of "Yes" or "No". What I want to do is insert a heading after "Related Categories" and before "Links" for all applicable "Featured Links" and then list the applicable links.

So far I have the following in the Category.html template. Of course, the "Featured Links" heading comes up even when there are no featured links, because I haven't been able to figure out a way to only display that heading if there are featured links within the category.

Can anyone help?

Thanks!

<%if links_loop.length~%>
<h3>Featured Links</h3>
<%loop links_loop~%>
<%if isFeatured eq 'Yes'%>
<%include link.html%>
<%endif%>
<%~endloop%>
<h3>Links</h3>
<%if paging.num_hits%><div class="paging"><%Links::Utils::paging()%></div><%endif%>
<%loop links_loop~%>
<%include link.html%>
<%~endloop%>
Quote Reply
Re: [Jobu] Feaured Links Heading In reply to
Try:

<%if links_loop.length~%>
<%loop links_loop~%>
<%if isFeatured eq 'Yes'%>
<h3>Featured Links</h3>
<%include link.html%>
<%endif%>
<%~endloop%>
<h3>Links</h3>
<%if paging.num_hits%><div class="paging"><%Links::Utils::paging()%></div><%endif%>
<%loop links_loop~%>
<%include link.html%>
<%~endloop%>

Quote Reply
Re: [gotze] Feaured Links Heading In reply to
Thanks - But this doesn't work (it seems to cut off the Links entirely). Additionally, while I am far from a programmer, what this would appear to do is repeat the heading "Featured Links" before every featured link. I want to show it just once, if possible.

My workaround for the moment is as follows (it just inserts a link -- to be hyperlinked -- under Featured Links that will appear whether there are Links or not). I'd still prefer not to show the heading "Featured Links" at all if there are none.

<%if links_loop.length~%>
<h3>Featured Links</h3>
Click here to feature your link!
<%loop links_loop~%>
<%if isFeatured eq 'Yes'%>
<%include link.html%>
<%endif%>
<%~endloop%>
<h3>Links</h3>
<%if paging.num_hits%><div class="paging"><%Links::Utils::paging()%></div><%endif%>
<%loop links_loop~%>
<%include link.html%>
<%~endloop%>
<%if paging.num_hits%><div class="paging"><%Links::Utils::paging(button_id => 'paging_button2')%></div><%endif%>
<%~endif%>
Quote Reply
Re: [Jobu] Feaured Links Heading In reply to
Hi Jobu,

You can do something like this:

<%if links_loop.length~%>
<%set header_printed = ""%>
<%loop links_loop~%>
<%if isFeatured eq 'Yes'%>
<%unless header_printed%>
<h3>Featured Links</h3>
Click here to feature your link!
<%set header_printed = 1%>
<%endif%>
<%include link.html%>
<%endif%>
<%~endloop%>

hope that helps.

peace
Quote Reply
Re: [klangan] Feaured Links Heading In reply to
Hi Klangan - That didn't seem to work either. But at this point I'm actually not too concerned about having it as it is. EXCEPT FOR THIS. I am using the following code; what I want to do is ensure that the links that are set as IsFeatured = Yes, they show up under Featured Links in that link's category at all times. Right now, if I have, say, 3 pages of links, the link will only show up as Featued on the page that it normally shows up on. How do I ensure the link shows up on all pages of links in the category?

<%if links_loop.length~%>
<h3>Featured Links</h3>
Click here to feature your link!
<%loop links_loop~%>
<%if isFeatured eq 'Yes'%>
<%include link.html%>
<%endif%>
<%~endloop%>
Quote Reply
Re: [Jobu] Feaured Links Heading In reply to
My mistake Klangan, this did work. Thanks!

Any idea how I can carry the Featured Links throughout the category, though? Right not my workaround is sorting by IsFeatured, so all show on the first page, and I've set it so there are no duplicates on the other pages.