![]() |
|
Ajax request - Printable Version +- ZenphotoCMS Forum (https://forum.zenphoto.org) +-- Forum: Support (https://forum.zenphoto.org/forum-1.html) +--- Forum: General support (https://forum.zenphoto.org/forum-4.html) +--- Thread: Ajax request (/thread-10926.html) |
Ajax request - jalves - 2013-03-19 Hi, i've added a checkbox in my image.php and i need to setup an ajax request to send the checkbox value when it's clicked and update the current image information in database. Ajax request - acrylian - 2013-03-19 Quote:I've already added the necessary fields to database, get and set functions to class-image.php no problem with that. As for the database table you should be using the plugin_storage table for that reason. As for the ajax request you should not be needing to call the core class. You should use a plugin or theme functionality for that. A custom theme page also would work. Ajax request - jalves - 2013-03-19 Hmm.. i followed this post http://www.zenphoto.org/support/topic.php?id=1217#post-6820 Ajax request - acrylian - 2013-03-19 A lot changed since the early days of Zenphoto. The plugin_storage table was exactly introduce to have theme or plugins authors have a place for custom storage. It is recommended to not add fields to the plugin_storage table and use the ones provide. It is also part of Zenphoto. Some recomended usage of the three fields:
Of course if you need really special things you can always create complete custom tables and write something to use them. Ajax request - jalves - 2013-03-20 So i have to develop a plugin! I think i can use the plugin_storage table. Ajax request - acrylian - 2013-03-20 Technically you might be able to do it as a theme custom function as well. But maybe what you want to do is of use for others so you might want to make it available as a plugin later on. There is a tutorial about plugins: A plugin that uses the plugin_storage table is for example the multiple_layouts one. Best you should also have read the theming tutorial and the object model tutorial. Ajax request - jalves - 2013-03-20 Well i think what i need is too specific to be done as a general plugin, if i can do as a theme function to begin it would be great. Later on i can try to make it a plugin. Ajax request - acrylian - 2013-03-20 Themes support a Besides the default theme structure you can create anything additionally within your theme. Even that structure you can leave if you have the knowledge. Ajax request - jalves - 2013-03-20 Nice, i'll go that way. Quote:Unless you want to add checkboxes or else to the backend pages you don't need a plugin. Ajax request - acrylian - 2013-03-20 A picture approval system? A kind of clients selecting what they like to buy or something? Then you should maybe take a look at the favorites plugin. Might server your purpose already. Also the rating plugin could server as a similar purpose (e.g five stars = approved). Ajax request - jalves - 2013-03-20 Yes i know that, but i need to save and expose the date it was approved. I really need it works this way. Ajax request - acrylian - 2013-03-20 Ok. If you wish your controller.php to feature the standard Zenphoto functions you need to call it as a custom page: Ajax request - jalves - 2013-03-21 Yes! It's all working now. Thank you Ajax request - jphilbert - 2013-03-28 @jalves can you share the code when you are finished I am interested in this. Ajax request - acrylian - 2013-03-28 Actually it is quite simple if using jQuery. Here some basic examples: To send something to a page that has ZP stuff available: To load somehting here a custom theme page as well so the function are all avaiable: |