Help get this topic noticed by sharing it on Twitter, Facebook, or email.
I’m happy

Managed to get contact form working using Contacular with Stacey.

I just wanted to say a massive thanks Kolber and Nacholabs for getting php parsing to work.

I know a lot of users have tried to add contact forms to Stacey but been unsuccessful and I wanted to share my experience with a successful implementation of integrating a contact form into my templates.

I like to use an open source script called Contacular. As it allows you customise all the fields you want, with validation included and I find it really handy.

To get Contacular to work with Stacey it's quite simple really.

1. Start by downloading Contacular

2. Then move the contents of this folder to a folder somewhere on your site. I've created a folder called extensions, but you could put it anywhere.

3. Copy the example form called example.php to /templates/partials/ and call it what you like. I renamed mine to form.php.

4. Now open up form.php and change the include to point to the correct location of the script. In our case we would change this to include_once "extensions/contacular/contacular.php".

5. Then in the template where you want the form to appear just add :form in between the rest of your html.

Once you've done that the form should appear without any problems. Now you can play around with the fields and don't forget to change the email address if you want to try it out.

Hope this proves helpful.

My next task is to get Perch CMS to work with Stacey!
Reply
  • I’m confused.
    Does this really work out of the box (meaning with the php partial patch)?

    In my experience, it does not, since Stacey caches the output from the first request of the page with the form rendered in it. The subsequent POST of the form only results in the cached page returning. The call to Contacular never happens again and so the form is not sent. Instead, the page is just returned.

    If caching were shut off, this would not be the case. I've got a simple patch that allows per-page shut-off of caching. I'll post it after I have tested it a bit more.
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. happy, confident, thankful, excited sad, anxious, confused, frustrated indifferent, undecided, unconcerned kidding, amused, unsure, silly

  • Hi Michael, you know I never thought to check the cashing issue. I think that you might be right. I think it is working on my setup because I have disable browser caching to test another project to do with Stacey I'm working on.

    Perhaps we could combine our efforts. I'm experimenting with a way for the server to tell if the page has been updated via the header of the document before it looks in the cache. I'm trialling this via php and htaccess. However I need to know more about how the templates are parsed before I can get this to work.

    Hopefully I will have a solution in the near future.
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. happy, confident, thankful, excited sad, anxious, confused, frustrated indifferent, undecided, unconcerned kidding, amused, unsure, silly

  • I've submitted my "bypass_cache" pull request to kolber. You can check it out here: https://github.com/michaelsmanley/sta...
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. happy, confident, thankful, excited sad, anxious, confused, frustrated indifferent, undecided, unconcerned kidding, amused, unsure, silly

  • You're absolutely right Michael regarding the HTTP header. I had it wrong. I have another experiment I am working on which I was able to get "working" by disabling the browser from ever caching the page. This I am still working on.

    I've since checked and realised this was not the reason why the Contacular form was working in my tests but simply because I had not enabled caching in Stacey.

    I look forward to trying out your per-page shutt-off cache patch.

    Would it be possible in the future to develop a way of getting Stacey to process the partial more intelligently based on when the file was last modified?

    EDIT: I've just realised that this wouldn't work either because it's not the partial that's being modified, it's the output of the php that changes. Silly me.
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. happy, confident, thankful, excited sad, anxious, confused, frustrated indifferent, undecided, unconcerned kidding, amused, unsure, silly

  • Yeah, selective caching of partials would be a substantive change in Stacey's caching structure. Not worth it given Stacey's goals, in my opinion.

    If you really wanted to have Stacey cache the majority of a page and leave only a widget or region dynamic on a per-request basis, I think you'd be best served having your static page content all cached and pull that dynamic content in via AJAX or AHAH.
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. happy, confident, thankful, excited sad, anxious, confused, frustrated indifferent, undecided, unconcerned kidding, amused, unsure, silly

  • I'm not sure if this is a new feature but you can now add:

    bypass_cache: true

    to the template .txt file you want the form on and voila.
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. happy, confident, thankful, excited sad, anxious, confused, frustrated indifferent, undecided, unconcerned kidding, amused, unsure, silly