add and update a new article to contents

41 views
Skip to first unread message

pherfinion

unread,
Apr 27, 2017, 8:02:42 AM4/27/17
to Joomla! General Development
Hallo,

Adding content with this example works well:

$article = JTable::getInstance('content'); $article->title = 'This is a new title!'; $article->alias = JFilterOutput::stringURLSafe($article->title);

if
(!$article->store(TRUE)) { JError::raiseNotice(500, $article->getError()); return FALSE; }

But my problem how to update the sentence with JTable ?

THX
Pherfinion

Viper

unread,
Apr 27, 2017, 1:59:34 PM4/27/17
to Joomla! General Development
See JTable::store() method description https://github.com/joomla/joomla-cms/blob/staging/libraries/joomla/table/table.php#L763
And see JModelAdmin::save() for implementation.
Message has been deleted

pherfinion

unread,
May 4, 2017, 3:09:14 AM5/4/17
to Joomla! General Development
Now It works with only one Problem. 
The Update woks with sending the key id to the store procedure. 

Error displaying the error page: Table 's' was not locked with LOCK TABLES: Unknown column 'alias' in 'field list' seemed to be similiar to this post.

Now my problem is the same as posted in this forum

pherfinion

unread,
May 4, 2017, 3:25:08 AM5/4/17
to Joomla! General Development
Reply all
Reply to author
Forward
0 new messages