jDiction Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

jDiction 2.2.0 released. http://jdiction.org/downloads

Author Topic: jdlanguage link bug?  (Read 6343 times)

joebarrus

  • Newbie
  • *
  • Posts: 21
    • View Profile
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

Logged

joebarrus

  • Newbie
  • *
  • Posts: 21
    • View Profile
Re: jdlanguage link bug?
« Reply #1 on: May 13, 2014, 03:19:18 am »

Ok I noticed this only happens when using the internal url to an article.  doesn't matter if I turn SEF on or off since $query_sef still gets populated with a view parameter since $active->query['view'] is always "featured while $view (from $input) is "article".
Logged

joebarrus

  • Newbie
  • *
  • Posts: 21
    • View Profile
Re: jdlanguage link bug?
« Reply #2 on: May 13, 2014, 04:00:02 am »

ok I'm really confused.  This only seems to be a problem when I make my homepage point to featured articles.  If point my homepage to a single article, then the internal URL of a subsequent hyperlink to another article looks like this

http://mysite.com/index.php/es/component/content/article/24-category/282-article

but if I make my homepage point to featured articles then the hyperlink looks like this

http://mysite.com/index.php/es/24-category/282-article

the "component/content/article" portion is missing.  I think this is what is messing up your code as when I point the homepage to a single article, your code works just fine as "$menuitem" is false but when pointing to featured articles $menuitem gets populated from your query.

I don't know enough of the internals of Joomla to know what is going on here but perhaps you might have a clue. 

Sorry for the multiple posts but this is just weird

thanks

Logged

joebarrus

  • Newbie
  • *
  • Posts: 21
    • View Profile
Re: jdlanguage link bug?
« Reply #3 on: May 13, 2014, 05:19:17 am »

Ok disregard.  It only happens when I set the homepage to Featured Articles.  However, some of the problem went away when I replaced the home menuitem with a new one so I think there was also some internal corruption.  However, it still occurs under some circumstances when I set the homepage to Featured Articles.

At this point I can no longer tell if this an environment issue or something else.  But I found a workaround so sorry post this.

Thanks
Logged

Harald Leithner

  • Administrator
  • Hero Member
  • *****
  • Posts: 1684
    • View Profile
Re: jdlanguage link bug?
« Reply #4 on: May 13, 2014, 09:57:33 am »

Hi,

I have sometimes problems too when the default homepage is the com_content featured view even without jdiction, but anyway that should do it right.

Please upgrade to 1.2.0 I have rewritten parts of the mod_jdlanguageswitcher, that maybe solve the problem.
Logged
Joomla! 5.0 Release Manager
Vote at JED