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: Oh oh Oh !!! Another way (dhtml) to surf categories ...  (Read 11336 times)

0 Members and 1 Guest are viewing this topic.

Rodinou

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 346
  • Tournicoti, Tournicota
    • http://www.sortons.net
Oh oh Oh !!! Another way (dhtml) to surf categories ...
« on: June 20, 2005, 05:16:29 am »

Ready to pay if someone can do this FOR COPPERMINE

http://www.alistapart.com/d/complexdynamiclists/order.html
http://www.alistapart.com/articles/complexdynamiclists/

intuitive, very practice, highly configurable, ONLY ONE load (mmmmmmm).
« Last Edit: October 17, 2005, 08:09:43 am by GauGau »
Logged

Titooy

  • VIP
  • Coppermine addict
  • ***
  • Offline Offline
  • Posts: 736
    • under construction...
Re: Oh oh Oh !!! Another way (dhtml) to surf categories ...
« Reply #1 on: July 03, 2005, 01:41:22 pm »

Code: [Select]
<?php
define
('IN_COPPERMINE'true);
require(
'include/init.inc.php');

global 
$CONFIG$HIDE_USER_CAT$FORBIDDEN_SET$cpg_show_private_album;
if (!empty(
$FORBIDDEN_SET) && !$cpg_show_private_album) {
    
$album_filter ' and ' str_replace('p.''a.'$FORBIDDEN_SET);
}
$sql "SELECT aid FROM {$CONFIG['TABLE_ALBUMS']} as a WHERE category>=" FIRST_USER_CAT $album_filter;
$result cpg_db_query($sql);
$private_album_count mysql_num_rows($result);
if (!
$private_album_count) {
    
$HIDE_USER_CAT 1;
}

function 
get_tree_subcat_data($parent) {
    global 
$CONFIG$HIDE_USER_CAT$catStr;
    if (
$CONFIG['categories_alpha_sort'] == 1) {
        
$cat_sort_order 'name';
    } else {
        
$cat_sort_order 'pos';
    }
    
$sql "SELECT cid, name " "FROM {$CONFIG['TABLE_CATEGORIES']} " "WHERE parent = '$parent' " "ORDER BY "$cat_sort_order;
    
$result cpg_db_query($sql);
    if (
mysql_num_rows($result) > 0) {
        
$rowset cpg_db_fetch_rowset($result);
        
$pos 0;
        
        foreach (
$rowset as $subcat) {
            if (
$subcat['cid'] == USER_GAL_CAT && $HIDE_USER_CAT == 1) {
                
            } else {
                
$catStr .= "<li>".$subcat['name']."\n\n";
                
$catStr .= "<ul>\n\n";
                
get_tree_subcat_data($subcat['cid']);
                
get_tree_album_data($subcat['cid']);
                
$catStr .= "</ul></li>\n";
            }
        }
        if (
$parent == 0) {
            
get_tree_album_data($parent);
        }
    }
}

function 
get_tree_album_data($category) {
    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 == USER_GAL_CAT) {
        
$sql "SELECT DISTINCT user_id, user_name FROM {$CONFIG['TABLE_USERS']}{$CONFIG['TABLE_ALBUMS']} WHERE  10000 + {$CONFIG['TABLE_USERS']}.user_id = {$CONFIG['TABLE_ALBUMS']}.category ORDER BY user_name ASC";
        
$result cpg_db_query($sql);
        if (
mysql_num_rows($result) > 0) {
            
$rowset cpg_db_fetch_rowset($result);
            foreach (
$rowset as $subcat) {
                
$catStr .= "<li>".$subcat['user_name']."\n";
                
$catStr .= "<ul>\n";
                
get_tree_album_data(FIRST_USER_CAT + (int) $subcat['user_id']);
                
$catStr .= "</ul></li>\n";
            }
        }
    } else {
        if (
$category == USER_GAL_CAT) {
            
$sql "SELECT aid,title FROM {$CONFIG['TABLE_ALBUMS']} WHERE category = $category ".$ALBUM_SET .$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 ".$ALBUM_SET .$unaliased_album_filter " ORDER BY pos";
        }
        
$result cpg_db_query($sql);
        if (
mysql_num_rows($result) > 0) {
            
$rowset cpg_db_fetch_rowset($result);
            foreach (
$rowset as $subcat) {
                
$catStr .= "<li><a href=\"thumbnails.php?album=".$subcat['aid']."\">".$subcat['title']."</a></li>\n";
            }
        }
    }
}

get_tree_subcat_data(0);

?>

<!DOCTYPE html
     PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Coppermine</title>
<link rel="stylesheet" type="text/css" href="http://www.alistapart.com/d/complexdynamiclists/finder.css" />
<script type="text/javascript" src="http://www.alistapart.com/d/complexdynamiclists/finder.js"></script>
</head>
<body>
<div id="finderparent">
<ul id="finder">
<?php
echo $catStr;
?>

</ul>
</div>
</body>
</html>
Replace cpg_db_ with db_ if you're using cpg 1.3.x

some browsers need the css and/or the script to be on the same server.
Logged

Rodinou

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 346
  • Tournicoti, Tournicota
    • http://www.sortons.net
Re: Oh oh Oh !!! Another way (dhtml) to surf categories ...
« Reply #2 on: July 03, 2005, 10:41:54 pm »

Ohhh yes !!! Works like a charm :) A little pb with IE (with HEIGHT when clicking)

http://www.sortons.net/photos/dhtmlCPG.htm

Imagine time you win for your visitors to surf on your album photo :) thanx !!! Titooy you are on my MSN ... wo when you have time, come on ! :)

ravendark

  • Coppermine newbie
  • Offline Offline
  • Posts: 12
Re: Oh oh Oh !!! Another way (dhtml) to surf categories ...
« Reply #3 on: October 01, 2007, 10:23:01 am »

anybody knows how to iclude this in anycontent.php? thanx
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Oh oh Oh !!! Another way (dhtml) to surf categories ...
« Reply #4 on: October 02, 2007, 08:32:10 am »

This is the paid help board. The thread has been marked as closed and is very old. Locking it now.
Logged
Pages: [1]   Go Up
 

Page created in 0.037 seconds with 20 queries.