Advanced search  


cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.

Pages: [1]   Go Down

Author Topic: Allowing more than one custom link in cpg 1.4  (Read 2855 times)

0 Members and 1 Guest are viewing this topic.


  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 46
Allowing more than one custom link in cpg 1.4
« on: July 06, 2005, 04:29:41 am »

I would love to have about 6 custom links in coppermine. Can it be done?
« Last Edit: July 06, 2005, 05:35:56 am by donnoman »


  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1615
  • From
    • Donovan Bray
Re: Allowing more than one custom link in cpg 1.4
« Reply #1 on: July 06, 2005, 05:35:15 am »

This is ...almost support, but since it shows how to do something brand-new with the template system I'd like to help illustrate how it works.

You can skin this cat several different ways.

For the most straightforward way (read that as brute force)  Look at step 9 in the theme.php instructions included with the documents directory as an example.

Now, that being said theres another method that I would use personally, and that is manipulate the button arrays directly.

copy these sections  out of sample's theme.php into your theme.php

Code: [Select]

// Creates an array of tokens to be used with function assemble_template_buttons
// this function is used in this file it needs to be declared before being called.
function addbutton(&$menu,$href_lnk,$href_title,$href_tgt,$block_id,$spacer) {

Code: [Select]
 // HTML template for template sys_menu buttons
    // Login and Logout don't have a spacer as only one is shown, and either would be the last option.

Code: [Select]
 // HTML template for template sub_menu buttons


Now just use the addbutton function and modify away. The order in which you use addbutton determines the order when the theme is rendered.

This is the format of addbutton($menu,'{HREF_LNK}','{HREF_TITLE}','{HREF_TGT}','BLOCK_ID','{SPACER}')

Such that HREF_LNK is the clickable text, HREF_TITLE is the hover text, HREF_TGT is the href, BLOCK_ID can be anything EXCEPT one thats already used, and spacer should match the format and _menu var you are working with.  Note in the default config spacer its set to null on the last option, you may want that or not, but you need to take that into account when you start adding buttons, it depends entirely on your theme.

A typical $sub_menu_button might be:
Code: [Select]
addbutton($sub_menu_button,'CPG-Contrib','Coppermine Contrib','','cpg-contrib',$template_sub_menu_spacer);

Hope that helps.


  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 32
    • DankSite.Com
Re: Allowing more than one custom link in cpg 1.4
« Reply #2 on: March 03, 2006, 08:46:18 am »

Hello. I apologize if this question sound ignorant, however, perhaps I am misunderstanding you. I added all blocks of the code on the forum to my themes.php. I still have no idea how to add a button. A little help here? Yes... that's right. I must be a moron. nevertheless, I am a noob, and need a little guidence. Thank you in advance for your reply. Perhaps a pre-made php CPGexternal navigation script would be the answer. I reallly don't know

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
Re: Allowing more than one custom link in cpg 1.4
« Reply #3 on: March 03, 2006, 08:48:38 am »

no support on the feature requests board. Thread locked.
Pages: [1]   Go Up

Page created in 0.016 seconds with 20 queries.