New module: Links In The Head

andrabr

Joined: 2007-09-05
Posts: 18
Posted: Mon, 2007-09-10 22:53

moderator: This module is now available via downloadable plugins thanks to alecmyers
Please see the codex page: http://codex.gallery2.org/Gallery2:Modules:linksinhead

I have written a new module! I am so proud of myself, I may explode by the time you read this. The halo is so blinding, I had to cover all the mirrors :-D

The module uses getSystemLinks hook to add ANY LINK to the prime real estate that is the top toolbar now carrying "Login", "Registration" and such.

Now you can add to it an UNLIMITED number of links to.. anywhere without modifying the theme.

Personally, I use it to point at my blog (hosted at wordpress.com) and at some pages inside Gallery2.

A lot of inspiration came from "About Page" plugin - mine is a different twist on the same topic.

This is my first plugin, so I am not adding it to the official "user contributions" page until someone tells me that I am not delusional and it actually works outside of my installation.

Enjoy!

A>

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Mon, 2007-09-10 23:41

Congrats! Sounds like a very useful little module.
I'm sure a lot of users will find it very useful.

Suggestion:
Instead of the view => 'yourmodule.goto', just use "href".

i.e. replace

		    'params' => array('view' => 'linksinthehead.goto', 'linksinthehead_linkname' => $linkname));

with

		    'params' => array('href' => $linkname));

and then you can remove the goto.inc file too.

--------------
Documentation: Support / Troubleshooting | Installation, Upgrade, Configuration and Usage

 
andrabr

Joined: 2007-09-05
Posts: 18
Posted: Tue, 2007-09-11 01:42

Brilliant!

All necessary changes applied, new version posted.
Thanks, valiant!

Hey, this use of getSystemLinks() is not obvious from documentation (I would not be going through the trouble with goto.inc otherwise). Would be nice to put it in as an example.

Going way beyond the original topic (sorry!) - we could use "user comment" feature in the API doc section, similar to the way php.net has it - that would take some of the burden of documenting all the API uses from your wide shoulders...

Thanks again!

P.S. To anyone reading this: if I could write a module, you can too. Do your part!

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Wed, 2007-10-31 14:49

[obsolete]

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Wed, 2007-10-31 14:49

[obsolete]

 
phovanxua

Joined: 2007-01-16
Posts: 1
Posted: Sat, 2007-11-03 05:56

Thanks ...like it .

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Thu, 2007-11-08 00:53

Great module - though I'm having a minor issue. It ceases to function after I flush the database and template caches. When I've done this, the links no longer appear however the module is still installed. Its admin page link also disappears from the Site Admin Options, *except* for on the plugins page when it shows up.

The only way to get it to work again is to uninstall and reinstall (and enter the links again)

Any suggestions?

I'm running gallery 2.2.1

 
andrabr

Joined: 2007-09-05
Posts: 18
Posted: Sat, 2007-11-10 00:03

Alec,

I am as mystified as you are...
The module is just a couple of straightforward calls to Gallery APIs. I would be tempted to blame the gallery/database interaction, but I am not qualified enough to prove it. I wonder if we can get one of the gurus to take a stab at this.

Help, o mighty ones!

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Mon, 2007-12-31 04:22

andrabr,
I have created a codex page:
http://codex.gallery2.org/Gallery2:Modules:linksinhead
please feel free to flesh it out a bit more.
I also removed

{include file="gallery:modules/core/templates/MarkupBar.tpl" viewL10domain="modules_core"
	     element="message" firstMarkupBar=true}

from the admin template. Adding markup to the links is not required.

I will try to investigate the issue; when you visit the admin page, after activation, the links disappear.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Mon, 2007-12-31 05:15

Edit module.inc

    function getSystemLinks() {
	global $gallery;

added global $gallery.
I am not a developer so don't know if that fixes the links disappearing or not. Seems to work for me.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
morgad

Joined: 2007-08-11
Posts: 39
Posted: Thu, 2010-02-18 18:29

I like it :-)

I have been able to strip out a pile of common links from all my album pages thanks to this.

The only minor problem is that the module cannot handle my 'mailto:davesphotos@morgad.co.uk' email link, but I can easily work around this by adding an 'emailme.html' page locally.

One feature request ... would it be possible to add a simple way of re-arranging the link order? Perhaps by an up-arrow next to each link to move it above the link above it (similar to this)

best regards
Dave
--
http://www.morgad.co.uk/index.html

 
andrabr

Joined: 2007-09-05
Posts: 18
Posted: Mon, 2007-12-31 20:21

This module desperately needs a new maintainer!

I do not have a live, or even a dead Gallery installation, so I keep falling behind on bugs and support requests :(
What's even worse, since I am not running a Gallery, I do not follow the updates/security announcements as diligently as I would like to.

If you are vaguely aware of PHP and are involved in "feeding and care" of a live Gallery, please, PLEASE PLEASE step up and take this module over - you will get a huge amount of good karma by removing my guilt!

Please? Anyone?

A>

 
serbanc

Joined: 2006-05-19
Posts: 314
Posted: Tue, 2008-01-01 04:01

From my point of view, links in the head is not multilingual - but that's my case.

My suggestion would be to treat systemlinks as menus and to be able to put a link (menu item) into a specific menu.

For instance, in my case (www.e-poze.ro/gallery2/) I needed at least two more menus. I managed to create them manually.

This suggestion does not go to users, but rather to the group of strategy definition, since it requires code change into core module at least.

serbanc - www.e-poze.ro

 
CumGranoSalis
CumGranoSalis's picture

Joined: 2008-02-18
Posts: 8
Posted: Mon, 2008-02-18 23:33

Hi, that's nice - THNX.

Is there an oppurtinity to place the links not absolute? In my multisite installation only full qualified uri work: http://www.mygal.now/file/see.html. I'd prefer only /file/see.html, cause the domains have aliases and i do not want to show the alias directly...

 
djpumpkin

Joined: 2006-12-06
Posts: 135
Posted: Sun, 2008-04-20 16:47

This is a great module and I'm really grateful to Andrabr for creating it. I've edited Edit module.inc with:

function getSystemLinks() {
global $gallery;

as suggested by Floridave, but alas, I too find that the links disappear - but not when the cache is flushed - just whenever another plugin is activated. I find that disabling then re-activating 'Links in the head', brings all my links back.

It's confusing when you have caching enabled under the 'performance' section of gallery as the actual point at which the links were lost can be hard to gauge. I was only able to pinpoint what was causing them to vanish by testing it on my development install - which has all caching disabled.

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Wed, 2008-05-14 20:14

The disappearing links bug is fixed (I think) and I've uploaded the new version to the community repository so you can install it from the "more plugins" admin page.

 
TCYFarms

Joined: 2008-06-25
Posts: 8
Posted: Fri, 2008-06-27 10:14

I really like this, but is it possible to get the links to appear in the same spot, but all the way to the left so it would display next to the Gallery link thing?

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Fri, 2008-06-27 10:19

The position of the various links around the page is totally theme-dependent - probably the easiest thing is for you to post a screenshot showing where you want it. Although, without having seen what you're after, the answer is probably "not with this module" - it adds the links to the list as displayed by the theme. You'd probably need to ditch this module and edit your theme templates if you want that sort of control.

 
TCYFarms

Joined: 2008-06-25
Posts: 8
Posted: Sat, 2008-06-28 11:34

Thats what I want to do. I want the link of Back to be before the link slideshow.
[IMG]http://hosting05.imagecross.com/image-hosting-16/8468Screen.jpg[/IMG]

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Sat, 2008-06-28 12:06

OK - this thread is about the Links In The Head module - please move your screenshot to the other thread you've opened for this question (it's not necessary to discuss it in two places) and I'll make another suggestion.

 
eaglelive

Joined: 2008-07-11
Posts: 55
Posted: Fri, 2008-07-11 10:30

I like the module very much. But It can not be find at via Get more plugins‎
Can you give me a link to download? It can not be find at via Get more plugins‎

Help!

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Fri, 2008-07-11 11:39

It is at "get more plugins". Check that you're running the latest version of Gallery (2.2.5) and that you've enabled the "community repository" check box then refresh your "available plugins" list.

 
DRB184

Joined: 2007-05-02
Posts: 23
Posted: Sat, 2008-07-19 05:27

Useful module, but is it possible to have the links open in a new window - I would prefer this if possible.

Also, how do you change the order of items in the main menu bar...not just from this module, but all of the items in the bar.

Thanks

David.

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Sat, 2008-07-19 09:52
Quote:
Useful module, but is it possible to have the links open in a new window

No, not possible

Quote:
Also, how do you change the order of items in the main menu bar...not just from this module, but all of the items in the bar.

Thanks

David.

I don't know, sorry.

 
josh597

Joined: 2008-10-29
Posts: 3
Posted: Wed, 2008-10-29 16:31

I don't see this as a plugin anymore.

I have used this in the past and would like to use it again.

Can I download the module from alternate location somewhere?

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Wed, 2008-10-29 16:49

Please read carefully the very first post in this thread.

 
shmagm1

Joined: 2006-06-14
Posts: 32
Posted: Mon, 2008-11-10 17:02

Thanks for this module alecmyers. I used it to link a "how 2 upload pictures" doc.

Perry

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Mon, 2008-11-10 17:05

In case anyone's in doubt - I didn't write the module, I just put it in the repository to make it easier to download. I am (and I'm sure the original author is, too) glad you're finding it useful!

 
budinsky

Joined: 2008-11-20
Posts: 28
Posted: Sat, 2008-12-27 13:32

I dont see the module available anywhere. am i looking in the wrong spots?

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Sat, 2008-12-27 13:37
budinsky wrote:
am i looking in the wrong spots?

That's hard to say. Where are you looking?

There are fairly explicit and complete instructions linked to in the codex page, which is itself linked to in the very first post in this thread.

 
budinsky

Joined: 2008-11-20
Posts: 28
Posted: Sat, 2008-12-27 13:57

yes, complete instructions lead me to download via Get more plugins.
I eventually worked out however i needed to select show repository list and check the Community plugins box.
Then i was able to select the module. So no i didn't think it was fairly explicit instuctions.

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Sat, 2008-12-27 14:07
budinsky wrote:
So no i didn't think it was fairly explicit instuctions.

Great! You found a hole in the documentation! 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!

Many thanks, and I look forward to reading the updated version!

 
alexxfender

Joined: 2009-05-05
Posts: 12
Posted: Tue, 2009-05-05 18:49

hello i new here and i just fresh install the latest version(2.3) and i dont get this plugin in my plugins lists.. even after updating the plugin list.

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Tue, 2009-05-05 20:10

http://codex.gallery2.org/Gallery2:Installing_Additional_Components
Watch the video it should help installing this 3rd party module.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
alexxfender

Joined: 2009-05-05
Posts: 12
Posted: Thu, 2009-05-07 01:48

Thanks a load.... is there a way to let the link/s open in a new window?
Thanks again

 
lightpainter

Joined: 2005-11-25
Posts: 64
Posted: Mon, 2009-09-07 17:09

alexxfender: your question was asked and answered just a few posts up! The answer was no.

-----------------------------
www.lightpainter.co.uk

 
mdsouza

Joined: 2010-07-13
Posts: 8
Posted: Tue, 2010-07-13 21:46

Hello everyone, I'm late to this party but have arrived :) I've installed Gallery2 for a client and all was well, I just installed this plug-in as we really needed it and it works great. Onto the problem I've lost the listings of plugins in the site admin. Site admin > plugins and the page is bare, the functionality of everything seems to be still intact but where did the plugins list and tabs go? If anyone can help that would be most appreciated.

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Tue, 2010-07-13 22:03

what do you mean by page is bare? A screenshot would help.

 
mdsouza

Joined: 2010-07-13
Posts: 8
Posted: Wed, 2010-07-14 04:37

Hi thanks for replying, here you go [img]http://www.webtressdesign.com/noplugin.gif[/img]

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Wed, 2010-07-14 11:54

Put gallery into debug mode and refresh the page; that looks like a template error to me.
FAQ: How to set/use Gallery in debug mode?

 
mdsouza

Joined: 2010-07-13
Posts: 8
Posted: Wed, 2010-07-14 14:48

Hi here is the output,

Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 122880 bytes) in /mnt/stor2-wc2-dfw1/437338/441506/www.earthnaturalspetfood.com/web/content/gallery2/lib/smarty/Smarty_Compiler.class.php on line 2102

Is this a memory issue if so can I deactive other modules that we are not going to use? The site is hosted on Rack Space - cloud it that helps.

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Wed, 2010-07-14 15:01
Quote:
Fatal error: Allowed memory size of 33554432 bytes exhausted

Quote:
Is this a memory issue

Looks that way

Quote:
can I deactive other modules that we are not going to use?

Worth a try. Here's how to deactivate modules without access to the plugins page.FAQ: How can I deactivate a module when I am unable to login?
Also see FAQ: PHP memory_limit - Why do I get the error Allowed memory size of Xxx bytes exhausted?

(Don't forget the FAQ - they're there because they're common issues.)

 
mdsouza

Joined: 2010-07-13
Posts: 8
Posted: Wed, 2010-07-14 17:46

Hi Thank you alemyers, I've deactivated several modules as per the FAQ sorry to report no joy. The memory error still persist however the line number has changes. I've even remove this module link in head. I've ran the maintenace to delete database cache and template cache. At a lost on how to get it the plugin screen back.

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Wed, 2010-07-14 17:53

You can try assigning more memory as per the FAQ I posted, or contact your hosting provider to assign more memory for you.

 
mdsouza

Joined: 2010-07-13
Posts: 8
Posted: Wed, 2010-07-14 20:22

I'll see what I can do on that side of things but the last time I tried to have memory increased to support G3 it didn't go over to well and I un-intalled g3 in favor of g2. Off to duel with host for more memory.

 
mdsouza

Joined: 2010-07-13
Posts: 8
Posted: Thu, 2010-07-15 04:52

Back on track thanks to your assistance and jas68 http://gallery.menalto.com/node/85414

 
tgontz

Joined: 2010-08-29
Posts: 13
Posted: Tue, 2010-08-31 02:35

Using target="_top" with Links in The Head Plugin

Is there anyway to use target="_top" with this plugin. I have a situation where my gallery is hosted on a separate server from the main site and a sub-domain points to the gallery. The gallery then loads within a URL Frame. So when I click on my link that says, "Return to Main Site" the problem is that the url still shows the gallery no matter what page you load after that point.

To see what I am talking about take a look at http://gallery.forevermomentspa.com/. The "Return to Main Site" in the sidebar uses target="_top" and loads the main site at http://www.forevermomentspa.com/ with http://www.forevermomentspa.com/ showing as the url. When you click on the "Return to Main Site" link that was created using the plugin the you are taken to the main site but the url remains gallery.forevermomentspa.com.

Thanks!

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Tue, 2010-08-31 02:41

From what I recall, there's no way to supply additional parameters into the G2 url-builder which is used to generate the links, so I think the answer is no.

 
tgontz

Joined: 2010-08-29
Posts: 13
Posted: Tue, 2010-08-31 19:11

Thank you for your response. Do you know if there is another way to add a link to this area (manually)? Or could you point me to where I might find this information. I have already searched the forums but have not found a solution.

I'm not a programmer but I don't have a problem with hacking files.

Thanks!

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Tue, 2010-08-31 20:53

gallery2/themes/your_theme/templates/local/theme.tpl <- you may have to copy the original here.

Add your link where you need.
Keep in mind that templates are cached, so to see your changes head to gallery admin -> maintenance -> clear template cache after you make changes.

-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2

 
tgontz

Joined: 2010-08-29
Posts: 13
Posted: Wed, 2010-09-01 00:09

Ah, yes - that was really quite simple. I found the section of theme.tpl (that I copied to local) that looks like this:

Quote:
<div class="gbSystemLinks">
{g->block type="core.SystemLinks"
order="core.SiteAdmin core.YourAccount core.Login core.Logout"
othersAt=4}
</div>

and then I simply added my link before the ending </div> tag to put my custom link after (to the right of) Login in the menu.

Thanks!