Module Development for Beginner
trowa barton
![]()
Joined: 2006-02-23
Posts: 27 |
![]() |
Hi I am a newbie in module development and I want to develop one.. Can anyone help me develop a module that logs every URL of every site I am visiting? Thanks in advance.. |
|
ckdake
![]()
Joined: 2004-02-18
Posts: 2258 |
![]() |
Take a look at an existing module and see how it works, when you have specific questions we can help you out. If you found my help useful, please consider donating to Gallery. |
|
trowa barton
![]()
Joined: 2006-02-23
Posts: 27 |
![]() |
Thanks for the reply. How do these existing gallery module handle event? What specific topic must I need to review in order to do this project. Thanks. |
|
ckdake
![]()
Joined: 2004-02-18
Posts: 2258 |
![]() |
Why type of event? What types of specific topics? If you found my help useful, please consider donating to Gallery. |
|
trowa barton
![]()
Joined: 2006-02-23
Posts: 27 |
![]() |
An event listener that logs the URL whenver I browse the gallery. Do I need to review the Gallery Core classes? How can I use these existing module for my project.. Thanks a lot. |
|
trowa barton
![]()
Joined: 2006-02-23
Posts: 27 |
![]() |
browse the web I mean.. I have read the handleEvent method of the Gallery Core.. what does this method do or the class itself, how does it function. |
|
trowa barton
![]()
Joined: 2006-02-23
Posts: 27 |
![]() |
I have figured it out.. Does the any of the Gallery Core classes have an API for creating a text file and writing to it? |
|
trowa barton
![]()
Joined: 2006-02-23
Posts: 27 |
![]() |
How can I log these URL's in a text file? Please help |
|
ckdake
![]()
Joined: 2004-02-18
Posts: 2258 |
![]() |
It's probably smarter to log them in the database. The rating module creates a table so you could take a look at that for an example. If you won't be redistributing your changes, just hard coding in an fopen fwrite fclose is probably alright. There is no API for logging text to a file. If you found my help useful, please consider donating to Gallery. |
|
trowa barton
![]()
Joined: 2006-02-23
Posts: 27 |
![]() |
Thanks.. What is the role of the handleEvent function of a module?! |
|
trowa barton
![]()
Joined: 2006-02-23
Posts: 27 |
![]() |
The Gallery dont seems to trigger my handlEvennt function.. What you think must be the problem? |
|
trowa barton
![]()
Joined: 2006-02-23
Posts: 27 |
![]() |
I cant execute the fwrite function.. please help.. |
|
ckdake
![]()
Joined: 2004-02-18
Posts: 2258 |
![]() |
You registered your handleEvent function only for the GalleryEntity::save event. Try editing an item and see if that shows up in the log. If you found my help useful, please consider donating to Gallery. |
|
trowa barton
![]()
Joined: 2006-02-23
Posts: 27 |
![]() |
What event must I register in order to trigger the event while I am browsing in and out of the album? Thank you very much. |
|
valiant
Joined: 2003-01-04
Posts: 32509 |
![]() |
facts: not all pages served by G2 are associated with an entity / item (album, image, ..). but most are and those you care about are definitely associated with an entity. your options: |
|
trowa barton
![]()
Joined: 2006-02-23
Posts: 27 |
![]() |
How can I add an event for page load? What do you mean "just hack your g2"? Does it mean I must edit a Gallery core class? What class is it? Thanks. |
|
valiant
Joined: 2003-01-04
Posts: 32509 |
![]() |
yes, if you follow this route you have to edit the core module. grep for postEvent to find examples. |
|
trowa barton
![]()
Joined: 2006-02-23
Posts: 27 |
![]() |
Oh thanks. Your reply is a great help. Another question.. What basically must I do in order to register a new Event which in my case in the onLoad page. |
|
trowa barton
![]()
Joined: 2006-02-23
Posts: 27 |
![]() |
The onPageLoad event is the only thing that is lacking in my module. Can you please give us the first release of these event so that we can implement and publish the module I am developing? Please help. Thanks in advance. |
|
ckdake
![]()
Joined: 2004-02-18
Posts: 2258 |
![]() |
Look around for postEvent in the code and use that as an example. Just add a postEvent call in main.php like valiant suggested. If you found my help useful, please consider donating to Gallery. |
|
trowa barton
![]()
Joined: 2006-02-23
Posts: 27 |
![]() |
OS - Mandrake Linux How can I add a GalleryCoreApi::postEvent() call in main.php? |
|
trowa barton
![]()
Joined: 2006-02-23
Posts: 27 |
![]() |
Ala eh, galing naman! This gallery is great.. I have already log these URL's but another problem occurs. It does not work when I use embede mode. How can I solve these problem? Is it really impossible for an embeded mode gallery to trigger postEvent directly from xxxx.php? What must I do to solve this? |
|
ckdake
![]()
Joined: 2004-02-18
Posts: 2258 |
![]() |
You'll need the post event in embed.php as well is my guess.. If you found my help useful, please consider donating to Gallery. |
|
trowa barton
![]()
Joined: 2006-02-23
Posts: 27 |
![]() |
Thanks for all the replies. I've finally finished this project. The Gallery is so great. |
|
RwD
![]()
Joined: 2005-01-09
Posts: 383 |
![]() |
Care to share? |
|
trowa barton
![]()
Joined: 2006-02-23
Posts: 27 |
![]() |
Well, this project seem so impossible for me when I am starting. But now, I figured out that it's just a matter of "taking it from the expert (valiant and ckdake)". |
|
RwD
![]()
Joined: 2005-01-09
Posts: 383 |
![]() |
I meant the URL log module. But a short step by step guide on what to do is not so bad either, I am sura that'll help a lot of people. |
|