• 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!

TOPIC: how to put an article in the database using script

how to put an article in the database using script 13 years 11 months ago #10533

  • brokie50
  • brokie50's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 2
Hello all

First of all: I'm very happy with RSFor! pro. I'm looking at the scripting part of the component now, but I think I could need some help. I would like to put all the information of the form into an new article in the database. So my question is: how to put an article into the database using the scripting tool. My idea is to have the article not published so I can have a look at the article before publishing. Could anyone give me some hints?

Thanks,
Brokie50
The administrator has disabled public write access.

Re:how to put an article in the database using script 13 years 11 months ago #10565

  • andreic
  • andreic's Avatar
  • NOW ONLINE
  • RSJoomla! Official Staff
  • Posts: 733
  • Thank you received: 60
Hello,

In order to achieve this you could try adding a custom script to your form that inserts the submitted data in the correct Joomla! tables, so a new article will be created. The script should be placed in "Script called after form has been processed" :
$db =& JFactory::getDBO();
 
$title = $_POST['form']['title'];
$fulltext = $_POST['form']['text'];
$state = -1; // 1 for published, 0 for unpublished, -1 for pending
$sectionid = 0; // the section id from Joomla!
$catid = 0; // the category id from Joomla!
 
// No need to edit below
 
$title = $db->getEscaped($title);
$alias = JFilterOutput::stringURLSafe($title);
$fulltext = $db->getEscaped($fulltext);
 
$db->setQuery("INSERT INTO #__content SET ".
"`title`='".$title."',".
"`alias`='".$alias."',".
"`fulltext`='".$fulltext."',".
"`state`='".$state."',".
"`sectionid`='".$sectionid."',".
"`catid`='".$catid."'");
$db->query();
Please note: my help is not official customer support. To receive your support, submit a ticket by clicking here
Regards,
RSJoomla! Development Team
The administrator has disabled public write access.
  • 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!