on the sub album pages I need a link back to the main album, and it should be hidden on the main album page
I tried this:
{if ($smarty.get.g2_itemId)}
<a href="main.php">HOME</a>
{/if}
but the smarty conditional doesn't work, I wish I could just use plain php there, at least I know how that works.
Any other ideas?
Posts: 27300
http://codex.gallery2.org/Gallery2:How_to_add_custom_stuff_on_main_root_page
is show root album stuff but just put your link in the else statment
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 74
Here is code for Gallery 2.3 (the link above is for 2.2). In this example, I don't want the logo to appear on any page except the root album:
Edit file "/themes/carbon/theme.inc" for standard theme "carbon":
/** * @see GalleryTheme::showAlbumPage */ function showAlbumPage(&$template, $item, $params, $childIds) { $ret = $this->loadCommonTemplateData( $template, $item, $params, array('owner', 'viewCount', 'childCount', 'descendentCount', 'parents', 'systemLinks', 'itemLinks', 'itemSummaries', 'permissions', 'thumbnails', 'pageNavigator', 'jumpRange'), $childIds); if ($ret) { return array($ret, null); } /* Add in our extra stuff */ $theme =& $template->getVariableByReference('theme'); $theme['columnWidthPct'] = floor(100 / $params['columns']); /* Check for JavaScript warning flag */ if (GalleryUtilities::getRequestVariables('jsWarning') != null) { $template->setVariable('jsWarning', true); } /* fotonut comment :Add check for being in main album. ref: http://codex.gallery2.org/Gallery2:How_to_add_custom_stuff_on_main_root_page */ /* get the rootId */ list ($ret, $rootId) = GalleryCoreApi::getPluginParameter('module', 'core', 'id.rootAlbum'); if ($ret) { return array(null, 'theme.tpl'); } if ($item->getId() == $rootId) { $isItRoot = true; } $template->setVariable('isItRoot', $isItRoot); /* end of add by fotonut */ /* Add our header and styles */ return array(null, 'theme.tpl'); } /** * @see GalleryTheme::showPhotoPage */ function showPhotoPage(&$template, $item, $params) { $dataTypes = array('owner', 'parents', 'systemLinks', 'itemLinks', 'permissions', 'itemLinksDetailed', 'itemNavigator', 'imageViews'); if (!empty($params['showMicroThumbs'])) { $dataTypes[] = 'navThumbnails'; } $ret = $this->loadCommonTemplateData($template, $item, $params, $dataTypes); if ($ret) { return array($ret, null); } /* Check for JavaScript warning flag */ if (GalleryUtilities::getRequestVariables('jsWarning') != null) { $template->setVariable('jsWarning', true); } return array(null, 'theme.tpl'); }
Edit file "/themes/carbon/templates/local/theme.tpl" for standard theme "carbon":
<div {g->mainDivAttributes}> {* * Some module views (eg slideshow) want the full screen. So for those, we don't draw * a header, footer, navbar, etc. Those views are responsible for drawing everything. *} {if $theme.useFullScreen} {include file="gallery:`$theme.moduleTemplate`" l10Domain=$theme.moduleL10Domain} {elseif $theme.pageType == 'progressbar'} <div id="gsHeader"> {if !empty($theme.params.logoImageLocation)} <img src="{g->url href=$theme.params.logoImageLocation}" alt=""/> {else} <img src="{g->url href="images/galleryLogo_sm.gif"}" width="107" height="48" alt=""/> {/if} </div> {g->theme include="progressbar.tpl"} {else} <div id="gsHeader"> <table width="100%" cellspacing="0" cellpadding="0"> <tr> <td align="left" valign="top" width="50%"> <a href="{g->url}"> {* * fotonut: Only show the logo if we are on the root. We added a flag isItRoot to the associated Theme.inc * *} {if $isItRoot} {if !empty($theme.params.logoImageLocation)} <img src="{g->url href=$theme.params.logoImageLocation}" alt=""/> {else} <img src="{g->url href="images/galleryLogo_sm.gif"}" width="107" height="48" alt=""/> {/if} {/if} </a> </td> <td align="right" valign="top"> {g->theme include="ads.tpl"} </td> </tr> </table> </div>
Posts: 74
Or show a small version of the logo if viewing an album or photo and a larger version of the logo/header (normal view) if viewing the root:
<div {g->mainDivAttributes}> {* * Some module views (eg slideshow) want the full screen. So for those, we don't draw * a header, footer, navbar, etc. Those views are responsible for drawing everything. *} {if $theme.useFullScreen} {include file="gallery:`$theme.moduleTemplate`" l10Domain=$theme.moduleL10Domain} {elseif $theme.pageType == 'progressbar'} <div id="gsHeader"> {if !empty($theme.params.logoImageLocation)} <img src="{g->url href=$theme.params.logoImageLocation}" alt=""/> {else} <img src="{g->url href="images/galleryLogo_sm.gif"}" width="107" height="48" alt=""/> {/if} </div> {g->theme include="progressbar.tpl"} {else} <div id="gsHeader"> <table width="100%" cellspacing="0" cellpadding="0"> <tr> <td align="left" valign="top" width="50%"> <a href="{g->url}"> {* * fotonut: Only show the logo if we are on the root. We added a flag isItRoot to the associated Theme.inc * (enhanced, show a large logo if on the root page and a small one if on an album or photo page) *} {if $isItRoot} {if !empty($theme.params.logoImageLocation)} <img src="{g->url href=$theme.params.logoImageLocation}" alt=""/> {else} <img src="{g->url href="images/galleryLogo_sm.gif"}" width="107" height="48" alt=""/> {/if} {else} {if !empty($theme.params.logoImageLocation)} <img src="{g->url href=$theme.params.logoImageLocation}" alt=""/> {else} <img src="{g->url href="images/galleryLogo_tiny.gif"}" width="50" height="24" alt=""/> {/if} {/if} </a> </td> <td align="right" valign="top"> {g->theme include="ads.tpl"} </td> </tr> </table> </div>