• [MOD] Left Gallery QuickList 4 0 5 1
Currently:  

Author Topic: [MOD] Left Gallery QuickList  (Read 112400 times)

0 Members and 1 Guest are viewing this topic.

Offline budduke

  • Hero Member
  • *****
  • Posts: 506
    • View Profile
    • http://www.budduke.com
[MOD] Left Gallery QuickList
« on: April 25, 2009, 10:31:46 PM »
[MOD] Left Gallery Quick List V1.03

I was asked by another person if this could be done or not so I gave it a try and it worked!
It is based on JQuery's Treeview script that can be found at
http://docs.jquery.com/Plugins/Treeview

Demo: http://www.budduke.com/gallery

Backup the following files before you begin...
includes/page_header.php
includes/functions.php
lang/english/main.php
your template folder/home.html
your template folder/categories.html
your template folder/header.html


Revisions:
1.0 first try at it
1.01 fixed page number problem with modifield jquery.treeview.js file
1.02 fixed session issue problems and location highlighting when page#rs involved.
  • replace the jquery.treeview.js file with the new one in the zip file attached
  • replace the insert in the header.html and the functions.php files to fix these issues
1.03 fixed the hide list till page load problem with the updated code.


Let's begin with the mod...


New files added in attached zip file (The Treeview script from jquery)
In your template folder create a folder and call it "quickscript" and copy all files from the zip folder to that directory along with a sub folder called images...
the finished path should look likt templates/your template directory/quickscript/images


in the includes/page_header.php file
look for
Code: [Select]
?>insert before
Code: [Select]
//-----------------------------------------------------
//--- MOD Left Quicklist -------------------------------
//-----------------------------------------------------
$left_quicklist = get_left_quicklist($cat_id);
$site_template->register_vars(array(
"left_quicklist"   => $left_quicklist,
"lang_left_quicklist" => $lang['left_quicklist']
));
unset($left_quicklist);
// END MOD Left quicklist

in the includes/functions.php file (updated for version 1.03)
look for
Code: [Select]
?>insert before
Code: [Select]
//MOD Left QuickList
function get_left_quicklist_bits($cat_id, $cid = 0, $depth = 1) {
  global $site_db, $drop_down_cat_cache, $cat_cache, $site_sess;
//config area
$left_quick_length=24; //length of category name, 0-3 =off (if on, will shorten name to fit with ... after it)
$adjust_depth=1; // try to adjust for depth for right side to line up
$with_folder=0; // if you want a folder to be displayed then set this to 1 (I thought it took to much screenspace)
//end config
  if (!isset($drop_down_cat_cache[$cid])) {
    return "";
  }
  $category_list = "";
  foreach ($drop_down_cat_cache[$cid] as $key => $category_id) {
    if (check_permission("auth_viewcat", $category_id)) {
$quick_cat_name=format_text($cat_cache[$category_id]['cat_name'],2);
$left_quick_length_var= $left_quick_length;
$test=strlen($quick_cat_name);
if ($adjust_depth && ($depth >1)){
$left_quick_length_var = $left_quick_length -(($depth-1)*3) -(($depth-1)*$with_folder);
}
if (($left_quick_length_var > 3)  && (strlen($quick_cat_name)> $left_quick_length_var) ){
$quick_cat_name= substr($quick_cat_name, 0, ($left_quick_length_var - 3))."...";
}
if ($with_folder){
$category_list .= "<li><span class='folder'><a href='".$site_sess->url('categories.php?'.URL_CAT_ID.'='.$category_id)."'>".$quick_cat_name."</a></span>";
}
else {
      $category_list .= "<li><a href='".$site_sess->url('categories.php?'.URL_CAT_ID.'='.$category_id)."'>".$quick_cat_name."</a>";
      }
 $result= get_left_quicklist_bits($cat_id, $category_id, $depth + 1);
  if ($result){
$category_list .= "<ul>".$result."</ul></li>";
}
else {
$category_list .= "</li>";
}
   }
   }
  unset($drop_down_cat_cache[$cid]);
  return $category_list;
}

function get_left_quicklist($cat_id) {
  global $drop_down_cat_cache, $cat_parent_cache;
  $category = "<ul id='left_quicklist_nav' class='filetree' style='display: none'>";
  $drop_down_cat_cache = array();
  $drop_down_cat_cache = $cat_parent_cache;
  $result= get_left_quicklist_bits($cat_id);
  if ($result){
$category .= $result."</ul>";
   }  
  return $category;
}
//END MOD Left QuickList


in the lang/english/main.php file
look for
Code: [Select]
?>insert before
Code: [Select]
//-----------------------------------------------------
//--- Left Quick List -------------------------------------
//-----------------------------------------------------
$lang['left_quicklist'] = "Gallery Quick List";


in your template folder/header.html file (updated for version 1.03)
look for
Code: [Select]
</head>insert before
Code: [Select]
<!-- MOD Left Quicklist -->
<link rel="stylesheet" href= "{template_url}/quickscript/jquery.treeview.css" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script>
<script src= "{template_url}/quickscript/jquery.treeview.js" type="text/javascript"></script>
<script language="javascript" type="text/javascript">
var urlSessName = "<?=SESSION_NAME;?>";
var urlPageName = "<?=URL_PAGE;?>";
$(document).ready(function(){

// first example
$("#left_quicklist_nav").treeview({
collapsed: true,
unique: true,
persist: "location"
});
});
onload=function() {
     document.getElementById('left_quicklist_nav').style.display ='block';
 }
</script>
<!-- END MOD Left Quicklist -->


in both your template folder/home.html and your template folder/categories.html files
Place this code where you would like to display the list on the left side
My example look for
Code: [Select]
{endif random_image}insert after in both files...
Code: [Select]
 <!--MOD left Quicklist-->
                  <table width="150" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td class="head2" height="20"> <img src="{template_url}/images/spacer.gif" alt="" width="4" height="4" />{lang_left_quicklist}</td>
                    </tr>
                    <tr>
                      <td class="tablebgcolor"><img src="{template_url}/images/spacer.gif" alt="" width="1" height="1" /></td>
                    </tr>
                    <tr>
                      <td>
                        {left_quicklist}
                      </td>
                    </tr>
                    <tr>
                      <td class="tablebgcolor"><img src="{template_url}/images/spacer.gif" alt="" width="1" height="1" /></td>
                    </tr>
                  </table>
 <!-- END MOD Left Quicklist-->

In the includes/functions.php file you will see at the start of my functions some config settings that you can play with
If your sub categories go real real real deep you may want to place this somewhere else on your template to give it more room.

Inside the quickscript folder there is a jquery.treeview.css file that you can modify to fit into your template better.
The .treeview, .treeview ul and the .treeview ul both at the top of the css file were the best place I found to modify to get the background color to match your template.
There is also .treeview a.selected area that is the background color used for the category you are currently viewing

That is the end of modification, you should now have a quicklist on your site...






 
« Last Edit: August 15, 2010, 08:53:59 PM by budduke »
Buddy Duke
www.budduke.com

Offline whosthis.ee

  • Newbie
  • *
  • Posts: 32
    • View Profile
Re: [MOD] Left Gallery QuickList
« Reply #1 on: April 28, 2009, 01:34:51 PM »
great mod

works fine

Offline mawenzi

  • Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
Re: [MOD] Left Gallery QuickList
« Reply #2 on: April 28, 2009, 01:46:22 PM »
... thanks for sharing ...  :D
... moved to Mods & Plugins (Releases & Support) ...
Your first three "must do" before you ask a question ! ( © by V@no )
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

You are on search for top 4images MOD's ?
- then please search here ... Mawenzi's Top 100+ MOD List (unsorted sorted) ...

Offline Nicky

  • Administrator
  • 4images Guru
  • *****
  • Posts: 3.195
    • View Profile
Re: [MOD] Left Gallery QuickList
« Reply #3 on: April 28, 2009, 04:37:27 PM »
hi budduke,

nice mod...

thank you for sharing!
cheers
Nicky
Your first three "must do" before you ask a question ! (© by V@no)
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

nicky.net 4 4images
Signature stolen from mawenzi

Offline whosthis.ee

  • Newbie
  • *
  • Posts: 32
    • View Profile
Re: [MOD] Left Gallery QuickList
« Reply #4 on: April 28, 2009, 05:35:16 PM »
but its not opening the google friendly urls

how to fix this ??

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [MOD] Left Gallery QuickList
« Reply #5 on: April 29, 2009, 01:45:37 AM »
In the new code in functions.php find:
Code: [Select]
   if (check_permission("auth_viewcat", $category_id)) {insert below:
Code: [Select]
$category_url = $site_sess->url(ROOT_PATH."categories.php?".URL_CAT_ID."=".$category_id);

Find:
Code: [Select]
$category_list .= "<li><span class='folder'><a href=categories.php?cat_id=".$category_id.">".$quick_cat_name."</a></span>";
Replace with:
Code: [Select]
$category_list .= "<li><span class='folder'><a href=".$category_url.">".$quick_cat_name."</a></span>";


Find next:
Code: [Select]
     $category_list .= "<li><a href=categories.php?cat_id=".$category_id.">".$quick_cat_name."</a>";
Replace with:
Code: [Select]
     $category_list .= "<li><a href=".$category_url.">".$quick_cat_name."</a>";



Find next:
Code: [Select]
  global $site_db, $drop_down_cat_cache, $cat_cache;
Replace with:
Code: [Select]
  global $site_db, $drop_down_cat_cache, $cat_cache, $site_sess;
« Last Edit: November 20, 2009, 02:09:03 AM by V@no »
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline 4ella

  • Jr. Member
  • **
  • Posts: 90
    • View Profile
    • http://www.dancersrecruit.com/pictures/
Re: [MOD] Left Gallery QuickList
« Reply #6 on: April 30, 2009, 01:49:02 PM »
Very nice , works perfect , thanks a lot budduke

http://www.dancersrecruit.com/pictures/
4IMAGES 1.7.6 version/default theme
Apache version   2.2.11 (Unix)
PHP version   5.2.9
MySQL version   5.0.75-community-log
Architecture   x86_64
Operating system   Linux

Offline 4ella

  • Jr. Member
  • **
  • Posts: 90
    • View Profile
    • http://www.dancersrecruit.com/pictures/
Re: [MOD] Left Gallery QuickList
« Reply #7 on: April 30, 2009, 02:42:15 PM »
Very nice , works perfect , thanks a lot budduke

Wanted to ask if somebody possibly know: When reload current page , left gallery quicklist due to my deep categories gallery spreads to the very wide (what doesnt look like very nice ) and after 2 seconds it arranges itself on exact place , Can I avoid it ? I saw budduke gallery , it makes the same , but only for a while (i know he has 300 categories , I have 1000 but maybe someone knows a trick how to do it ) I had the same problem with language flags , when reload it showed language names and after flags so I had to put the the lang flags to another place and had to shorten the language names , left gallery quicklist fits best on the left sidebar so i wouldn't like  to miss it there ,  thanks Daniel .
« Last Edit: April 30, 2009, 03:00:08 PM by 4ella »

http://www.dancersrecruit.com/pictures/
4IMAGES 1.7.6 version/default theme
Apache version   2.2.11 (Unix)
PHP version   5.2.9
MySQL version   5.0.75-community-log
Architecture   x86_64
Operating system   Linux

Offline 4ella

  • Jr. Member
  • **
  • Posts: 90
    • View Profile
    • http://www.dancersrecruit.com/pictures/
Re: [MOD] Left Gallery QuickList
« Reply #8 on: April 30, 2009, 10:24:02 PM »
I had to remove it :( , but very nice MOD anyway for everybody with not too many cats , will be happy if someone will explain how managed to get to put it in left sidebar when having many deep categories

http://www.dancersrecruit.com/pictures/
4IMAGES 1.7.6 version/default theme
Apache version   2.2.11 (Unix)
PHP version   5.2.9
MySQL version   5.0.75-community-log
Architecture   x86_64
Operating system   Linux

Offline Sunny C.

  • Addicted member
  • ******
  • Posts: 1.808
  • I ♥ 4I
    • View Profile
Re: [MOD] Left Gallery QuickList
« Reply #9 on: April 30, 2009, 10:36:56 PM »
Ich finde der Fix von Vano sollte im ersten Post Editiert werden bzw. zugefügt werden!

@budukke,

very nice! THX

Offline budduke

  • Hero Member
  • *****
  • Posts: 506
    • View Profile
    • http://www.budduke.com
Re: [MOD] Left Gallery QuickList
« Reply #10 on: May 01, 2009, 10:52:16 PM »
Very nice , works perfect , thanks a lot budduke

Wanted to ask if somebody possibly know: When reload current page , left gallery quicklist due to my deep categories gallery spreads to the very wide (what doesnt look like very nice ) and after 2 seconds it arranges itself on exact place , Can I avoid it ? I saw budduke gallery , it makes the same , but only for a while (i know he has 300 categories , I have 1000 but maybe someone knows a trick how to do it ) I had the same problem with language flags , when reload it showed language names and after flags so I had to put the the lang flags to another place and had to shorten the language names , left gallery quicklist fits best on the left sidebar so i wouldn't like  to miss it there ,  thanks Daniel .

I saw that also when I ran the script the first time. It seems the different browsers handle it differently. I have very limited knowledge of javascript but I think the problem is the entire page had to be loaded before the javascript kicks in.
Since they have to be list items to work correctly, the browser loads it as a normal list of links until the javascript get to changing it. I saw no way to preload it in anyway before displaying.
I sometimes wonder if flash or regular java may handle this any better? Maybe look into it when I have a little play time.
Buddy Duke
www.budduke.com

Offline whosthis.ee

  • Newbie
  • *
  • Posts: 32
    • View Profile
Re: [MOD] Left Gallery QuickList
« Reply #11 on: May 02, 2009, 12:19:55 AM »
In the new code in functions.php find:
Code: [Select]
    if (check_permission("auth_viewcat", $category_id)) {insert below:
Code: [Select]
$category_url = $site_sess->url(ROOT_PATH."categories.php?".URL_CAT_ID."=".$category_id);

Find:
Code: [Select]
$category_list .= "<li><span class='folder'><a href=categories.php?cat_id=".$category_id.">".$quick_cat_name."</a></span>";
Replace with:
Code: [Select]
$category_list .= "<li><span class='folder'><a href=".$category_url.">".$quick_cat_name."</a></span>";


Find next:
Code: [Select]
      $category_list .= "<li><a href=categories.php?cat_id=".$category_id.">".$quick_cat_name."</a>";
Replace with:
Code: [Select]
      $category_list .= "<li><a href=".$category_url.">".$quick_cat_name."</a>";



Hi

i tried the same

but its not working for me

Offline whosthis.ee

  • Newbie
  • *
  • Posts: 32
    • View Profile
Re: [MOD] Left Gallery QuickList
« Reply #12 on: May 02, 2009, 12:25:26 AM »
how to display all the categories in the expand view

Offline 4ella

  • Jr. Member
  • **
  • Posts: 90
    • View Profile
    • http://www.dancersrecruit.com/pictures/
Re: [MOD] Left Gallery QuickList
« Reply #13 on: May 02, 2009, 03:46:24 AM »
@budduke
Thanks a lot for your respond , this quicklist  is really very very nice and usefull , I had to remove it , but I really miss it now :(  I will wait if you will happily find a solution, but I think that it is only my very poor designer ability , that I'm not able to make left sidebar firm like e.g Mawenzi's web where everything is always firm - fest

http://www.dancersrecruit.com/pictures/
4IMAGES 1.7.6 version/default theme
Apache version   2.2.11 (Unix)
PHP version   5.2.9
MySQL version   5.0.75-community-log
Architecture   x86_64
Operating system   Linux

Offline budduke

  • Hero Member
  • *****
  • Posts: 506
    • View Profile
    • http://www.budduke.com
Re: [MOD] Left Gallery QuickList
« Reply #14 on: May 02, 2009, 02:39:31 PM »
how to display all the categories in the expand view
in your template folder...
look in the header.html file for the
Code: [Select]
$("#left_quicklist_nav").treeview({
collapsed: true,
unique: true,
persist: "location"
});
Collapsed=true for collapsed list or if you want to expand all categories collapsed= false
unique=true for only only branch being open at a time or unique = false if you want to open any at the same time
Persist variable is what highlights the location you are currently at in the gallery


Hope that help!
« Last Edit: May 04, 2009, 12:25:54 AM by budduke »
Buddy Duke
www.budduke.com