Create a page with menu item and set to show a module for that page. Everything looks great until you change the URL from:
index.php?option=com_content&id=1&Itemid=101
to
index.php?option=com_content&id=1&Itemid=101
That happens when I programmatically redirect pages to a URL using JRoute::() method to create the URL without adding false as the second parameter to the JRoute::() method.
Module will still appear in the page.
Page still renders but the module will disappear. The method:
$this->countModules($position)
returns null.
Joomla v3.5.1
Setting Value
PHP Built On
Linux 3.10.0-229.20.1.el7.x86_64 #1 SMP Tue Nov 3 19:10:07 UTC 2015 x86_64
Database Version
5.5.47-MariaDB
Database Collation
utf8_general_ci
Database Connection Collation
utf8mb4_general_ci
PHP Version
5.4.16
Web Server
nginx/1.10.0
WebServer to PHP Interface
fpm-fcgi
Joomla! Version
Joomla! 3.5.1 Stable [ Unicorn ] 05-April-2016 22:45 GMT
Joomla! Platform Version
Joomla Platform 13.1.0 Stable [ Curiosity ] 24-Apr-2013 00:00 GMT
User Agent
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.94 Safari/537.36
At first I was thinking maybe changing & to & is mandatory for xml view but html is default and why would JRoute::_() defaults to xhtml. Can any of the Joomla masters educate a fledgling please. Thanks!
i think this is expected behavioir see:
https://api.joomla.org/cms-3/classes/JRoute.html
Translates an internal Joomla URL to a humanly readable URL.
_(string $url, boolean $xhtml = true, integer $ssl = null) : string
$xhtml
boolean Replace & by & for XML compliance.
The second parameter default value is true so you need to set it to false if you want it.
@photodude it is &
and &
Category | ⇒ | Libraries Router / SEF |
Status | New | ⇒ | Expected Behaviour |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2016-05-10 08:17:30 |
Closed_By | ⇒ | brianteeman |
Closed as expected behaviour
Hi brianteeman,
My point is why is if xhtml=true is for XML compliance then why set it to true by default when the default view is html format? Why not set the xhtml automatically depending on a view format requested?
Having to add the second parameter (false) when redirecting to view.html.php using JRoute is an extra step, don't you think?
And by the way, if I am redirecting to a page from a controller, because of that behaviour my modules will disappear after redirect renders unless I explicitly add the second parameter false in JRoute. But it does render fine if SEF is enabled.
Joomla's layouts for the longest time defaulted to aiming for XHTML compliance and as such that's how the system is designed.
Hi mbabker,
I see, then why the modules disappears when the URL is XHTML compliant? Is it also by design?
Probably has something to do with the decoding of the ampersand when used in a URL that way and causes values to not be set to PHP's superglobals correctly. Either way it has nothing to do with JRoute at that point.
Probably it's not the JRoute I agree. But that I believe is an issue, just noticed that the modules that are set to show in a specific Item id are those module that only disappears but not those modules that are set to show in all pages.
If it's not being decoded into PHP correctly that's the issue. With option=com_content&id=1&Itemid=101
without proper decoding you'd have something equivalent to $_GET['id'] = '1&Itemid=101'
and no $_GET['Itemid']
value, and that's happening outside Joomla.
The problem is my URL is being processed inside Joomla and just redirecting. I'm not even using $_GET variable. To be specific, I am using:
$app->redirect( JRoute::_('index.php?option=com_content&id=1&Itemid=' . $itemid) );
And I tried this in 2 different servers: 1 - XAMPP 7.0.4 in Mac, 2 - CentOS server with LEMP and Joomla is having the same behaviour. Must be in countModules() method or somewhere. You can try it in your site if you want and I hope you'll find it strange for a module to disappear. But make sure SEF is turned off.
I'm just reporting this strange behaviour and have no solution to offer, but hoping you guys find it strange and hope I'll get an answer as to why. Anyways, thanks for you answers.
Labels |
Added:
?
|
Hey
I am having the same issue with a plugin using : $app->redirect( JRoute::_('index.php?option=com_content&id=1&Itemid=' . $itemid) );
The output redirects with & instead of & : http://cdl.joomlademos.co.uk/index.php?option=com_content&view=featured&Itemid=1207
Ideas?
Thanks
Sorry I am using : if($itemid) $app->redirect(JRoute::_($menuitem->link.'&Itemid='.$itemid));
Joomla 3.6.3
Database Version 5.6.30-log
Database Collation utf8_unicode_ci
Database Connection Collation utf8mb4_general_ci
PHP Version 5.6.24
No one will see a comment on a closed issue
Oh sorry... first time using this issue tracker... will open new one. Thanks
Your fromURL and toURL are exactly the same... Can you clarify?