Page 3 of 3 FirstFirst 123
Results 21 to 28 of 28

Thread: Help with code to create an array from contents of folder

  1. #21
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    I see no change. Here's the view source:

    Code:
    <script>
    var ShowPics=new fadeSlideShow({
    	wrapperid: "fadeshow1", //ID of blank DIV on page to house Slideshow
    	dimensions: [400, 300], //width/height of gallery in pixels. Should reflect dimensions of largest image
    	imagearray: [
    
    </script>
    
    ["/test/Graphics/ShowPics/100_0466-A.jpg"],<br/>["/test/Graphics/ShowPics/100_0467-A.jpg"],<br/>["/test/Graphics/ShowPics/100_0469-A.jpg"],<br/>["/test/Graphics/ShowPics/100_0470-A.jpg"],<br/>["/test/Graphics/ShowPics/100_0471-A.jpg"],<br/>["/test/Graphics/ShowPics/100_0472-A.jpg"]<br/>
    <script>
    
    	],
    	displaymode: {type:'auto', pause:2000, cycles:1, wraparound:false},
    	persist: false, //remember last viewed slide and recall within same session?
    	fadeduration: 500, //transition duration (milliseconds)
    	descreveal: "none",
    	togglerid: ""
    })
    </script>
    The highlighted tags must be removed and in Bev's function:

    Code:
    echo "[\"$path$files_array[$i]\"]$comma<br>";
    Needs to be:

    Code:
    echo "[\"$path$files_array[$i]\"]$comma\n";
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  2. #22
    Join Date
    Jan 2006
    Posts
    170
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Default

    John.

    Not sure which file you were looking at. The NewFadinSlideshow_1 file does not have the script tags. However, I did notice a typo in the array definition. I corrected that and everything works.

    John & Beverley.

    Thank you both so much for all your help and patience. I know this was frustrating ... for all of us. Now all I have to do is transfer everything to the real page, which I don't foresee any problems with. Again, many thanks for your help.

    Mark this puppy RESOLVED.

    Best regards to you both.
    Jim

  3. #23
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Great! I was looking before at NewFadinSlideShow.php. The newer file looks fine. BTW, way back when I mentioned index PHP, I meant the (at that time) single PHP file in the test folder. It did have (among others) the word index in its name, but was not displaying. You've since fixed that somehow, in any case that file is no longer there in the folder view.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  4. #24
    Join Date
    Jan 2006
    Posts
    170
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Default

    John & Beverley.

    I hope your still monitoring this post. Everything works fine, but what I'd like to do is to move the slideshow definitions

    i.e.
    Code:
    var ShowPics=new fadeSlideShow({
    	wrapperid: "fadeshow1", //ID of blank DIV on page to house Slideshow
    	dimensions: [650, 490], //width/height of gallery in pixels. Should reflect dimensions of largest image
    	imagearray: [
    <?php imageSlideArray('/hsphere/local/home/bswebmas/ohiobuttons.org/Graphics/ShowPics/CurrentShow/', '/Graphics/ShowPics/CurrentShow/');?>
    	],
    	displaymode: {type:'auto', pause:2000, cycles:1, wraparound:false},
    	persist: false, //remember last viewed slide and recall within same session?
    	fadeduration: 500, //transition duration (milliseconds)
    	descreveal: "none",
    	oninit: function(){++this.setting.currentstep},
    	onslide: function(){
    		if(this.setting.currentstep === this.setting.imagearray.length){
    			setTimeout(ShowPics1, this.setting.displaymode.pause);
    		}
    	},
    	togglerid: ""
    })
    var ShowPics1 = function(){
    	Showpics=new fadeSlideShow({
    		wrapperid: "fadeshow1", //ID of blank DIV on page to house Slideshow
    		dimensions: [560, 490], //width/height of gallery in pixels. Should reflect dimensions of largest image
    		imagearray: [
    <?php imageSlideArray('/hsphere/local/home/bswebmas/ohiobuttons.org/Graphics/ShowPics/PreviousShows/', '/Graphics/ShowPics/PreviousShows/');?>
    		],
    		displaymode: {type:'auto', pause:2000, cycles:1, wraparound:false},
    		persist: false, //remember last viewed slide and recall within same session?
    		fadeduration: 500, //transition duration (milliseconds)
    		descreveal: "ondemand",
    		togglerid: ""
    	});
    }
    to an external file.

    I believe it needs to be a .php file, but I'm not sure what the syntax should be. Also, can I just reference it as I would a .js file i.e.
    Code:
    <script type="text/javascript" src="Script_Files/slidedef.php">
    ) or would I use an include as I did for the build_array routine?

    I'd appreciate any recommendation you would have.

    Thanks.

    p.s. If this should be posted as a new thread, let me know and I'll do it.

  5. #25
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Yes. do it like that:

    HTML Code:
    [CODE]<script type="text/javascript" src="Script_Files/slidedef.php">[/CODE]
    But include a PHP javascript header at the beginning of the external file:

    PHP Code:
    <?php
    header
    ("content-type: application/x-javascript");
    ?>
    Any relative paths used by javascript in the file should be relative to the page that's using it. Relative paths used by PHP should be relative to the file itself. Looks like all that's OK at the moment (the relative paths).
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  6. #26
    Join Date
    Jan 2006
    Posts
    170
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Default

    Hi John.

    Didn't work. To make sure I didn't mess something up, here's the new code:

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <head>
    <meta http-equiv="content-type" content="text/html;charset=utf-8" />
    <meta http-equiv="Content-Style-Type" content="text/css" />
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
    
    <?php include('/hsphere/local/home/bswebmas/ohiobuttons.org/test/Script_Files/build_array.php');?>
    
    <script type="text/javascript" src="Script_Files/fadeslideshow.js">
    /***********************************************
    * Ultimate Fade In Slideshow v2.0- (c) Dynamic Drive DHTML code library (www.dynamicdrive.com)
    * This notice MUST stay intact for legal use
    * Visit Dynamic Drive at http://www.dynamicdrive.com/ for this script and 100s more
    ***********************************************/
    
    </script>
    
    <script type="text/javascript" src="Script_Files/slidedef.php">
    
    </head>
    
    <body bgcolor="#FEF4E4">
    <center>
    <table cellspacing=1 border=0 width=100%>
    <tr>
    <td colspan=3 valign="top" align="center"><font size="4" color="Navy"><b>The Buckeye State Button Society<br>presents</b></td></tr>
    <tr>
    <td align="center" valign="middle"><p><font size="6" color="Green" face="Arial"><center>Spring Show 2014</font>
    <p><font size=4 color="Navy"><b>April 9-10, 2011</b></font></td>
    </tr><tr>
    <td align="center">
    <table border=0>
    <td align="center" valign="top">
    
    <div id="fadeshow1"></div>
    
    </td>
    </tr></table>
    </tr></table>
    </center>
    </body>
    </html>
    The external file (located in /Script_Files, the same folder as fadeslideshow.js) is:

    Code:
    <?php
    header("content-type: application/x-javascript");
    ?>
    var ShowPics=new fadeSlideShow({
    	wrapperid: "fadeshow1", //ID of blank DIV on page to house Slideshow
    	dimensions: [650, 490], //width/height of gallery in pixels. Should reflect dimensions of largest image
    	imagearray: [
    <?php imageSlideArray('/hsphere/local/home/bswebmas/ohiobuttons.org/Graphics/ShowPics/CurrentShow/', '/Graphics/ShowPics/CurrentShow/');?>
    	],
    	displaymode: {type:'auto', pause:2000, cycles:1, wraparound:false},
    	persist: false, //remember last viewed slide and recall within same session?
    	fadeduration: 500, //transition duration (milliseconds)
    	descreveal: "none",
    	oninit: function(){++this.setting.currentstep},
    	onslide: function(){
    		if(this.setting.currentstep === this.setting.imagearray.length){
    			setTimeout(ShowPics1, this.setting.displaymode.pause);
    		}
    	},
    	togglerid: ""
    })
    var ShowPics1 = function(){
    	Showpics=new fadeSlideShow({
    		wrapperid: "fadeshow1", //ID of blank DIV on page to house Slideshow
    		dimensions: [560, 490], //width/height of gallery in pixels. Should reflect dimensions of largest image
    		imagearray: [
    <?php imageSlideArray('/hsphere/local/home/bswebmas/ohiobuttons.org/Graphics/ShowPics/PreviousShows/', '/Graphics/ShowPics/PreviousShows/');?>
    		],
    		displaymode: {type:'auto', pause:2000, cycles:1, wraparound:false},
    		persist: false, //remember last viewed slide and recall within same session?
    		fadeduration: 500, //transition duration (milliseconds)
    		descreveal: "ondemand",
    		togglerid: ""
    	});
    }

  7. #27
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    There are at least two problems here. I hope that's it. For one, you need a closing script tag here (added in red):

    Code:
    <script type="text/javascript" src="Script_Files/fadeslideshow.js">
    /***********************************************
    * Ultimate Fade In Slideshow v2.0- (c) Dynamic Drive DHTML code library (www.dynamicdrive.com)
    * This notice MUST stay intact for legal use
    * Visit Dynamic Drive at http://www.dynamicdrive.com/ for this script and 100s more
    ***********************************************/
    
    </script>
    
    <script type="text/javascript" src="Script_Files/slidedef.php"></script>
    
    </head>
    For the other, instead of including the external file with the PHP function on it here:

    Code:
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
    
    <?php include('/hsphere/local/home/bswebmas/ohiobuttons.org/test/Script_Files/build_array.php');?>
    
    <script type="text/javascript" src="Script_Files/fadeslideshow.js">
    It should be included on slidedef.php like so:

    Code:
    <?php
    header("content-type: application/x-javascript");
    include 'build_array.php';
    ?>
    var ShowPics=new fadeSlideShow({
    	wrapperid: "fadeshow1", //I . . .
    You can probably use the server path there if you like. But, since it's in the same folder, just that should be OK.

    Assuming everything else is good, that should do it.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  8. #28
    Join Date
    Jan 2006
    Posts
    170
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Default

    Hi John.

    Sorry about the end tag. The good news is that it works! Thanks. BTW, I didn't need the server path in the build_array address.

Similar Threads

  1. Script to show folder contents
    By dwarfer in forum Looking for such a script or service
    Replies: 7
    Last Post: 07-14-2012, 04:20 AM
  2. can lightbox read the contents of a folder
    By mtokoly in forum Dynamic Drive scripts help
    Replies: 11
    Last Post: 07-13-2009, 08:17 PM
  3. Create new folder and .TXT file
    By Spinethetic in forum PHP
    Replies: 4
    Last Post: 03-24-2009, 02:03 AM
  4. Building a dynamic array from folder contents
    By Jim Weinberg in forum JavaScript
    Replies: 20
    Last Post: 05-15-2008, 03:34 PM
  5. php folder array
    By insanemonkey in forum PHP
    Replies: 0
    Last Post: 11-06-2007, 05:58 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •