I'm trying to make a little php function so I can easily create and change links in my website. I am using a jQuery plugin for hash pages, which is what my website is driven on, all hash based website, so I use this a lot and at some point if I want to change the URL setup it would take forever to go through each place and do it.
I've got something like this right now, which would work for the first two variables, but the problem is there could just be one variable returned sometimes, and other times there could be 2, or 4, and in the future even more than the four i have defined.
function href($page, $pageID, $subPage, $subPageID)
{
$href = 'href="#/'.$page.'/'.$id.'" rel="address:/'.$page.'/'.$id.'"';
return $href;
}
The finished links would look like these:
<a href="#/home" rel="address:/home"></a>
and or
<a href="#/profile/1" rel="address:/profile/1"></a>
and or
<a href="#/profile/1/subPage/2" rel="address:/profile/1/subPage/2"></a>
etc.
and I would like to accomplish this using the function, and the usage would be something along the lines of:
<a <?php echo href('home')?>></a>
and or
<a <?php echo href('profile', '1')?>></a>
and or
<a <?php echo href('profile', '1', 'subPage')?>></a>
etc.
Any help with how to solve this would be greatly appreciated, thanks!
foreachandfunc_get_args?