Help with auto_play

66 views
Skip to first unread message

Jim

unread,
Mar 14, 2011, 2:49:02 PM3/14/11
to PHPSlideShow by zinkwazi.com
I am trying to get my slideshow to open in auto_play mode and be able
to start and stop the show.

Here's what I have done:

Renamed slideshow.php to index.php to have it as the default page
on my website.
Set a variable, path_to_images = ssslideshow in the config section.
path_to_images= "sspictures"; works.
The slideshow opened and found my pictures in sspictures.

Following Greg Lawler's instructions in the readme file, I appended
$auto = 1 to path_to_images.

path_to_images = "sspictures&auto=1"; fails. Raises the following
error:
path_to_images = "pictures" . "&auto=1" fails and raises the same
error.

Warning: opendir(sspictures&auto=1) [function.opendir]: failed to
open dir: No such file or
directory in /home/content/31/6543031/html/zbt_test/index.php on line
212
Warning: readdir(): supplied argument is not a valid Directory
resource in /home/content/31/6543031/html/zbt_test/index.php on line
215

Then I set the auto_play variable in the config section.
$auto = 1;

I commented out these two lines in the code:

// grab the variables we want set for newer php version compatability
// Modified by JLH 1/26/2011. Set the variables in config section.
// kept $currentPic because needed the "?".
//$path_to_images = isset($_GET['directory']) ?
strip_tags($_GET['directory']) : '';
$currentPic = isset($_GET['currentPic']) ?
strip_tags($_GET['currentPic']) : '';
//$auto = isset($_GET['auto']) ? strip_tags($_GET['auto']) : '';

With these changes, the slideshow would start in auto play mode, but
when I click on "stop
slideshow", the program will pause and then resume in auto play mode.
It looks like the code loops
and picks up the $auto=auto=1 setting again. Can't figure out how this
happens.

Then I saw your recommendations on setting auto play in this group,
BrandonRandon, and added the if then statement:
if (isset($_GET['auto'])){
$auto = strip_tags($_GET['auto']);
}
else {
$auto = 1;
}

Updated these links. Are these the correct ones, and is my code
correct?
a.$nav = "<a href='$path?directory=
$path_to_images&auto=0&currentPic=$nav'>$back_src</a>";
b.$next_link = "<a href='$path?directory=
$path_to_images&auto=0&currentPic=$next'>$next_src</a>";
I don't think these lines affect my code since I'm not using the next
and back buttons.

With else auto=1, the slideshow will start in auto_play but will not
start and stop.
If else auto=0, the slideshow will start and stop but not start in
auto_play.

Thanks in advance for any suggestions, comments or help. It seems like
such a simple problem.

BandonRandon

unread,
Mar 15, 2011, 3:26:00 PM3/15/11
to PHPSlideShow by zinkwazi.com
Jim,

I feel like you're really over complicating things here ;)

I just did a test on my localhost and sovled the issue.

You'll need to change line 141 from:
$auto = isset($_GET['auto']) ? strip_tags($_GET['auto']) : '';
to
$auto = isset($_GET['auto']) ? strip_tags($_GET['auto']) : '1';

This is esentally the same thing you had before with my original if
statement. This sets auto to true (or 1) The problem you were having
is that the `stop slideshow link` unsets $auto so our if statemens
sees it as null and sets it to true again

The solution is simple change line 366 (the stop slideshow link code)
from
$auto_slideshow = "<a href='$path?directory=
$path_to_images&currentPic=$currentPic'>$lang_stop_slideshow</a>\n";
to
$auto_slideshow = "<a href='$path?directory=
$path_to_images&auto=0&currentPic=$currentPic'>$lang_stop_slideshow</a>
\n";

You'll note we are setting 'auto=0' this way our if statement still
has a value for '$auto'

Also can I have you do me a favor? next time you post large code
blocks use a pastebin like http://pastebin.com It'll make it easier
for me to follow what's going on

Hope this helps.

BandonRandon

unread,
Mar 15, 2011, 3:33:18 PM3/15/11
to PHPSlideShow by zinkwazi.com
Also note, that what Greg was getting at in the readme is when you
first link to your slideshow you can set '&auto=1'. This would be a
solution to require no code modifications but does require a link to
the slideshow. Since you are using it as an index page I don't think
that solution will work for you.

On Mar 15, 12:26 pm, BandonRandon <bandonran...@gmail.com> wrote:
> Jim,
>
> I feel like you're really over complicating things here ;)
>
> I just did a  test on my localhost and sovled the issue.
>
> You'll need to change line 141 from:
> $auto = isset($_GET['auto']) ? strip_tags($_GET['auto']) : '';
> to
> $auto = isset($_GET['auto']) ? strip_tags($_GET['auto']) : '1';
>
> This is esentally the same thing you had before with my original if
> statement.  This sets auto to true (or 1) The problem you were having
> is that the `stop slideshow link` unsets $auto  so our if statemens
> sees it as null and sets it to true again
>
> The solution is simple change line 366 (the stop slideshow link code)
> from
>         $auto_slideshow = "<a href='$path?directory=
> $path_to_images&currentPic=$currentPic'>$lang_stop_slideshow</a>\n";
> to
>         $auto_slideshow = "<a href='$path?directory=
> $path_to_images&auto=0&currentPic=$currentPic'>$lang_stop_slideshow</a>
> \n";
>
> You'll note we are setting 'auto=0' this way our if statement still
> has a value for '$auto'
>
> Also can I have you do me a favor? next time you post large code
> blocks use a pastebin likehttp://pastebin.comIt'll make it easier

Jim

unread,
Mar 15, 2011, 6:01:40 PM3/15/11
to PHPSlideShow by zinkwazi.com
Thank you BrandonRandon,

Your suggestions worked perfectly! Here is the URL where I'm
developing this project in case you would like to see it.

http://www.whereismybartender.com/zbt_dev/

Again, thank you so very much. Jim

On Mar 15, 12:26 pm, BandonRandon <bandonran...@gmail.com> wrote:
> Jim,
>
> I feel like you're really over complicating things here ;)
>
> I just did a  test on my localhost and sovled the issue.
>
> You'll need to change line 141 from:
> $auto = isset($_GET['auto']) ? strip_tags($_GET['auto']) : '';
> to
> $auto = isset($_GET['auto']) ? strip_tags($_GET['auto']) : '1';
>
> This is esentally the same thing you had before with my original if
> statement.  This sets auto to true (or 1) The problem you were having
> is that the `stop slideshow link` unsets $auto  so our if statemens
> sees it as null and sets it to true again
>
> The solution is simple change line 366 (the stop slideshow link code)
> from
>         $auto_slideshow = "<a href='$path?directory=
> $path_to_images&currentPic=$currentPic'>$lang_stop_slideshow</a>\n";
> to
>         $auto_slideshow = "<a href='$path?directory=
> $path_to_images&auto=0&currentPic=$currentPic'>$lang_stop_slideshow</a>
> \n";
>
> You'll note we are setting 'auto=0' this way our if statement still
> has a value for '$auto'
>
> Also can I have you do me a favor? next time you post large code
> blocks use a pastebin likehttp://pastebin.comIt'll make it easier

BandonRandon

unread,
Mar 17, 2011, 3:20:58 PM3/17/11
to PHPSlideShow by zinkwazi.com
Glad that worked for you! It's always neat to see the various ways
people use PHPSlideshow.

Ps, my name is "BandonRandon" or Brooke not "BrandonRandon" ;)
> > blocks use a pastebin likehttp://pastebin.comIt'llmake it easier
Reply all
Reply to author
Forward
0 new messages