I like to read an article by id from Joomla 2.5.
As I'm not inside the framework I've to include it first.
I found also some samples how to get an article by id than but it ever fails ...
This is the sample I'm trying:
define( '_JEXEC', 1 );
define( '_VALID_MOS', 1 );
define( 'JPATH_BASE', realpath(dirname(__FILE__)));
define( 'DS', DIRECTORY_SEPARATOR );
require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' );
require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' );
echo JPATH_BASE .DS.'includes'.DS.'framework.php';
$mainframe =& JFactory::getApplication('site');
$mainframe->initialise();
echo $mainframe->getCfg('sitename');
$articleId = JRequest::getInt('Itemid');
$db =& JFactory::getDBO();
$sql = "SELECT fulltext FROM #__content WHERE id = 260"; //.intval($articleId);
$db->setQuery($sql);
$fullArticle = $db->loadResult();
Article ID 260 is available but it ever return null ...
When I trace it $cursor in loadResult() is every null:
public function loadResult()
{
// Initialise variables.
$ret = null;
// Execute the query and get the result set cursor.
if (!($cursor = $this->execute()))
{
return null;
}
...
Can somebody help please?
Thanks
Andre
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…