Is there a way to parse PHP in template files (3.0.0)?
Or is that completely incompatible with twig / stacey 3?
It was very useful to be able to include php in partials in stacey 2.
There isn't a way to parse PHP in template files in v3. What sort of use cases did you have in mind?
I would like this as well. It gives you more freedom. For instance do I like to use PHP variables to set descriptions, keywords, etc. metadata that you can use on ie. facebook, twitter, etc. opengraph.
You only needs to have it written once, and php does the rest.
Stacey uses TWIG for templates, which is quite powerful and supports variables: http://twig.sensiolabs.org/doc/templates.html#variables
You cannot use PHP in TWIG, but it has shortcuts for most methods you would ever need. The benefit is to keep template logic separate and readable.
How then do I implement a contact form in Stacey?
I have looked through the twig documentation and haven't found anything that offers the mail function of PHP or a way to access the submitted values of a form. Is there a way to emulate this?
I assume that would be a separate custom PHP file, possibly located in your plugins folder, which you refer to from the POST button in your form. Technically, this is neither a feature of Stacey nor TWIG, but you can still use your own PHP scripts. I would however like to see some example or recommendation in Stacey on how to organize plugins or external PHP if and when @kolber gets around to it.
I have on my agenda to add a form script to a Stacey-website shortly, and will post here when I get around to it.
You are right, thanks for pointing out this possibility . Although I don't like this implementation very much.
For a simple contact form it would be much easier to redirect to the same site and give feedback dynamically on that site, especially because you cannot use the stacey templating engine in this other script, so that accessing your other partials would be a pain. For now I'm just going with "mailto:...".
It is the SAME site, you would just have something like /yourphp/mail.php, and then on the form submission you would point to that file. Those form scripts can be found easily on the internet. I do agree that Stacey should have some plugins and some guidelines on how and where to add custom scripts, but per definition it not something that Stacey does for you ...
@Kampfzwerg
I have a working form with phpmailer, error checking & redirect, but will need to clean it up a bit before I post it here, if you can wait a couple days.