Is there a way to go from form to Article?

Post any questions you may have here

Is there a way to go from form to Article?

Postby fbc on Tue May 13, 2008 7:19 pm

Before I waste any time and install the component, I was wondering if there was anyway to go from form to article? Using a template?

Like I wanted people to submit poetry to a section of my joomla 1.5 site.

Once they hit the submit button I would like for the poem to appear as an article in a specific format like:

Poem name= article title & altertnate title

Article Body = Poem + sumitted by <name> + etc.etc.etc

Can it be done with this?
fbc
Fresh Boarder
 
Posts: 9
Joined: Tue May 13, 2008 7:13 pm

Re:Is there a way to go from form to Article?

Postby GreyHead on Tue May 13, 2008 7:23 pm

Hi fbc,

It's possible but not 'built-in'. You;d need to find or write the code to save the results into the articles table.

Bob
Bob Janes
info at greyhead.net
ChronoForms Support If you like ChronoForms please vote or post a review at Joomla.org
User avatar
GreyHead
Platinum Boarder
 
Posts: 3248
Joined: Tue May 29, 2007 10:15 pm
Location: Brittany

Re:Is there a way to go from form to Article?

Postby fbc on Tue May 13, 2008 7:25 pm

Awesome!! thanks.. I will look for the code..

any hints of where to start looking? article name?
fbc
Fresh Boarder
 
Posts: 9
Joined: Tue May 13, 2008 7:13 pm

Re:Is there a way to go from form to Article?

Postby GreyHead on Wed May 14, 2008 10:52 am

Hi fbc,

There's been a recent thread about posting from a form into the FireBoard forums. The code there would be a good starting place, then you'll need to dig into the Joomla code to find out which tables need to be updated to post a new article.

Bob
Bob Janes
info at greyhead.net
ChronoForms Support If you like ChronoForms please vote or post a review at Joomla.org
User avatar
GreyHead
Platinum Boarder
 
Posts: 3248
Joined: Tue May 29, 2007 10:15 pm
Location: Brittany

Re:Is there a way to go from form to Article?

Postby fbc on Wed May 14, 2008 12:22 pm

great! I'll check it out.
fbc
Fresh Boarder
 
Posts: 9
Joined: Tue May 13, 2008 7:13 pm

Re:Is there a way to go from form to Article?

Postby fbc on Fri May 16, 2008 4:49 pm

This a piece of code another program uses to create content in joomla. What would I need to alter to make it write the form data to jcontent?

Code: Select all
   $db =& JFactory::getDBO();

   //extraemos la noticia

   $query = "SELECT * FROM #__periodico_noticia WHERE IDNoticia = '$nid'";

   $db->setQuery( $query );

   $noticia = $db->loadObject();

   

   //construimos la consulta para insertarla como contenido en Joomla

   $query = "INSERT INTO #__content(title,alias,title_alias,introtext,sectionid,catid,state,created,publish_up) VALUES ("

      . "'$noticia->Titulo',"

      . "'$noticia->Titulo',"

      . "'$noticia->Link',"

      . "'$noticia->Descripcion',"

      . "'$sid',"

      . "'$cid',"

      . "'$noticia->published',"

      . "'$noticia->Fecha_de_publicacion',"

      . "'$noticia->Fecha_de_publicacion'"

      . ")";

   $db->setQuery( $query );

   

   //ejecutamos la consulta

   $db->query();

   //si todo va bien devolvemos cero

   return 0;
fbc
Fresh Boarder
 
Posts: 9
Joined: Tue May 13, 2008 7:13 pm

Re:Is there a way to go from form to Article?

Postby fbc on Sat May 17, 2008 2:49 am

OK In the form html area I got this:

Code: Select all
input class="inputbox" name="title"
id="title" size="50" maxlength="100" value=""
type="text"


in the On Submit code - before sending email section i got:

Code: Select all
$db =& JFactory::getDBO();
    $query = "INSERT INTO #__content(title,alias,title_alias,introtext,sectionid,catid,state,created,publish_up) VALUES ("

        . "'$title',"

        . "'$title',"

        . "'$title',"

        . "'$introtext',"

        . "'3',"

        . "'$catid',"

        . "'1',"

        . "'2008-05-04 20:16:44',"

        . "'2008-05-04 20:16:44'"

        . ")";

    $db->setQuery( $query );

     

    //execute the query

    $db->query();

    //if everything goes well the result is zero 

    return 0;


And it just creates a record with the dates section id and correct state, but all the other fields are blank. The variables are not being passed. What should I do? Any recommendations?
fbc
Fresh Boarder
 
Posts: 9
Joined: Tue May 13, 2008 7:13 pm

Re:Is there a way to go from form to Article?

Postby fbc on Sat May 17, 2008 7:27 pm

OK it all works now, I figured it all out. Now I'm trying to get the text entered into the form to retain it's formatting. When it's saved to the table, it's saved as one long string. No linefeeds or nothing.. Just one long string of line together with no carriage returns or nothing.
fbc
Fresh Boarder
 
Posts: 9
Joined: Tue May 13, 2008 7:13 pm

Re:Is there a way to go from form to Article?

Postby GreyHead on Sat May 17, 2008 8:53 pm

Hi fbc,

Please take a look at post #7707 in this thread

Bob
Bob Janes
info at greyhead.net
ChronoForms Support If you like ChronoForms please vote or post a review at Joomla.org
User avatar
GreyHead
Platinum Boarder
 
Posts: 3248
Joined: Tue May 29, 2007 10:15 pm
Location: Brittany


Return to Questions & Answers

Who is online

Users browsing this forum: GreyHead, novagiant, Yahoo [Bot] and 5 guests