Gossamer Forum
Home : Products : Links 2.0 : Discussions :

Enhanced Template Parser

Quote Reply
Enhanced Template Parser
I have installed the Enhanced Template Parser mod and it works fine.

In the links.hml file is there a way to do something like

Quote:
<%if Prefix eq "Mrs" OR Prefix eq "Ms" OR Prefix eq "Miss""%>
do something <%endif%>
or is there another way to do the above?


Gene
"The older I get, the more I admire competence, just simple competence in any field from adultery to zoology."
Quote Reply
Re: [esm] Enhanced Template Parser In reply to
Try (no gaurantee) the following:

Quote:

<%if Prefix eq 'Mrs|Ms|Miss'%>
do something
<%endif%>


Alternatively, you could use some reverse logic, like the following:

Quote:

<%if Prefix ne 'Mr'%>
<%if Prefix ne 'Dr'%>
do something related to females
<%endif%>


Or if you trying to print something related to females versus males, it might be more efficient to use Gender with only two values of "Male" and "Female".
========================================
Buh Bye!

Cheers,
Me
Quote Reply
Re: [Stealth] Enhanced Template Parser In reply to
Thanks....I appreciate the suggestion and it was a good idea but didn't work - but you offered no guarantee

I tried a few variations but apparently it is looking for text after the EQ

Actually, I do have a gender field but it's not about that and besides I want to be able to use it elsewhere

since the field can only have one value I guess I could do something like

Quote:
<%if Prefix eq 'Mrs'%>
<%include mrs.html%> <%endif%> <%if Prefix eq 'Ms'%>
<%include ms.html%>
<%endif%>
<%if Prefix eq 'Miss'%>
<%include miss.html%>
<%endif%>

I was trying to avoid that since the code for each is similar and almost duplicated in some parts

I guess I could put the duplicate parts in a sub-file and do a nested include

gets a little messy but not too bad


Gene
"The older I get, the more I admire competence, just simple competence in any field from adultery to zoology."
Quote Reply
Re: [esm] Enhanced Template Parser In reply to
Well, you could use the following:

Code:

<%if Prefix eq 'Ms'%>
<%if Prefix eq 'Mrs'%>
<%if Prefix eq 'Miss'%>
<%include female.html%>
<%endif%>
<%endif%>
<%endif%>

========================================
Buh Bye!

Cheers,
Me

Last edited by:

Stealth: Sep 7, 2002, 4:25 PM
Quote Reply
Re: [esm] Enhanced Template Parser In reply to
I have plans to re-write the Links2 parser to bring it close to the standard of the links sql parser. I am hoping to speak to Alex regarding this so keep your eyes peeled :)
Quote Reply
Re: [Stealth] Enhanced Template Parser In reply to
Yeah, I thought of that too and may give it a try

Thanks for the ideas...!!!


Gene
"The older I get, the more I admire competence, just simple competence in any field from adultery to zoology."
Quote Reply
Re: [Paul] Enhanced Template Parser In reply to
That's great! I am sure that Links 2.0 users will appreciate that. Hopefully, it'll be a simple matter of replacing the current Templates.pm with whatever parser you come up with.
========================================
Buh Bye!

Cheers,
Me
Quote Reply
Re: [Stealth] Enhanced Template Parser In reply to
Thanks, yeah definitely, should be just a matter of uploading the new file.

There may have to be a change in sub load_template though in db_utils.pl as it calls some subroutines like:

Code:
$db_template->clear_vars;
$db_template->load_template ($tpl, $string) or &cgierr ("Can't load template. Reason: $Template::error");
$db_template->load_vars ($vars) or &cgierr ("Can't load variables. Reason: $Template::error");
return $db_template->parse ($tpl) or &cgierr ("Can't parse template. Reason: $Template::error");

...and I'll probably be removing those.

Last edited by:

Paul: Sep 8, 2002, 2:12 AM