MonoSlideShow Intergration (updated) with Category Image Selection
Posted: 17 July 2007 12:51 AM   [ Ignore ]  
Lab Assistant
RankRank
Total Posts:  162
Joined  01-22-2007

Full credit go’s to http://www.5pieces.com/index.php/tutorials/comments/monoslideshow_and_ee_gallery/ for this code and concept - this is just slightly tweaked and updated and addresses some of the issues I had with setting this up.

In the 5pieces tutorial it suggests to rename the image that you want to be the category image to be the same as the category name.

This isn’t very accessible for non-techy people, especially if they want to change existing category images, so what I’ve done is merge another of his tutorials - http://www.5pieces.com/index.php/tutorials/comments/alternative_gallery_template/ that makes use of category images and custom fields.

Taken from the Alternate Gallery Template page:

» Call Custom Field One Album Image
» Choose Text Formatting as ‘none’
» Choose type as ‘dropdown’
» Add 2 options
» Type ‘no’ as first then on new line type ‘yes’
» Save preferences

So once your gallery is all setup and your resizing info has been defined you make a custom field entry.

I changed the suggested ‘Album Image’ field text to be ‘Make Photo Category Title Image?’ - just made it a little easier to use.

With this customer field change made you can now use this mono_xml template (instructions on the mono_xml template are from the first tutorial).

{assign_variable:gallery_url="http://www.somesite.com/images/gallery_photos"}
{assign_variable
:gallery_name="galleryname"}
{assign_variable
:gallery_template="gallery"}
{assign_variable
:gallery_folder="relative path to gallery images"}
{assign_variable
:gallery_id="1"}
{assign_variable
:site_url="http://www.somesite.com"}

<?xml version
="1.0" encoding="UTF-8"?>
<slideshow>
    <
preferences

******************************************
**
INSERT MONOSLIDESHOWS PARAMETERS HERE - UNABLE TO KEEP THIS IN AS MY POST LENGTH WAS TOO LONG***
******************************************

    />
    
    
{exp:gallery:categories gallery="{gallery_name}"}
      {category_row}
      {row}
       
      {exp
:query sql="SELECT cat_folder FROM exp_gallery_categories WHERE gallery_id = '{gallery_id}' AND cat_id = '{cat_id}' ORDER BY cat_id DESC"}
      {exp
:query sql="SELECT filename, entry_id FROM exp_gallery_entries WHERE custom_field_one = 'yes'  AND cat_id = '{cat_id}' "}
            
<album thumbnail="{gallery_url}/{cat_folder}/{filename}_thumb.jpg" title="{category}" description="{category_description}"  imagePath="{gallery_url}{cat_folder}/" thumbnailPath="{gallery_url}{cat_folder}/">{/exp:query}{/exp:query}
                {exp
:gallery:entries gallery="{gallery_name}" category="{cat_id}"}
                {entries}    
                
<img src="{filename}.jpg" title="{title}" description="{caption}"/>
                
{/entries}
            
</album>
            
{/exp:gallery:entries}

      {
/row}
      {
/category_row}
      {
/exp:gallery:categories}
</slideshow>

Make sure you adjust the variables at the top.

The code at the bottom returns images that have the custom_field_one set to ‘yes’ and then displays that thumb nails as the category image.

One problem that I have come across is that if more than 1 image has the drop down set to yes then the xml output wont work. Is there a way I can limit the results to 1 or somehow gracefull handle more than 1 image having the custom field set to ‘yes’??

Otherwise this should work without a hitch.

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: 65027 Total Logged-in Users: 43
Total Topics: 82116 Total Anonymous Users: 22
Total Replies: 441313 Total Guests: 209
Total Posts: 523429    
Members ( View Memberlist )