Quantcast
Channel: Joomla! Forum - community, help and support
Viewing all articles
Browse latest Browse all 1436

Joomla! 5.x Coding • Re: Using the Joomla (not WEB Services) API.

$
0
0
:) Paucity
I guess I should have written "dearth" instead.

In any case, I have been able to retrieve an article using
$app = Factory::getApplication();
$factory = $app->bootComponent('com_content')->getMVCFactory();
$model = $factory->createModel('Article');
$article = $model->getItem($articleId);

at that point I have some code that modifies the introtext (never mind the details) in the $article object (array?) and I'm ready to write the updated introtext back. I tried using
$model->save($article);
but that causes an error:
0 Call to undefined method Joomla\Component\Content\Site\Model\ArticleModel::save()
I would guess that I need to add another "use" directive because the save function/method only exists in the administrator version of com_content. OR, perhaps, it is just not possible to use save() at all?

I'd be happy with know where I could find this info, but delighted if somebody could tell me how I should be doing this.

Statistics: Posted by davidascher — Sat Oct 26, 2024 8:28 pm



Viewing all articles
Browse latest Browse all 1436

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>