Wedge

Public area => The Pub => Features => Topic started by: live627 on June 17th, 2012, 12:29 AM

Title: Proposed change to add_linktree()
Post by: live627 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.
Title: Re: Proposed change to add_linktree()
Post by: 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'].

If there is a function, $name should be first and $url optional, for that exact reason, so +1 from me.
Title: Re: Proposed change to add_linktree()
Post by: live627 on June 17th, 2012, 12:47 AM
Could also add extra_before and extra_after, just for the hell of it...
Title: Re: Proposed change to add_linktree()
Post by: Arantor 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...
Title: Re: Proposed change to add_linktree()
Post by: 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...
Title: Re: Proposed change to add_linktree()
Post by: Nao 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...