Jump to content


if greater then..


  • You cannot reply to this topic
3 replies to this topic

#1 noobalyzed

    Etomite Forum Newbie

  • Member
  • 30 posts

Posted 16 December 2004 - 08:56 AM

hey all, im using a snippet that will get an image thats named like the page id, so when the page id = 4 , 4.jpg will be included at the top. that works perfect, but i want it like this : if page_id is greater then 50, it should include 1.jpg , i tried this but it doesnt seem to work.. can some1 plz help me ?

$nr = "50";
if($page_id > $nr){$page_id= "1";}else{
$page_id = $etomite->documentObject['id']; 
$output = "<img border=0 src=images/$page_id.jpg>";}
return $output;

thanx,

#2 syn

    Etomite Forum Fan

  • Member
  • Pip
  • 66 posts

Posted 16 December 2004 - 10:06 AM

Hmm try either of these and see how it works for you.

[1]
$nr = "50";
$high = "1";
$page_id = $etomite->documentObject['id'];
if($page_id > $nr){$output = "<img border=0 src=images/$high.jpg>";}else{
$output = "<img border=0 src=images/$page_id.jpg>";}
return $output;

[2]
$nr = "50";
$page_id = $etomite->documentObject['id'];
if($page_id > $nr){$img= "1";$output = "<img border=0 src=images/$img.jpg>";}else{
$output = "<img border=0 src=images/$page_id.jpg>";}
return $output;

One main this is that you needed to provide just what page_id was, so I moved the line
$page_id = $etomite->documentObject['id'];
above the first call of page_id.

Let me know if either of these works for you.
syn

#3 noobalyzed

    Etomite Forum Newbie

  • Member
  • 30 posts

Posted 16 December 2004 - 10:12 AM

great! the first 1 works, thank you evry much :) i owe u :D

#4 luislacerda

    Etomite Forum Fan

  • Member
  • Pip
  • 87 posts

Posted 16 December 2004 - 03:58 PM

noobalyzed, on Dec 16 2004, 11:12 AM, said:

great! the first 1 works, thank you evry much :) i owe u :D

noobalyzed, Can you share your code? It would be nice!
Luis





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users