Gossamer Forum
Home : Products : Gossamer Links : Discussions :

if statement help needed

Quote Reply
if statement help needed
Hi Everyone,


I have this code that works fine except when no links have <%story eq 'Yes'~%>
The Header shows: My Title: which I do not want.

I did try to correct this, but had no success.


<%if link_results_loop.length~%>
<h3>My Title:</h3>
<%if title_loop.length%>
<%~set formatted_title = Links::Utils::format_title($title_loop, separator => $category_separator, no_escape_separator => $no_escape_category_separator, include_home => 0, link_type => 1)%>
<p class="category"><%if highlight and query%><%Links::Tools::highlight($formatted_title, $query)%><%else%><%formatted_title%><%endif%></p>
<%~endif%>

<%loop link_results_loop~%>
<%if story eq 'Yes'~%>
<%include link.html%>
<%~endif%>
<%~endloop%>
<%~endif%>

Can I stop the Header from showing when no Links Available?


Thanks in Advance!!!
Quote Reply
Re: [rascal] if statement help needed In reply to
bump
Quote Reply
Re: [rascal] if statement help needed In reply to
Hi,

What happens if you change;

<%loop link_results_loop~%>
<%if story eq 'Yes'~%>
<%include link.html%>
<%~endif%>
<%~endloop%>
<%~endif%>

..to;

Code:
<%loop link_results_loop~%>
<b>Story: <%story%></b><br/>
<%if story eq 'Yes'~%>
<%include link.html%>
<%~endif%>
<%~endloop%>
<%~endif%>

...what does it print next to "Story: ...." ?

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] if statement help needed In reply to
Hi Andy,

The <%story%> tag prints the story fine, but Story: is printed for every link.
Quote Reply
Re: [rascal] if statement help needed In reply to
Mmm.. what if you change it to;

Code:
<%loop link_results_loop~%>
<%if story eq 'Yes'%>
<%include link.html%>
<%endif%>
<%~endloop%>
<%~endif%>

?

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] if statement help needed In reply to
Andy,

That last code you posted is what I had, it does not work.


Tryed everything I could, no success.
Quote Reply
Re: [rascal] if statement help needed In reply to
Quote:
That last code you posted is what I had, it does not work.


Tryed everything I could, no success.

Not exactly ;) (note the missing ~'s).

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] if statement help needed In reply to
Andy,

<%if story eq 'Yes'~%> to <%if story eq 'Yes'%>

Made no difference.
Quote Reply
Re: [rascal] if statement help needed In reply to
Hi,

Afraid I'm out of ideas then :(

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] if statement help needed In reply to
   
Andy,

Thanks for trying to help me out.
Quote Reply
Re: [rascal] if statement help needed In reply to
Maybe you could try



<%if link_results_loop.length~%>

<%if link_results_loop.length and story eq 'Yes'%>
<h3>My Title:</h3>
<%endif%>

<%if title_loop.length%>
<%~set formatted_title = Links::Utils::format_title($title_loop, separator => $category_separator, no_escape_separator => $no_escape_category_separator, include_home => 0, link_type => 1)%>
<p class="category"><%if highlight and query%><%Links::Tools::highlight($formatted_title, $query)%><%else%><%formatted_title%><%endif%></p>
<%~endif%>

<%loop link_results_loop~%>
<%if story eq 'Yes'~%>
<%include link.html%>
<%~endif%>
<%~endloop%>
<%~endif%>
Quote Reply
Re: [Payooo] if statement help needed In reply to
Thanks Payooo, but no success with your code.

I do not get any header showing at all now.


When I seen the code you provided I thought it would work, it looked good!



Thanks
Quote Reply
Re: [rascal] if statement help needed In reply to
How about this one:

<%if link_results_loop.length~%>

<%loop link_results_loop~%>
<%if story eq 'Yes'~%>
<%set MY_TITLE_AVAILABLE = 'YES'%>
<%~endif%>
<%~endloop%>

<%if MY_TITLE_AVAILABLE eq 'YES'%>
<h3>My Title:</h3>
<%endif%>

<%if title_loop.length%>
<%~set formatted_title = Links::Utils::format_title($title_loop, separator => $category_separator, no_escape_separator => $no_escape_category_separator, include_home => 0, link_type => 1)%>
<p class="category"><%if highlight and query%><%Links::Tools::highlight($formatted_title, $query)%><%else%><%formatted_title%><%endif%></p>
<%~endif%>

<%loop link_results_loop~%>
<%if story eq 'Yes'~%>
<%include link.html%>
<%~endif%>
<%~endloop%>
<%~endif%>


This one is with additional <%loop link_results_loop~%> (I am sure that there is a better way to solve this problem)

Last edited by:

Payooo: Jun 27, 2005, 7:49 PM
Quote Reply
Re: [Payooo] if statement help needed In reply to
Payooo,

The code worked perfect, thanks for the help.
Quote Reply
Re: [rascal] if statement help needed In reply to
Great! Smile