PDA

View Full Version : Can forms be embedded into content items?


cparekh
09-05-2008, 09:50 AM
Hi,

I've just played around with Fabrik and am very impressed by how quickly a form can be generated.

Is it possible to embed a form into a content item? I'm building a custom component for j1.5 where users can post a question and other users can post answers. So, ideally, a content item i.e. a question, will include a fabrik 'answer' form.

Thanx in advance.

C.

terp
09-05-2008, 11:46 AM
Indeed, forms can be embedded into content items quite nicely using the respective Fabrik mambot (for either tables, forms, or both).

http://fabrikar.com/index.php?option=com_docman&Itemid=29

Grab the mambot for the Joomla platform you are using and take it for a test drive. ;)

cparekh
09-05-2008, 12:57 PM
Hi terp,

thanks for that - yep, tried it out in a new article and it works great.

Question - how would I display a form in an output file? For my new component I'd like a form to appear below some other dynamic output thus:

<?php if ($user->id > 0)
{
echo "<p>".$row->content."</p>";

echo "<p>".$row->created_by_alias."</p>";

echo "<p>".$row->related_resources."</p>";

echo "<p>Anwer this question:</p>";

echo "{fabrik view=form id=4}";
}
?>

however this only prints {fabrik view=form id=4} literally.

cheesegrits
09-05-2008, 05:22 PM
You can't invoke mambots with the {...} from inside other component output. The text has to be part of the initial content.

You could try invoking the formbot directly by looking at how mod_fabrik_form.php does it, and rolling your own PHP to drive that code.

-- hugh