atwitz3nd Posted June 7, 2011 Share Posted June 7, 2011 Hi can anyone tell me how to replace my ampersands with '&' so my page validateshere is the current output code $name = str_replace('.', '', strstr($categorie->name, '.')); I tried adding this but it didn't seem to work. $name = str_replace('.', '', '&', '&', strstr($categorie->name, '.')); How can i successfully translate this category name which is: fruit & veg so it validates?Thanks very much Link to comment Share on other sites More sharing options...
Burhan BVK Posted June 7, 2011 Share Posted June 7, 2011 Try this: $name = str_replace(array('.', '&'), array('', '&'), strstr($categorie->name, '.')); Hi can anyone tell me how to replace my ampersands with '&' so my page validateshere is the current output code $name = str_replace('.', '', strstr($categorie->name, '.')); I tried adding this but it didn't seem to work. $name = str_replace('.', '', '&', '&', strstr($categorie->name, '.')); How can i successfully translate this category name which is: fruit & veg so it validates?Thanks very much Link to comment Share on other sites More sharing options...
atwitz3nd Posted June 8, 2011 Author Share Posted June 8, 2011 THanks for you reply. I tried your suggestion, which didn't fix it unfortunately. It didn't break it either, so I' wondering if I'm changing the right codeThe output code is this: {$MENU} presumably reading from the .php file below: > private function getCategoryOption($id_category, $id_lang, $children = true) { $categorie = new Category($id_category, $id_lang); if(is_null($categorie->id)) return; if(count(explode('.', $categorie->name)) > 1) $name = str_replace(array('.', '&'), array('', '&'), strstr($categorie->name, '.')); else $name = $categorie->name; $this->_html .= ''.$name.''; if($children) { $childrens = Category::getChildren($id_category, $id_lang); if(count($childrens)) foreach($childrens as $children) $this->getCategoryOption($children['id_category'], $id_lang); } } private function getCategory($id_category, $id_lang) { global $page_name; $categorie = new Category($id_category, $id_lang); if(is_null($categorie->id)) return; $selected = ($page_name == 'category' && ((int)Tools::getValue('id_category') == $id_category)) ? ' class="sfHoverForce"' : ''; $this->_menu .= ''; if(count(explode('.', $categorie->name)) > 1) $name = str_replace(array('.', '&'), array('', '&'), strstr($categorie->name, '.')); else $name = $categorie->name; $this->_menu .= 'getLink().'">'.$name.''; $childrens = Category::getChildren($id_category, $id_lang); if(count($childrens)) { $this->_menu .= '</pre> <ul>'; foreach($childrens as $children) $this->getCategory($children['id_category'], $id_lang); $this->_menu .= '</ul>';<br> }<br> $this->_menu .= '';<br> Is this right bit, Which is affecting category and subcategory menu itemsAny ideas? Thanks for your help Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now