Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

Extra 'else', but is there?

Quote Reply
Extra 'else', but is there?
Hi. I'm trying to get this 3 column link stuff done. I have the following code;

Code:
<!-- Links in this category. -->
<%if links%>

<!--BEGIN 3-COL LINK LOOP-->
<%loop links_loop%>

<%if TypeOfDetailed eq "Galleries"%>

<%if first%> <%-- set up the opening table --%>
<TABLE>
<TR>
<%endif%>

<TD>
<%include link.html%>
</TD>
<%ifnot row_num % 3%> <%-- close the row --%>
</TR>
<%endif%>

<%if last%> <%-- close the table --%>
<%if row_num % 3 eq 1%> <%-- balance the trailing rows --%>
<TD></TD><TD></TD>
<%endif%>
<%if row_num % 3 eq 2 %> <%-- balance the trailing rows --%>
<TD></TD>
<%endif%>
</tr>
</TABLE>
<%endif%>

<%else%>
<%include link.html%>
<%endif%>


<%endloop%>

<%endif%>

If I remove the bits in red, it gets rid of the 'extra else statement' error.

Can anyone see what I'm missing? Unsure

TIA.

Andy
Quote Reply
Re: [Andy] Extra 'else', but is there? In reply to
Andy;

The statements below are not proper.
Do you see where a problem might show in the lines below?

Hint: "order of evaluation" and "delimiters"

<%ifnot row_num % 3%>

<%if row_num % 3 eq 1%>
How exactly do you think this will be evaluated?
I see "3 eq 1" as well as "row_num % 3"
Which expression gets evaluated first?

One of the reasons your code is wrong is for the same reason that this example below will cause an error:
<a href="http://www.cnn.com?code="green" title="cnn news" ">CNN</a>
Quote Reply
Re: [webslicer] Extra 'else', but is there? In reply to
I think you will find its row_num / 3 = 1 ... ie., row_num divided by 3, and then check to see if it equals 1 Wink

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] Extra 'else', but is there? In reply to
Andy;

I already thought about it.

Take a good look there, there are two fatal problems with those lines.
If you still don't see the problem, then take a break and look again tomorrow.

Always make sure of order of execution, and always watch out for delimiters...
Quote Reply
Re: [Andy] Extra 'else', but is there? In reply to
I just took a look at GT Templates DOC again, and there is some neat and interesting stuff in there for doing tables and rows .... the ~ operator for instance. Really, really cool!


PUGDOG� Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: [Andy] Extra 'else', but is there? In reply to
Hi,

You might want to check what is in link.html as that may have an unbalanced if/endif tag.

Cheers,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [Alex] Extra 'else', but is there? In reply to
Actually that bit me once *really* badly. An error in an included file is not reported well.

It's a good rule of thumb to first check all include files, then the main file, not to assume the main file is the bad one.

if you keep a list of "gotchas" then this is one to add to that list to check when things get funky.


PUGDOG� Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: [webslicer] Extra 'else', but is there? In reply to
In Reply To:
Andy;

I already thought about it.

Take a good look there, there are two fatal problems with those lines.
If you still don't see the problem, then take a break and look again tomorrow.

Always make sure of order of execution, and always watch out for delimiters...

Well, it works fine on its own. This is simply the codes by pugdog, for multi columns. I managed to get around it now though. Instead of checking to see what category we are dealing with, I simply set the 'Category Template', and added another template set, which is designed for the multi-column, and the default template for single file links.

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!