picocms / Pico

Pico is a stupidly simple, blazing fast, flat file CMS.
http://picocms.org/
MIT License
3.82k stars 616 forks source link

Php contact form script in picocms #484

Closed CodeTipsy closed 5 years ago

CodeTipsy commented 5 years ago

Hello, php mail script included picocms - how can I achieve this? Insert html form in contact.md and mail.php? Thanks for your help.

Nepose commented 5 years ago

Hi :smiley: The way you propose is possible, though you will have to place mail.php in assets/ folder. Any other location may cause 500 error or requesting script will return 404 error rendered by Pico. In fact, non-Pico-logic PHP should be avoided everywhere outside those assets. You can also try writing your script like plugin, using Pico events. There is a getFormParameter method which gets value of particular POST variables. My idea is, for instance, to post mail to http://yourwebsite.com/mail. When loading website, your PHP will look by onRequestUrl method for URL - if it is /mail, than the form parameters will be read by getFormParameter and mail will be sent. Of course there is also non-PHP, but the simplest Formspree :wink:

PhrozenByte commented 5 years ago

You can either use a 3rd-party contact form service (just search for "Contact Form Services", but please keep privacy in mind when using such services) or a plugin for Pico to keep full control. If you choose to use a plugin, please refer to the Plugins page in our Wiki; it currently lists the following contact form plugins:

Please note that our Wiki is fully community-driven and all plugins listed there were developed by 3rd-party developers. Unfortunately we can't provide support for them.

CodeTipsy commented 5 years ago

Thank you very much for the information! That makes me happy. ;o)

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in two days if no further activity occurs. Thank you for your contributions! :+1: