close ad
Help us test the new Databridge BETA with MySQLi support
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

show if in its own loop

Thread began 12/08/2017 2:21 pm by Jamie | Last modified 12/11/2017 3:34 pm by Ray Borduin | 115 views | 10 replies |

Jamie

show if in its own loop

Hey Ray

in the below code (which is an image slideshow) I am trying to get an icon to show based on the following

<?php if ("".($SponsorsCore->getColumnVal("SponsorPlus"))  ."" != "1") { ?><span class="glyph plus"><i class="coffeecup-icons-plus2"></i></span><?php } ?>

however I am not able to include this within the existing loop (it breaks the slideshow) so need it to be separate but still linked to the image that is showing at any given moment in the slideshow
Cheers

Jamie

<a href="sponsors.php" class="link-container sponsorContainer">
<div class="container sponsorWrapper">

<span class="glyph plus"><i class="coffeecup-icons-plus2"></i></span>

<div class="responsive-picture sponsorImage core">
<?php
while(!$SponsorsCore->atEnd()) {
?>
<?php
if(TRUE){ // Begin Cached Resized Image: ImageCacheInstance_1509263731297
ob_start();
?>
<img alt="<?php echo($SponsorsCore->getColumnVal("SponsorName")); ?>" src="images/<?php if ("".($SponsorsCore->getColumnVal("SponsorLogo")) ."" != "noimage") { ?>sponsors/<?php echo($SponsorsCore->getColumnVal("SponsorLogo")); ?><?php } else { ?>cms_icons/no-image.jpg<?php } ?>" width="200" height="75">
<?php
echo(getCachedResizedImageHTML(ob_get_clean(), "../../images/image_cache", "fit", "#FFFFFF", true));
} // End Cached Resized Image: ImageCacheInstance_1509263731297
?>
<?php
$SponsorsCore->moveNext();
}
$SponsorsCore->moveFirst(); //return RS to first record
?>
</div>
</div>
<span class="text-element sponsorType bronze">core Sponsor</span></a>
Sign in to reply to this post

Ray BorduinWebAssist

The first step would be to figure out how to include it in the slideshow for all of the images. Then you can work on the conditional portion.

I'm not sure why it would break your slideshow. What code are you using to do the slideshow? Most likely the solution is going to be to update that so that it supports adding what you need.

Sign in to reply to this post

Jamie

its one we worked on a few weeks ago

The sponsors 'pyramid' on this page is a slide show http://clients.motley.site/iteac/. The only one that should be animated is 'core' (its the only one with multiple images) and as you can see inside the loop the slideshow just stops.

Sign in to reply to this post

Ray BorduinWebAssist

The solution is probably to wrap the image and the added span in a div and give it a class to identify it as the rotated content. Then update the image rotation script to rotate based on the class instead of img tags.

Sign in to reply to this post

Jamie

like this?

<div class="responsive-picture sponsorImage core">
<div class="rotatingContent">
<?php
while(!$SponsorsCore->atEnd()) {
?>
<?php if ("".($SponsorsCore->getColumnVal("SponsorsPlus")) ."" != "1") { ?>
<span class="glyph plus"><i class="coffeecup-icons-plus2"></i></span>
<?php } ?>
<?php
if(TRUE){ // Begin Cached Resized Image: ImageCacheInstance_1509263731297
ob_start();
?>
<img alt="<?php echo($SponsorsCore->getColumnVal("SponsorName")); ?>" src="images/<?php if ("".($SponsorsCore->getColumnVal("SponsorLogo")) ."" != "noimage") { ?>sponsors/<?php echo($SponsorsCore->getColumnVal("SponsorLogo")); ?><?php } else { ?>cms_icons/no-image.jpg<?php } ?>" width="200" height="75">
<?php
echo(getCachedResizedImageHTML(ob_get_clean(), "../../images/image_cache", "fit", "#FFFFFF", true));
} // End Cached Resized Image: ImageCacheInstance_1509263731297
?>
<?php
$SponsorsCore->moveNext();
}
$SponsorsCore->moveFirst(); //return RS to first record
?>
</div>
</div>



and the updated js from this

$(function(){
if ($(".core img").length <= 1) return;
$('.core img:gt(0)').hide();
setInterval(function() {hideNext("core")}, 2000);
});



to this

$(function(){
if ($(".core .rotatingContent").length <= 1) return;
$('.core .rotatingContent:gt(0)').hide();
setInterval(function() {hideNext("core")}, 2000);
});


?

Cheers

Jamie

Sign in to reply to this post

Ray BorduinWebAssist

I think you would have to put the:

<div class="rotatingContent">


inside of the while loop.

Sign in to reply to this post

Jamie

ah gotcha... done that but still not working

Sign in to reply to this post

Ray BorduinWebAssist

Did you also move the </div> into the loop?

Sign in to reply to this post

Jamie

sure did....it looks like this now:

<!--- core start ---> 
<a href="sponsors.php" class="link-container sponsorContainer">
<div class="container sponsorWrapper">
<div class="responsive-picture sponsorImage core">
<?php
while(!$SponsorsCore->atEnd()) {
?>
<div class="rotatingContent">
<?php if ("".($SponsorsCore->getColumnVal("SponsorsPlus")) ."" != "1") { ?>
<span class="glyph plus"><i class="coffeecup-icons-plus2" title="Core Plus"></i></span>
<?php } ?>
<?php
if(TRUE){ // Begin Cached Resized Image: ImageCacheInstance_1509263731297
ob_start();
?>
<img alt="<?php echo($SponsorsCore->getColumnVal("SponsorName")); ?>" src="images/<?php if ("".($SponsorsCore->getColumnVal("SponsorLogo")) ."" != "noimage") { ?>sponsors/<?php echo($SponsorsCore->getColumnVal("SponsorLogo")); ?><?php } else { ?>cms_icons/no-image.jpg<?php } ?>" width="200" height="75">
<?php
echo(getCachedResizedImageHTML(ob_get_clean(), "../../images/image_cache", "fit", "#FFFFFF", true));
} // End Cached Resized Image: ImageCacheInstance_1509263731297
?>
</div>
<?php
$SponsorsCore->moveNext();
}
$SponsorsCore->moveFirst(); //return RS to first record
?>
</div>
</div>
<span class="text-element sponsorType bronze">core Sponsor</span></a>
<!--- core end --->
Sign in to reply to this post

Ray BorduinWebAssist

You had to update your hideNext() and showNext() functions as well. I've done that and it seems to be working now.

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...