Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: Drop-Down navigation menu  (Read 11988 times)

0 Members and 1 Guest are viewing this topic.

andreyua

  • Coppermine newbie
  • Offline Offline
  • Posts: 11
Drop-Down navigation menu
« on: August 18, 2004, 12:02:22 am »

Drop-Down navigation menu

I need a drop down navigation menu to browse through the albums and categories.
If you could help, it would be awesome.

Thanks in ADVANCE
Logged

mstralka

  • VIP
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 178
Re: Drop-Down navigation menu
« Reply #1 on: August 18, 2004, 12:30:57 am »

Are you looking for a horizontal menu like in a brower (File, Edit, etc) that drops down, or a tree menu?
Main
---Sub 1
       -- Photo 1
---Sub 2
       -- Photo 2

The tree menu has been done - read the MODs board
http://forum.coppermine-gallery.net/index.php?topic=8827.0
Logged
GO IRISH

andreyua

  • Coppermine newbie
  • Offline Offline
  • Posts: 11
Re: Drop-Down navigation menu
« Reply #2 on: August 18, 2004, 02:32:24 am »

All i need is a simple HTML drop down menu.
« Last Edit: August 18, 2004, 02:38:24 am by andreyua »
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Drop-Down navigation menu
« Reply #3 on: August 18, 2004, 08:47:43 am »

where should it appear on the page? Should it replace the existing stuff. Is it supposed to replace the navigation, the admin menu, the category/albums list? Post more details...

GauGau
Logged

andreyua

  • Coppermine newbie
  • Offline Offline
  • Posts: 11
Re: Drop-Down navigation menu
« Reply #4 on: August 19, 2004, 10:52:34 pm »

It needs to be on the top (above the thumbnails). Replacing nothing.

It needs to be something like the language select.
Logged

mstralka

  • VIP
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 178
Re: Drop-Down navigation menu
« Reply #5 on: August 19, 2004, 11:52:29 pm »

I'll take a look at this.  I should be able to modify my tree menu to work like this since it's based on the PHP Layers Menu System
Logged
GO IRISH

mstralka

  • VIP
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 178
Re: Drop-Down navigation menu
« Reply #6 on: August 20, 2004, 12:34:28 pm »

Here's the start - I haven't integrated into CPG yet
http://www.photo-junky.com/gallery/hor_menu.php
Logged
GO IRISH

Tarique Sani

  • VIP
  • Coppermine addict
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 2712
    • http://tariquesani.net
Re: Drop-Down navigation menu
« Reply #7 on: August 20, 2004, 02:22:46 pm »

Here's the start - I haven't integrated into CPG yet
http://www.photo-junky.com/gallery/hor_menu.php
We had also done some thing similar BUT gave up becuase if the number of galleries are more than what you can fit in the screen hieght then it does not work - also it is a pain to work with the positioning of the phpLayersMenu....

This is not to discourage you BUT just a heads up - I suggest a theme where the menu is stuck right at the top!
Logged
SANIsoft PHP applications for E Biz

mstralka

  • VIP
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 178
Re: Drop-Down navigation menu
« Reply #8 on: August 21, 2004, 02:17:32 am »

I see what you mean Tarique.  I got it working but I can't position it anywhere except along the top of the screen.  I won't be using this mod on my site because of these limitations, and won't make further changes to it, but if you really want it, here it is. 

Andreyua, if you're still interested, even with the limitations, here the instructions.

1.  Download phplayersmenu, unzip the contents into folder called phplayersmenu, and upload it to your coppermine directory on your server.

2.  Create a file called hor_menu.php in your coppermine directory.

3.  Paste this code into that file
Code: [Select]
<?php
// ------------------------------------------------------------------------- //
// Coppermine Photo Gallery - Tree Menu                                      //
// ------------------------------------------------------------------------- //
// Based on Browser Sidebar, which is                                        //
// Copyright (C) Dr. Tarique Sani                                            //
// http://tariquesani.net/                                                   //
// --------------------------------------- --------------------------------- //
// This program is free software; you can redistribute it and/or modify      //
// it under the terms of the GNU General Public License as published by      //
// the Free Software Foundation; either version 2 of the License, or         //
// (at your option) any later version.                                       //
// ------------------------------------------------------------------------- //
// Just put into the same directory as your coppermine installation          //
// ------------------------------------------------------------------------- //

if (!defined('IN_COPPERMINE')) {
define('IN_COPPERMINE'true);
}
require_once(
'include/init.inc.php');

global 
$CONFIG//NEW

if (isset($HTTP_COOKIE_VARS[$CONFIG['cookie_name'] . '_sidebar'])) {
    
$sidePrefs = @unserialize(@base64_decode($HTTP_COOKIE_VARS[$CONFIG['cookie_name'] . '_sidebar']));
//Read prefs from cookie
$theme $sidePrefs['theme'];
$thumb_count $sidePrefs['thumbs'];
$thumb_per_page $sidePrefs['thumbs'];
}else{
$theme "kde";
$thumb_count 1;
$thumb_per_page 1;
}

//Change these variables to reflect your choices if you don't want lastup
$album 'lastup';
$album_name "";
$lower_limit 0;


$link_url "displayimage.php?album=lastup&cat=0&pos=";
$image_url "albums/";

get_private_album_set();

$data get_pic_data($album$thumb_count$album_name$lower_limit$thumb_per_page);

require_once(
"hor_menu_funcs.php");
//$startTime = microtime();
//Start building the string needed for php Tree Menu
//$catStr = ".|".$CONFIG['gallery_name']."|index.php\n";
//if (empty($_COOKIE["tree_menu"])) {
$catStr ".|Home|index.php\n";
if (!empty($_SERVER['QUERY_STRING'])) {
$catStr get_tree_subcat_data(0,".");
} else {
$catStr get_tree_subcat_data(0,".");
}
//$_COOKIE["tree_menu"] = gzcompress($catStr);
// setcookie("tree_menu",$catStr,time() + 600,"/",".photo-junky.com");
//} else {
// $catStr = gzuncompress($_COOKIE["tree_menu"]);
//}
//$endTime = microtime();
// benchmark timing

//print timediff($startTime,$endTime);
//starttable("100%", "Site Tree");

/* TO USE RELATIVE PATHS: */
$myDirPath 'phplayersmenu/';
$myWwwPath 'phplayersmenu/';
/* TO USE ABSOLUTE PATHS: */
//$myDirPath = '/home/pratesi/public_html/phplayersmenu/';
//$myWwwPath = '/~pratesi/phplayersmenu/';

?>

<tr>
<td class="tableb" >


<?php
/* TO USE RELATIVE PATHS: */
$myDirPath 'phplayersmenu/';
$myWwwPath './phplayersmenu/';
/* TO USE ABSOLUTE PATHS: */
//$myDirPath = '/home/pratesi/public_html/phplayersmenu/';
//$myWwwPath = '/~pratesi/phplayersmenu/';
?>


<link rel="stylesheet" href="<?php print $myWwwPath?>layersmenu-demo.css" type="text/css"></link>
<link rel="stylesheet" href="<?php print $myWwwPath?>layersmenu-gtk2.css" type="text/css"></link>
<link rel="shortcut icon" href="<?php print $myWwwPath?>LOGOS/shortcut_icon_phplm.png"></link>

<script language="JavaScript" type="text/javascript">
<!--
<?php require_once $myDirPath 'libjs/layersmenu-browser_detection.js'?>
// -->
</script>
<script language="JavaScript" type="text/javascript" src="<?php print $myWwwPath?>libjs/layersmenu-library.js"></script>
<script language="JavaScript" type="text/javascript" src="<?php print $myWwwPath?>libjs/layersmenu.js"></script>

<?php
require_once $myDirPath 'lib/PHPLIB.php';
require_once 
$myDirPath 'lib/layersmenu-common.inc.php';
require_once 
$myDirPath 'lib/layersmenu.inc.php';

//$mid = new LayersMenu(6, 7, 2, 5, 140);
//$mid = new LayersMenu(6, 7, 2, 1); // Gtk2-like
//$mid = new LayersMenu(3, 8, 1, 1); // Keramik-like
$mid = new LayersMenu(3921); // Galaxy-like
//$mid = new LayersMenu(-12, 10, 6, 5); // "Traditional" PHPLM look

/* TO USE RELATIVE PATHS: */
$mid->setDirroot('./phplayersmenu/');
$mid->setLibjsdir('./phplayersmenu/libjs/');
$mid->setImgdir('./phplayersmenu/menuimages/');
$mid->setImgwww('./phplayersmenu/menuimages/');
$mid->setIcondir('./phplayersmenu/menuicons/');
$mid->setIconwww('./phplayersmenu/menuicons/');
/* either: */
$mid->setTpldir('./templates/');
$mid->setHorizontalMenuTpl('layersmenu-horizontal_menu.ihtml');
$mid->setSubMenuTpl('layersmenu-sub_menu.ihtml');
/* or: (disregarding the tpldir) */
//$mid->setHorizontalMenuTpl('templates/layersmenu-horizontal_menu.ihtml');
//$mid->setSubMenuTpl('templates/layersmenu-sub_menu.ihtml');

/* TO USE ABSOLUTE PATHS: */
//$mid->setDirroot($myDirPath);
////$mid->setLibjsdir($myDirPath . 'libjs/');
////$mid->setImgdir($myDirPath . 'menuimages/');
//$mid->setImgwww($myWwwPath . 'menuimages/');
////$mid->setIcondir($myDirPath . 'menuicons/');
//$mid->setIconwww($myWwwPath . 'menuicons/');
////$mid->setTpldir($myDirPath . 'templates/');
//$mid->setHorizontalMenuTpl('layersmenu-horizontal_menu.ihtml');
//$mid->setSubMenuTpl('layersmenu-sub_menu.ihtml');

////$mid->setHorizontalMenuTpl('layersmenu-horizontal_menu-old.ihtml');
////$mid->setSubMenuTpl('layersmenu-sub_menu-old.ihtml');
//$mid->setDownArrowImg('down-arrow.png');
//$mid->setForwardArrowImg('forward-arrow.png');
//$mid->setMenuStructureFile($myDirPath . 'layersmenu-horizontal-1.txt');
$mid->setMenuStructureString($catStr);
$mid->setIconsize(1616);
$mid->parseStructureForMenu('hormenu1');
$mid->newHorizontalMenu('hormenu1');

$mid->printHeader();
/* alternatively:
$header = $mid->getHeader();
print $header;
*/
?>


<?php
$mid
->printMenu('hormenu1');
/* alternatively:
$hormenu1 = $mid->getMenu('hormenu1');
print $hormenu1;
*/
?>


<!--<div class="normalbox">
<div class="normal" align="center">
<b>A file-based example with a Horizontal Layers Menu</b>
<div style="height: 5px"></div>
<a href="http://phplayersmenu.sourceforge.net/"><img border="0"
src="<?php print $myWwwPath?>LOGOS/powered_by_phplm.png" alt="Powered by PHP Layers Menu"
height="31" width="88" /></a>&nbsp;<a
href="http://validator.w3.org/check/referer"><img border="0"
src="<?php print $myWwwPath?>images/valid-xhtml10.png" alt="Valid XHTML 1.0!"
height="31" width="88" /></a>&nbsp;<a
href="http://jigsaw.w3.org/css-validator/"><img border="0"
src="<?php print $myWwwPath?>images/vcss.png" alt="Valid CSS!" height="31" width="88" /></a>
</div>
</div>

<div class="normalbox">
<div class="normal">
<?php //require_once $myDirPath . 'README.ihtml'; ?>
</div>
</div>-->

<?php
$mid
->printFooter();
/* alternatively:
$footer = $mid->getFooter();
print $footer;
*/
?>


</td>
</tr>
<?php
endtable
();

4. Create another file called tree_menu_functions.php in the same folder.  Put this in it:
Code: [Select]
<?php
function get_tree_subcat_data($parent$ident '') {
global $CONFIG$catStr;
    
if ($parent == 0) {
get_tree_album_data($parent,$ident );
}
$sql "SELECT cid, name, description " "FROM {$CONFIG['TABLE_CATEGORIES']} " "WHERE parent = '$parent' " " ORDER BY pos";
$result db_query($sql);
if (($cat_count mysql_num_rows($result)) > 0) {
        
$rowset db_fetch_rowset($result);
        
$pos 0;
        foreach (
$rowset as $subcat) {
$catStr .= $ident."|".$subcat['name']."|index.php?cat=".$subcat['cid']." \n";
get_tree_album_data($subcat['cid'], $ident '.');
get_tree_subcat_data($subcat['cid'], $ident '.');
        }
    }
return $catStr;
}

function 
get_tree_album_data($category,$ident) {
global $catStr,$ALBUM_SET;
global $CONFIG$HIDE_USER_CAT$FORBIDDEN_SET,$cpg_show_private_album;
    
$album_filter='';
    
$pic_filter='';
    if (!empty(
$FORBIDDEN_SET) && !$cpg_show_private_album) {
        
$album_filter ' and '.str_replace('p.','a.',$FORBIDDEN_SET);
        
$pic_filter ' and '.str_replace('p.',$CONFIG['TABLE_PICTURES'].'.',$FORBIDDEN_SET);
    }
if ($category == 1) {
$sql "SELECT DISTINCT user_id, user_fullname FROM {$CONFIG['TABLE_USERS']}{$CONFIG['TABLE_ALBUMS']} WHERE  10000 + {$CONFIG['TABLE_USERS']}.user_id = {$CONFIG['TABLE_ALBUMS']}.category ORDER BY user_fullname ASC";
$result db_query($sql);
if (($cat_count mysql_num_rows($result)) > 0) {
$rowset db_fetch_rowset($result);
foreach ($rowset as $subcat) {
$catStr .= $ident."|".$subcat['user_fullname']."|index.php?cat=". (FIRST_USER_CAT + (int) $subcat['user_id']) ."\n";
get_tree_album_data(FIRST_USER_CAT + (int) $subcat['user_id'],$ident '.');
}
}
} else {
if ($category == USER_GAL_CAT) {
$sql "SELECT aid,title FROM {$CONFIG['TABLE_ALBUMS']} WHERE category = $category ".$album_filter." ORDER BY pos";
} else {
$unaliased_album_filter str_replace('a.','',$album_filter);
$sql "SELECT aid,title FROM {$CONFIG['TABLE_ALBUMS']} WHERE category = $category " .$unaliased_album_filter ." ORDER BY pos";
}
$result db_query($sql);
if (($cat_count mysql_num_rows($result)) > 0) {
$rowset db_fetch_rowset($result);
foreach ($rowset as $subcat) {
$catStr .= $ident."|".htmlentities($subcat['title'])."|thumbnails.php?album=".$subcat['aid']."\n";
}
}
}
}
?>


5.  Open yourtheme/template.html, put this somewhere:
Code: [Select]
{HOR_MENU}

6.  Open yourtheme/theme.php, add this function:
Code: [Select]
function theme_hor_menu() {
require_once("hor_menu.php");
}

7.  Find:
Code: [Select]
        '{MAIN_MENU}' => theme_main_menu(),
        '{ADMIN_MENU}' => theme_admin_mode_menu(),
Add:
Code: [Select]
'{HOR_MENU}' => theme_hor_menu(),

Logged
GO IRISH
Pages: [1]   Go Up
 

Page created in 0.027 seconds with 20 queries.