How to create post programmaticaly
Hi all!
I need to create posts without una interface. I have file with structured data: title, text and i'd like to create a several posts. All posts should be with one una person profile.
I'd like to use UNA classes
Is this posible?
-
-
- · zaytseff
-
·
In reply to LeonidS
- ·
Thanks, man.
I'll try this code and report here -
- · zaytseff
- ·
Hello LeonidS !
That code work fine,thanks. I could have guessed for myself that one should use BxDolService :: call (...);
Now I got another one question. Can I edit some posts if I know $iContentId?
I tried to use 'entity_edit' by analogy with the previous code, but it not work.Can you tell me which function I need use for that?
I looked code and couldn't find analog addData() function for edit action in BxBaseModGeneralFormsEntryHelper.php. Is it possible?
-
- · zaytseff
- ·
I got some idea if 'entity_edit' not work such as 'entity_add'
So, I know post ID and can modify values with $oDb->prepare("UPDATE... WHERE id=?", $iPostId); code -
-
-
·
LeonidS
- ·
Hi all!
How to use the service edit form method:
$oForm = BxDolService::call('bx_posts', 'entity_edit', array($iPostId));
$oForm->update($iPostId, array('title' => 'title'));
-
·
LeonidS