Snippet vs. helper vs. plugin - what is the difference?
|
Jul 4, 2008 11:36
131 posts
|
I'm a bit confused on the difference between a snippet, helper, and plugin? Could a file be potentially saved as any of the three? Is there different functionality available in a snippet, plugin,helper that is not available in the other two? |
|
Jul 5, 2008 18:14
458 posts
|
As I understand it: Snippet - stored in the database. Is just a "snippet" of information, which could be anything really. Mostly used to "includeSnippet()" into a Layout. This makes your layout more readable. Helper - a piece of functionality, stored on disk. Functions get loaded only if you specifically want it to with the aid of: <?php use_helper('Pagination'); ?> after loading the functions, you can actually make use of them in your pages etc. Plugin - a piece of functionality, stored on disk. Can be turned on/off through the admin screen. When turned on, it gets loaded on each and every page. Hope that helps! |
|
Jul 5, 2008 20:50
131 posts
|
Thanks for the explanation! I'm having problems converting PHP form processing code I've used on several websites for use on Frog CMS. The form processing code includes validation, error, and suspect phrase checking. When invalid information is entered in a form field, the user is returned to the form, and will see an error message displayed next to any field with invalid information. I've converted the form processing code to a snippet and can send a message using the code from the contact form, when all the form fields are entered with valid information. However, the form is not processing my validation and error checking. When invalid information is entered in the Frog CMS form, the form is not sent, but error messages aren't displaying on the form. The code is a bit lengthy, and I wasn't sure about posting all the code on the forum. Hopefully I've entered the correct Markdown code to get it to display below. I only need the form processing code for one page, so I created it as a snippet. Since plugins are loaded on every page, it didn't seem that a plugin was the best option for this site.
|
|
Jul 5, 2008 20:52
131 posts
|
Since I'm now reporting a problem with code, perhaps this message should be moved to the General Bug Reports/Problems forum? |
|
Jul 6, 2008 21:04
131 posts
|
Any suggestions? I've been working on this code for four days, and am not sure how to proceed. I contacted David a few days ago about the issue, but neither of us were able to find a solution. David suggested I change the code to a "helper" file, which I did, but I still couldn't get the page to display validation and other error messages. I've used this code on the same server, as a regular PHP page, and it works well. |
|
Jul 10, 2008 12:06
131 posts
|
I ended up putting all the code, form processing, and the page layout in a Layout. After spending 2 hours troubleshooting with another PHP programmer, we came to the conclusion that Frog was stripping out variables that were being used in two different snippets. We tried using the Global variables as well, but nothing worked. I've posted a request on the forums asking about variables in Frog, but haven't heard back. |