We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

New Extension: Related Gallery

Development and Programming

plank's avatar
plank
30 posts
16 years ago
plank's avatar plank

Hi.

My first extension release.

This extension creates a new Custom Field, Full Gallery, which allows you to relate a full gallery to a weblog entry.

Not submitting it yet to the Extensions lib, since I have to go over the whole checklist (ie: I can’t guarantee it works under php 4.3, but afaik, it should).

Either way, thought some people might find it handy (well, i did for this one project).

Some usage docs are in the comments, so check that out.

Has the ability to exclude gallerys from the drop down (see the extension settings).

Feedback please if you see me doing anything wrong, or ways to improve it - still learning EE.

Basically stores the Cat ID of the gallery you relate to, and then you can pull it out and do what you will with it. Handy for one gallery page, which dynamically populates based on the cat.

Here’s a copy of the helper I use to pull the gallery short name for the gallery tag. the default gallery short name is set in the function, so you would want to mod it for your needs.

/**
 * Returns a gallery short name from a given gallery category id.
 * Defaults to page_content
 * @param  int $cat_id
 * @return string
 **/
function get_gal_shortname($cat_id = 0)
{
  global $DB;
  
  $sql = "SELECT  gal.gallery_short_name 
      FROM exp_galleries AS gal
      INNER JOIN exp_gallery_categories AS gc  ON gc.gallery_id = gal.gallery_id  
      WHERE gc.cat_id = '{$cat_id}'";

  $result = $DB->query($sql);

  if($result->num_rows > 0) {
    return $result->row['gallery_short_name'];      
  } else {
    return 'page_content';
  }
      
}
       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.