How can you use AND / OR in styles?

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

Moderator: Spunkmeyer

Postby mrpat » Tue Jan 21, 2003 5:13 am

I've done something similar with one of my sites (200+ categories), I just did a seperate if for each category.
<If: Field: Category eq "cat1">
link1
</If>
<If: Field: Category eq "cat2">
link2
</If>

It ends up to be quite a bit of code, but with copy/paste it's not too difficult, just copy the first one and paste it 30 times, then change the names :)
mrpat
 
Posts: 168
Joined: Thu Nov 14, 2002 4:50 am

Postby Gmaniac » Tue Jan 21, 2003 9:31 am

i have use a mix of perl code and <Field's: bla bla> in my styles for another reason maybe the example below helps you to find what you want to do!!



<PerlCode>
if ($CustomField_1 || $CustomField_2 || $CustomField_3) {
$HTMLAdditionalInformation = '<TR><TD><B><I>My Text or <Field: Here></I></B></TD></TR>';
} else {
$HTMLAdditionalInformation = '<TR><TD>&</TD></TR>';
}
</PerlCode>

<Table>
<Field: HTMLAdditionalInformation>
</Table>
Gmaniac (A Greek, Coranto Experienced User)
Gmaniac
 
Posts: 291
Joined: Mon Jan 15, 2007 11:05 am
Location: Hellas - Greece

Postby Gmaniac » Wed Jan 22, 2003 7:48 am

yes..... i am sorry i forgot to specify that!!!! :lol:
that || means OR
Gmaniac (A Greek, Coranto Experienced User)
Gmaniac
 
Posts: 291
Joined: Mon Jan 15, 2007 11:05 am
Location: Hellas - Greece

Postby Gmaniac » Wed Jan 22, 2003 3:10 pm

my perl tutorials said that you can use " && "
Gmaniac (A Greek, Coranto Experienced User)
Gmaniac
 
Posts: 291
Joined: Mon Jan 15, 2007 11:05 am
Location: Hellas - Greece

Postby l0rdphi1 » Wed Jan 22, 2003 6:19 pm

&& and || can be used in place of 'and' and 'or' petty much anywhere except for a few cases (because they're not exactly the same thing)

Although, for what you guys are doing here, you should be fine intermixing them.
User avatar
l0rdphi1
 
Posts: 3590
Joined: Sat Mar 09, 2002 10:03 pm
Location: Pennsylvania, United States of America

Postby Gmaniac » Thu Jan 23, 2003 10:23 am

Error Free Style

after the eq the values must have ' ' single quotes
example: eq 'PC'
and you have use single quotes at the new variables values
the correct is "<MaginotURL: 1>"; not '<MaginotURL: 1>';
and "Blah Blah"; not 'Blah Blah';

after theese changes the style pass the coranto debuger.!
i hope to help you with that.! :roll:

Code: Select all
<PerlCode>
if ($Category eq 'PC' || $Category eq 'DVD') {
$HTMLAdditionalInformation = "<MaginotURL: 1>";
$Image = "Blah Blah";
}
if ($Category eq 'Movie' || $Category eq 'Industry') {
$HTMLAdditionalInformation = "<MaginotURL: 2>";
$Image = "Esta Esta";
}
</PerlCode>

<p><Field: Category> | <Field: HTMLAdditionalInformation><br>
<Field: ImageCarrier></p>
Gmaniac (A Greek, Coranto Experienced User)
Gmaniac
 
Posts: 291
Joined: Mon Jan 15, 2007 11:05 am
Location: Hellas - Greece

Postby Lawrence » Thu Jan 23, 2003 11:04 pm

I dunno if this will help, but it's worth a shot!
Code: Select all
<PerlCode>
my($HTMLAdditionalInformation, $Image);

if ($Category eq 'Movie' || $Category eq 'Industry') {
$HTMLAdditionalInformation = &MaginotURL("temp_news");
$Image = 'Esta Esta';
}
</PerlCode>

<p><Field: Category> | <A HREF="<Field: HTMLAdditionalInformation>">Click</A><br>
<Field: Image></p>
Stuff I'm working on:
- nothing

Addons:
http://sourceforge.net/projects/lw-craddons/
Lawrence
 
Posts: 1524
Joined: Sun Sep 16, 2001 4:24 am

Next

Return to Customization

Who is online

Users browsing this forum: No registered users and 1 guest

cron