0

Iam Coding A Small Portal And Need Help

This Is My Code

echo "<div class='posterdecoration'><img src='$row[scr1]' width='640' alt='$row[name]' /></div>";
echo "<div class='posterdecoration'><img src='$row[scr2]' width='640' alt='$row[name]' /></div>";

When I Put Scr1 + Scr2 From Site Panel

It Show On The Site

I Need To Use <If Condition>

On The Scr2

So If I Didnt Put The Field Scr2 It Dont Appear

I Used To Made It In vBulletin Forum

<If Condition="#post[field10]"> Something </if>

But Here In My Code I Dont Know How To Do It

All I Need To Do Is If The $row2 Is Empty Dont Show It In The Page

3
Contributors
4
Replies
5
Views
6 Years
Discussion Span
Last Post by -==Zero==-
1

Try this:

echo "<div class='posterdecoration'><img src='$row[scr1]' width='640' alt='$row[name]' /></div>";
echo (isset($row['scr2'])) ? "<div class='posterdecoration'><img src='$row[scr2]' width='640' alt='$row[name]' /></div>" : NULL;

bye :)

Edited by cereal: n/a

Votes + Comments
Thanks For Reply Plz Continue With Me
0

First Thanks Sir For Reply

After Edit

When I Add Only Scr1

And Leave Scr2 Empty

The Field Appear But With No Image Inside It

I Need The Whole Class Not Appear If $Row2 It Empty

I Mean I Dont Want This To Appear

<div class='posterdecoration'>
2

Try this

if($row[scr1]!="")
{
echo "<div class='posterdecoration'><img src='$row[scr1]' width='640' alt='$row[name]' /></div>";
}
if($row[scr2]!="")
{
    echo "<div class='posterdecoration'><img src='$row[scr2]' width='640' alt='$row[name]' /></div>";
}

Edited by karthik_ppts: n/a

Votes + Comments
You Are Amazing Thanks So Much
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.