简体   繁体   中英

Create an Article

I would like to understand how to create Articles using PHP. As today I use Fabrik to collect info using form, but i need to create in authomatic way a Joomla Article based on those data.

I'm looking for a solution (if is possible) based on PHP that will be executed when user submit the form.

To run PHP code or a pre-written script following the submission of a Fabrik form, use the PHP Form Plugin . Scripts that run via the PHP Form plugin are within the scope of the Joomla application, so you could definitely automate the creation of an article (by way of the com_content component).

If you have questions about using the plugin, your best bet would be asking on the Fabrik Forums

You would, preferably, save the article in a database (MySQL, maybe) then you would using the form (using METHOD="POST") send the results and extract them (using $_POST['* name of input']) and then save that variable into the MySQL database.

<form action="?article=submit" method="POST">
<input type="text" name="title"/>
<input type="submit"/>
</form>

<?php
if($_GET['article'] == "submit"){
if(!empty($_POST['title'])){
mysql_query("INSERT INTO article (title)VALUES ('".$_POST['title']."')")or die(mysql_error());
}

}
?>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM