accessing elements for form custom design in default and bluesky templates

pkjoshi

Active Member
I need some help on how I can access elements in default and blue-sky templates as example in contact-custom template is quite different than these templates.

Thanks.
 
Greetings,
I'd like to figure this out as well. I'm trying to build templates and layouts accessing specific Fabrik elements.

I believe this post is closely related to my post on a similar subject. I'm asking about templates in general, but I think the techniques for accessing elements is probably the same:
http://fabrikar.com/forums/showthread.php?t=24075

Hopefully answers in one post can answer questions in the other one!

Thanks,
Matthew
 
Hello,
I've been looking at all the posts and the documentation, but must admit I am still stumped. Can't seem to figure out how to simply call elements in order to place data from specific fields into DIVs or other page structures.

I'm using fabrik 3.0 beta, so perhaps the current documentation doesn't apply?

Thanks,
Matthew
 
For a try to position fields in a form take a look in default_group.php of the contacts template. There you see an example how to arrange fields in DIVs. It's all explained there in the comments.

For example there you see DIVs like that:

<div class="example">
<?php
$this->element = $this->elements['first_name'];
echo $this->loadTemplate('element');
?>
</div>

Replace for example first_name with one of your elements.

For positioning of this element go into the template_css.php and put in somewhere something like that

.yourcustomcssname .fabrikElement {
your css parameters here..... ;}

.yourcustomcssname .fabrikLabel {
your css parameters here..... ;}

In the the default_group.php in div class = "example" replace "example" with yourcustomcssname.


Of course you have to copy for example the bluesky template and rename it.
Replace for starting the default_group.php of this custom folder with the default_group.hph of the contacts template folder.

This is just a simple quick an dirty example to give you a hint.
For further development Wiki is your friend.
 
The contacs_custom form template is the example you are looking for: elements are called by name, so this type of template can only be used for a form containing exactly this elements.

For testing:

  • clone the contacts_custom form template (located in components\com_fabrik\views\form\tmpl\): copy the folder, rename (without spaces) eg. my_contacts_form
    • !Bug: edit default_group.php: in line 26 + 27 it must be
      $this->group->intro (instead of $group->intro)
  • create a list e.g. test_contact (this will create a form and a group test_contact)
  • create a (second) group e.g. test_contact2, select form=test_contact
  • create elements with exactly this names (choose labels as you want)
    • first_name (group test_contact)
    • last_name (group test_contact)
    • email (group test_contact)
    • message (group test_contact2)
  • edit your form test_contact, select the my_contacts_form template (form + detailed view)
  • edit default_group.php and template_css.php (in my_contacts_form) to display your elements as you like
 
Greetings,
Thank you troester and anfjst. I'll give this another try today -- hoping for that "aha" moment!

To pkjoshi: since you and I seem to be in about the same place, please report on your success.

Thanks,
Matthew
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top