This site uses cookies and similar technologies.

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

I understand
251 Posts
Viktor Iwan
5 years ago
14
Topic

Hello, i'm working with custom extension.

I would like to know if its possible to usa custom script to insert a content type programmatically ?

Thanks

Get a VIP membership
4229 Posts
Kadministrator
5 years ago
6
Level 1

Hi,

would you like to insert new content type or new content?

251 Posts
Viktor Iwan
5 years ago
5
Level 2

New content on specific content type

4229 Posts
Kadministrator
5 years ago
4
Level 3

Hi,

you can do sth like this, first array is for basic object - article int his case, second one for your additional content type fields

$content    =   new JCckContent( array( 'joomla_article' ) );
            $status     =   $content->create(
                'some_content_type',
                array(
                    'title'=>JFactory::getDate()->toSql(),
                    'catid'=>19,
                    'state'=>1,
                    'language'=>'*',
                    'publish_up'=>JFactory::getDate()->toSql(),
                    'created_by'=> JFactory::getUser()->id
                ),
                array(
                    'field0'=>'something',
                    'field1'=>'somehing else',
                )
            );
1 Post
jMeister
5 years ago
1
Level 4

Hello Klas,

your solution would perfectly fit my needs, but in version 3.3.6 of Seblod is the function create in class JCckContent empty. This does not work. 

Is the create method implemented in an alpha version?

Where is the source repository to have a look on the current development?

Best regards

4229 Posts
Kadministrator
5 years ago
0
Level 5

Please check 3.3.7.

8 Posts
Johnathan
5 years ago
0
Level 4

tutorial is good!

8 Posts
Johnathan
5 years ago
0
Level 4

image original: http://www.seblod.com/images/medias/18734/erroseblod.jpg

hello good evening. Your explanation is really great, made me want SEBLOD again .

However when I put this code somewhere in the frontend mainbody.php even while logged in , returns me these errors . Could you give me a light ?

Unfortunately these errors can not solve . I thank you for the excellent work and really help people discover SEBLOD the world . 'm Brazilian .

8 Posts
Johnathan
5 years ago
1
Level 1

Very good information . could give more information to implement in SEBLOD ? if you can detail each code would be perfect !

251 Posts
Viktor Iwan
4 years ago
0
Level 2

I don't think jcckcontent support tags, since tags basically store things in independent/standalone table (#__tags). Also for custom field, jcckcontent is only support for the 'locked' one (attached to specific content type)

251 Posts
Viktor Iwan
4 years ago
2
Level 1

anybody successfully make the code works ?

251 Posts
Viktor Iwan
4 years ago
1
Level 2

The problem arise because it looks for additional table.

For example i create content type 'book', and i am only using core joomla article. Seblod does not create additional table #__cck_store_form_book . i look on 'create' method, and it called CCKTable Instance:
"$this->_instance_more=JCckTable::getInstance( '#__cck_store_form_'.$this->_type );"

How to skip this line IF i don't need extra fields on extra table ?

251 Posts
Viktor Iwan
4 years ago
0
Level 3

I know the problem.. just made pull request on /dev branch.. hope Octopoos team agreed

251 Posts
Viktor Iwan
4 years ago
1
Level 1

Hi Guys, i just spend few hours to tweak JCckContent.. and now i can create, update, load content from external apps. Please note that this approach is a direct manipulation to seblod database and you're playing with raw data... and it works with plain data (that's why i call it simple). If you have interest to test you can visit my git here:

https://github.com/doxadigital/simpleseblodapi

Please don't hesitate to contribute :D

Desclaimer: this is developer stuff, no gui.. and not supported by Octopoos.. please test on production stage first.

if you have question, post here, don't PM me.. i rarely read PM :D

17 Posts
kolydart
4 years ago
0
Level 2

Hi Viktor. Thanks a lot for your contribution!

It is a very important step for using seblod in extensions. I actually use it from the cli..

I made a pull request containg a fix (sql query contains your table prefix).

best regards

Get a VIP membership