Forums

Silly Question - Article Creation with Chronoforms?

hannylicious 16 Jun, 2011
I've searched, googled, browsed and looked for tutorials on creating article submission forms with chronoforms - but have come up empty handed.

Is there anywhere out there where I can find a tutorial on how to do that? I've stumbled across a couple threads here where people had small issues with it, but otherwise had already had it setup. I see it in use at the top of this site as well.

Is it as simple as creating a simple form and connecting it to the 'content' table of your Joomla site? I think I could put something together that would work, but I'd rather make sure I'm doing it right from the start...

Any advice would be greatly appreciated.
GreyHead 21 Jun, 2011
Hi hannylicious,

For ChronoForms v3 there is a submit_content form that you can download from the Downloads area here.
For ChronoForms v4 there is a Submit Article action in the Utilities group.

Bob
hannylicious 24 Jun, 2011
Thanks for the reply!

I actually just found that utility (running V4) yesterday - but was a little unsure what it does. I'm gonna play around with it and see.

Do I need to connect the form to the '_content' table? Or will the Submit Article utility automatically do that?

**Added**
Also, where can I view/edit the HTML like I could in V3? I liked that feature because I could set everything up with the wizard and then go tweak it to my content.

Nevermind - I answered that question! Found the code tab (duh!)
hannylicious 24 Jun, 2011
Alright, sweet.
I've done the testing and I see how this is working now.

Would it be possible for me to also do it manually? I.e. create a form and connect it to the '_content' database so I can specify certain things in addition to the title/intro-text/full-text/?

I'd like to be able to add a specific meta-keyword to user created articles, and 'combine' two fields to create the 'intro-text' portion by adding some specific html markup to them. Does that sound possible?

Thanks in advance for all your help!
GreyHead 24 Jun, 2011
Hi hannylicious ,

Yes you can do all of that. Use a Custom Code action first to create whatever values you want and add them to the form data. Provided that the name in the data array matches the column name in jos_contents the value will be added to the table.
<?php
$form->data['metakey'] = "key1,key2,key3";
?>


Bob
hannylicious 24 Jun, 2011
excellent - in the event you can't tell, I'm rubbing my hands together like an evil genius about to attempt a plan that can only be foiled by a super hero!

Okay, I'm not really doing that - I am just very happy to be getting a better grasp on customizing Chronoforms V4, and this article creation ability makes it really simple to do what I'm looking for. My hat is off to you guys at Chronoengine, the whole lot of you!
hannylicious 28 Jun, 2011
Alright,
I've just about got it done with what I wanted, just trying to handle uploaded photos.

Ultimately I've got the fields I want combined getting combined into their proper places in the DB - but I'm trying to get it to print the location of the file as well (for use in an img tag).

In reading a bit I found where it said to use:
<?php
print_r2($form->data['_PLUGINS_']['upload_files']);
?>


I've used that and it prints out the arrays I need to use to find the path to the image. My code looks like this:

<?php

$form->data['metakey'] = "review";

$imageloc = $form->data['_PLUGINS']['upload_files']['image']['path'];

$form->data['introtext'] = "<img class=\"floatleft\" src=\"".$imageloc."\" alt=\"".$_POST["title"]." Image\" border=\"0\" /><span class=\"article-title1\">".$_POST["summary"]."</span>".$_POST["introtext"] ;
?>


Everything gets pulled into the appropriate spot, except for the location of the image. It shows up blank in the article every time.

Any help on how to get that to show up would be greatly appreciated! I apologize if I'm doing something incorrectly - but this is the last little bit I need to complete the form🙂
GreyHead 28 Jun, 2011
Hi hannylicious ,

If you look at the article page HTML using View Source what do you see for the src attribute?

Please post a link to the article so we can take a quick look.

Bob
hannylicious 28 Jun, 2011
When I go into the article in the backend, the article looks like this:
<img class="floatleft" src="" alt="Test Image" border="0" />


I'd love to provide a link - however I'm developing this locally at the moment and haven't taken it live anywhere yet.

I have attached 2 screenshots
'order' shows the order of the events in the backend
'variabls' shows the output after a submission from the front end (displaying the array data)
GreyHead 28 Jun, 2011
Hi Hannylicious,

I think you are missing an _ after PLUGINS and the path may be missing the first part. Usually there is a root path before images. Please try:
$imageloc = JPATH_SITE.$form->data['_PLUGINS_']['upload_files']['image']['path'];

Bob
hannylicious 28 Jun, 2011
Perfect!
Works like a charm.

Thanks for all your help (to everyone!) and such a great great component!
This topic is locked and no more replies can be posted.