Getting SEF url of one joomla from another joomla in root

For Joomla! 2.5 Coding related discussions, please use: http://groups.google.com/group/joomla-dev-general
Note: All 1.6, 1.7 and 3.5 releases have reached end of life and should be updated to 3.x.

Moderator: ooffick

Forum rules
Please use the mailing list here: http://groups.google.com/group/joomla-dev-general rather than this forum.
Locked
hs_jha
Joomla! Apprentice
Joomla! Apprentice
Posts: 10
Joined: Fri Jan 15, 2010 5:54 pm
Location: New York
Contact:

Getting SEF url of one joomla from another joomla in root

Post by hs_jha » Mon Feb 09, 2015 4:17 pm

I have a directory structure like this
root-->joomla-application1

and sub folder applications

joomla-application1/joomla-application2
joomla-application1/joomla-application3
joomla-application1/joomla-application4


I am trying get article with most hits in joomla-application2 from joomla-application3 with the help of a module.

using the code below -
(the module parameter is provided with server,dbname,pass and table prefix)

$db = & JDatabase::getInstance( $option );
$query = 'SELECT catid,id,title,introtext,alias,(SELECT cat.title FROM #__categories cat WHERE cat.id=catid) AS cattitle FROM #__content ORDER BY hits DESC LIMIT 0,'.$NumofRec;
$db->setQuery($query);
$column= $db->loadObjectList();

Everything seems to work fine however the sef url is taking values from current executing joomla application.
ie --

http://xxx.com/<menu-alias>/<article-id>-article-alias

--the area in bold above should be from application 2 but it is taken from 1 and i dont know how to get menu alias of application2.

I am using the code below to get url-

$artlink = JRoute::_(ContentHelperRoute::getArticleRoute($name->id, $name->catid)) .'-'.$name->alias;

I hope i am able to clarify my difficulty....
Last edited by imanickam on Mon Feb 09, 2015 5:01 pm, edited 1 time in total.
Reason: Moved the topic from the forum General Questions/New to Joomla! 2.5 to the forum Joomla! 2.5 Coding

itoctopus
Joomla! Virtuoso
Joomla! Virtuoso
Posts: 4025
Joined: Mon Nov 25, 2013 4:35 pm
Location: Montreal, Canada
Contact:

Re: Getting SEF url of one joomla from another joomla in roo

Post by itoctopus » Mon Feb 09, 2015 4:57 pm

This behavior is normal. What you need to is to create a web service that will publish the most visited pages every 15 minutes (or so) in an XML file, and the read that XML file from your other website. This is the best and the cleanest way of doing this.

There are also other ways, but they'll be more in the realm of spaghetti code.
http://www.itoctopus.com - Joomla consulting at its finest
https://twitter.com/itoctopus - Follow us on Twitter

hs_jha
Joomla! Apprentice
Joomla! Apprentice
Posts: 10
Joined: Fri Jan 15, 2010 5:54 pm
Location: New York
Contact:

Re: Getting SEF url of one joomla from another joomla in roo

Post by hs_jha » Mon Feb 09, 2015 5:44 pm

itoctopus wrote:This behavior is normal. What you need to is to create a web service that will publish the most visited pages every 15 minutes (or so) in an XML file, and the read that XML file from your other website. This is the best and the cleanest way of doing this.

There are also other ways, but they'll be more in the realm of spaghetti code.
Is is not possible to reference one joomla application from another ?(so that url of that installation is available via joomla api)
Please read forum rules regarding signatures: http://forum.joomla.org/viewtopic.php?t=65


Locked

Return to “Joomla! 2.5 Coding”