amp and amp and... menu elements parsing
Moderator: ooffick
Forum rules
Please use the official Bug Tracker to report a bug: https://issues.joomla.org
Please use the official Bug Tracker to report a bug: https://issues.joomla.org
-
- Joomla! Apprentice
- Posts: 18
- Joined: Thu Jun 16, 2011 4:49 am
- Contact:
amp and amp and... menu elements parsing
A day with bugs aye?
There is somewhere a simple mistake
I'm mega busy so can't help you with search, but at least I'll report. Steps how to get "amp" instead of &:
- create menu with sub-elements
- create one sub-menu element with "&" char.
- in module manager add module "menu" to the website with this element, but narrow it only to submenu (start level 2 and end level 2)
Joomla will produce & in source so on the website it will be printed &.
With normal menu it works fine.
[I replaced it temporary for "and" so let me know when it'll be fixed ]
There is somewhere a simple mistake
I'm mega busy so can't help you with search, but at least I'll report. Steps how to get "amp" instead of &:
- create menu with sub-elements
- create one sub-menu element with "&" char.
- in module manager add module "menu" to the website with this element, but narrow it only to submenu (start level 2 and end level 2)
Joomla will produce & in source so on the website it will be printed &.
With normal menu it works fine.
[I replaced it temporary for "and" so let me know when it'll be fixed ]
- Webdongle
- Joomla! Master
- Posts: 44093
- Joined: Sat Apr 05, 2008 9:58 pm
Re: amp and amp and... menu elements parsing
I am unable to replicate the error. Perhaps the & should be converted to the word and instead of the letter a. But the error you encountered did not appear.
These are the tests I performed.
Created a child item called
Test & test this
on save
The alias auto created
test-a-test-this
The menu item displayed
Test & test this
Changed the
&
to
&
Cleared the Alias
on save
The alias auto created
test-a-test-this
The Title changed to
Test & test this
Changed the
a
to
&
on save
The alias auto created
test-a-test-this
Changed the
a
to
&
on save
The alias auto created
test-a-test-this
These are the tests I performed.
Created a child item called
Test & test this
on save
The alias auto created
test-a-test-this
The menu item displayed
Test & test this
Changed the
&
to
&
Cleared the Alias
on save
The alias auto created
test-a-test-this
The Title changed to
Test & test this
Changed the
a
to
&
on save
The alias auto created
test-a-test-this
Changed the
a
to
&
on save
The alias auto created
test-a-test-this
http://www.weblinksonline.co.uk/
https://www.weblinksonline.co.uk/updating-joomla.html
"When I'm right no one remembers but when I'm wrong no one forgets".
https://www.weblinksonline.co.uk/updating-joomla.html
"When I'm right no one remembers but when I'm wrong no one forgets".
-
- Joomla! Apprentice
- Posts: 18
- Joined: Thu Jun 16, 2011 4:49 am
- Contact:
Re: amp and amp and... menu elements parsing
Ok, I will show you just for one day as the website is under construction and we don't have many visitors yet
http://www.futurelab.co.nz/solutions/what-we-do
[the part "e-commerce & portals"]
Look on the sidebar menu and on the footer menu. The menu is exactly the same, just footer is full footer menu, sidebar is just depth 2.
http://www.futurelab.co.nz/solutions/what-we-do
[the part "e-commerce & portals"]
Look on the sidebar menu and on the footer menu. The menu is exactly the same, just footer is full footer menu, sidebar is just depth 2.
- Webdongle
- Joomla! Master
- Posts: 44093
- Joined: Sat Apr 05, 2008 9:58 pm
Re: amp and amp and... menu elements parsing
I see on the bottom menu and in the Meta details on the browser
e-commerce & portals
On the side menu I see
e-commerce & portals
But using a default Template the menu in the left shows
e-commerce & portals
This suggests that the Template that you are using has a badly written Override. It is often better to test with a default Template and a fresh install. That rules out other errors and premature assumptions.
e-commerce & portals
On the side menu I see
e-commerce & portals
But using a default Template the menu in the left shows
e-commerce & portals
This suggests that the Template that you are using has a badly written Override. It is often better to test with a default Template and a fresh install. That rules out other errors and premature assumptions.
You do not have the required permissions to view the files attached to this post.
http://www.weblinksonline.co.uk/
https://www.weblinksonline.co.uk/updating-joomla.html
"When I'm right no one remembers but when I'm wrong no one forgets".
https://www.weblinksonline.co.uk/updating-joomla.html
"When I'm right no one remembers but when I'm wrong no one forgets".
-
- Joomla! Apprentice
- Posts: 18
- Joined: Thu Jun 16, 2011 4:49 am
- Contact:
Re: amp and amp and... menu elements parsing
Now this is really weird! I don't have any menu modifications in my template but indeed just my template makes that error.
All I have in my template html is:
com_contact
com_content
mod_articles_category
and that's it.
What I found so far is:
- In database there is just &.
- in JMenuSite::load everything looks ok and it's & as well
- now in JMenu::getItems sometimes it's & sometimes it's & when you load $this->_items array.
I have no clue what is going on between load and getItems with menu object. I definitely don't modify it, but I'm stuck with it for now...
All I have in my template html is:
com_contact
com_content
mod_articles_category
and that's it.
What I found so far is:
- In database there is just &.
- in JMenuSite::load everything looks ok and it's & as well
- now in JMenu::getItems sometimes it's & sometimes it's & when you load $this->_items array.
I have no clue what is going on between load and getItems with menu object. I definitely don't modify it, but I'm stuck with it for now...
- infograf768
- Joomla! Master
- Posts: 19133
- Joined: Fri Aug 12, 2005 3:47 pm
- Location: **Translation Matters**
Re: amp and amp and... menu elements parsing
Maybe your template is using a "framework" and that one is messing with the menu titles.
If it is the case, contact the template developer as these "frameworks" are often the reason of various issues.
If it is the case, contact the template developer as these "frameworks" are often the reason of various issues.
Jean-Marie Simonet / infograf
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group
-
- Joomla! Apprentice
- Posts: 18
- Joined: Thu Jun 16, 2011 4:49 am
- Contact:
Re: amp and amp and... menu elements parsing
Noup, I just copied beez5 template and modified index.php and htmls - that's all.
- Webdongle
- Joomla! Master
- Posts: 44093
- Joined: Sat Apr 05, 2008 9:58 pm
Re: amp and amp and... menu elements parsing
Well you modified the overrides incorrectly then. Also the beez5 Template has a lot of hard coded links in.pojke wrote:...modified index.php and htmls - that's all.
http://www.weblinksonline.co.uk/
https://www.weblinksonline.co.uk/updating-joomla.html
"When I'm right no one remembers but when I'm wrong no one forgets".
https://www.weblinksonline.co.uk/updating-joomla.html
"When I'm right no one remembers but when I'm wrong no one forgets".
-
- Joomla! Apprentice
- Posts: 18
- Joined: Thu Jun 16, 2011 4:49 am
- Contact:
Re: amp and amp and... menu elements parsing
Now you can tell me whatever you want, but you have to admit that something is wrong
I tried a lot of things, searched through the libraries, modules and... I tried to do the simplest test. Tried to turn off parts of the website and it worked.
SOoo you know where the bug is?
When you apply the same menu twice as a module. When I found it and was 99% I had to be 100% sure, so I attached a copy of footer as a module. So on one page there was 3 modules of footer menu and you know what? The first one is & , the second one is & and the third attached one is & !
Now try to blame me for that
Also as I mentioned, there is no modifications of mod_menu, I'm using the original one.
I tried a lot of things, searched through the libraries, modules and... I tried to do the simplest test. Tried to turn off parts of the website and it worked.
SOoo you know where the bug is?
When you apply the same menu twice as a module. When I found it and was 99% I had to be 100% sure, so I attached a copy of footer as a module. So on one page there was 3 modules of footer menu and you know what? The first one is & , the second one is & and the third attached one is & !
Now try to blame me for that
Also as I mentioned, there is no modifications of mod_menu, I'm using the original one.
- Webdongle
- Joomla! Master
- Posts: 44093
- Joined: Sat Apr 05, 2008 9:58 pm
Re: amp and amp and... menu elements parsing
So now your saying it happens when you have two menu modules on the same page.pojke wrote:...
When you apply the same menu twice as a module.....
I see reason to have two identical menus on the same page but I tested that way. The result was that the main menu displayed &
However if you use split menus(because the menu item only displays once) then the menu item showed just the &
Also if you create a menu item of Type 'Alias' and name it the same then just the & displays on both menu items.
The question is how often would a web designer have two copies of the same menu on the same page ? Would they be more likely to use split menus or create menu item of 'Type' Alias if they needed a menu item to appear in another menu ?
http://www.weblinksonline.co.uk/
https://www.weblinksonline.co.uk/updating-joomla.html
"When I'm right no one remembers but when I'm wrong no one forgets".
https://www.weblinksonline.co.uk/updating-joomla.html
"When I'm right no one remembers but when I'm wrong no one forgets".
-
- Joomla! Apprentice
- Posts: 18
- Joined: Thu Jun 16, 2011 4:49 am
- Contact:
Re: amp and amp and... menu elements parsing
It always been 2 menus - sidebar is just a part of footer menu.
Your solution works, as well as mine with replacing & with 'and' This is just workaround and to be honest I have a lot of designs with menu on the top (or in footer) and then in sidebar just menu from a group this page belongs to. But never used & in the menu so haven't noticed it before.
Up to you if you're going to fix it or not. Should be a simple fix for someone who knows where to change it.
Your solution works, as well as mine with replacing & with 'and' This is just workaround and to be honest I have a lot of designs with menu on the top (or in footer) and then in sidebar just menu from a group this page belongs to. But never used & in the menu so haven't noticed it before.
Up to you if you're going to fix it or not. Should be a simple fix for someone who knows where to change it.
- Webdongle
- Joomla! Master
- Posts: 44093
- Joined: Sat Apr 05, 2008 9:58 pm
Re: amp and amp and... menu elements parsing
Not up to mepojke wrote:....
Up to you if you're going to fix it or not. Should be a simple fix for someone who knows where to change it.
http://www.weblinksonline.co.uk/
https://www.weblinksonline.co.uk/updating-joomla.html
"When I'm right no one remembers but when I'm wrong no one forgets".
https://www.weblinksonline.co.uk/updating-joomla.html
"When I'm right no one remembers but when I'm wrong no one forgets".
- infograf768
- Joomla! Master
- Posts: 19133
- Joined: Fri Aug 12, 2005 3:47 pm
- Location: **Translation Matters**
Re: amp and amp and... menu elements parsing
I confirm the issue, and it also shows in the breadcrumbs.
Although it is not good practice to display twice the same menu instead of using alias menu items, here is a solution:
Edit .../modules/mod_menu/helper.php
add after line 112
this line
It may not be the way to patch trunk but it works here.
Although it is not good practice to display twice the same menu instead of using alias menu items, here is a solution:
Edit .../modules/mod_menu/helper.php
add after line 112
Code: Select all
$item->title = htmlspecialchars($item->title);
Code: Select all
$item->title = str_replace('amp;amp;', 'amp;', $item->title);
Jean-Marie Simonet / infograf
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group
-
- Joomla! Apprentice
- Posts: 18
- Joined: Thu Jun 16, 2011 4:49 am
- Contact:
- Webdongle
- Joomla! Master
- Posts: 44093
- Joined: Sat Apr 05, 2008 9:58 pm
Re: amp and amp and... menu elements parsing
Should there be a Tracker started for it ?infograf768 wrote:I confirm the issue, and it also shows in the breadcrumbs.
Although it is not good practice to display twice the same menu instead of using alias menu items, ...
....
It may not be the way to patch trunk but it works here.
http://www.weblinksonline.co.uk/
https://www.weblinksonline.co.uk/updating-joomla.html
"When I'm right no one remembers but when I'm wrong no one forgets".
https://www.weblinksonline.co.uk/updating-joomla.html
"When I'm right no one remembers but when I'm wrong no one forgets".
- infograf768
- Joomla! Master
- Posts: 19133
- Joined: Fri Aug 12, 2005 3:47 pm
- Location: **Translation Matters**
Re: amp and amp and... menu elements parsing
we have one
http://joomlacode.org/gf/project/joomla ... m_id=24628
as I said the issue is deeper and the code above is only a bandaid
(there are other ways than str_replace to do it anyway)
http://joomlacode.org/gf/project/joomla ... m_id=24628
as I said the issue is deeper and the code above is only a bandaid
(there are other ways than str_replace to do it anyway)
Jean-Marie Simonet / infograf
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group
- ChiefGoFor
- Joomla! Champion
- Posts: 5614
- Joined: Tue Sep 13, 2005 12:22 am
- Location: Omaha, Nebraska, USA
- Contact:
Re: amp and amp and... menu elements parsing
Another solution that does not involve modifying core code is as follows:
We will use template overrides.
We will use template overrides.
- In your template's directory, go into the directory that is the same as your template's name.
- You should see a folder called "html". If you do not see it, create it.
- Create a folder called "mod_menu" in the "html" folder.
- Copy the following three files from "\modules\mod_menu\tmpl" to the "mod_menu" directory you just created:
Code: Select all
default_component.php default_separator.php default_url.php
- Now, open each of these files that are in the "\templates\<your_template>\html\mod_menu" folder.
- Look for the following line (around line 14 or 15):
Code: Select all
$title = $item->anchor_title ? 'title="'.$item->anchor_title.'" ' : '';
- Add the following line after the line you found above.
Code: Select all
$item->title = str_replace('amp;amp;', 'amp;', $item->title);
- Save the files and test.
Joomla! ...because open source matters
"Try to answer two questions for every one question you ask." - Me
"Try to answer two questions for every one question you ask." - Me
-
- Joomla! Fledgling
- Posts: 1
- Joined: Mon Jul 27, 2009 12:47 am
Re: amp and amp and... menu elements parsing
I found this problem too. I have a second level menu down the left hand side of my site, replicating the second level drop-downs in the main menu.
I applied the template overrides, works grate, thanks to all.
I applied the template overrides, works grate, thanks to all.
- ChiefGoFor
- Joomla! Champion
- Posts: 5614
- Joined: Tue Sep 13, 2005 12:22 am
- Location: Omaha, Nebraska, USA
- Contact:
Re: amp and amp and... menu elements parsing
I'm glad it helped. ... and welcome to the Joomla Forums!
Joomla! ...because open source matters
"Try to answer two questions for every one question you ask." - Me
"Try to answer two questions for every one question you ask." - Me
-
- Joomla! Intern
- Posts: 80
- Joined: Sun Jul 27, 2008 1:15 pm
Re: amp and amp and... menu elements parsing
Thanks for the fix!
For anyone who is struggling with this in breadcrumbs, a similar fix can be done with template overrides. Once you have copied default.php into yourtemplate/html/mod_breadcrumbs, find line 20, which is:
and right below it insert this line:
Cheers!
For anyone who is struggling with this in breadcrumbs, a similar fix can be done with template overrides. Once you have copied default.php into yourtemplate/html/mod_breadcrumbs, find line 20, which is:
Code: Select all
<?php for ($i = 0; $i < $count; $i ++) :
and right below it insert this line:
Code: Select all
$list[$i]->name = str_replace('amp;amp;', 'amp;', $list[$i]->name);
-
- Joomla! Apprentice
- Posts: 16
- Joined: Sun Mar 06, 2011 2:03 am
- Location: US
Re: amp and amp and... menu elements parsing
thank you!
-
- Joomla! Fledgling
- Posts: 1
- Joined: Thu Jan 19, 2012 3:18 am
Re: amp and amp and... menu elements parsing
This looks like a satisfactory fix above but it exposes what seems like a logical error in the code.
This line in mod_menu/helper.php
is running every time a menu is displayed in the page. It breaks if a menu is displayed more than once. The first time it runs it successfully escapes special characters. The second time it runs it is escaping the already escaped code.
If nothing else a re-assessment of the code and some refactoring might reduce double handling here.
Cheers,
This line in mod_menu/helper.php
Code: Select all
$item->anchor_title = htmlspecialchars($item->params->get('menu-anchor_title', ''));
If nothing else a re-assessment of the code and some refactoring might reduce double handling here.
Cheers,
-
- Joomla! Apprentice
- Posts: 11
- Joined: Sat Nov 24, 2007 10:38 pm
- Location: ISRAEL
- Contact:
Re: amp and amp and... menu elements parsing
I'ts related to php version, see here.
http://no2.php.net/manual/en/function.h ... lchars.php
replacing the string amp; would not be a wise fix.
the fix
open mod_menu/helper.php
on line ~116 replace or comment:
with:
this will ensure your localhost will work fine and also work when you upload the site to the server.
http://no2.php.net/manual/en/function.h ... lchars.php
replacing the string amp; would not be a wise fix.
the fix
open mod_menu/helper.php
on line ~116 replace or comment:
Code: Select all
$item->title = htmlspecialchars($item->title);
Code: Select all
$item->title = htmlspecialchars($item->title, ENT_COMPAT, 'UTF-8', FALSE);
Oren Wassersprung - Joomla Israel
בניית אתרים בג'ומלה: http://www.joomla-israel.co.il
בניית אתרים בג'ומלה: http://www.joomla-israel.co.il