Help...
Posted: Fri 9. Jul 2004, 05:47
Hi
I want to write a function to return a topic in menu.
Example Home > Home_sub > topic
And my function will return a string : "topic" and a string is only English.
I used the function
function breadcrumb ($start_id, $struct_array, $end_id, $link_to="index.php", $spacer=" > ") {
//builds the breadcrumb menu based on given values
//$link_to = the page on which the breadcrum part links
//$root_name = name of the breadcrumb part if empty/false/0 $start_id
//$spacer = how should breadcrumb parts be divided
$start_id = intval($start_id);
$end_id = intval($end_id);
$act_id = $start_id; //store actual ID for later comparing
while ($start_id) { //get the breadcrumb path starting with given start_id
/*if($_SESSION["wcs_user_lang"]=='vn'){
$data[$start_id] = $struct_array[$start_id]["acat_name"];
}elseif($_SESSION["wcs_user_lang"]=='en'){
$data[$start_id] = $struct_array[$start_id]["acat_name_en"];
}else
*/
$data[$start_id] = $struct_array[$start_id]["acat_name"];
$start_id = $struct_array[$start_id]["acat_struct"];
if($end_id && $start_id == $end_id) break;
}
/*if($_SESSION["wcs_user_lang"]=='vn'){
$data[$start_id] = $struct_array[$start_id]["acat_name"];
}elseif($_SESSION["wcs_user_lang"]=='en'){
$data[$start_id] = $struct_array[$start_id]["acat_name_en"];
}else*/
$data[$start_id] = $struct_array[$start_id]["acat_name"];
$crumbs_part = array_reverse($data, 1);
if(sizeof($crumbs_part)) {
$breadcrumb = "";
foreach($crumbs_part as $key => $value) {
if ($act_id != $key) {
$breadcrumb .= ($breadcrumb) ? $spacer : "";
$breadcrumb .= "<a href=\"".$link_to."?id=".$key.",0,0,1,0,0\">";
$breadcrumb .= html_specialchars($crumbs_part[$key])."</a>";
} else {
$breadcrumb .= (($breadcrumb) ? $spacer : "").html_specialchars($crumbs_part[$key]);
$category_name = html_specialchars($crumbs_part[$key]);
}
}
} else {
$breadcrumb = "";
}
//return $breadcrumb;
return $category_name;
}
to get topic ( $category_name ) but I can't get it only by English ( because sension ).
Somebody can help me ?
Thanks
I want to write a function to return a topic in menu.
Example Home > Home_sub > topic
And my function will return a string : "topic" and a string is only English.
I used the function
function breadcrumb ($start_id, $struct_array, $end_id, $link_to="index.php", $spacer=" > ") {
//builds the breadcrumb menu based on given values
//$link_to = the page on which the breadcrum part links
//$root_name = name of the breadcrumb part if empty/false/0 $start_id
//$spacer = how should breadcrumb parts be divided
$start_id = intval($start_id);
$end_id = intval($end_id);
$act_id = $start_id; //store actual ID for later comparing
while ($start_id) { //get the breadcrumb path starting with given start_id
/*if($_SESSION["wcs_user_lang"]=='vn'){
$data[$start_id] = $struct_array[$start_id]["acat_name"];
}elseif($_SESSION["wcs_user_lang"]=='en'){
$data[$start_id] = $struct_array[$start_id]["acat_name_en"];
}else
*/
$data[$start_id] = $struct_array[$start_id]["acat_name"];
$start_id = $struct_array[$start_id]["acat_struct"];
if($end_id && $start_id == $end_id) break;
}
/*if($_SESSION["wcs_user_lang"]=='vn'){
$data[$start_id] = $struct_array[$start_id]["acat_name"];
}elseif($_SESSION["wcs_user_lang"]=='en'){
$data[$start_id] = $struct_array[$start_id]["acat_name_en"];
}else*/
$data[$start_id] = $struct_array[$start_id]["acat_name"];
$crumbs_part = array_reverse($data, 1);
if(sizeof($crumbs_part)) {
$breadcrumb = "";
foreach($crumbs_part as $key => $value) {
if ($act_id != $key) {
$breadcrumb .= ($breadcrumb) ? $spacer : "";
$breadcrumb .= "<a href=\"".$link_to."?id=".$key.",0,0,1,0,0\">";
$breadcrumb .= html_specialchars($crumbs_part[$key])."</a>";
} else {
$breadcrumb .= (($breadcrumb) ? $spacer : "").html_specialchars($crumbs_part[$key]);
$category_name = html_specialchars($crumbs_part[$key]);
}
}
} else {
$breadcrumb = "";
}
//return $breadcrumb;
return $category_name;
}
to get topic ( $category_name ) but I can't get it only by English ( because sension ).
Somebody can help me ?
Thanks