Page 1 of 1

A very special conditional (I think)

PostPosted: Wed Jun 15, 2005 4:43 pm
by Esstee
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?

PostPosted: Wed Jun 15, 2005 10:09 pm
by Esstee
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 :(

PostPosted: Thu Jun 16, 2005 2:59 am
by Esstee
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

PostPosted: Thu Jun 16, 2005 2:11 pm
by Lumberjack
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

PostPosted: Thu Jun 16, 2005 8:13 pm
by LoneOwl
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.

PostPosted: Thu Jun 16, 2005 9:09 pm
by Lumberjack
Oh you don't? I wondered about that, thanks for the tip.

PostPosted: Fri Jun 17, 2005 2:56 am
by Lumberjack
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.

PostPosted: Fri Jun 17, 2005 8:32 am
by Esstee
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)

PostPosted: Fri Jun 17, 2005 1:37 pm
by Lumberjack
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 ;).