Community @ The Turning Gate

Support community for TTG plugins and products.

You are not logged in.

#1 2016-04-11 01:41:43

fwillette
Member
From: Brussels - Belgium
Registered: 2014-05-08
Posts: 124

Drop menu in several autoindex pages

Hello

I am building my own site and experimenting things like Drop menu with autoindex.

http://fredy-willette.be/

If I well understood, Drop menu with autoindex can only provide one level sub menu, like in Galeries pages, thus Would I add one or more galleries pages. I uploaded an AutoIndex (called voyages) at the root and created a publisher instance to publish there and it works. Next step is to implement drop menu with autoindex for this new item. I tried to paste code, adapted for that page, but the result is not exactly what I hoped. I even don't know if it is possible. That is what my phpligins.php code is looking now:


        <!-- EDIT ONLY BELOW THIS LINE : -->

            <li><a href="/">Home</a></li>
            <li><a href="/galleries.php">Galeries</a>
                <ul>

';
    $theroot = $_SERVER['DOCUMENT_ROOT'];
    $indexPath = '/galleries/'; // set folder location to scan for galleries

    require_once($theroot.'/lib/autoindex/autoindex.php');
    if (trim($_SERVER["QUERY_STRING"]) == 'debug')
        define ('AUTOINDEX_DEBUG', true); // enable statement to output debugging info from autoindex()
    $albums = autoindex($theroot.$indexPath);
    // $albums = array_reverse($albums); // Reverses album order
    // shuffle($albums); // Shuffles albums
    $j = min(count($albums), 8); // build <li>s from first 8 in gallery list   
    for($i=0; $i < $j; $i++) {
        echo '<li><a href="'.$albums[$i]['url'].'" title="'.$albums[$i]['description'].'">'.$albums[$i]['title'].'</a></li>';
    };
    if (count($albums) > 8) { // the 8 here matches the 8 above
        echo '<li><a href="/galleries.php" title="See more galleries" >more ...</a></li>';
    };

    echo '
                </ul>
            </li>
           
            <li><a href="/voyages/">Voyages</a>
            </ul>
           
';
    $theroot = $_SERVER['DOCUMENT_ROOT'];
    $indexPath = '/voyages/'; // set folder location to scan for galleries

    require_once($theroot.'/lib/autoindex/autoindex.php');
    if (trim($_SERVER["QUERY_STRING"]) == 'debug')
        define ('AUTOINDEX_DEBUG', true); // enable statement to output debugging info from autoindex()
    $albums = autoindex($theroot.$indexPath);
    // $albums = array_reverse($albums); // Reverses album order
    // shuffle($albums); // Shuffles albums
    $j = min(count($albums), 8); // build <li>s from first 8 in gallery list   
    for($i=0; $i < $j; $i++) {
        echo '<li><a href="'.$albums[$i]['url'].'" title="'.$albums[$i]['description'].'">'.$albums[$i]['title'].'</a></li>';
    };
    if (count($albums) > 8) { // the 8 here matches the 8 above
        echo '<li><a href="/voyages/" title="See more galleries" >more ...</a></li>';
    };

    echo '
                </ul>
            </li>           
           
            <li><a href="/contact.php">Contact</a></li>
            <li><a href="/search/"><i style="color:red;"class="fa fa-search"></i>&nbsp;Recherche de photos</a></li>
            <li><a href="/about.php">About</a></li>
            <li><a href="/info.php"><i style="color:green;"class="fa fa-info-circle"></i>&nbsp;Infos utiles</a></li>
           
           

        <!-- EDIT ONLY ABOVE THIS LINE -->

Am I dreaming or is it simply a "little" code missing. I apologise but my knowledges coding are near absolute zero.

Offline

#2 2016-04-11 02:06:58

rod barbee
Moderator
From: Port Ludlow, WA USA
Registered: 2012-09-24
Posts: 12,644
Website

Re: Drop menu in several autoindex pages

This is probably the problem:

   
            <li><a href="/voyages/">Voyages</a>
            </ul>

You've got a closing ul tag </ul> where is should be an opening tag <ul>


Rod 
Just a user with way too much time on his hands.
www.rodbarbee.com
ttg-tips.com, Backlight test site

Offline

#3 2016-04-11 02:24:21

fwillette
Member
From: Brussels - Belgium
Registered: 2014-05-08
Posts: 124

Re: Drop menu in several autoindex pages

Fine
Works now like expected.
Not sur I could point it by myself. Rod you are great.
Thanks a million times.

Offline

#4 2016-04-11 02:30:12

fwillette
Member
From: Brussels - Belgium
Registered: 2014-05-08
Posts: 124

Re: Drop menu in several autoindex pages

May I?
Seems that the number of albums beeing detected is limited to 8 in the example.
Is it a technical reason, or is it for display cleanliness?

Offline

#5 2016-04-11 02:32:17

rod barbee
Moderator
From: Port Ludlow, WA USA
Registered: 2012-09-24
Posts: 12,644
Website

Re: Drop menu in several autoindex pages

cleanliness I suspect. But you can change that. Just change the number in this line of code:

  $j = min(count($albums), 8); // build <li>s from first 8 in gallery list


Rod 
Just a user with way too much time on his hands.
www.rodbarbee.com
ttg-tips.com, Backlight test site

Offline

Board footer

Powered by FluxBB