Problem with If and customfields

Discuss news styles, css code, and other Coranto customizations in here...the possibilities are endless, so have at it!

Moderator: Spunkmeyer

Problem with If and customfields

Postby Masterplumber » Mon Feb 12, 2007 11:35 am

I am going mad. I have set up a custom field as a drop-down list and want to check the value of that field so that I can display some relevant content. Here's what i have

<If: Field: CustomField_Review eq "Film" >
Link to Amazon music or film in here
<If: Else >
no link
</If >

The output I get is

Link to amazon music or film in here no link

i.e. seems to be processing both statements. I've looked at this all ways and can't see what I'm doing wrong.
Masterplumber
 
Posts: 14
Joined: Mon Feb 12, 2007 11:28 am

Postby SrNupsen » Mon Feb 12, 2007 11:45 am

Try stripping out the spaces from all of your tags, e.g. </If> and not </If >:

Code: Select all
<If: Field: CustomField_Review eq "Film">
Link to Amazon music or film in here
<If: Else>
no link
</If>
-----------------------------------------------------------------------------------------------------
Coranto is free software. I am available for custom work or troubleshooting.

http://www.sundaune.no - transkripsjon, webdesign, nettsider, tekstbyrå
http://www.vagbladet.no - satire, politikk, kultur, sport, nettavis
-----------------------------------------------------------------------------------------------------
SrNupsen
 
Posts: 2229
Joined: Tue Jan 09, 2007 6:46 pm
Location: Nesodden, outside Oslo, Norway

Postby Masterplumber » Mon Feb 12, 2007 2:35 pm

Tried that already. If I do I get this message

Error: That style is invalid and has a syntax error. Check, in particular, that all ifs are properly matched and ended. Perl reported the following error, which may or may not be helpful: syntax error at (eval 20) line 15, near "} else" (Might be a runaway multi-line ~~ string starting on line 2)

If I put the spaces in it saves ok - albeit the result is not what I am expecting.

If it helps the full style listing I want (with spaces removed as you suggest) is

<tr>
<td>
<h2><Field: Subject></h2>
<h6><Field: CustomField_author></h6>
<p><Field: Text><p>
<p>&nbsp;</p>
<p>Our rating: <Field: CustomField_rating></p>
<p class="tinytxt">by <a href="mailto:<Field: UserField_Email>"><Field: UserField_DisplayName></a> on <Field: Date></p>
<p>Find more <a href="blah"><Field: CustomField_Review></a> reviews</p>
</td>
<If: Field: CustomField_Review EQ "Film">
Link to Amazon music or film in here
<If: Else>
no link
</If>
</tr>
Masterplumber
 
Posts: 14
Joined: Mon Feb 12, 2007 11:28 am

Postby SrNupsen » Mon Feb 12, 2007 2:49 pm

Hm. Which version of Coranto are you running? There was a problem with If/Else - parsing in some old versions (read here for more info), but if you upgrade to 1.24B you should be OK.

There is a fix in the thread I linked to aswell, if you only want a quick'n'dirty hack. I would recommend the upgrade though.
-----------------------------------------------------------------------------------------------------
Coranto is free software. I am available for custom work or troubleshooting.

http://www.sundaune.no - transkripsjon, webdesign, nettsider, tekstbyrå
http://www.vagbladet.no - satire, politikk, kultur, sport, nettavis
-----------------------------------------------------------------------------------------------------
SrNupsen
 
Posts: 2229
Joined: Tue Jan 09, 2007 6:46 pm
Location: Nesodden, outside Oslo, Norway

Postby Masterplumber » Mon Feb 12, 2007 3:01 pm

I'm on 1.23

I'll upgrade to 1.24 tonight when I get back home and see if that fixes the problem.
Masterplumber
 
Posts: 14
Joined: Mon Feb 12, 2007 11:28 am

Postby SrNupsen » Mon Feb 12, 2007 3:08 pm

OK, if you're on 1.23 then most likely it will. Please report back if this fixed your problem.
-----------------------------------------------------------------------------------------------------
Coranto is free software. I am available for custom work or troubleshooting.

http://www.sundaune.no - transkripsjon, webdesign, nettsider, tekstbyrå
http://www.vagbladet.no - satire, politikk, kultur, sport, nettavis
-----------------------------------------------------------------------------------------------------
SrNupsen
 
Posts: 2229
Joined: Tue Jan 09, 2007 6:46 pm
Location: Nesodden, outside Oslo, Norway

Postby Masterplumber » Mon Feb 12, 2007 10:06 pm

OK. Reinstalled everything from scratch. Now running v1.24

Took all trailing spaces out of the relevant tags and now seems to be working ok.

btw, whatever happened to that really nice facility that showed you what files you neede dto change if you were upgrading between versions? That was extremely helpful.

Thanks again for your assistance on this one.
Masterplumber
 
Posts: 14
Joined: Mon Feb 12, 2007 11:28 am

Postby SrNupsen » Mon Feb 12, 2007 10:31 pm

Masterplumber wrote:whatever happened to that really nice facility that showed you what files you neede dto change if you were upgrading between versions? That was extremely helpful.

Thanks again for your assistance on this one.


No prob. And thanks for reminding me about the upgrade script. It's still archived somewhere, and should be easy to set up. Will add to my todo-list!
-----------------------------------------------------------------------------------------------------
Coranto is free software. I am available for custom work or troubleshooting.

http://www.sundaune.no - transkripsjon, webdesign, nettsider, tekstbyrå
http://www.vagbladet.no - satire, politikk, kultur, sport, nettavis
-----------------------------------------------------------------------------------------------------
SrNupsen
 
Posts: 2229
Joined: Tue Jan 09, 2007 6:46 pm
Location: Nesodden, outside Oslo, Norway


Return to Customization

Who is online

Users browsing this forum: No registered users and 1 guest

cron