1
General Questions / jdlanguage link bug?
« on: May 13, 2014, 02:06:35 am »
I have a problem with the building the link in the jdlanguage module. This seems to happen when I navigate to a page using a hyperlink built to go to the article by id directly rather than through a menu item. For instance, if I have a link built that looks like this http://mysite/index.php/es/282 where the article ID is used to render the article.
I'm using jdiction 1.1.0 on Joomla 3.2.2
I debugged the issue and found in your jdlanguage helper.php code where it seems to be happening. In the getLink() function on line 29 you define $active as
$active = $menu->getActive();
Then later you build the link under by adding the article id to the $query_sef[] array if $active->query['id'] exists but it doesn't exist because the active menu item wasn't used to navigate to this page. Here is the code snippet in question on line 145
if ($id) {
$query[] = 'id='.$id;
if (isset($active->query['id']) && $active->query['id'] != $id) {
$query_sef[] = 'id='.$id;
}
}
since it never gets populated into the $query_sef[] array, it doesn't get added to the link when you build it on line 178
if (!empty($query_sef)) {
$link .= '?'.implode('&', $query_sef);
}
$query_sef is not empty as it was populated with the view variable which does exist in the $active->query array so it leaves the id out of the URL string.
The view variable is "featured" and because this is different than "article" it populates the $query_sef with "article"
Suggestions?
thanks
Joe
I'm using jdiction 1.1.0 on Joomla 3.2.2
I debugged the issue and found in your jdlanguage helper.php code where it seems to be happening. In the getLink() function on line 29 you define $active as
$active = $menu->getActive();
Then later you build the link under by adding the article id to the $query_sef[] array if $active->query['id'] exists but it doesn't exist because the active menu item wasn't used to navigate to this page. Here is the code snippet in question on line 145
if ($id) {
$query[] = 'id='.$id;
if (isset($active->query['id']) && $active->query['id'] != $id) {
$query_sef[] = 'id='.$id;
}
}
since it never gets populated into the $query_sef[] array, it doesn't get added to the link when you build it on line 178
if (!empty($query_sef)) {
$link .= '?'.implode('&', $query_sef);
}
$query_sef is not empty as it was populated with the view variable which does exist in the $active->query array so it leaves the id out of the URL string.
The view variable is "featured" and because this is different than "article" it populates the $query_sef with "article"
Suggestions?
thanks
Joe