On Fri, Aug 3, 2012 at 12:54 AM, KHarmer <kristianhar...@gmail.com> wrote:
> Hi all,
> I have a custom module with custom paramaters which I'd like to be able to
> get from either a plugin (non-related) or from the modules helper file.
> The reason being is that these paramaters can/will be used by other
> extensions.
> I've googled and cannot find anything that works; I can only load the
> modules parameters from the modules own tmpl file or the modules own
> definition file!
> Any ideas would be gratefully received.
> Best regards,
> K...
> --
> You received this message because you are subscribed to the Google Groups
> "Joomla! General Development" group.
> To view this discussion on the web, visit
> https://groups.google.com/d/msg/joomla-dev-general/-/wKBkfhpXT9cJ.
> To post to this group, send an email to
> joomla-dev-general@googlegroups.com.
> To unsubscribe from this group, send email to
> joomla-dev-general+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/joomla-dev-general?hl=en-GB.
Because joomla doesn't provide a way to get the params by module id (mostly
you don't have the module title!!) I get it from the table directly
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('m.*');
$query->from('#__modules AS m');
$query->where('id = '.JRequest::getInt('moduleid'));
$db->setQuery($query);
$module = $db->loadObject();
$params = new JRegistry($module->params);
I also don't like to get it form the database rather than via API, but I
was searching up and down for a function to get the params by module id via
API.
On Fri, Aug 3, 2012 at 6:23 AM, fornandakishore
<fornandakish...@gmail.com>wrote:
> On Fri, Aug 3, 2012 at 12:54 AM, KHarmer <kristianhar...@gmail.com> wrote:
>> Hi all,
>> I have a custom module with custom paramaters which I'd like to be able
>> to get from either a plugin (non-related) or from the modules helper file.
>> The reason being is that these paramaters can/will be used by other
>> extensions.
>> I've googled and cannot find anything that works; I can only load the
>> modules parameters from the modules own tmpl file or the modules own
>> definition file!
>> Any ideas would be gratefully received.
>> Best regards,
>> K...
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Joomla! General Development" group.
>> To view this discussion on the web, visit
>> https://groups.google.com/d/msg/joomla-dev-general/-/wKBkfhpXT9cJ.
>> To post to this group, send an email to
>> joomla-dev-general@googlegroups.com.
>> To unsubscribe from this group, send email to
>> joomla-dev-general+unsubscribe@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/joomla-dev-general?hl=en-GB.
> --
> You received this message because you are subscribed to the Google Groups
> "Joomla! General Development" group.
> To post to this group, send an email to
> joomla-dev-general@googlegroups.com.
> To unsubscribe from this group, send email to
> joomla-dev-general+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/joomla-dev-general?hl=en-GB.
> Because joomla doesn't provide a way to get the params by module id (mostly
> you don't have the module title!!) I get it from the table directly
> $db = JFactory::getDbo();
> $query = $db->getQuery(true);
> $query->select('m.*');
> $query->from('#__modules AS m');
> $query->where('id = '.JRequest::getInt('moduleid'));
> $db->setQuery($query);
> $module = $db->loadObject();
> $params = new JRegistry($module->params);
> I also don't like to get it form the database rather than via API, but I
> was searching up and down for a function to get the params by module id via
> API.
> On Fri, Aug 3, 2012 at 6:23 AM, fornandakishore
> <fornandakish...@gmail.com>wrote:
> > On Fri, Aug 3, 2012 at 12:54 AM, KHarmer <kristianhar...@gmail.com> wrote:
> >> Hi all,
> >> I have a custom module with custom paramaters which I'd like to be able
> >> to get from either a plugin (non-related) or from the modules helper file.
> >> The reason being is that these paramaters can/will be used by other
> >> extensions.
> >> I've googled and cannot find anything that works; I can only load the
> >> modules parameters from the modules own tmpl file or the modules own
> >> definition file!
> >> Any ideas would be gratefully received.
> >> Best regards,
> >> K...
> >> --
> >> You received this message because you are subscribed to the Google Groups
> >> "Joomla! General Development" group.
> >> To view this discussion on the web, visit
> >>https://groups.google.com/d/msg/joomla-dev-general/-/wKBkfhpXT9cJ.
> >> To post to this group, send an email to
> >> joomla-dev-general@googlegroups.com.
> >> To unsubscribe from this group, send email to
> >> joomla-dev-general+unsubscribe@googlegroups.com.
> >> For more options, visit this group at
> >>http://groups.google.com/group/joomla-dev-general?hl=en-GB.
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Joomla! General Development" group.
> > To post to this group, send an email to
> > joomla-dev-general@googlegroups.com.
> > To unsubscribe from this group, send email to
> > joomla-dev-general+unsubscribe@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/joomla-dev-general?hl=en-GB.
IMHO it's not possible to use module parameters from another extension. Wich module? You can have a couple of them if the user clicks on the Duplicate button. You do not have any unique identifier, On a private site you can hardcode it but not for a general solution. I guess you'll need a small backend component to set the needed general parameters.
> It seems that module parameters are being loaded as string in
> JModuleHelper::getModule().
> You could convert these to a JRegistry using:
> // Get First module
> $module = JModuleHelper::getModule('mod_login')
> // Get module parameters
> $params = new JRegistry;
> $params->loadString($module->params);
> But, as Allon Moritz mentioned this doesn't filter module by id and
> 'title' is up to user.
> If you are inside the module itself, you may use $params variable.
> I guess it was an unlikely scenario to prepare loading module
> paramaters for other reasons that in template positions or inside a
> module.
> On Aug 3, 6:56 am, allon moritz <allon.mor...@gmail.com> wrote:
>> Because joomla doesn't provide a way to get the params by module id (mostly
>> you don't have the module title!!) I get it from the table directly
>> $db = JFactory::getDbo();
>> $query = $db->getQuery(true);
>> $query->select('m.*');
>> $query->from('#__modules AS m');
>> $query->where('id = '.JRequest::getInt('moduleid'));
>> $db->setQuery($query);
>> $module = $db->loadObject();
>> $params = new JRegistry($module->params);
>> I also don't like to get it form the database rather than via API, but I
>> was searching up and down for a function to get the params by module id via
>> API.
>> On Fri, Aug 3, 2012 at 6:23 AM, fornandakishore
>> <fornandakish...@gmail.com>wrote:
>>> Hello Harmer,
>>> Try to use this code ...
>>> jimport('joomla.application.module.helper');
>>> $module = JModuleHelper::getModule('mod_login', 'YourModuleTitle');
>>> //echo JModuleHelper::renderModule($module);
>>> I hope this code will help you to give the specified module parameter in
>>> any component, module and plugin.
>>> Thanks & Regards
>>> Nanda Kishore. M
>>> Senior PHP Developer
>>> http://php-desk.blogspot.com >>> Mobile: + 91 98499 71144
>>> On Fri, Aug 3, 2012 at 12:54 AM, KHarmer <kristianhar...@gmail.com> wrote:
>>>> Hi all,
>>>> I have a custom module with custom paramaters which I'd like to be able
>>>> to get from either a plugin (non-related) or from the modules helper file.
>>>> The reason being is that these paramaters can/will be used by other
>>>> extensions.
>>>> I've googled and cannot find anything that works; I can only load the
>>>> modules parameters from the modules own tmpl file or the modules own
>>>> definition file!
>>>> Any ideas would be gratefully received.
>>>> Best regards,
>>>> K...
>>>> --
>>>> You received this message because you are subscribed to the Google Groups
>>>> "Joomla! General Development" group.
>>>> To view this discussion on the web, visit
>>>> https://groups.google.com/d/msg/joomla-dev-general/-/wKBkfhpXT9cJ.
>>>> To post to this group, send an email to
>>>> joomla-dev-general@googlegroups.com.
>>>> To unsubscribe from this group, send email to
>>>> joomla-dev-general+unsubscribe@googlegroups.com.
>>>> For more options, visit this group at
>>>> http://groups.google.com/group/joomla-dev-general?hl=en-GB.
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Joomla! General Development" group.
>>> To post to this group, send an email to
>>> joomla-dev-general@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> joomla-dev-general+unsubscribe@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/joomla-dev-general?hl=en-GB.
Using module params from one module would work for a specific design, as to
get the specific module instance you have to set type of module and title,
but if the user has 2 modules, or if the user changes the module title,
this will not work.
Obviously solution provided by Allon Moritz will work too, as far as you
know the specific module id.
All best!!
I think it would be better to set these parameters in a component. This way
you guarantee that not matter what user makes with the module, your
parameters will remain the same.
On Fri, Aug 3, 2012 at 6:23 AM, fornandakishore
<fornandakish...@gmail.com>wrote:
> On Fri, Aug 3, 2012 at 12:54 AM, KHarmer <kristianhar...@gmail.com> wrote:
>> Hi all,
>> I have a custom module with custom paramaters which I'd like to be able
>> to get from either a plugin (non-related) or from the modules helper file.
>> The reason being is that these paramaters can/will be used by other
>> extensions.
>> I've googled and cannot find anything that works; I can only load the
>> modules parameters from the modules own tmpl file or the modules own
>> definition file!
>> Any ideas would be gratefully received.
>> Best regards,
>> K...
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Joomla! General Development" group.
>> To view this discussion on the web, visit
>> https://groups.google.com/d/msg/joomla-dev-general/-/wKBkfhpXT9cJ.
>> To post to this group, send an email to
>> joomla-dev-general@googlegroups.com.
>> To unsubscribe from this group, send email to
>> joomla-dev-general+unsubscribe@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/joomla-dev-general?hl=en-GB.
> --
> You received this message because you are subscribed to the Google Groups
> "Joomla! General Development" group.
> To post to this group, send an email to
> joomla-dev-general@googlegroups.com.
> To unsubscribe from this group, send email to
> joomla-dev-general+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/joomla-dev-general?hl=en-GB.