1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

HTML slideshow?

Discussion in 'Software Development' started by Peacock, Oct 20, 2003.

Thread Status:
Not open for further replies.
Advertisement
  1. Peacock

    Peacock Thread Starter

    Joined:
    Oct 9, 2003
    Messages:
    48
    I'd like to do a "slideshow" of HTML files - I have about 90 HTML docs and would like the user to be able to click "previous" and "next" links at the bottom of the page to navigate through the information. How would you recommend I do this? Can I do it with PHP? Can you recommend any snippets of code?

    Thanks,
    Lisa
     
  2. khaki

    khaki

    Joined:
    Jul 26, 2003
    Messages:
    2,431
    hi Lisa....

    you could probably do something like that using <iframe>'s.

    are you looking to do this specifically using PHP?
    (if so.... I can't help you..... I'm an ASP girl :) )

    And actually... a server-side solution would probably hammer the server too hard (cuz you have a lot of pages :eek: )....
    so maybe a client-side solution using javascript and <iframe>'s is best.

    I may have something already coded that does that. I'll look for it later tonite and see if it fits what you are trying to do.

    stay tuned.......

    :) khaki
     
  3. Peacock

    Peacock Thread Starter

    Joined:
    Oct 9, 2003
    Messages:
    48
    I can't use frames; I want to make it 508 compliant.

    So far, I have...
    - a text file which lists the file name of each slide and a "page number" for each slide (/slide001.htm;1;/slide002.htm;2;etc)
    - a template
    - 90 pages based on said template

    I'd like to have the forward button take a look at the number of the page that is currently up, add one to the page number, and pull the corresponding HTML file. And for the reverse, subtract one and pull the corresponding HTML file.
     
  4. khaki

    khaki

    Joined:
    Jul 26, 2003
    Messages:
    2,431
    your a demanding one, Lisa ;) .....

    but okay.....

    I only know ASP (and not PHP)..... so that's all that I can comment on.

    But....
    depending upon the content....
    you can do this server-side..... although that would force the user to re-read the menu (and everything else) after each page load, right???
    (so I'm not sure how 508 compliant that is).

    But anyway...
    you could use client-side OnClick events to query a DB that contains text data.....
    and have that data populate a table ( :eek: is that compliant???) or a <div> ( :) ) based on the results of an SQL query.

    Does this sound like something that would work for you???

    Like I said.... I'm an ASP girl....
    so I can only provide an ASP example.
    If you are able to convert it to a PHP solution... then good for you :)

    Otherwise...... sorry :( (but I tried)

    Let me know

    :) khaki
     
  5. Gibble

    Gibble

    Joined:
    Oct 9, 2001
    Messages:
    27,087
    K, just give asp code, and I'll give it the old switcharoo ;)
     
  6. brendandonhu

    brendandonhu

    Joined:
    Jul 8, 2002
    Messages:
    14,681
    A simple PHP script should be able to do this. Later I'll write something for you. It will take each HTML file in a directory, give it an ID number, and have Back and Forward buttons for navigation, that sound good?
     
  7. bassetman

    bassetman Moderator (deceased) - Gone but never forgotten

    Joined:
    Jun 7, 2001
    Messages:
    47,973
    B where ya been lately? :eek:
     
  8. brendandonhu

    brendandonhu

    Joined:
    Jul 8, 2002
    Messages:
    14,681
    Heres the start of the script (with the important parts *Borrowed* from onjae.com)

    I will do the Navigation and error correction when I get home...

    PHP:
    <?php 
    $dir 
    opendir('.'); 
    $files[] = $PHP_SELF;
    while ((
    $file readdir($dir)) !== false) { 
    $files[] = $file;
    }
    closedir($dir);
    if(isset(
    $_GET['page']))
    {
    include(
    $files[$_GET['page']]);
     ;}
    ?>
     
  9. Peacock

    Peacock Thread Starter

    Joined:
    Oct 9, 2003
    Messages:
    48
    I'll try that code and see how it works. Thank you all!

    Yes, I am demanding. In fact, I have anothe question!

    I have a dreamweaver template (.dwt) which has a bit of php at the top:

    <?php
    inlcude 'header.php'
    ?>

    Now, should all files based on that template be saved as HTML or as PHP files? Thanks in advance - I'm new to PHP.

    L
     
  10. Gibble

    Gibble

    Joined:
    Oct 9, 2001
    Messages:
    27,087
    if it has php code (stuff between <? and ?>) then save it as php, otherwise save it as html.

    Both are text, so it's merely the extension that determines how the webserver handles the file.

    But in the case of this template, they are probably all php files.
     
  11. AbvAvgUser

    AbvAvgUser

    Joined:
    Oct 3, 2002
    Messages:
    2,281
    If your HTML files contain Images and its a slide show of images, try out JAlbum (http://www.datadosen.se/jalbum). It will make a slide show with a few clicks and very efficiently. Its a freeware :).
     
  12. brendandonhu

    brendandonhu

    Joined:
    Jul 8, 2002
    Messages:
    14,681
    Heres the script I came up with...

    PHP:
    <?php
    $dir 
    opendir('.'); 
    $files[] = $PHP_SELF;
    while ((
    $file readdir($dir)) !== false) { 
    $files[] = $file;
    }
    closedir($dir);
    $first 1;
    $last count($files) - 1;
    $forward $_GET['page'] + 1;
    $back $_GET['page'] - 1;
    if(isset(
    $_GET['page']))
    {
    include(
    $files[$_GET['page']]);
     ;}
    ?>
    <hr>
    <a href="<?php echo $PHP_SELF "?page=" $first ?>">First Page</a>|<a href="<?php echo $PHP_SELF "?page=" $back ?>">Back</a>|<a href="<?php echo $PHP_SELF "?page=" $forward ?>">Forward</a>|<a href="<?php echo $PHP_SELF "?page=" $last ?>">Last Page</a>
     
  13. khaki

    khaki

    Joined:
    Jul 26, 2003
    Messages:
    2,431
    okay Gibby.....
    now that Brendan gave us the PHP version (also know as complete gibberish ;) )....

    how about you "give it the old switcharoo" into ASP for me :)
    (or at least explain what each line means ;) p-l--e-a-s-e :) )


    all these stinkin' question-marks and dollar-signs are maddening ! :eek:
     
  14. Gibble

    Gibble

    Joined:
    Oct 9, 2001
    Messages:
    27,087
    Code:
    <%
    Set objFS = Server.CreateObject("Scripting.FileSystemObject")
    FolderPath = Request.ServerVariables("APPL_PHYSICAL_PATH")
    Set objFolder = objFS.GetFolder(FolderPath)
    Set objFiles = objFolder.Files
    
    iFirst = 1
    iLast = objFiles.Count
    
    iForward = Request.QueryString("page") + 1; 
    iBack = Request.QueryString("page") - 1; 
    if (Request.QueryString("page") > 0) then
    	'This isn't proper asp because includes in ASP don't allow variable strings like this...
    	%>
    	<!-- #include file=objFiles[Request.QueryString("page")] -->
    	%>
    end if
    %> 
    
    <hr> 
    <a href="<%Response.write Request.ServerVariables("SCRIPT_NAME ") & "?page=" . iFirst %>">First Page</a>
    |
    <a href="<%Response.write Request.ServerVariables("SCRIPT_NAME ") & "?page=" . iBack %>">Back</a>
    |
    <a href="<%Response.write Request.ServerVariables("SCRIPT_NAME ") & "?page=" . iForward %>">Forward</a>
    |
    <a href="<%Response.write Request.ServerVariables("SCRIPT_NAME ") & "?page=" . iLast %>">Last Page</a>
    It may not be 100%, and the include needs to be worked differently with a document reader function...but that's basically the way it would be coded in ASP. :)
     
  15. brendandonhu

    brendandonhu

    Joined:
    Jul 8, 2002
    Messages:
    14,681
    $ = variable

    I suppose I could cut it down to 2 ?s but that wouldnt be fun..
     
  16. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/173366

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice