Slideshow not working

17 posts by 3 authors in: Forums > CMS Builder
Last Post: June 5, 2012   (RSS)

By NigelGordijk - May 31, 2012 - edited: May 31, 2012

Hi, there.

I'm trying to use this slideshow code from Dynamic Drive with CMSB, but I can't get the images to load: http://www.dynamicdrive.com/dynamicindex14/fadeinslideshow.htm. Here's the test page: http://www.cityofowensville.com/home3.php. It works when I do a handcoded version - i.e. without using CMSB - but as soon as I try loading the images with the cms, I get nothing.

My version of the code looks like this:

<script type="text/javascript" src="fadeslideshow.js"></script>

<!-- STEP1: Load Record (Paste this above other step) -->
<?php
require_once "cmsAdmin/lib/viewer_functions.php";
$options = array(); // NOTE: see online documentation for more details on these options
$options['tableName'] = 'homepage_slideshow'; // (REQUIRED) MySQL tablename to list record from. Example: "article";
$options['recordNum'] = ''; // (optional) Record number to display. Example: "1"; Defaults to number on end of url, then 1
$options['where'] = ''; // (ADVANCED) MySQL WHERE conditions to use INSTEAD of recordNum to look up record. Example: "fieldname = 'value'"
$record = getRecord($options);
?>
<!-- /STEP1: Load Record -->

<!-- STEP2: Display Record (Paste this where you want your record displayed and re-arrange fields) -->
<?php if ($record): ?>
<?php endif ?>

<?php if (empty($record)): ?>
<?php endif ?>
<!-- STEP2: /Display Record -->


<script type="text/javascript">

var mygallery=new fadeSlideShow({
wrapperid: "fadeshow2", //ID of blank DIV on page to house Slideshow
dimensions: [990, 422], //width/height of gallery in pixels. Should reflect dimensions of largest image
imagearray: [
<?php $firstImage = true ?>
<?php if ($record): ?>
<?php foreach (getUploads($options['tableName'], 'slides', $record['num']) as $upload): ?>
<?php if ($upload['hasThumbnail']): ?>

<?php if (!$firstImage): ?>
,
<?php endif ?>
<?php $firstImage = false ?>

[
<?php echo json_encode($upload['thumbUrlPath']) ?>,
"",
"",
"<a href='" + <?php echo json_encode($upload['info2']) ?> + "' class='aWhite'>"
+ <?php echo json_encode($upload['info1']) ?> + "</a>"
]

<?php endif ?>
<?php endforeach ?>
<?php endif ?>
],
displaymode: {type:'auto', pause:3000, cycles:0, wraparound:false},
persist: true, //remember last viewed slide and recall within same session?
fadeduration: 500, //transition duration (milliseconds)
descreveal: "always",
togglerid: "fadeshow2toggler"
})

</script>

I've attached the file for this page.

Any suggestions, please?
Nigel Gordijk

Common Sense Design: User-focused Web design
Tel: 001 519 342 5348 | Web: www.commonsensedesign.net
Attachments:

home3.php 16K

Re: [NigelGordijk] Slideshow not working

By Damon - May 31, 2012

Hi Nigel,

I looked at the source code of this page,
http://www.cityofowensville.com/home3.php.

The doctype and html tag are missing from the top. This doesn't effect the image but it should be there.

Also the imagearray on line 78 is empty so there is no image data to display.

Can you try using the standard publish code for upload and see how that works?

I think the issue is with this code and I'm not sure why it is needed:

<?php $firstImage = true ?>
<?php if ($record): ?>
<?php foreach (getUploads($options['tableName'], 'slides', $record['num']) as $upload): ?>
<?php if ($upload['hasThumbnail']): ?>

<?php if (!$firstImage): ?>
,
<?php endif ?>
<?php $firstImage = false ?>


Also, can you include a link to your hardcoded page that is working to compare source?

Thanks!
Cheers,
Damon Edis - interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Damon] Slideshow not working

Hi, Damon.

Here we go (attached).

home2.php is the hard coded version; home3.php is the CMSB version.

http://www.cityofowensville.com/home2.php
http://www.cityofowensville.com/home3.php

Thanks,
Nigel Gordijk

Common Sense Design: User-focused Web design
Tel: 001 519 342 5348 | Web: www.commonsensedesign.net
Attachments:

home2.php 15K

home3_001.php 16K

Re: [NigelGordijk] Slideshow not working

By Damon - May 31, 2012

Hi Nigel,

Can you you try replacing the PHP code inside the imagearray with this:

imagearray: [
<?php foreach ($$homepage_slideshowRecords['slides'] as $index => $upload): ?>
["<?php echo $upload['urlPath'] ?>", "", "", ""],
<?php endforeach ?>

],


This should work. Check it out and let me know.
Cheers,
Damon Edis - interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Damon] Slideshow not working

By NigelGordijk - June 1, 2012 - edited: June 1, 2012

Hi, Damon.

Do you mean replace this:

imagearray: [
<?php $firstImage = true ?>
<?php if ($record): ?>
<?php foreach (getUploads($options['tableName'], 'slides', $record['num']) as $upload): ?>
<?php if ($upload['hasThumbnail']): ?>

<?php if (!$firstImage): ?>
,
<?php endif ?>
<?php $firstImage = false ?>

[
<?php echo json_encode($upload['thumbUrlPath']) ?>,
"",
"",
"<a href='" + <?php echo json_encode($upload['info2']) ?> + "' class='aWhite'>"
+ <?php echo json_encode($upload['info1']) ?> + "</a>"
]

<?php endif ?>
<?php endforeach ?>
<?php endif ?>
],


with this:

imagearray: [
<?php foreach ($homepage_slideshowRecords['slides'] as $index => $upload): ?>
["<?php echo $upload['urlPath'] ?>", "", "", ""],
<?php endforeach ?>

],


Cheer,
Nigel Gordijk

Common Sense Design: User-focused Web design
Tel: 001 519 342 5348 | Web: www.commonsensedesign.net

Re: [NigelGordijk] Slideshow not working

By Damon - June 1, 2012

Hi Nigel,

Yes, replace your code with mine and it should work fine.

I edited the above post as I had made a typo and had two dollar signs in the code but I have fixed that now.

Try out mine code and let me know if that works.

Thanks!
Cheers,
Damon Edis - interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [NigelGordijk] Slideshow not working

By Damon - June 1, 2012

Hi Nigel,

I checked you attached code and you need to change this:

$$homepage_slideshowRecords

to this

$homepage_slideshowRecords

That was from a typo I made in my code example but now I fixed my example.

Make that change and let me know. :)
Cheers,
Damon Edis - interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Damon] Slideshow not working

Sorry!

http://www.cityofowensville.com/home3.php
Nigel Gordijk

Common Sense Design: User-focused Web design
Tel: 001 519 342 5348 | Web: www.commonsensedesign.net
Attachments:

home3_003.php 16K

Re: [NigelGordijk] Slideshow not working

By Damon - June 1, 2012

Is the name of the image field called "slides"?

If it is something different change it in this code:
<?php foreach ($homepage_slideshowRecords['slides'] as $index => $upload): ?>
["<?php echo $upload['urlPath'] ?>", "", "", ""],
<?php endforeach ?>


I can take a closer look if you can send in a Support Request with the site details:
https://www.interactivetools.com/support/email_support_form.php?priority=free&message=Forum post: http://www.interactivetools.com/iforum/P93585

Don't post any site details in the forum.

Thanks!
Cheers,
Damon Edis - interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/