How can I create a valid article from my custom component?

This forum is for general questions about extensions for Joomla! 2.5.

Moderators: pe7er, General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Locked
cowboymathu
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Mon Oct 27, 2014 8:01 am

How can I create a valid article from my custom component?

Post by cowboymathu » Mon Oct 27, 2014 8:11 am

I want to create a valid article entry in the #__content table with all the dependencies by giving only 'title' from my custom component. Something like I want to call com_content component controller in my custom component and call save() method with title = "my value". I know how to call other component model in my component and get items but this time I want to create an entry of an article from my component.

imarklee
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 205
Joined: Wed Aug 29, 2012 7:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: How can I create a valid article from my custom componen

Post by imarklee » Fri Oct 31, 2014 4:40 pm

You should try using the JTable classes as it's pretty handy when it comes to CRUD operations. For instance,

Code: Select all

$article = JTable::getInstance('Content');

var_dump($article);

// Save the article
$article->store();
Lead Developer,
https://stackideas.com


Locked

Return to “Extensions for Joomla! 2.5”