Please note that Form2Content is no longer being developed. All files from the latest version can be found on Github.

Form2Content Forum

Questions and answers for Form2Content, a Joomla CCK.
  1. Travis S.
  2. F2C article templating
  3. Thursday, 13 October 2016
  4.  Subscribe via email
Hey there! So I'm doing a non-article creating content type in F2C Pro. I've created a form for people to request a room reservation for meetings to take place (contact details, room requested, time/date, etc.). This form's template is utilizing the {php}{/php} Smarty feature to take all the entered form data and simply create an email to be sent to the person in charge of the Meeting Rooms' Calendar so they can review and approve the request.

Here's the issue. In my {php} Smarty block at the very end I'm using the PHP mail() function to send my constructed e-mail message. This code seems to be called twice as I'm getting two emails exactly the same sent to the receiving party's address. The only thing I can think is that the F2C main.tpl is getting called/processed twice somehow on Save. Can I prevent this from happening in someway? Thanks as always!
Accepted Answer
Accepted Answer Pending Moderation
Hi Travis,

For technical reasons, templates can be processed twice, there's nothing you can do about that.
The place for the e-mail functionality is not in the template. This kind of functionality should be in a F2C custom plug-in that will be triggered by the after save event. Then it will be triggered only once.

You are using an old version of F2C, but I think it already has plug-in support.
Building your own plug-ins requires good PHP knowledge. The documentation (for the latest version) can be found here: http://documentation.form2content.com/f2c-extensions/joomla-plugins/151-create-your-own-form2content-plugin

best,
Julien
Responses (4)
Accepted Answer Pending Moderation
Also, this is on an older Joomla/F2C setup. Joomla 1.6.3 and F2C Pro 4.5.3.
  1. more than a month ago
  2. F2C article templating
  3. # 1
Accepted Answer Pending Moderation
Hi Travis,

Thanks you for that last info ;)

With custom code it's difficult to reproduce. There are certain event triggers in Joomla. Maybe you trigger them twice with the code? Maybe it's you get an admin message automatically?
I don't have more programming experience to help futher. Maybe other forum users do.

Regards,
Patrick
Please read the F2C documentation before asking questions! Thank you if you've done so ;)
  1. more than a month ago
  2. F2C article templating
  3. # 2
Accepted Answer Pending Moderation
Hi Travis,

For technical reasons, templates can be processed twice, there's nothing you can do about that.
The place for the e-mail functionality is not in the template. This kind of functionality should be in a F2C custom plug-in that will be triggered by the after save event. Then it will be triggered only once.

You are using an old version of F2C, but I think it already has plug-in support.
Building your own plug-ins requires good PHP knowledge. The documentation (for the latest version) can be found here: http://documentation.form2content.com/f2c-extensions/joomla-plugins/151-create-your-own-form2content-plugin

best,
Julien



Thanks so much Julien! Helpful as always! We're working on upgrading our site but right now this is just a last minute needed feature we needed to get into our current version. I've made a F2C plugin before so I'm familiar with how that whole process works but wasn't aware that the templates were processed twice. Thanks so much for that information!
  1. more than a month ago
  2. F2C article templating
  3. # 3
  • Page :
  • 1


There are no replies made for this post yet.
However, you are not allowed to reply to this post.