Forums

Submit Article with custom code

vbarlakoski 01 Apr, 2012
Hello!

I have an issue about Submit Article.

My form contains many fields that i want to apply into the Full text field. Because the Submit Article Action have a simple structure, i want to ask if there is an way to Submit trought Custom Code, that so i can exact format of the article look (like creating email template with email action)?

I really hope that there is an way for doing this.

Thanks!
GreyHead 01 Apr, 2012
Hi vbarlakoski ,

Yes - no problem. Use Custom code to create all of the parameters needed for the article record in the $form->data array and the use DB Save action to create the article in the #__content table.

Bob
vbarlakoski 02 Apr, 2012
Thanks Bob!

I am searching the forum for similar problem to get the code, but i cant find any. Is there any tutorial for this, for folks like me, that dont know php very well?
GreyHead 03 Apr, 2012
Hi vbarlakoski,

There have been a couple of threads on this a while back - see this post about including an image in an article. it can be adapted for almost any structure.

What are you trying to build?

Bob
vbarlakoski 03 Apr, 2012
Hello Bob!

I am trying to compile FULL TEXT from more than one field, it the way that i can make pre-formated article, exact field info to be shown in exact place with exact formating that i will give in the custom code action.

As i mentioned, something like creating e-mail template in e-mail action.

Thanks!
GreyHead 03 Apr, 2012
Hi vbarlakoski ,

OK, that much I'd already worked out. Please see the post I linked to.
Bob
vbarlakoski 09 Apr, 2012
Hi Bob!

That post leaded me to:

<?php
jimport( 'joomla.filesystem.file' );
$uri = JFactory::getURI();
$titlez = $form->data['input_text_3'];
$ref = $form->data['input_text_24'];
$desc = $form->data['input_textarea_5'];
$personal = $form->data['input_checkbox_group_8'];
$day = $form->data['input_checkbox_group_6'];
$till = $form->data['input_checkbox_group_7'];
$money = $form->data['input_text_10'];

$formated = "<p><strong>Ref. No.</strong></p>".$ref." <p>".$desc."</p> <p></p> <p><strong>Тип заетост</strong></p><p>".$day."</p> <p></p><p><strong>Срок на заетост</strong></p><p>".$till."</p><p></p><p><strong>Ниво на квалификация</strong></p><p>".$personal."</p><p></p><p><strong>Заплата</strong></p><p>".$money."</p>";


From here i am not pretty sure what shoul i do? Can i ask for little help?
GreyHead 10 Apr, 2012
Hi vbarlakoski,

$form->data['fulltext'] = $formated;


Bob
gandgy 28 Jan, 2013
I feel my self like i'm real stupied! I can't understand how to make it works. Maybe there is some tutorial about this issue? It will be very helpful!
GreyHead 28 Jan, 2013
Hi gandgy,

What exactly is the problem?

Bob
This topic is locked and no more replies can be posted.