close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

show if

Thread began 1/24/2014 6:44 pm by Jamie | Last modified 1/27/2014 6:39 pm by Jason Byrnes | 522 views | 13 replies |

Jamie

show if

hey Jason

I was wondering how one would go about using a show if based on 2 conditions (or if its even possible)

Basically, want this image

<img src="images/sponsors/<?php echo $row_PlatinumFooter['SponsorLogo']; ?>"  width="190" height="150" style="margin:46px 0 0 9px;">

to show based on these 2 conditions

if SponsorLive = 1 and SponsorCategoryID = 2

I can obviously use the show if in WA but that only gives me the one condition ... how would I modify it to include 2 and if that isnt the way to achieve it, what should I be doing?

Many thanks

Sign in to reply to this post

Jason ByrnesWebAssist

you'll need to hand code the if statement for this:

<?php if($row_PlatinumFooter['SponsorLive'] == "1" && $row_PlatinumFooter['SponsorCategoryID'] == "2") { ?>
<img src="images/sponsors/<?php echo $row_PlatinumFooter['SponsorLogo']; ?>" width="190" height="150" style="margin:46px 0 0 9px;">
<?php } ?>
Sign in to reply to this post

Jamie

Thanks Jason.

What I was looking to use that for was to be able to use one recordset and use the show if's to show the content for each relevant <div>

The below is onlyi returning the first <div>'s content but not the 2nd <div>

<div>
<?php do { ?>
<?php if($row_Sponsors['SponsorLive'] == "1" && $row_Sponsors['SponsorCategoryID'] == "1") { ?>
<div style="float:left; margin: 10px 0 10px 10px; background-color: #e9e9e9; border: 1px solid #ccc; padding: 5px;"> <a href="sponsor-detail.php?id=<?php echo $row_Sponsors['SponsorID']; ?>"><img src="images/sponsors/<?php echo $row_Sponsors['SponsorLogo']; ?>" width="260" height="137" border="0" /></a> </div>
<?php } ?>
<?php } while ($row_Sponsors = mysql_fetch_assoc($Sponsors)); ?>
<div style="clear:left; width: 630px; height: 20px;"></div>
</div>
<div style="clear:left; margin: 20px 0;">
<?php do { ?>
<?php if($row_Sponsors['SponsorLive'] == "1" && $row_Sponsors['SponsorCategoryID'] == "2") { ?>
<div style="float:left; margin: 10px 0 10px 10px; background-color: #e9e9e9; border: 1px solid #ccc; padding: 5px;"> <a href="sponsor-detail.php?id=<?php echo $row_Sponsors['SponsorID']; ?>"><img src="images/sponsors/<?php echo $row_Sponsors['SponsorLogo']; ?>" width="190" height="100" border="0" /></a> </div>
<?php } ?>
<?php } while ($row_Sponsors = mysql_fetch_assoc($Sponsors)); ?>
</div>
Sign in to reply to this post

Jason ByrnesWebAssist

Remember when we talked last week and i showed you the Reset to first record behavior? you need to use that before the second div to reset the recordset.

you have a repeat region around the first recordset, and another around the second.

the second doesn't work, because the recordset is at the end, it needs to be ret to the first record using the behavior i showed you last week.

open the server behaviors panel, and click the plus button and select webAssist -> Dynamic Web Charts -> Reset Recordset.

Sign in to reply to this post

Jamie

I thought it might have something to do with that! Thanks a million :D

Sign in to reply to this post

Jason ByrnesWebAssist

you're welcome.

Sign in to reply to this post

Jamie

Why would this not work Jason?

<?php if($row_SponsorsFooter['SponsorLive'] == "1" && $row_SponsorsFooter['SponsorCategoryID'] == "3" && $row_Sponsors['SponsorCategoryID'] == "4") { ?>
Sign in to reply to this post

Jason ByrnesWebAssist

Jamie, need more details.

whenever you report a problem, the following information is needed:

What are the steps to reproduce the problem?

what is supposed to happen?

what is happening?

"it's not working" doesn't provide those details.

in this case, i would also need to also know what the values of these bindings is:

<?php echo $row_SponsorsFooter['SponsorLive']; ?>
<?php echo $row_SponsorsFooter['SponsorCategoryID']; ?>
<?php echo $row_Sponsors['SponsorCategoryID']; ?>

Sign in to reply to this post

Jamie

OK sorry.. just thought it may be a quick fix.

So, this is part of a slideshow and there are 4 separate slideshows, one for platinum, one for gold, one for silver and one for bronze.

the plat, gold and bronze work fine and as expected( ie add images to the relevant slideshow based on if its live and a 'member' of the appropriate category (SponsorCategoryID)

The silver slideshow is slightly different in that the client has 2 sliver types. Silver Plus (SponsorCategoryID = 3) and Silver (SponsorCategoryID = 4) and therefore the silver slideshow needs to show images from both of those.

So to achieve that, I *thought* that this could be achieved by doing it this way;

<?php if($row_SponsorsFooter['SponsorLive'] == "1" && $row_SponsorsFooter['SponsorCategoryID'] == "3" && $row_SponsorsSponsorsFooter['SponsorCategoryID'] == "4") { ?>



The silver slideshow just doesnt display any of the images and you can see whats happening by going here http://clients.motley.co.uk/ITEAC/ and scrolling to the bottom of the page where you will see 4 hexagons ... the 2nd from right is the silver and silver plus and as you will see is blank

Sign in to reply to this post

Jason ByrnesWebAssist

just before the if statement, echo the values:

<?php echo $row_SponsorsFooter['SponsorLive'] ."|". $row_SponsorsFooter['SponsorCategoryID'] ."|". $row_SponsorsSponsorsFooter['SponsorCategoryID']; ?>

what does that return?

my bet is that it wont return the values you expect, not that you are using 2 different recordsets, this probably wont give the desired results unless the SponsorsSponsorsFooter is nested in the first one.



http://www.webassist.com/tutorials/Display-nested-recordsets

Sign in to reply to this post
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...