New Module: Links Page


Joined: 2005-04-24
Posts: 21
Posted: Fri, 2006-04-28 22:35


Attached is a zip file for a module I have written that allows a seperate page for external website links.

Very simple to install/use:

Unpack in the modules directory, go to the site admin modules screen and install the module, configure it as below, save it and activate the module.

There will then be a "Useful Links" link in the top right links area that will display your links page.

The admin page has a general title area, which can contain BBCode or HTML (if Gallery settings allow it) - this is shown at the top of the links page.
Most of the other fields are self explanatary.
You must have at least 1 URL field filled in to activate the module...

I have tested it with G2.1 Matrix theme and PGThemes.

Hope it is of use to somebody...

linkspage.zip8.26 KB

Joined: 2005-10-03
Posts: 52
Posted: Fri, 2006-05-26 09:21

Thank you very much for this Module, I've already looked forward to somebody who offers this!

The Module Itself works great, but I have a Problem with the integration. It doesn't shows me the Link "Usefull Links" on the front Page. On the Other Pages I don't have any problem.

I have changed the Matrix template in a way, that i uses another template for the frontpage. The script is:

{if $theme.pageType == 'admin'}
{g->theme include="admin.tpl"}
{elseif $theme.pageType == 'album'}
{if $theme.item.parentId == 0}
{g->theme include="front.tpl"}
{g->theme include="album.tpl"}
{elseif $theme.pageType == 'photo'}
{g->theme include="photo.tpl"}
{elseif $theme.pageType == 'module'}
{g->theme include="module.tpl"}
{elseif $theme.pageType == 'progressbar'}
{g->theme include="progressbar.tpl"}

There you can see, that the filename for the Frontpage is: front.tpl, may this is the problem?

May it is also important to say, that I don't have the problem with the Contact Module, which is also made by you!

Thanks very much!

mfg OMA


Sorry, the Problem was caused by the template caching!


Joined: 2006-12-06
Posts: 358
Posted: Sat, 2006-12-09 02:57

I when to use your link module and came across a small bug (but it as been slayed).

When you loop and create the textarea's for the description of each of the urls you include the MarkupBar.tpl to generate the formating buttons:

{ include file="gallery:modules/core/templates/MarkupBar.tpl" viewL10domain="modules_core"
	  element="text" }
<textarea id="text" rows="4" cols="39" name="{g->formVar var="form[text][`$smarty.section.x.index`]"}">{if isset($form.text[x])}{$form.text[x]}{/if}</textarea>

Unfortunately what happens is it generates several MarkupBar/textarea combinations for a text area call 'text'. When you try to use anyof the formatting buttons, the changes all end up in the first textarea.

What I did to correct this is:

{assign var="textID" value=$smarty.section.x.index}

{ include file="gallery:modules/core/templates/MarkupBar.tpl" viewL10domain="modules_core"
	  element="text$textID" }

<textarea id="text{$smarty.section.x.index}" rows="4" cols="39" name="{g->formVar var="form[text][`$smarty.section.x.index`]"}">{if isset($form.text[x])}{$form.text[x]}{/if}</textarea>

For some reason, I had to assign $smarty.section.x.index to an intermediate variable. I am kind of new to smarty so I couldn't find a more elegant solution.


Joined: 2005-12-15
Posts: 154
Posted: Wed, 2007-04-11 07:03

It is possible activate the url rewrite for this module?


Joined: 2007-05-09
Posts: 263
Posted: Wed, 2007-05-16 19:47

Hi Is It possible to rename the "useful Links" to something else?

Also was wondering if there were a way to have it click an go to a url with out the links screen, just link a hot link??


Joined: 2007-05-17
Posts: 2
Posted: Sat, 2007-05-19 00:05

Was thinking it would be nice to have the url rewrite work like another person commented...

Can do it by adding the following function to the file:

* @see GalleryModule::getRewriteRules
function getRewriteRules() {
return array(
array('comment' => $this->translate('Links'),
'match' => array('view' => 'linkspage.Links'),
'pattern' => 'links',
'help' => $this->translate('Short URL for the HTML pages')

The author might like to include this in the module if they think it is useful...

Scott Walsh


Joined: 2007-05-17
Posts: 2
Posted: Sat, 2007-05-19 00:09

Another comment asked about changing what is displayed from Useful Links to something else.

In the file, look for the following function:

function getSystemLinks() {
$links = array();

$links['LinksPage'] = array(
'text' => $this->translate('Useful Links'),
'params' => array('view' => 'core.UserAdmin',
'subView' => 'linkspage.Links',
'return' => 1));

return array(null, $links);

Where it says:

'text' => $this->translate('Useful Links'),

You can change the text to say something else, e.g.:

'text' => $this->translate('Links'),

Scott Walsh


Joined: 2007-05-19
Posts: 30
Posted: Sun, 2007-06-03 13:02

Hi all, I have installed this plugin and it works really great! I have prepared a czech translation so you can use it with czech gallery (see attached cs.po) file.

I have one question - I have tried to setup url rewriting for this page and it works only in one way - when I go to everything works well but in the system menu, Gallery is still generating URL like this:

I have tried to find a solution but I didn't find it. Please, can anybody help me? I would like to have the short rewrited version of URL in the system menu.



Joined: 2005-10-06
Posts: 41
Posted: Mon, 2007-06-04 05:51

I have installed it with Gallery 2.2.1 and it seems to work fine. Its not bad- simple and to the point. I think I will keep it installed.
Here is the link with the Matrix theme:

I did change the "Contact::Useful Links" to "Useful Links" under the links.tpl file


Joined: 2007-08-22
Posts: 1
Posted: Wed, 2007-08-22 14:40

not sure if this is the right place to ask this if it isn't i'll delete this and move it somewhere else.

I've installed and tried to setup the links page but when i click configure i get an error message which reads

Security Violation

The action you attempted is not permitted.

Back to the Gallery
Error Detail -
Error (ERROR_BAD_PARAMETER) : Smarty error: unable to read resource: "gallery:modules/linkspage/templates/Admin.tpl"

* in modules/core/classes/GallerySmarty.class at line 76 (gallerycoreapi::error)
* in lib/smarty/Smarty.class.php at line 1591 (gallerysmarty::trigger_error)
* in lib/smarty/Smarty.class.php at line 1417 (gallerysmarty::_fetch_resource_info)
* in lib/smarty/Smarty.class.php at line 1869 (gallerysmarty::_compile_resource)
* in g2info/smarty/templates_c/%%3490554123/%%CD^CD7^CD714190%%SiteAdmin.tpl.php at line 62 (gallerysmarty::_smarty_include)
* in lib/smarty/Smarty.class.php at line 1871
* in g2info/smarty/templates_c/%%3490554123/%%40^404^4047CDF3%%admin.tpl.php at line 4 (gallerysmarty::_smarty_include)
* in lib/smarty/Smarty.class.php at line 1871
* in modules/core/classes/GalleryTemplateAdapter.class at line 747 (gallerysmarty::_smarty_include)
* in g2info/smarty/templates_c/%%3490554123/%%2E^2E1^2E11E2E2%%theme.tpl.php at line 111 (gallerytemplateadapter::theme)
* in lib/smarty/Smarty.class.php at line 1265
* in modules/core/classes/GallerySmarty.class at line 61 (smarty::fetch)
* in modules/core/classes/GalleryTemplate.class at line 186 (gallerysmarty::fetch)
* in main.php at line 479 (gallerytemplate::fetch)
* in main.php at line 94
* in main.php at line 83


i've tried hunting around the forum but can't seem to work out what it is i'm doing wrong. Does anyone have any ideas?


Joined: 2008-11-20
Posts: 28
Posted: Sun, 2008-12-28 02:29

Just installed this module and i cant find where to activate it. i looked in the plugins admin options but it's not there.
Hopefully someone knows how to fix this

Edit: Installed to template folder instead of module folder. I really need to read those instructions again.

floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Sun, 2008-12-28 05:05

Is there a codex page for this module? Any volunteers? I created the start of one:

Please play your part in the Gallery project and repay some of the debt you owe for using this free software by updating the codex (created by users like you, for users like you) to make it easier for the next person!

Blog & G2 || floridave - Gallery Team


Joined: 2008-11-20
Posts: 28
Posted: Sun, 2008-12-28 06:15

hi floridave, u've always got handy advice.

I have actually spent half a day trying to get it to work and now I finally did im trying to fix it.
Problem is that gallery thinks the links page is an admin page!

floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Sun, 2008-12-28 07:59

Seems to work for me:
all I did was install the module, it asked for it to be configured first, added some info on the configuration/admin page and activated the module.

Blog & G2 || floridave - Gallery Team


Joined: 2008-11-20
Posts: 28
Posted: Mon, 2008-12-29 10:47

Ah yes, it does work exactly like you say.
Problem was that the module runs as an admin page, which i didn't like.
Works better now with a few tweaks


Joined: 2008-11-20
Posts: 28
Posted: Thu, 2009-10-15 12:38

Is there a way to use anchor text as well?