Observers
|
Aug 8, 2008 09:25
38 posts
|
Hi all, The Observer pattern is a good way to extend frog functionality with plugins. Thank you Philippe to have implemented it! I just don't found a good list of all events that's can be observeable (this page is not totally up-to-date). Here the actual (r162) list:
I have some idea to improve this list: First, it would be nice to have a reference to the page object in parameter when it is possible and when there are a sense (for example the It would be nice to have more observers too. Here some ideas:
What do you think about that ? |
|
Aug 8, 2008 09:36
277 posts
|
These observers have been updated in the v0.9.3! The |
|
Aug 8, 2008 11:19
390 posts
|
ho yea I like those kind of idea :) and I will really impress to have a cache plugin too. I add those observer right now !! |
|
Aug 8, 2008 11:21
390 posts
|
with the page_requested one, i think I will trow the unparsed $url ( with full query ) !! and the parsed one will stil be available with the CURRENT_URI constant. |
|
Aug 8, 2008 11:26
390 posts
|
and for the |
|
Aug 8, 2008 11:28
38 posts
|
Thanks! :) I will release a first version of the file cache plugin soon. I just need to do more tests and small doc. |
|
Aug 8, 2008 11:43
390 posts
|
good :) I have add those observer: |
|
Sep 25, 2008 18:04
351 posts
|
Can anyone give me a brief code example for using page_add_after_save? For example, emailing the page contents somewhere… I’m interested in doing an Upcoming.org plugin so that events created in Frog can automatically be published to Upcoming…. |
|
Sep 26, 2008 02:58
38 posts
|
Hi ricks, Sure, it’s really easy :-) See this exemple:
But perhaps, for your need, it’s better to use the ‘part_edit_after_save’ event:
|
|
Sep 26, 2008 04:03
351 posts
|
awesome. thank you, gido! |
|
Sep 26, 2008 11:33
458 posts
|
@gido – I shamelessy stole your code example and placed it in the site’s Docs section in preperation for a more complete document about Observers… when I find the time. |
|
Sep 26, 2008 12:14
38 posts
|
@mvdkleijn – no problems ;) I have some idea to extends the layout system and I want to know if it would be possible to add following observers in frog core:
It’s really not urgent, but it would be nice to have an implementation of these events in all main controllers in frog admin. |
|
Sep 27, 2008 14:51
15 posts
|
Maybe my problem fits in here. I have form, I use Observer – page_found and problem is when form has errors, how can I serve those error variables in frontend? Lets say: So how can I server this $error variable into frontend? thanks.. edit// why codebox not working? damn.. |
|
Sep 27, 2008 15:16
458 posts
|
Marko, you could use the following code to produce a red “flash” error message with the message you want:
and then just redirect back to the original form/page. It depends a lot on your specific situation. p.s. the codebox wasn’t working because you didn’t prefix it with an empty line.. I think. |