The Joomla! Forum ™



Forum rules


Please use the official Bug Tracker to report a bug: http://joomlacode.org/gf/project/joomla ... er_id=8103



Post new topic Reply to topic  [ 23 posts ] 
Author Message
PostPosted: Thu Aug 18, 2011 8:36 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Thu Jun 16, 2011 4:49 am
Posts: 13
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 :) ]

_________________
http://www.futurelab.co.nz


Top
 Profile  
 
PostPosted: Fri Aug 19, 2011 2:43 am 
User avatar
Joomla! Master
Joomla! Master

Joined: Sat Apr 05, 2008 9:58 pm
Posts: 23363
Location: @Webdongle
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

_________________
http://weblinksonline.co.uk/joomla-faq.html


Top
 Profile  
 
PostPosted: Fri Aug 19, 2011 3:34 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Thu Jun 16, 2011 4:49 am
Posts: 13
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


Top
 Profile  
 
PostPosted: Fri Aug 19, 2011 3:58 pm 
User avatar
Joomla! Master
Joomla! Master

Joined: Sat Apr 05, 2008 9:58 pm
Posts: 23363
Location: @Webdongle
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.
Attachment:
Screenshot-687.png


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://weblinksonline.co.uk/joomla-faq.html


Top
 Profile  
 
PostPosted: Fri Aug 19, 2011 8:24 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Thu Jun 16, 2011 4:49 am
Posts: 13
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...

_________________
http://www.futurelab.co.nz


Top
 Profile  
 
PostPosted: Sat Aug 20, 2011 5:07 am 
User avatar
Joomla! Master
Joomla! Master

Joined: Fri Aug 12, 2005 3:47 pm
Posts: 16668
Location: **Translation Matters**
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.

_________________
Jean-Marie Simonet / infograf · http://www.info-graf.fr
Multilanguage in 2.5: http://help.joomla.org/files/EN-GB_multilang_tutorial.pdf
---------------------------------
Joomla Translation Coordination Team • Joomla! Production Working Group


Top
 Profile  
 
PostPosted: Sat Aug 20, 2011 8:17 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Thu Jun 16, 2011 4:49 am
Posts: 13
Noup, I just copied beez5 template and modified index.php and htmls - that's all.

_________________
http://www.futurelab.co.nz


Top
 Profile  
 
PostPosted: Sat Aug 20, 2011 8:58 pm 
User avatar
Joomla! Master
Joomla! Master

Joined: Sat Apr 05, 2008 9:58 pm
Posts: 23363
Location: @Webdongle
pojke wrote:
...modified index.php and htmls - that's all.
Well you modified the overrides incorrectly then. Also the beez5 Template has a lot of hard coded links in.

_________________
http://weblinksonline.co.uk/joomla-faq.html


Top
 Profile  
 
PostPosted: Sat Aug 20, 2011 11:42 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Thu Jun 16, 2011 4:49 am
Posts: 13
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 :p
Also as I mentioned, there is no modifications of mod_menu, I'm using the original one.

_________________
http://www.futurelab.co.nz


Top
 Profile  
 
PostPosted: Sun Aug 21, 2011 1:17 am 
User avatar
Joomla! Master
Joomla! Master

Joined: Sat Apr 05, 2008 9:58 pm
Posts: 23363
Location: @Webdongle
pojke wrote:
...
When you apply the same menu twice as a module.....

So now your saying it happens when you have two menu modules on the same page.

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://weblinksonline.co.uk/joomla-faq.html


Top
 Profile  
 
PostPosted: Sun Aug 21, 2011 1:58 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Thu Jun 16, 2011 4:49 am
Posts: 13
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.

_________________
http://www.futurelab.co.nz


Top
 Profile  
 
PostPosted: Sun Aug 21, 2011 2:02 am 
User avatar
Joomla! Master
Joomla! Master

Joined: Sat Apr 05, 2008 9:58 pm
Posts: 23363
Location: @Webdongle
pojke 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.

Not up to me

_________________
http://weblinksonline.co.uk/joomla-faq.html


Top
 Profile  
 
PostPosted: Sun Aug 21, 2011 5:25 am 
User avatar
Joomla! Master
Joomla! Master

Joined: Fri Aug 12, 2005 3:47 pm
Posts: 16668
Location: **Translation Matters**
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
Code:
$item->title = htmlspecialchars($item->title);

this line
Code:
$item->title = str_replace('amp;amp;', 'amp;', $item->title);


It may not be the way to patch trunk but it works here.

_________________
Jean-Marie Simonet / infograf · http://www.info-graf.fr
Multilanguage in 2.5: http://help.joomla.org/files/EN-GB_multilang_tutorial.pdf
---------------------------------
Joomla Translation Coordination Team • Joomla! Production Working Group


Top
 Profile  
 
PostPosted: Sun Aug 21, 2011 11:28 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Thu Jun 16, 2011 4:49 am
Posts: 13
Thanks, works perfectly :)

_________________
http://www.futurelab.co.nz


Top
 Profile  
 
PostPosted: Sun Aug 21, 2011 3:22 pm 
User avatar
Joomla! Master
Joomla! Master

Joined: Sat Apr 05, 2008 9:58 pm
Posts: 23363
Location: @Webdongle
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.
Should there be a Tracker started for it ?

_________________
http://weblinksonline.co.uk/joomla-faq.html


Top
 Profile  
 
PostPosted: Sun Aug 21, 2011 3:56 pm 
User avatar
Joomla! Master
Joomla! Master

Joined: Fri Aug 12, 2005 3:47 pm
Posts: 16668
Location: **Translation Matters**
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)

_________________
Jean-Marie Simonet / infograf · http://www.info-graf.fr
Multilanguage in 2.5: http://help.joomla.org/files/EN-GB_multilang_tutorial.pdf
---------------------------------
Joomla Translation Coordination Team • Joomla! Production Working Group


Top
 Profile  
 
PostPosted: Mon Oct 03, 2011 7:01 am 
User avatar
Joomla! Champion
Joomla! Champion

Joined: Tue Sep 13, 2005 12:22 am
Posts: 5212
Location: Omaha, Nebraska, USA
Another solution that does not involve modifying core code is as follows:

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:
    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:
    $title = $item->anchor_title ? 'title="'.$item->anchor_title.'" ' : '';
  • Add the following line after the line you found above.
    Code:
    $item->title = str_replace('amp;amp;', 'amp;', $item->title);
  • Save the files and test.

@JM - Good to see you. :)

_________________
Kenneth Crowder - Omaha, Nebraska, USA
Global Moderator - Joomla! ...because open source matters
Recipes for people with food allergies: http://intolerantoffspring.com
Author of "Joomla! 1.5: Developing Secure Sites": http://www.lynda.com/home/DisplayCourse.aspx?lpk2=73559


Top
 Profile  
 
PostPosted: Mon Oct 10, 2011 12:43 am 
Joomla! Fledgling
Joomla! Fledgling

Joined: Mon Jul 27, 2009 12:47 am
Posts: 1
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.


Top
 Profile  
 
PostPosted: Mon Oct 10, 2011 2:50 am 
User avatar
Joomla! Champion
Joomla! Champion

Joined: Tue Sep 13, 2005 12:22 am
Posts: 5212
Location: Omaha, Nebraska, USA
I'm glad it helped. ... and welcome to the Joomla Forums! :)

_________________
Kenneth Crowder - Omaha, Nebraska, USA
Global Moderator - Joomla! ...because open source matters
Recipes for people with food allergies: http://intolerantoffspring.com
Author of "Joomla! 1.5: Developing Secure Sites": http://www.lynda.com/home/DisplayCourse.aspx?lpk2=73559


Top
 Profile  
 
PostPosted: Mon Oct 10, 2011 5:30 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Sun Jul 27, 2008 1:15 pm
Posts: 47
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:

Code:
<?php for ($i = 0; $i < $count; $i ++) :


and right below it insert this line:

Code:
$list[$i]->name = str_replace('amp;amp;', 'amp;', $list[$i]->name);


Cheers!


Top
 Profile  
 
PostPosted: Fri Jan 13, 2012 6:43 pm 
User avatar
Joomla! Apprentice
Joomla! Apprentice

Joined: Sun Mar 06, 2011 2:03 am
Posts: 13
Location: US
thank you!


Top
 Profile  
 
PostPosted: Thu Jan 19, 2012 3:24 am 
Joomla! Fledgling
Joomla! Fledgling

Joined: Thu Jan 19, 2012 3:18 am
Posts: 1
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

Code:
$item->anchor_title = htmlspecialchars($item->params->get('menu-anchor_title', ''));


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,


Top
 Profile  
 
PostPosted: Tue Apr 03, 2012 9:30 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Sat Nov 24, 2007 10:38 pm
Posts: 11
Location: ISRAEL
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:
Code:
$item->title = htmlspecialchars($item->title);


with:
Code:
$item->title = htmlspecialchars($item->title, ENT_COMPAT, 'UTF-8', FALSE);


this will ensure your localhost will work fine and also work when you upload the site to the server.

_________________
Oren Wassersprung - Joomla Israel
בניית אתרים בג'ומלה: http://www.joomla-israel.co.il


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 23 posts ] 



Who is online

Users browsing this forum: No registered users and 9 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group