Joomla 2.5 data retrieve in external php page -


i use joomla 2.5 website, home page external php page, need data specific joomla articles , menu items.

  1. what best way go, calling modules or connecting database retrieve need?
  2. how can call joomla classes, functions etc results?

what i've tried:

the "module" solution post (joomla menu in external page), shows error concerning session being started.

some code data retrieval:

define('_jexec', 1); define('jpath_base', dirname(__file__).'/../../joomla_2.5.9' );   // should point 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 getting article text specific article. of course it's not functional since want work around categories , multilingual content.

i add whatever turns out solve problem in better way. further ideas help!

you need initialize joomla application:

$joomlapath = dirname(__file__).'/../../joomla_2.5.9'; define('_jexec', 1); define('ds', directory_separator);  if (file_exists($joomlapath . '/defines.php')) {     include_once $joomlapath . '/defines.php'; }  if (!defined('_jdefines')) {     define('jpath_base', $joomlapath);     require_once jpath_base.'/includes/defines.php'; }  require_once jpath_base.'/includes/framework.php';  // instantiate application. $app = jfactory::getapplication('site');  // initialise application. $app->initialise(); 

first have access configured joomla environment.


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -