Hi there, I'm not really that clued up on devoping modules etc.
I have had a good look through the list and there doesn't seem to be anything that suites my need.
I would like a link to be placed in the sidebar which says "View as Polaroids" and whould link to /gallery2/polaroid_gallery2.php?g2id=xxx
xxx being the id of the gallery we are viewing
Am I barking up the wrong tree here, is there a simpler way to do this, or is it quite difficult?
As an alternative I would be able to use a module that could customise links depening on what album you are viewing, ie. set it in the theme section for that album... I haven't seen anything like this yet.
Hope someone can help!
Graham
Posts: 314
you may use htmlblock, see the doc in the codex
serbanc - www.e-poze.ro
Posts: 7
I did see that but reading the description I thought it was used to add a whole page which would then be shown as a link to that page.
htmlblock seems like just what I need, only it's not quite working for me... I created a .tpl file in the editor and inserted this:
The file is not picking up "{$theme.item.id}", when I view an album it links to http:www.thistleyhough.stoke.sch.uk/media/gallery2/polaroid_gallery2.php?g2id={$theme.item.id} which obviously doesn't work
If I insert the exact same code into album.tpl in my theme it works fine, but shows in every album which is why I would like to use this module.
Any ideas why this is??
Thanks
Posts: 314
yeap, htmlblock is not able to use variables like $theme.
it just load $user.
sorry
serbanc - www.e-poze.ro
Posts: 7
ahh i see. is there any way around this?
Posts: 314
with htmlblock, no.
what you could do id to quickly develop a module!
<?php
class ExtraLinksModule extends GalleryModule {
function ExtraLinksModule() {
global $gallery;
$this->setId('extralinks');
$this->setName($gallery->i18n('Extralinks'));
$this->setDescription(
$gallery->i18n('Provides extralinks to the items'));
$this->setVersion('1.0.0');
$this->setGroup('display', $gallery->i18n('Display'));
$this->setCallbacks('getItemLinks');
$this->setRequiredCoreApi(array(7, 4));
$this->setRequiredModuleApi(array(3, 0));
}
/**
* @see GalleryModule::getItemLinks
*/
function getItemLinks($items, $wantsDetailedLinks, $permissions, $userId) {
global $gallery;
$links = array();
foreach ($items as $item) {
$itemId = $item->getId();
if (GalleryUtilities::isA($item, 'GalleryPhotoItem') &&
$item->getisLinkable() &&
isset($permissions[$itemId]['core.viewSource']) &&
isset($permissions[$itemId]['core.edit']) &&
isset($wantsDetailedLinks[$itemId])
) {
$params['view'] = 'core.ItemAdmin';
$params['subView'] = 'extralinks.something';
$params['itemId'] = $itemId;
$params['return'] = 1;
$links[$itemId][] = array('text' => $this->translate('do something'),
'params' => $params);
}
}
return array(null, $links);
}
}
?>
then generate the a link with urlGenerator (not in the example!)
install->test->go!
serbanc - www.e-poze.ro
Posts: 7
Hi, Thanks for your reply, I managed to get a link in the side bar to open the page correctly. However you have now inspired me to go and create a complete module to do the same thing (starting to regret it now)
I followed the Module Deveopment Tutorial and got my polaroid gallery to work with the default album due to this:
only now I can't figure out what to replace this with to be able to view a specific album, similar to how view slideshow works.
Appreciate any help!!
Graham
Posts: 314
what I sent in my previous post, if put in a module.inc file and placed in a folder named extralinks, actually IT IS a module
named extralinks.
all you have to do is to generate the link.
another option:
a full module which creates a sidebar link.
check in http://www.e-poze.ro/downloads/ for a file named sidebarex.zip; it contains an example for waht you need.
check however the texts, messages.
serbanc - www.e-poze.ro
Posts: 7
reading my previous post, I didn't really word it very well, what I meant was I decided to try to make a module that will be self contained and open a page within gallery2. I want it to work similar to how the sldeshow works only I can't work out which bit is the code that reads what album you are looking at.
Posts: 314
as I said in my previous post, sidebarex is a module that you can start working on - aka not to start from scratch.
serbanc - www.e-poze.ro