I use Joomla 2.5 for a website, but the home page is an external php page, where I need to get data from specific joomla articles and menu items.
- What is the best way to go, calling modules or connecting to database to retrieve what I need?
- How can I call the Joomla classes, functions etc to get my results?
What I've already tried:
The "module" solution from this post (Joomla Menu In External Page), which shows error concerning the session being already started.
Some code for data retrieval:
define('_JEXEC', 1);
define('JPATH_BASE', dirname(__FILE__).'/../../Joomla_2.5.9' ); // should point to joomla root
require_once ( JPATH_BASE .'/includes/defines.php' );
require_once ( JPATH_BASE .'/includes/framework.php' );
require_once ( JPATH_BASE .'/libraries/joomla/factory.php' );
$db = JFactory::getDBO();
$query = $db->getQuery(true);
$query->select('introtext')
->from('#__content')
->where('id = 1');
$db->setQuery($query);
$fullArticle = $db->loadResult();
echo $fullArticle;
This piece of code works great for getting the Article Text from a specific Article. Of course it's not that functional since I want to work around categories and multilingual content.
I will add whatever turns out to solve the problem in a better way. Any further ideas would certainly help!