Jump to content

Gallery works only after refresh


zerouno

Recommended Posts

Hello,
im newbie, i make a gallery with jquerymobile/php, but when i click on gallery thumb, have a blank page, and not slideshow, if go back to gallery and refresh page gallery, and click on image, gallery slideshow works fine.

I go here: https://forum.jquery.com/topic/gallery-after-refresh#14737000004289991

but they tellme is a php problem.

 

Thanks.

 

This  is my gallery.php

    <!DOCTYPE html>
    <html>
        <head>
            <title>Gallery</title>
            <meta name="viewport" content="width=device-width, initial-scale=1" />
            <link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.css" />
            <link rel="stylesheet" href="css/style.css" />       
            <script type="text/javascript" src="http://code.jquery.com/jquery-1.6.4.min.js"></script>
            <script type="text/javascript" src="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.js"></script>
            <script type="text/javascript" src="js/script.js"></script>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /></head>
        <body>
            <div data-role="page" class="page gallery-page">
                <div data-role="header">
                    <a href="gallery.html" data-icon="arrow-l" data-rel="back" data-direction="reverse">Back</a>
                    <a href="index.html" data-icon="home" data-direction="reverse">Home</a>
                    <h1>PANORAMA</h1>
                </div><!--/header-->
                <div data-role="content" class="full-width">
                    <ul class="gallery three-column-gallery" id="gallery">

    comment this code:
                        <!--                    <!--<li><a href="img/gallery/full/holiday/01.jpg" rel="external"><img src="img/gallery/thumb/holiday/01.jpg"  /></a></li>
                        <li><a href="img/gallery/full/holiday/02.jpg" rel="external"><img src="img/gallery/thumb/holiday/02.jpg"  /></a></li>
                        <li><a href="img/gallery/full/holiday/03.jpg" rel="external"><img src="img/gallery/thumb/holiday/03.jpg"  /></a></li>
                        <li><a href="img/gallery/full/holiday/04.jpg" rel="external"><img src="img/gallery/thumb/holiday/04.jpg"  /></a></li>
                        <li><a href="img/gallery/full/holiday/05.jpg" rel="external"><img src="img/gallery/thumb/holiday/05.jpg"  /></a></li>
                         
                        -->
                        ...and add php code
                                <?php     

    $directory = dirname(__FILE__)."/images/";
    if (is_dir($directory)) {
        if ($directory_handle = opendir($directory)) {
            while (($file = readdir($directory_handle)) !== false) {
            
                if((!is_dir($file))&($file!=".")&($file!="..")) {
                    echo "<li><a href=\"/mobile/images/".$file."\"><img src=\"/mobile/images/thumb/".$file."\" alt=\"Image 01\" /></a></li>";
            }
            }
            closedir($directory_handle);
        }
    }

    ?>
                         
                       
                    </ul>       
                </div><!-- /content -->

            </div><!-- /page -->
           
           
        </body>
    </html>
Link to comment
https://forums.phpfreaks.com/topic/279945-gallery-works-only-after-refresh/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.