I have set up a breadcrumb trail using the arguments for that page. There are a max 3 categories. I want to know how to determine that it's the last argument in the function so I can eliminate the seperators, ie:
Category 1 >> Category 2
vs.
Category 1 >> Category 2 >> Category 3
I am thinking the answer is func_num_args?
A function example:
head('Enterprise Solutions - Lawson Solutions','35','32','9');
(where 'title','maincat','subcat','subsubcat')
The code:
if(func_get_arg(1) && func_get_arg(1) != '0') { // parent
$query = "select * from navigation WHERE id = ".func_get_arg(1)." AND active='y'";
$result = mysql_query($query);
while ($row = mysql_fetch_array($result)) {
echo '<img src="images/nav/heads/'.$row['image'].'" alt="'.$row['title'].'"> >> ';
}
}
if(func_get_arg(2) && func_get_arg(2) != '0') { // sub-category
$query = "select * from navigation WHERE id = ".func_get_arg(2)." AND active='y'";
$result = mysql_query($query);
while ($row = mysql_fetch_array($result)) {
echo $row['title']." >> ";
}
}
if(func_get_arg(3) && func_get_arg(3) != '0') { // third sub-level
$query = "select * from navigation WHERE id = ".func_get_arg(3)." AND active='y'";
$result = mysql_query($query);
while ($row = mysql_fetch_array($result)) {
echo $row['title']." >> ";
}
}