Collapsible Navigation tool for a Gallery Category Menu
Posted: 30 August 2008 08:42 PM   [ Ignore ]  
Grad Student
Avatar
Rank
Total Posts:  69
Joined  05-09-2005

Hello:

I’ve created a gallery navigation bar of sorts that lists all gallery categories with subcategories ‘nested’ beneath them.  What I want to do is be able to expand/collapse the list of subcategories by clicking on an icon or the category lable.  I’m using some {if/else if} statements to create linked vs. grayed out sub-category names, but otherwise, I think the code is pretty standard. 

The gallery page for my site can be seen here: www.canted.com/index.php/tca/tca_idxpg/

The code I use is this:

At the top of the page I put these (I use the same code on more than one site)
{assign_variable:blog_name="tca"}
{assign_variable
:gallery_name="tcag"}


{exp
:gallery:categories gallery="{gallery_name}"}
<table border="0" cellpadding="0" cellspacing="0" width="164" >
    
{category_row}{row_start}<tr>{/row_start}{row}
    
<td>
        <
div class="smallStuff">&nbsp; <br /></div>
        
{category}
    
</td>
    
{/row}{row_end}</tr>{/row_end}{/category_row}
    {subcategory_row}{row_start}
<tr>{/row_start}{row}
    
<td>
    <
div class="link">
    
{if total_files < 1}
        
- <font color="AFAFAF">{category}</font>
    
{if:else}
        
- <a href="{category_path={blog_name}/{blog_name}_idxpg_tn/}" title="{category description}" alt="{category_description}">{category}</a>
    
{/if}
    
</div>
    </
td>
    
{/row}
    {row_end}
</tr>{/row_end}{/subcategory_row}
    
</table>
{/exp:gallery:categories}

I suspect that’s a brute force approach, but it gets me what I want—if I can find a way to collapse the list.

I’ve spent the day playing with ddanimated div, toggle menu, and other jquery items, but I’m just not sure where to insert the added code, and I’ve worked myself in circles, so any advice, guidance, or examples would be most welcome.

Thanks in advance
/npl

Profile
 
 
Posted: 31 August 2008 07:43 AM   [ Ignore ]   [ # 1 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1463
Joined  09-16-2004

I’d suggest simplifying the markup to a a nested list (which is what it is after all) and have a look at the Jquery UI Accordion plugin.
That page has several examples where you can check both the markup used and the script code. Good luck smile

 Signature 

Peace, e-man.
stookstudio.com, websites built with care and web standards. LinkedIn profile

Profile
 
 
Posted: 31 August 2008 05:27 PM   [ Ignore ]   [ # 2 ]  
Grad Student
Avatar
Rank
Total Posts:  69
Joined  05-09-2005

e-man, thank you.

I considered that and I looked at the jquery accordion code, but I was under the impression (and am still, after rereading the EE Gallery user docs) that I have to use the ExpEng markup for gallery categories, which does not seem to have a nested option (i.e., style=“nested”).

Are you saying that I need not use the table/row code for gallery categories; that I can code gallery categories the way I would weblog categories? That sure would be a lot easier and cleaner!

Either way, I would be most grateful for a code-pointer (which tags to use, if not the actual markup).

Again, thanks in advance.

/npl

Profile
 
 
Posted: 31 August 2008 05:39 PM   [ Ignore ]   [ # 3 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1463
Joined  09-16-2004

My bad, I didn’t notice that it was the gallery categories code, not the standard ones.
Seems odd that there is a category list tag but that that only shows the main categories, not the subcategories.
To be honest, I’ve never used the gallery so I’m not much help there I’m afraid.

 Signature 

Peace, e-man.
stookstudio.com, websites built with care and web standards. LinkedIn profile

Profile
 
 
Posted: 31 August 2008 06:03 PM   [ Ignore ]   [ # 4 ]  
Grad Student
Avatar
Rank
Total Posts:  69
Joined  05-09-2005

e-man, thanks again….

I hadn’t tried the category list code.  I was focused on having the subcategories display in a different font size, etc., than on nesting, and so I went with the table/row code.  I think I’ll try the category list tag and see what it gets me.

As for what’s there, I did try using the ddaccordion which lets you put the expand/collapse code separate from the list, but it requires each category to have a unique name, which has to be coded in advance of the list generation.  In other words, there does not seem to be a way to make it dynamic, based on the categories that exist at the time.

Anyway, thanks again.

/npl

BTW, I looked at your site and recent work examples.  Very nice and very neat.  The Antipodean Dance text on the main screen fades a little too fast for me to read, but I’m an old guy, so I’m used to that…  Otherwise, it’s very appealing stuff.

v/r

Profile
 
 
Posted: 31 August 2008 06:17 PM   [ Ignore ]   [ # 5 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1463
Joined  09-16-2004
npl - 31 August 2008 06:03 PM

BTW, I looked at your site and recent work examples.  Very nice and very neat.  The Antipodean Dance text on the main screen fades a little too fast for me to read, but I’m an old guy, so I’m used to that…  Otherwise, it’s very appealing stuff.

Thanks for the compliment, it took me a few seconds to get the antipodean dance reference though smile  (I’ll set the timeout a little slower, you may be right about the speed!)

 Signature 

Peace, e-man.
stookstudio.com, websites built with care and web standards. LinkedIn profile

Profile
 
 
Posted: 31 August 2008 06:30 PM   [ Ignore ]   [ # 6 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1463
Joined  09-16-2004

Just for giggles, what kind of markup does this produce with your data?

{exp:gallery:categories gallery="{gallery_name}"}

    {category_row}{row_start}
<ul>{/row_start}{row}
    
<li>
        <
div class="smallStuff">&nbsp; {category}</div>
        
    </
li>
    
{/row}{row_end}</ul>{/row_end}{/category_row}

    {subcategory_row}{row_start}
<ul>{/row_start}{row}
    
<li>
    <
div class="link">
    
{if total_files < 1}
        
- <font color="AFAFAF">{category}</font>
    
{if:else}
        
- <a href="{category_path={blog_name}/{blog_name}_idxpg_tn/}" title="{category description}" alt="{category_description}">{category}</a>
    
{/if}
    
</div>
    </
li>
    
{/row}
    {row_end}
</ul>{/row_end}{/subcategory_row}


{
/exp:gallery:categories}

 Signature 

Peace, e-man.
stookstudio.com, websites built with care and web standards. LinkedIn profile

Profile
 
 
Posted: 31 August 2008 08:52 PM   [ Ignore ]   [ # 7 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  381
Joined  03-01-2006

You can ignore the fact that the default categories code includes all that table stuff. Here’s some code I’ve used before that uses just a simple unordered list:

<ul>
{exp:gallery:categories gallery="gallery"}
{category_row}
{row}
<li><h3><a href="{category_path=gallery/category}">{category}</a> ({total_files} photos)</h3></li>{/row}
{
/category_row}       
{
/exp:gallery:categories}
</ul>

 Signature 

John Faulds - Tyssen Design | Member of EE Pro Network

Profile
 
 
Posted: 01 September 2008 09:55 AM   [ Ignore ]   [ # 8 ]  
Grad Student
Avatar
Rank
Total Posts:  69
Joined  05-09-2005

e-man & Tyssen,

  Thank you both.  I tried out both of your suggestions and variations and combinations of both, including a switch to the category_list tag, but none of them does exactly what I want.  I even tried using just the <li> tag without the <ul> or <ol> tags, and that actually worked, except for the bullet/indent, so I tried doing something with the subcat_marker, but in the end I just couldn’t think my way through this.  Basically, I want to show empty categories grayed out, I want the subcat links to be a smaller font and to have a marker of some kind, and I want to be able to collapse the whole so that the visitor doesn’t have to scroll around so much.  I know I’ll need to compromise—maybe even do a completely different layout (ugh)—I’m just not sure how to get there from here.

One thing that would help immensely is if I could use a conditional to test for a subcategory, e.g., {if subcategory=“true”}.  Any ideas on this one?  If I could do that, I could use just one line of code like Tyssen’s, add the subcat marker code, _AND_ apply the ‘link’ formatting.  And that would get me where I need to be to use the jquery accordion code, I think.

Anyway, both of your suggestions gave me some very good ideas and I’ve learned a lot just fiddlin’ with it, and, if nothing else, you’ve showed me how to clean up the code so that I’ve reduced it to this:

{exp:gallery:categories gallery="{gallery_name}"}
   {category_row}{row}
      
<div class="smallStuff">&nbsp; <br /></div>
      
{category}
   {
/row}{/category_row}
   {subcategory_row}{row}
      
<div class="link">
      
{if total_files < 1}
         
- <font color="AFAFAF">{category}</font>
      
{if:else}
         
- <a href="{category_path={blog_name}/{blog_name}_idxpg_tn/}" title="{category description}" alt="{category_description}">{category}</a>
      
{/if}
      
</div>
   
{/row}{/subcategory_row}
{
/exp:gallery:categories}

All in all, a lot of work for minimal gain, but who knows what will come of it…

Again, thanks!

/npl

Profile
 
 
Posted: 01 September 2008 09:50 PM   [ Ignore ]   [ # 9 ]  
Grad Student
Avatar
Rank
Total Posts:  69
Joined  05-09-2005

Just by way of follow-up:

I am getting closer, I think. I’ve managed to work some CSS and some ExpEng code together to get it looking almost the way I want using an <li> tag and just the category row. I’m not sure yet, but I think, I can make this work with the accordion code if it lets me style the category and the subcategory (stuff inside the collapsible part) differently.

The test-code there now (a kludge, which I will clean up when I get it working) is this:

{exp:gallery:categories gallery="{gallery_name}"}
{category_row}{row}
  
<div class="link">
   <
STYLE type="text/css">
     
LI.catList {list-style-type: none; list-style-position: outside;}
   
</STYLE>
   <
li class="catList">
   
{subcat_marker}-&nbsp;{/subcat_marker}
   {if total_files
< 1}
     {category}
<br />
   
{if:else}
     
<a href="{category_path={blog_name}/{blog_name}_idxpg_tn/}" title="{category descripton}" alt="{category_description}">{category}</a><br />
   
{/if}
   
</li>
   </
div>
{/row}{/category_row}
{
/exp:gallery:categories}

I’m not sure if this keys any ideas in anyone, but if anyone has a suggestion, I’d love to hear it.

As always, thanks in advance.

/npl

Profile
 
 
Posted: 02 September 2008 04:41 AM   [ Ignore ]   [ # 10 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1463
Joined  09-16-2004

It’s hard to say without seeing the actual markup this produces, but it shouldn’t be that hard with the proper css/html.
jQuery has some very powerful selectors, as soon as you have a “hook” (a claas or id usually) you can get to pretty much any element in the dom.

 Signature 

Peace, e-man.
stookstudio.com, websites built with care and web standards. LinkedIn profile

Profile
 
 
Posted: 03 September 2008 10:48 PM   [ Ignore ]   [ # 11 ]  
Grad Student
Avatar
Rank
Total Posts:  69
Joined  05-09-2005

e-man, thanks, but I’ve pretty much given up on that for now.  Nothing I do works, and there is just no way to make the gallery do everything I want it to anyway, so I’m looking at maybe moving everything out of EE to some other gallery/phot manager, and just linking to it somehow.

I’ve posted a request for help to the “how do I do this” forum, but so far, no answers, so I am assuming it either can’t be done or that I need to learn a lot more about scripting and so on…

Anyway, thanks again for your interest.

BTW, the simple solutions would have been as you pointed out a style=nested for gallery categories, or an ability to test for subcategories w/ a conditional. 

Ever Onwards….

Profile
 
 
Posted: 04 September 2008 08:06 AM   [ Ignore ]   [ # 12 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1463
Joined  09-16-2004

As a last suggestion, why not use the regaular weblog module to power your gallery?
I for one never understood the need for a separate gallery module…

 Signature 

Peace, e-man.
stookstudio.com, websites built with care and web standards. LinkedIn profile

Profile
 
 
Posted: 05 September 2008 12:42 AM   [ Ignore ]   [ # 13 ]  
Grad Student
Avatar
Rank
Total Posts:  69
Joined  05-09-2005

Well, I’ve got several thousand images that will ultimately be on-line, and I like being able to upload just one size and have the thumbnail and a watermark automatically applied, and have the images categorized (and be easily recategorized), etc.  Basically, I was looking for something that would make it easier than what I was doing before (all manual), and so far that’s been pretty much the case, but the batch loading and naming has proven to be a bit klunky too, so I was already leaning toward seeking another solution. 

Anyway, thanks again for your time.  If I find a way to do what I want, I’ll post back here…

Regards,
/npl

Profile
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 09:33 AM
Total Registered Members: 65086 Total Logged-in Users: 34
Total Topics: 82224 Total Anonymous Users: 23
Total Replies: 441923 Total Guests: 198
Total Posts: 524147    
Members ( View Memberlist )