TeamPhotoshop
Reviews, updates and in depth guides to your favourite mobile games - AppGamer.com
Forum Home Latest Posts Search Help Subscribe

Another Question - If/Else....i think?

Page: 1 2 Reply
Nov 26th 2001#21595 Report
Member since: Mar 18th 2001
Posts: 1452
Ok, i'm making a blog for someone, and I've run into a minor nuisance. It's nothing big, but it would look better if I could change it.

I know just a little about if/else, and what I've tried hasn't worked. I'm displaying everything like most blogs, and ordering in a DESC limit of 5. So it would look like:

Posted by <name> on Date at Time

text text text text text

<hr>

Posted by <name> on Date at Time

text text text text text

<hr>

etc.

Then I have Prev 1 2, etc Next links below the bottom of the 5. I don't want the last <hr> tag to show up, but want to leave the others. 5 blogs per page, 4 <hr> tags.

Code I'm using:[code]echo "<center><table width=100%><tr><td valign=top><font face=arial size=2><br>";
echo "Posted by: <a href=mailto:$email>$name</a> on $today | $time CST<br><br>
<p align=justify>$text</p><hr width=500>";
echo "</td></tr></table></center>";[/code]

So I'm guessing it would something the effect of:

if such and such = blah
Show code with <hr> tag
else
Show code without <hr> tag
endif

But I dont know :(

If I didnt make any sense, let me simplify it: :D
http://visualintensity.com/blogex.gif
Reply with Quote Reply
Nov 26th 2001#21599 Report
Member since: Mar 24th 2001
Posts: 3734
Sounds like you are going to have to put things within an object, then specify on if whether or not that object exists, then set a variable to it.

if x = n, then t = hr
else t = "blank"

God it's been a long time since I've dealt with this if/then/else programming crap...
Reply with Quote Reply
Nov 26th 2001#21603 Report
Member since: Mar 20th 2001
Posts: 3367
[PHP]

if($no >= $max) {
echo"

";
echo "Posted by: $name on $today | $time CST


$text

";
echo "
";
}
else {
echo "

";
echo "Posted by: $name on $today | $time CST


$text


";
echo "
";
}

[/PHP]

tested, it should work... don't know if this is what you want :p
Reply with Quote Reply
Nov 26th 2001#21604 Report
Member since: Mar 18th 2001
Posts: 1452
I'll try it shortly and see if thats what I need. I'll let you know.
Reply with Quote Reply
Nov 26th 2001#21606 Report
Member since: Mar 20th 2001
Posts: 3367
sure, no problem
Reply with Quote Reply
Nov 26th 2001#21607 Report
Member since: Mar 18th 2001
Posts: 1452
I get a parse error. :\
Reply with Quote Reply
Nov 26th 2001#21608 Report
Member since: Mar 20th 2001
Posts: 3367
u sure?? cause it works perfectly fine for me.. the variables, have u changed it??

i tested it by setting $max to 5 and $no to 4 .. it printed the hr tag...
changed the $no to 5 and the hr tag is gone..
Reply with Quote Reply
Nov 26th 2001#21609 Report
Member since: Mar 18th 2001
Posts: 1452
Oh, i just copied and pasted exactly what was above.

So just somewhere, I need to set those variables?
Reply with Quote Reply
Nov 26th 2001#21610 Report
Member since: Mar 18th 2001
Posts: 1452
It's still not removing it (for me anyway). Ah well, she just got on and says it doesn't bother her, so I guess it's no biggie.

I got to thinking about it anyway, and on the oldest page, there might not be a whole 5 posts, so it would still show there. :p

Anyway, thanks for helping me anyway. But it's her site, and if she doesnt mind, I guess I wont either.
Reply with Quote Reply
Nov 26th 2001#21612 Report
Member since: Mar 20th 2001
Posts: 3367
no problem... anyways if it bothers u,

set $max somewhere in the script for the maximum number of posts before you remove the hr tag

the $no gets its value from the post number on that page

hope this helps

or maybe you'd like to pass me the script?? [email]zed@side-fx.net[/email]
Reply with Quote Reply
Page: 1 2 Back to top
Please login or register above to post in this forum