Gallery Entries Tag to Show Child Categories
Posted: 14 November 2006 09:22 AM   [ Ignore ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1183
Joined  01-05-2006

I have my photo gallery set up with the following categories:

Category 1
——Sub 1.1
——Sub 1.2
Category 2
——Sub 2.1
——Sub 2.2
——Sub 2.3

Is there any way that I tell my {exp:gallery:entries /} tag to display all images in “Category 1”, sub categories inclusive?  Say, the latest ten images in either Sub 1.1 or Sub 1.2?

Thanks!

 Signature 

================================================
    Mark Huot
    http://markhuot.com
================================================

Profile
 
 
Posted: 14 November 2006 10:33 AM   [ Ignore ]   [ # 1 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1709
Joined  03-26-2006

Mark - I don’t think so. I asked a similar question a few weeks back when I was setting up my galleries. I ended up having to create a weblog for my photo gallery (arrrgh!) - which, when dealing with a lot of images is a real pain.

 Signature 

ryan masuga
—————
Masuga Design | Member, EE Pro Network
My EE Add-Ons | {devot:ee}
Twitter: masuga | masugadesign | devot_ee

Profile
 
 
Posted: 14 November 2006 10:36 AM   [ Ignore ]   [ # 2 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  23485
Joined  05-20-2002

mdesign is right- categories in the gallery are handled differently than they are by default in the weblog.  In the weblog, a child is also assigned to the parent.  In the gallery, that’s not the case.  So using tags, a top level cat in the gallery is only going to show the entries assigned to it- not to its children.

 Signature 

AKA rob1

Help Request TipsPro Network

Profile
 
 
Posted: 14 November 2006 12:03 PM   [ Ignore ]   [ # 3 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1183
Joined  01-05-2006

I needed a workaround to this and putting my gallery in a weblog didn’t seem right, so I wrote an extension to allow children entries.  all you do is add the attribute ‘children=“true”’ to your {exp:gallery:entries /} tag and it should then grab any children categories.

File Attachments
ext.gallery_entries_children_100.zip  (File Size: 2KB - Downloads: 288)
 Signature 

================================================
    Mark Huot
    http://markhuot.com
================================================

Profile
 
 
Posted: 14 November 2006 12:10 PM   [ Ignore ]   [ # 4 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1709
Joined  03-26-2006

First, let me complement you.

Second, let me tear out what little hair I have left wondering where this was a couple weeks ago.

Thanks, Mark.

 Signature 

ryan masuga
—————
Masuga Design | Member, EE Pro Network
My EE Add-Ons | {devot:ee}
Twitter: masuga | masugadesign | devot_ee

Profile
 
 
Posted: 14 November 2006 12:18 PM   [ Ignore ]   [ # 5 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  5890
Joined  11-23-2003

Mark is an extension monster.

 Signature 

EE 2.0:  A designers dream becomes a developers dream | Follow me on Twitter.

Profile
 
 
Posted: 14 November 2006 09:06 PM   [ Ignore ]   [ # 6 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1183
Joined  01-05-2006

EE is the real monster that can change to whatever you need with such a great module/extension/plugin interface.

 Signature 

================================================
    Mark Huot
    http://markhuot.com
================================================

Profile
 
 
Posted: 18 January 2007 07:15 AM   [ Ignore ]   [ # 7 ]  
Lab Assistant
RankRank
Total Posts:  257
Joined  05-26-2003

Trying to get this to work in my gallery but i think user error must be hampering me.

I have installed the extension in /system/extensions and enabled it in the Extensions manager control panel.

Then in my gallery category template I have:

{exp:gallery:entries gallery="{gallery_name}" children="true" orderby="date" sort="desc" columns="4" rows="8"}

<h2>{category}</h2>
<
p>{category_description}</p>
<
table class="tableBorder" cellpadding="6" cellspacing="1" border="0" width="100%" style="padding-top: 10px;">
{entries}
{row_start}
<tr>{/row_start}
{row}

<td class="thumbs">
<
a href="{id_path=scrapbook/image_full}"><img src="{thumb_url}"  class="border" width="{thumb_width}" height="{thumb_height}" border="0" title="{title}" /></a>
<
div class="title-small">{title}</div>
</
td>
{/row}
{row_blank}
<td class="thumbs">&nbsp;</td>{/row_blank}
{row_end}
</tr>{/row_end}
{
/entries}

However it is still only showing images from the selected category and not any sub categories. Any keen eyes spot the error? Using EE 1.5.1, cheers Kenny

 Signature 

ExpressionEngine 1.6.4 - Build:  20080808

Profile
 
 
Posted: 18 January 2007 07:40 AM   [ Ignore ]   [ # 8 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1183
Joined  01-05-2006

Can you try it without any other attributes, just the gallery= and children=?  Thanks.

Here is the code I used, that worked properly:

{exp:gallery:entries gallery="photos" category="{photo_category}" children="true" orderby="entry_date" sort="desc" limit="3"}
...
{/exp:gallery:entries}

 Signature 

================================================
    Mark Huot
    http://markhuot.com
================================================

Profile
 
 
Posted: 19 January 2007 07:34 AM   [ Ignore ]   [ # 9 ]  
Lab Assistant
RankRank
Total Posts:  257
Joined  05-26-2003

Hi Mark,
i tried what you suggested but it does something very odd when i add the category variable.
It seems to default to the first top level category I created (no matter what category is in the URL), it also displays a random selection of images!

Not sure what is going on there, I think I will try to create a new gallery with default code and see what happens,

thanks for your quick reply, Kenny

 Signature 

ExpressionEngine 1.6.4 - Build:  20080808

Profile
 
 
Posted: 19 January 2007 08:18 AM   [ Ignore ]   [ # 10 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1183
Joined  01-05-2006

And have you tried it with just the gallery= and children= attributes, nothing else?  When you did pass in a category, was it a parent category?  Were there children categories below the passed in category?

 Signature 

================================================
    Mark Huot
    http://markhuot.com
================================================

Profile
 
 
Posted: 19 January 2007 08:22 AM   [ Ignore ]   [ # 11 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1183
Joined  01-05-2006

Alright, I dug a little deeper and you’re going to have to assign a category= attribute, because I’m not sure where in EE the cat is parsed from the URL.  So try it with just the gallery=, children= and category= attributes.  Also make sure that the category you choose has children categories.  Finally make sure that there are photos in the children categories more recent that those in the parent category (or you’ll only see parent photos when sorting by date descending.

 Signature 

================================================
    Mark Huot
    http://markhuot.com
================================================

Profile
 
 
Posted: 31 August 2007 11:20 AM   [ Ignore ]   [ # 12 ]  
Lab Assistant
RankRank
Total Posts:  257
Joined  05-26-2003

Hi Mark,
just thought you would like to know that with debugging turned on an error appears when looking at a sub category page. It only appears for categories that have no children. The error does not appear on any other pages.

The error is:
Warning: Invalid argument supplied for foreach() in /blahblah/extensions/ext.gallery_entries_children.php on line 116

cheers Kenny

version 1.0.2 wink

 Signature 

ExpressionEngine 1.6.4 - Build:  20080808

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: 64553 Total Logged-in Users: 30
Total Topics: 81156 Total Anonymous Users: 15
Total Replies: 436586 Total Guests: 183
Total Posts: 517742    
Members ( View Memberlist )