Hi,
Another question slightly related to my other post:
Can I register a module for an event in the same way as I register plugins for events?
What I would like to achieve is building a navigation bar which updates itself when an event gets triggered by the component.
Or: Is there a possibility that a plugin can update a component?
Cheers,
Uwe
Events and Modules
Moderators: tjay, seadap, Rogue4ngel, matthewhayashida
- uweD
- Joomla! Apprentice
- Posts: 39
- Joined: Mon May 14, 2007 9:38 pm
- Location: Auckland -- New Zealand
- Contact:
Events and Modules
Last edited by uweD on Wed Aug 29, 2007 1:54 am, edited 1 time in total.
Re: Events and Modules
I know folks have used Moofx in modules. So without knowing a great deal more than that I am not sure.
This day it is my wish that I helped you to live
Re: Events and Modules
Modules can certainly registered code to handle events. But I don't think this is what you want to do.
A module gets called at load time, so presumably it would operate on the latest data produced by the module anyway, so that seems rather pointless...
I think what you are trying to do, as tjay suggested, is to use mootools or some sort of Javascript to trigger an update.
Ian
A module gets called at load time, so presumably it would operate on the latest data produced by the module anyway, so that seems rather pointless...
I think what you are trying to do, as tjay suggested, is to use mootools or some sort of Javascript to trigger an update.
Ian
Help test my Component XML Generator Tool!
http://extensions.joomla.org/component/option,com_mtree/task,viewlink/link_id,1997/Itemid,35/
All feedback appreciated!
http://extensions.joomla.org/component/option,com_mtree/task,viewlink/link_id,1997/Itemid,35/
All feedback appreciated!
- uweD
- Joomla! Apprentice
- Posts: 39
- Joined: Mon May 14, 2007 9:38 pm
- Location: Auckland -- New Zealand
- Contact:
Re: Events and Modules
Hi Ian,
I am simply struggling with understanding the joomla! framework properly. You see, what I am trying to do is.
1. My component performs a search.
2. My module presents the user with a navigation bar to navigate through the search result.
To do this (I believe) I need to create an event, and something that listens for an event and then updates my module...
I start to believing that this might be impossible in Joomla!
Thanks,
Uwe
I am simply struggling with understanding the joomla! framework properly. You see, what I am trying to do is.
1. My component performs a search.
2. My module presents the user with a navigation bar to navigate through the search result.
To do this (I believe) I need to create an event, and something that listens for an event and then updates my module...
I start to believing that this might be impossible in Joomla!
Thanks,
Uwe
Re: Events and Modules
Okay...
That is pretty simple...
There are options on how to accomplish it:
The first option is to create a Search plugin for the Joomla! search component. Look at the plugins in the search directory for examples. This might save you from writing some of the login in your component.
The other option is to incorporate the search as part of your component. This is the method you seem to be trying to pull off. You're stuck trying you to present your navigation bar in your module.
My impulse would be to include the navigation bar as part of the component itself. Problem solved. You seem to want to separate it and put it into a module. I'll assume you have a good reason to do this, but I can't think of what that might be. It is of no consequence, really...
Since your navigation bar is in the module, it is really the module that has to update the component, probably not vice versa. But they don't really have to communicate. You'd probably have in your module an HTML form of some sort, right?
Your component will determine which page to display based on the form variables (or you may possibly be using request variables on the query string). These are retrieve using JRequest::getInt(), right?
So... in your module, you determine where the in the result set you are and display the navigation bar appropriately.
As an example, say there are 25 records. We will use two variables - limit, and limitstart. limit is the number of results to display per page, and limitstart is the place in the results to start.
Your navigation bar would do something like:
$limit = JRequest::getInt( 'limit' );
$limitstart = JRequest::getInt( 'limitstart' );
based on limit and limitstart it will display the navigation.
Then, the component would contain the same two lines, and based on those numbers will display the result set.
Does this answer your question.
Ian
That is pretty simple...
There are options on how to accomplish it:
The first option is to create a Search plugin for the Joomla! search component. Look at the plugins in the search directory for examples. This might save you from writing some of the login in your component.
The other option is to incorporate the search as part of your component. This is the method you seem to be trying to pull off. You're stuck trying you to present your navigation bar in your module.
My impulse would be to include the navigation bar as part of the component itself. Problem solved. You seem to want to separate it and put it into a module. I'll assume you have a good reason to do this, but I can't think of what that might be. It is of no consequence, really...
Since your navigation bar is in the module, it is really the module that has to update the component, probably not vice versa. But they don't really have to communicate. You'd probably have in your module an HTML form of some sort, right?
Your component will determine which page to display based on the form variables (or you may possibly be using request variables on the query string). These are retrieve using JRequest::getInt(), right?
So... in your module, you determine where the in the result set you are and display the navigation bar appropriately.
As an example, say there are 25 records. We will use two variables - limit, and limitstart. limit is the number of results to display per page, and limitstart is the place in the results to start.
Your navigation bar would do something like:
$limit = JRequest::getInt( 'limit' );
$limitstart = JRequest::getInt( 'limitstart' );
based on limit and limitstart it will display the navigation.
Then, the component would contain the same two lines, and based on those numbers will display the result set.
Does this answer your question.
Ian
Help test my Component XML Generator Tool!
http://extensions.joomla.org/component/option,com_mtree/task,viewlink/link_id,1997/Itemid,35/
All feedback appreciated!
http://extensions.joomla.org/component/option,com_mtree/task,viewlink/link_id,1997/Itemid,35/
All feedback appreciated!
- uweD
- Joomla! Apprentice
- Posts: 39
- Joined: Mon May 14, 2007 9:38 pm
- Location: Auckland -- New Zealand
- Contact:
Re: Events and Modules
Thanks for that very detailed explanation Ian,
yes that answers my question,
Cheers,
uwe
yes that answers my question,
Cheers,
uwe