well basically i ended up just checking to see if the gallery existed with the same name as the title of the current page and if it did, showed a link to it. if you still need it, 10 months later... the code is below.
// GALLERY FUNCTIONS - 07.06.08
function has_gallery($title)
{
global $wpdb;
$table = $wpdb->prefix . "ngg_gallery";
$sql = "select count(gid) from " . $table . " where title like '%" . str_replace(".","",$title) . "%'";
if ( $wpdb->get_var($sql) != 0 )
return true;
else
return false;
}
function get_gallery($title)
{
global $wpdb;
$table = $wpdb->prefix . "ngg_gallery";
return $wpdb->get_var("select gid from " . $table . " where title like '%" . $title . "%' limit 1;");
}
function gallery_link( $title )
{
global $wpdb;
$table = $wpdb->prefix . "ngg_gallery";
return '<p class="gallery-link">For more photos from ' . $title . ', please visit the <a>get_var("select name from " . $table . " where title like '%" . str_replace(".","",$title) . "%' limit 1") . '/">' . $title . ' Photo Gallery</a></p>';
}
function gallery_link_no_article( $title )
{
global $wpdb;
$table = $wpdb->prefix . "ngg_gallery";
return '<p class="gallery-link">Even though we haven\'t written an article about ' . $title . ' yet, we have been there and have added a gallery for you to view. Please visit the <a>get_var("select name from " . $table . " where title like '%" . str_replace(".","",$title) . "%' limit 1") . '/">' . $title . ' Photo Gallery</a> to view the photos from this park.</p>';
}