A very special conditional (I think)

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

Moderator: Spunkmeyer

A very special conditional (I think)

Postby Esstee » Wed Jun 15, 2005 4:43 pm

How could one setup a conditional like this...

If there is no next but a previous page then display <CustomField_newsSource>
in other words this is how I would determine a last page for a maginot
multipage split.

I think this is how at least.

Similarely I would be looking at if there is no previous but a next page then
add this <no of views script> and hopefull this would be a good way to
determine a first page.

is this the best way?
How would I setup the code to accomplish that?
I went deeper into the belly of Coranto and look! I found maginot.
User avatar
Esstee
 
Posts: 320
Joined: Thu Nov 25, 2004 4:13 pm
Location: Deep in some project

Postby Esstee » Wed Jun 15, 2005 10:09 pm

not being sure that there is such as statement to check if the absense
of a value exists I had another idea while searching the forums.

would it be more feasable to identify the pages using a greater or smaller
than function?

ex:

if the page no value is <= to 1 then ... bblabla (it would have to be page1)

if the page no. value is >= than 2 then and if there is a "previous an next" statement present then ... blablabla else if (this would be last page)


Would this work?
if so could someone help me write it, I am a true n00b when it comes
to programing :(
I went deeper into the belly of Coranto and look! I found maginot.
User avatar
Esstee
 
Posts: 320
Joined: Thu Nov 25, 2004 4:13 pm
Location: Deep in some project

Postby Esstee » Thu Jun 16, 2005 2:59 am

Go ahead laugh! :lol:

Code: Select all
<If: Field: TotalSplitPages == 1>"this is a single page article"</If>

<If: Field: TotalSplitPages == 1>"<If: Else><If: Field: SplitNumber == 1>"this is a multipage article and this is page 1"</If></If>

<If: Field: PrevSplit><If: Field: NextSplit>"this is a multipage article and it has more and less pages"</If></If>

<If: Field: TotalSplitPages == 1><If: Else><If: Field: NextSplit>"<If: Else><If: Field: PrevSplit>"this is the last page"</If></If></If>


but they work
hopfuly someone with experience will look it over and make it more efficient
I went deeper into the belly of Coranto and look! I found maginot.
User avatar
Esstee
 
Posts: 320
Joined: Thu Nov 25, 2004 4:13 pm
Location: Deep in some project

Postby Lumberjack » Thu Jun 16, 2005 2:11 pm

You should only need to put <If: Field: TotalSplitPages == 1> once in the style. I'll get back to you on this... its too complicated for me to think about in style tags, will think about it in perl.
Code: Select all
<PerlCode>
if ($TotalSplitPages == 1) {
   $newshtml .= 'this is a single page article';
} else {
   if ($SplitNumber == 1) {
      $newshtml .= 'this is a multipage article and this is page 1';
   };
   if ($NextSplit) {
      if ($PrevSplit) {
         $newshtml .= 'this is a multipage article and it has more and less pages';
      };
   } else {
      if ($PrevSplit) {
         $newshtml .= 'this is the last page';
      };
   };
};
</PerlCode>

See if you can translate that into style tags :S
Lumberjack
 
Posts: 555
Joined: Wed Jan 10, 2007 7:22 pm
Location: Oxford, UK

Postby LoneOwl » Thu Jun 16, 2005 8:13 pm

Lumberjack wrote:You should only need to put <If: Field: TotalSplitPages == 1> once in the style. I'll get back to you on this... its too complicated for me to think about in style tags, will think about it in perl.
Code: Select all
<PerlCode>
if ($TotalSplitPages == 1) {
   $newshtml .= 'this is a single page article';
} else {
   if ($SplitNumber == 1) {
      $newshtml .= 'this is a multipage article and this is page 1';
   };
   if ($NextSplit) {
      if ($PrevSplit) {
         $newshtml .= 'this is a multipage article and it has more and less pages';
      };
   } else {
      if ($PrevSplit) {
         $newshtml .= 'this is the last page';
      };
   };
};
</PerlCode>

See if you can translate that into style tags :S
It's all basic if statements. Just do it line by line really... Oh, and you don't need a semicolon after a block statement, such as the {} after if and else statements.
User avatar
LoneOwl
 
Posts: 1465
Joined: Sun Mar 10, 2002 2:57 am
Location: That one place, you know?

Postby Lumberjack » Thu Jun 16, 2005 9:09 pm

Oh you don't? I wondered about that, thanks for the tip.
Lumberjack
 
Posts: 555
Joined: Wed Jan 10, 2007 7:22 pm
Location: Oxford, UK

Postby Lumberjack » Fri Jun 17, 2005 2:56 am

Code: Select all
<If: Field: TotalSplitPages == 1>this is a single page article
<If: Else>
   <If: Field: SplitNumber == 1>this is a multipage article and this is page 1</If>
   <If: Field: PrevSplit>
      <If: Field: NextSplit>this is a multipage article and it has more and less pages
      <If: Else>this is the last page
      </If>
   </If>
</If>

Correct? Looks about right, translated from the perl... more or less what you had Esstee but without half the </If>s.
Lumberjack
 
Posts: 555
Joined: Wed Jan 10, 2007 7:22 pm
Location: Oxford, UK

Postby Esstee » Fri Jun 17, 2005 8:32 am

Wow thats some nasty code shrinkage LJ :D

I take it the entire style falls between those If statements right?
I will try it this afternoon and see how it works out.

thanks a bunch guys! 8)
Last edited by Esstee on Fri Jun 17, 2005 1:37 pm, edited 1 time in total.
I went deeper into the belly of Coranto and look! I found maginot.
User avatar
Esstee
 
Posts: 320
Joined: Thu Nov 25, 2004 4:13 pm
Location: Deep in some project

Postby Lumberjack » Fri Jun 17, 2005 1:37 pm

I'm not sure if it will work exactly, I was not exactly with it when I made the swap to the style code... oh btw its LJ but don't worry bout it ;).
Lumberjack
 
Posts: 555
Joined: Wed Jan 10, 2007 7:22 pm
Location: Oxford, UK


Return to Customization

Who is online

Users browsing this forum: No registered users and 2 guests

cron