Gossamer Forum
Home : Products : Gossamer Links : Discussions :

How to simplify this if statement?

Quote Reply
How to simplify this if statement?
hi - can anyone suggest how to simplify the following statement? It seems a bit silly to repeat the loop code again, but I don't know how to wrap them into one...

Code:
<%if links_loop%>
<%loop links_loop%>
features[<%ID%>] = '<%if Description%><%Description%><%endif%>' ;
<%endloop%>
<%endif%>
<%if link_results_loop%>
<%loop link_results_loop%>
features[<%ID%>] = '<%if Description%><%Description%><%endif%>' ;
<%endloop%>
<%endif%>

thanks

r
Quote Reply
Re: [ryel01] How to simplify this if statement? In reply to
Hi rye|01

What are you trying to achieve with it and on what pages do you want it displayed on.

Regards

minesite
Quote Reply
Re: [minesite] How to simplify this if statement? In reply to
hi minesite

in my link.html template I've got a description icon which pops up a javascript pop up window if anyone rolls over it with their mouse, displaying the description of that link.

So at the bottom of every page is the javascript which controls that. That javascript has an array of the description(s) of the link, or links, that are displayed on that particular page.

var features = new Array() ;
features[0] = 'null value';
features[1] = 'description 1';
features[2] = 'description 2';

What my loop is doing is just automatically creating the list of the descriptions for however many links are being displayed on that page - be it 1 link or 25 links.

So I'd like this to work on the category page, modify, modify select, claim link, detailed etc etc etc - anywhere where a link or links are displayed, but it seems that the links are never displayed consistentely with the same tag... Unimpressed

Hope that makes sense!

My other post that you replied to is also in relation to this - what I was trying to do was get the link information so that I could create the description in the array above.

url to the other post I'm referring to

regan
Quote Reply
Re: [minesite] How to simplify this if statement? In reply to
another way around it would be to include the following javascript in the actual link template, which then does print the description BUT it doesn't recognise it as part of the javascript features array started at the bottom of the page, therefore it doesn't display.

This would probably solve the problem if I could get the two to connect - any idea how?

Code:
<SCRIPT TYPE="text/javascript">
<!--
features[<%ID%>] = '<%if Description%><%Description%><%endif%>' ;
//-->
</SCRIPT>

r
Quote Reply
Re: [ryel01] How to simplify this if statement? In reply to
In Reply To:
This would probably solve the problem if I could get the two to connect - any idea how?



Solved it!

Just moved the javascript code with the begin array to the top of the page, put the script inside the link template so it gets called separately for every link, and now it works like a charm - no loops or anything!

wooooo hoooooo! Smile

r