page part forms (custom fields)
|
70 posts
|
Hello all, today I want to contribute my second plug-in to the frog community. It’s called page_part_forms and allows the page admin to create a custom form based on the page_parts for page editing. The source as well as a description is available at github. A zip file for each official version can be found in the download section. From the README:
The wiki contains simple instructions and will be extended over time by user feedback. Please give it a try and write your feedback to this thread. PS: please note the dependencies against the jQuery plug-in and the page_metadata plug-in, as well as the little changes to the frog core (replace “include” with “include_once”). Code changes
frog/app/views/page/edit.php, line 211
Screenshot
Frontend The field are simple page_parts you can access them with:
Have fun |
|
486 posts
|
Nice work! |
|
36 posts
|
This is great! Thank you. Looking forward to implementing this into upcoming projects. |
|
36 posts
|
We’re having trouble getting Page Part Forms to work correctly. I followed the instructions to install it correctly, modified Frog code, etc. However, the plugin seems to break when we try to edit any of the forms you put up. Any advice on what to look out for? |
|
36 posts
|
I just put up a fresh install of Frog 0.9.5 and added all of the necessary plugins. Now, when I try to create a new Page Part Form, nothing comes up in the admin, but the plugin is functioning because it’s adding records to the database. I’m hosted with Media Temple, though I’m not sure that makes a difference. |
|
36 posts
|
Okay, I went through the same procedure on Mosso. Fresh install. Same thing. Does not work. The admin shows nothing when I try to add a new Page Part… sometimes even a blank screen. The database does get populated with data. |
|
70 posts
|
Hello all, thanks for trying this out and sorry that the plug-in is not working for you. Please let me check some things first. I’ve redone the steps with a fresh 0.95 installation. I also tried Firefox 3.0.11 and Safari 4.0 both on a mac.
If you have completed this steps, and still have problems, please enable the ‘debug’ option in your configuration file if there is any warning with the plug-in. I also checked it with mod_rewrite enabled and disabled. Hope this helps |
|
70 posts
|
Hello, ok, there is a bug, Due to Photoshop on my mac, Adobe forced me to have a case-insensitive file system :( UPDATE: new version is uploaded on github, also tested on external hoster :D |
|
36 posts
|
Thanks for looking into this M. I appreciate quick fix. Unfortunately, that didn’t seem to do it. I’ll try another clean install of everything later this evening and report back. |
|
36 posts
|
M, tried it again just now, followed the new instructions exactly. Still running into the same problem. Will try enabling debug options and see what comes up tomorrow. |
|
36 posts
|
Time for the morning update… turning off PDO in the config.php file did the trick. After two days of frustrating nothingness… Page Parts Forms works like a charm. Hopefully this helps others. |
|
70 posts
|
Hello everflight, it’s not working with native PDO? Strange, but I must admit I also use the PDO-light version. I’ll look into it to find the differences. I’m glad it worked finally, I already started to doubt myself. Maybe you would be so kind and post me your ‘structure’, so that I can see what people are doing with it (once you finished playing :D). Have a nice working day |
|
36 posts
|
Alright, time for the stupid question. Now that I have it working on the backend, how do I get the new fields to show up on the front end? What is the code that I need to put in the layout? I’ve tried a few things, but have been unsuccessful. There is no instruction on github in the usage section. Thanks M. I appreciate the help. |
|
70 posts
|
Hello everflight, check the wiki entries for the syntax, I’ll add more information if needed. Page part form fields are simple page_parts. You can access them regularly with: |
|
36 posts
|
Hot damn it works! Thanks for all your help. Very very useful plugin. |
|
70 posts
|
Hello everflight,
thanks to the flexible interfaces of the Frog core.
And BTW, the multiple values are encoded with json, you can use the PHP primitives for json to ‘split’ the values. Have fun |
|
8 posts
|
Hi everybody! Your plugin looks absolutely awesome, M! This is exactly, what I was about to realize :) So, I tried to get the plugins to work and did exactly as you wrote (the second version). Now I have another problem: When entering some data into my custom page fields, these aren’t saved. I submit the new information and suddenly, everything is gone … do you have an idea, why this happens? (DEBUG is active, no errors) |
|
70 posts
|
Hello a.renz, 0.0.5 is buggy! Please update to the version 0.0.6. UPDATE: github is having problems right now: ensure your have the commit: 735080f7eba227621bdb72f92af72e1cb3fec8a9 UPDATE2: version 0.0.6 fixes the PDO issues, too M |
|
191 posts
|
I’ve read the explanation of page part forms five times now, but still have no idea what its function is, nor how to use it. Must be my dense brain. Can someone explain in the simplest terms under what circumstances I would use “page part forms”? I noticed a.renz disabled PDO in order to get this plugin to work, which seems to me would potentially cause issues with Frog. |
|
70 posts
|
Hello redcrew,
As you can see, as of version 0.0.6 it works with and without PDO now. So there is no need to use PDOLite if not necessary. You can keep the
First of all, your don’t have to. It’s a plug-in and not part of the Frog core. If you see no use-case or benefit for it, there are chances you might not need this plug-in. I’ll tell you my motivation for this plug-in and maybe it clarifies things a little bit. Frog has build in support for page parts. In a pristine Frog installation you have the ‘body’ page part as default. There you can add continuous text as much as you like, but with no structural information. For example if you want to display more content on the site and the content is not part of the main content (‘body’ page part), you need another ‘container’ to store this information. E.g. attached to your root page there is the ‘sidebar’ page part that inherits the content to its children. In your presentation layer (layout and body page part) you just call Sometimes there is the case that you want to add more structured information to the site. e.g. your want to add keywords, a custom style sheet, select pre-defined values from a list, set a rating, etc. To some point you can use the build-in metadata fields from Frog (and I strongly encourage to do so), but sometimes the fields for your particular use case is not build-in. For simple metadata I created the plug-in page_metadata, with this plug-in you can add simple ‘key-values’ fields to your page. From the admin user interface you select the tab ‘more metadata’. Sometimes also simple metadata fields are not enough. My use-case: customer website with different products and the corresponding product descriptions. Each product is a page, there is an intro description as well as a detailed description. As a good Frog citizen I created an extra page part ‘intro’ besides the existing ‘body’ to maintain the content separately for each product. You might say: ‘hey, use an excerpt and split your main content with a regex!' —and you are right. But in my case it was simpler for the customer to have two separate textareas to maintain the two descriptions. As part of the core user interface of Frog, page parts are organized in tabs and only allow textareas with filters —even if you just need a simpler element e.g. for a timestamp. Here comes the use of the page part forms. Instead of creating all page parts for every product and inherit a not filled-out-warning (user forgot to fill out the second tab), I define some form fields that should be displayed instead. Due to the flexible storage of the Frog core, this form fields are stored as page parts in the back-end. This gives me the flexibility to display page parts on one page without a tab interface and to some level custom form elements (e.g. drop down, radio, etc.) based on pre-defined values. Another benefit is that in your presentation layer it makes no difference how the page part was created, you just display the content with
E.g. you can create a simple event calendar. Just add the fields you need (e.g. location, price, person capacity, loudness, date, etc.) apply this form to a page and display the child pages/events at your master page (e.g. the archive page in your default Frog installation). Then you can also display only the main content (‘body’) if you display this particular page/event with additional information that is not displayed at the overview page. Of course the plug-in can never be so flexible and feature rich as a ‘real’ plug-in solution, but it helps you to create custom content and interfaces very quickly. Hope this outlines the purpose of this plug-in and clarifies some open questions. If there are still open questions, just post to this thread I’ll be eager to answer them ;) M |
|
67 posts
|
Hi M, Thanks for taking the trouble to provide such a detailed explanation… Kind Regards, |
|
8 posts
|
Hey! |
|
36 posts
|
I just wanted to chime in again and say how incredibly useful this plugin is. Once I got it working, it’s been a real treat. From now on, I will never build a Frog based site without it. Entering content has never been more straightforward and streamlined. Maybe I’ll have to post a couple of example screenshots sometime on how I’m using it. One thing that might be nice in the near future is to have a collection of pre-written syntax templates so people can go in and use them (as easy as copy and paste) and modify them as they see fit. Immediately, I could see some being built for things like events, product pages, etc. Might be helpful for some folks who are new to the plugin, and a time saver for those who are using it. Maybe we can all contribute some generic entries to this post? I’ll think of some. Thank you again M for a great contribution to Frog. |
|
108 posts
|
I am sure this is something simple but ive gone though the entire install and its all loaded in fine. However when i try to create one it comes up with “Page part form not found” Any ideas anyone? |
|
70 posts
|
@everflight:
I added one in the sidebar and in the wiki, but yes we could use more.
That would be terrific! I’ll add this to the plug-in wiki. @andytwo
Can you describe your environment of your installation a little bit (e.g. MySQL, SQLite, Mod_rewrite, sub-directory, etc.)? Without that searching for faults is difficult. |



