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
Help...
- Oliver Georgi
- Site Admin
- Posts: 9906
- Joined: Fri 3. Oct 2003, 22:22
- Contact:
I hope I have understand what you want to have - you want get the current cat/structure name to use it anywhere in the content - right?
Then all you have to do is:
if there might be problems with special chars use:
Oliver
Then all you have to do is:
Code: Select all
{PHPVAR:$GLOBALS['content']['struct'][$GLOBALS['content']['cat_id']]['acat_name']}
Code: Select all
[PHP]echo html_specialchars($GLOBALS['content']['struct'][$GLOBALS['content']['cat_id']]['acat_name']);[/PHP]
Thanks you very much
Yes..It is very great.
But I want to display it only by English. My website have multilanguages
but I want to display it only by English. Hic, my English is very bad, I hope you can undestand what I said. Vey sorry...
But I want to display it only by English. My website have multilanguages
but I want to display it only by English. Hic, my English is very bad, I hope you can undestand what I said. Vey sorry...
Ok
Thank you , Oliver.
I have done my work.
My database :
CREATE TABLE `phpwcms_articlecat` (
`acat_id` int(11) NOT NULL auto_increment,
`acat_name` text NOT NULL,
`acat_name_en` text NOT NULL,
`acat_info` text NOT NULL,
`acat_info_en` text NOT NULL,
`acat_public` int(1) NOT NULL default '0',
`acat_tstamp` timestamp(14) NOT NULL,
`acat_aktiv` int(1) NOT NULL default '0',
`acat_uid` int(11) NOT NULL default '0',
`acat_trash` int(1) NOT NULL default '0',
`acat_struct` int(11) NOT NULL default '0',
`acat_sort` int(11) NOT NULL default '0',
`acat_alias` text NOT NULL,
`acat_hidden` int(1) NOT NULL default '0',
`acat_template` int(11) NOT NULL default '0',
`acat_ssl` int(1) NOT NULL default '0',
`acat_regonly` int(1) NOT NULL default '0',
`acat_url` varchar(200) default NULL,
`acat_portal` int(1) NOT NULL default '0',
`acat_sec` int(1) NOT NULL default '0',
`acat_news` int(1) NOT NULL default '0',
PRIMARY KEY (`acat_id`)
) TYPE=MyISAM AUTO_INCREMENT=280 ;
So, first I get id of the category by this var :
$GLOBALS['content']['struct'][$GLOBALS['content']['cat_id']]['acat_id']
and then I use a sql query to select acat_id_en from the table to get category name only by English. Thank you again for your help.
Hihi
Nice week
I have done my work.
My database :
CREATE TABLE `phpwcms_articlecat` (
`acat_id` int(11) NOT NULL auto_increment,
`acat_name` text NOT NULL,
`acat_name_en` text NOT NULL,
`acat_info` text NOT NULL,
`acat_info_en` text NOT NULL,
`acat_public` int(1) NOT NULL default '0',
`acat_tstamp` timestamp(14) NOT NULL,
`acat_aktiv` int(1) NOT NULL default '0',
`acat_uid` int(11) NOT NULL default '0',
`acat_trash` int(1) NOT NULL default '0',
`acat_struct` int(11) NOT NULL default '0',
`acat_sort` int(11) NOT NULL default '0',
`acat_alias` text NOT NULL,
`acat_hidden` int(1) NOT NULL default '0',
`acat_template` int(11) NOT NULL default '0',
`acat_ssl` int(1) NOT NULL default '0',
`acat_regonly` int(1) NOT NULL default '0',
`acat_url` varchar(200) default NULL,
`acat_portal` int(1) NOT NULL default '0',
`acat_sec` int(1) NOT NULL default '0',
`acat_news` int(1) NOT NULL default '0',
PRIMARY KEY (`acat_id`)
) TYPE=MyISAM AUTO_INCREMENT=280 ;
So, first I get id of the category by this var :
$GLOBALS['content']['struct'][$GLOBALS['content']['cat_id']]['acat_id']
and then I use a sql query to select acat_id_en from the table to get category name only by English. Thank you again for your help.
Hihi
Nice week
- Oliver Georgi
- Site Admin
- Posts: 9906
- Joined: Fri 3. Oct 2003, 22:22
- Contact: