Gossamer Forum
Home : Products : Gossamer Links : Discussions :

category Id's in title linked

Quote Reply
category Id's in title linked
Hello

I want to create a copy of sub_title_linked in Build.pm & i want to use the id of the category in the link.

Now it generates a string of the full category & split it up but i want it generating something like:

<a href="">top</a> : <a href="?ID=1>category 1</A> : <a href="?ID=14>Subcategory of 1 with id 14</A> : <a href="?ID=25>Subcategory of 14 with id 25</A> etc.

How can i do this?
Quote Reply
Re: [ridesworld] category Id's in title linked In reply to
I needed to do something similar and wrote a plugin to do it. Just a simple pre hook on build_title_linked. I copied the existing sub into the plugin and changed it to do what I wanted. Using $GT::Plugins->action ( STOP ); you can use this new sub to replace the existing one.

I'm not sure that this is the best way to do it but I'm sure it must be better than editing the core code.

Laura.
The UK High Street
Quote Reply
Re: [afinlr] category Id's in title linked In reply to
Hello afinlr

Can you post your code on this forum.
maybe you can help me and others with your suggestion.
Quote Reply
Re: [ridesworld] category Id's in title linked In reply to
Sorry - my plugin is very specific to my site and I don't think that it will help you.

This is a very simple plugin to do yourself - its a good way to quickly learn how the plugin system works if you haven't used it before.

I'll try to walk you through it.

Step 1: Go to the plugin wizard and fill in the name of your plugin.

Step 2: Fill in the necessary fields here such as the version number.

Step 3: Now add the PRE hook. Choose build_title_linked and click 'use'. Make sure that PRE and FIRST are selected and click on 'Add New Hook'.

Now you can go through to the end of the wizard without adding anything else.

Next you need to edit the pm file for your plugin. Copy the existing build_title_linked sub from build.pm and paste it into your pm file (not install.pm - the other one) in place of the empty sub that should already be in there. Somewhere in the sub - before you return the values - you need to type

GT::Plugins->action ( STOP );

That should be it. I recommend that you install this now as it is and make sure that your site still works as expected. If everything is fine then you can uninstall the plugin and make your changes and then reinstall it.

Laura.
The UK High Street