Gossamer Forum
Home : Products : Links 2.0 : Customization :

"elsif" Template Code not working - Help

(Page 1 of 2)
> >
Quote Reply
"elsif" Template Code not working - Help
Hello,

For some reason my template code is not working right.
I have this in the template:
<%if Address%><%elsif City%><%elsif Zipcode%><%elsif State%> then say hi <%endif%>

And I'm getting this error:
Unkown Tag: elsif City

It used to work...and I'm unsure what I did to mess it up. Any ideas?

P a i n t b a l l C i t y . c o m
http://www.paintballcity.com
Quote Reply
Re: "elsif" Template Code not working - Help In reply to
er.....

In Reply To:
<%if Address%><%elsif City%><%elsif Zipcode%><%elsif State%> then say hi <%endif%>
Check your syntax.......it isn't correct.

Paul Wilson.
new - http://www.wiredon.net
Quote Reply
Re: "elsif" Template Code not working - Help In reply to
Can you tell me what is wrong with it please?

P a i n t b a l l C i t y . c o m
http://www.paintballcity.com
Quote Reply
Re: "elsif" Template Code not working - Help In reply to
Well firstly you use elsif right after if without doing anything.

You need

<%if Something%>
do something
<%endif%>

<%elsif Somethingelse%>
do that thing
<%endif%>


Paul Wilson.
new - http://www.wiredon.net
Quote Reply
Re: "elsif" Template Code not working - Help In reply to
What I'm trying to say in that statement is

If City and State and Zipcode exists, then say hi.

How would I create that?

P a i n t b a l l C i t y . c o m
http://www.paintballcity.com
Quote Reply
Re: "elsif" Template Code not working - Help In reply to
<%if City%>
<%if State%>
<%if Zip%>
Say Hi
<%endif%>

Paul Wilson.
new - http://www.wiredon.net
Quote Reply
Re: "elsif" Template Code not working - Help In reply to
I don't think that is right, because now if there is no
<%address%>

it doesn't show the rest of the page even though there is an <%endif%> I even tried matching the amount of <%if%>'s with <%endif%>'s

Any ideas? Thanks. :)

P a i n t b a l l C i t y . c o m
http://www.paintballcity.com
Quote Reply
Re: "elsif" Template Code not working - Help In reply to
what do you mean there is no address?

it was an example.....you have to modify it.

Paul Wilson.
new - http://www.wiredon.net
Quote Reply
Re: "elsif" Template Code not working - Help In reply to
Meaning if the <%Address%> field is blank it does not show the rest of the page using your method.

There has to be another way to use multiple variables in the same if statement. To say "If address & city & zip" then say hi.

Your method works if the <%Address%> field contains a value, but fails if it does not contain a value.

P a i n t b a l l C i t y . c o m
http://www.paintballcity.com
Quote Reply
Re: "elsif" Template Code not working - Help In reply to
You have confused me.

Explain what exactly you want the code to do.

Paul Wilson.
new - http://www.wiredon.net
Quote Reply
Re: "elsif" Template Code not working - Help In reply to
The statement shoudl do this:
IF the Address, City, and State fields have a value, then say hi.

Thats it.

P a i n t b a l l C i t y . c o m
http://www.paintballcity.com
Quote Reply
Re: "elsif" Template Code not working - Help In reply to
<%if Address%>
<%if City%>
<%if State%>
Say Hi
<%endif%>

.....that will mean all three have to have values.

If only one needs to have a value use:

<%if Address%>
Say Hi
<%elsif City%>
Say Hi
<%elsif State%>
Say Hi
<%endif%>

.......don't quote me on that!

Paul Wilson.
new - http://www.wiredon.net
Quote Reply
Re: "elsif" Template Code not working - Help In reply to
Hello,

No it doesn't work that way. I've tried.

P a i n t b a l l C i t y . c o m
http://www.paintballcity.com
Quote Reply
Re: "elsif" Template Code not working - Help In reply to
There is no 'elsif' tag for Links 2.0 (however, Links SQL 2.0.2 does).

What you could do is hard-code a new tag into sub site_html_link.

After
Code:
%rec = @_;
if you want ALL of the fields to be required:
Add
Code:
if ($rec{Address} and $rec{City} and $rec{State}) {
$SayHello = 1;
}
if you want ANY of the fields to be required:
Add
Code:
if ($rec{Address} or $rec{City} or $rec{State}) {
$SayHello = 1;
}
Above
Code:
%globals
Add
Code:
SayHello => $SayHello,
Then in your links.html template, add
Code:
<%if SayHello%>
Hello!
<%endif%>
OR:
(This will only work if ALL fields are required)

You should be able to use nested if's in your template, like this:
Code:
<%if Address%>
<%if City%>
<%if State%>
Hello!
<%endif%>
<%endif%>
<%endif%>
Happy Coding,

--Drew
http://www.FindingHim.com
Quote Reply
Re: "elsif" Template Code not working - Help In reply to
Thanks for you rtime Junko. Eliot Lee (Antrhorules) had seen this post and emailed me a similar solution to the problem. It worked. I should have posted that I got it so that you didn't waste your time.

Thank you though. :)

Eliot got banned. I can't believe it. Although he was sarcastic in many of his posts, he was and still is very knowledgable of the Links system and is a tough loss in my oppinion.

P a i n t b a l l C i t y . c o m
http://www.paintballcity.com
Quote Reply
Re: "elsif" Template Code not working - Help In reply to
Are you serious?

I have seen some posts from Eliot recently?

Paul Wilson.
new - http://www.wiredon.net
Quote Reply
Re: "elsif" Template Code not working - Help In reply to
Yes...he is...GT has banned posting access from my office computer...which is a good thing, I guess...Fortunately, they are not able to ban dialup IP Addresses since they are always changing, as you know.

Wink

Regards,

Eliot Lee
Quote Reply
Re: "elsif" Template Code not working - Help In reply to
And why in heaven would GT ban you from posting??


Quote Reply
Re: "elsif" Template Code not working - Help In reply to
Well if it is any consolation, although we have had our disagreements in the past, I don't agree with GT banning your IP.

I'm not quite sure of the reasons behind Alex's decision but in *my* opinion I don't think it is fair.

But as I said....I don't know the full situation.

Also....I notice there is a nicer atmosphere around the forums at the moment - do you agree?

I hope it stays that way and we can get along.....

Paul Wilson.
new - http://www.wiredon.net
Quote Reply
Re: "elsif" Template Code not working - Help In reply to
Probably because of people's complaints of my "attitude", which is nothing but expression of myself through sarcacism and also frustrating remarks...(I am a sarcastic person by nature...and I don't mask my personality through electronic communications.)

Don't know why really...and I am not going to "rock the boat"...it is probably a good thing that I don't waste time in the forums during work, which I should be concentrating on our web site redesign...so, it is not a bad thing really. Although I would've sent an email notifying "banned" users that they were being banned. Simply banning users without sending a personal message is a bit aristocratic if you ask me...but again, let's not make an issue out of it, okay?

Regards,

Eliot Lee
Quote Reply
Re: "elsif" Template Code not working - Help In reply to
Hi,

I assume this is for Links SQL 2, not Links 2? The template parser in Links 2 does not support elsif tags.

If it is for Links SQL 2, make sure you are using version 2.0.2 as there was a bug in the template parser with if's in previous versions.

If you are still having problems, please post a URL to a txt version of your entire template so I can try it out.

Cheers,

Alex

--
Gossamer Threads Inc.
Quote Reply
Re: "elsif" Template Code not working - Help In reply to
OK I know you don't want to rock the boat as you say but that I do not agree with.

I mean....banning you without warning. I think that is very disrespectful.

The least I would expect is warning and a reason.

........and I think you were hinting at it being me who got you banned but I can assure you it wasn't. I at no point asked anyone to ban you.

Paul Wilson.
new - http://www.wiredon.net
Quote Reply
Re: "elsif" Template Code not working - Help In reply to
Paul,

I was not incinuating that you were one of the people who complained...I was stating a broad fact...and the "warning" posted by Alex in the Announcement forum was enough...but on an individual basis, an automated email message should have been sent, IMHO.

Anyway...this is really getting off-topic, so let's let it rest, okay?

Regards,

Eliot Lee
Quote Reply
Re: "elsif" Template Code not working - Help In reply to
Yep you are correct it is off topic.

One final thing.......

What is IMHO?

Also....I thought the warning in the announcements forum was directed at me..lol..so you are not alone.

Anyway..........

Paul Wilson.
new - http://www.wiredon.net
Quote Reply
Re: "elsif" Template Code not working - Help In reply to
IMHO is a common Internet acronym...

In My Humble Opinion

Regards,

Eliot Lee
> >