9 Posts
icke
4 years ago
2
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
4 years ago
0
Level 1

Hi Nils,

You should also include (at least):

JPluginHelper::importPlugin( 'cck_storage_location' );

Saba

164 Posts
redback
4 years ago
0
Level 1

Hello Saba,

thanks for you hint. I had the same needs and made an working example Script.

          External PHP Script for manipulating Seblod Joomla Article

Best Chris

Get a Book for SEBLOD