This site uses cookies and similar technologies.

If you don't change browser settings, you agree to it.

I understand
9 Posts
icke
16 days ago
1
Topic

Hello,

I want to use the JCckContentArticle class in an external PHP script, but when I try to create an object the script aborts after the following code line:

$content = new JCckContentArticle;

I able to get the Database-object with "$db = JFactory::getDbo();" and a test query is working as well, so in general I have access to my Joomla application.

What am I missing to be able to use the JCckContentArticle class?  

Maybe I have to include one more file? But which one?

My code as it is in the moment. It breaks after "db connected".

<?php

define('_JEXEC', 1);
defined('DS') or define('DS', DIRECTORY_SEPARATOR);

if (file_exists(str_replace("/myscripts/php","",__DIR__) . '/defines.php'))
{
include_once str_replace("/myscripts/php","",__DIR__) . '/defines.php';
}

if (!defined('_JDEFINES'))
{
define('JPATH_BASE', str_replace("/myscripts/php","",__DIR__));
require_once JPATH_BASE . '/includes/defines.php';
}

require_once JPATH_BASE . '/includes/framework.php';
require_once JPATH_BASE . '/libraries/cms/cck/content.php';

$db = JFactory::getDbo();
echo 'db connected';

$content = new JCckContentArticle;
echo 'object created successfully';

?>

Any ideas / hints? 

Thank you! Nils

Get a VIP membership
14 days ago
0
Level 1

Hi Nils,

You should also include (at least):

JPluginHelper::importPlugin( 'cck_storage_location' );

Saba

Get a VIP membership