Proposed change to add_linktree()

live627

  • Should five per cent appear too small / Be thankful I don't take it all / 'Cause I'm the taxman, yeah I'm the taxman
  • Posts: 1,670
Proposed change to add_linktree()
« on June 17th, 2012, 12:29 AM »
For those of you who don't know (or remember), add_linktree() iis a small helper function to append a link to the breadcrumb chain.

I would like to see the $name param first and $url next, as an optional param. That way, it can be used to add an item without an anchor.
A confident man keeps quiet.whereas a frightened man keeps talking, hiding his fear.

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Proposed change to add_linktree()
« Reply #1, on June 17th, 2012, 12:43 AM »
There was a function for this?! I wasn't aware there was ever a function for it, that it was always done by just adding to $context['linktree'].

If there is a function, $name should be first and $url optional, for that exact reason, so +1 from me.
When we unite against a common enemy that attacks our ethos, it nurtures group solidarity. Trolls are sensational, yes, but we keep everyone honest. | Game Memorial

live627

  • Should five per cent appear too small / Be thankful I don't take it all / 'Cause I'm the taxman, yeah I'm the taxman
  • Posts: 1,670

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Proposed change to add_linktree()
« Reply #3, on June 17th, 2012, 01:11 AM »
On the one hand I can see the benefit of that, on the other do we really need a helper function? It's not like it's actually saving much code...

Dragooon

  • I can code! Really!
  • polygon.com has to be one of the best sites I've seen recently.
  • Posts: 1,841
Re: Proposed change to add_linktree()
« Reply #4, on June 17th, 2012, 05:50 AM »
Quote from Arantor on June 17th, 2012, 12:43 AM
There was a function for this?! I wasn't aware there was ever a function for it, that it was always done by just adding to $context['linktree'].
This pretty much sums up my reaction as well, I never knew such function existed...
The way it's meant to be

Nao

  • Dadman with a boy
  • Posts: 16,082
Re: Proposed change to add_linktree()
« Reply #5, on June 17th, 2012, 08:57 AM »
Quote from Dragooon on June 17th, 2012, 05:50 AM
Quote from Arantor on June 17th, 2012, 12:43 AM
There was a function for this?! I wasn't aware there was ever a function for it, that it was always done by just adding to $context['linktree'].
This pretty much sums up my reaction as well, I never knew such function existed...
:lol: :lol: :lol:

Code: [Select]
function mgal_addLinktree($url,$name) {
global $context;
$context['linktree'][] = array('url' => $url, 'name' => $name);
}

That was in SMF Media Gallery 1.0.2...
So you actually wrote it :lol:

It evolved as time went by, becoming add_linktree() in later versions, and then being moved to Subs.php when I integrated AeMe into Wedge -- at the time I thought I'd use it for every single file but it never really took off in me, so it's used exclusively in the /media folder.

As for inverting the params... Well, that means also rewriting the 29 use cases of the function :P
Plus I'd rather turn it into an object... welnk::add(), ah ah. Err, well...