Making Gallery2 Joomla component point to Gallery2 URL

Request: The excellent Gallery2 Bridge component/module for Joomla has one “shortcoming”: it points to the embedded Joomla component. Some applications/websites will require the Bridge’s functionality to embed the Gallery, but will want to link to Gallery2 and not the embedded component.

Solution:

The URL link is created using the $baseUrl variable in /components/com_gallery2/init.inc.

At around line 83 of the Gallery2 Bridge component, there are the statements that assign the link URL:


/* build url according to our current Itemid and our ItemidList */
if(!empty($ItemidList) && in_array($Itemid, $ItemidList)){
        $baseUrl = 'index.php?option=com_gallery2&Itemid='.$Itemid;
} else if(!empty($ItemidList)){
        $baseUrl = 'index.php?option=com_gallery2&Itemid='.(int) $ItemidList[0];
} else {
        $baseUrl = 'index.php?option=com_gallery2&Itemid=99999999';
}

Right after this, add one statement to specify the URL of the actual Gallery2 site:


/* $g2Uri is specified earlier in the code */
$baseUrl = $g2Uri;

and that’s it - all Gallery2 Bridge components and modules should now point to the live Gallery2 site.

No Comment

No comments yet

Leave a reply