How to make modules and Template take parameters

General questions relating to Joomla! 3.x.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting.
Forum Post Assistant - If you are serious about wanting help, you should use this tool to help you post.
Locked
arthurbonnie
Joomla! Apprentice
Joomla! Apprentice
Posts: 6
Joined: Sun Jan 25, 2015 12:39 pm

How to make modules and Template take parameters

Post by arthurbonnie » Mon Apr 20, 2015 8:00 am

Hello, I am currently using Joomla is version 3.3.6.

I designed a module, which must go to obtain the parameters of the model currently used in the modules in the php file to do at the inside.

I have the same design template, and we must get a certain module parameters in the patterns in the php file for processing.

Will the module and how this interaction takes two template arguments?

Thanks reply.

User avatar
toivo
Joomla! Master
Joomla! Master
Posts: 11119
Joined: Thu Feb 15, 2007 5:48 am
Location: Oxford, UK

Re: How to make modules and Template take parameters

Post by toivo » Mon Apr 20, 2015 12:52 pm

I designed a module, which must go to obtain the parameters of the model currently used in the modules in the php file to do at the inside.
Do you mean that your module needs to access parameters set in the options of the template? Try this:

Code: Select all

$app		= JFactory::getApplication();
$doc		= JFactory::getDocument();
echo 'template = ' . $doc->template . '<br />';
echo 'language = ' . $doc->language . '<br />';

$params		= $app->getTemplate(true)->params;
$params		= $params->toArray();
if ($doc->template === 'protostar')
{
	$logofile	= '';
	if ($params['logoFile'])
	{
		$logofile	= $params['logoFile'];
	}
	echo 'logofile = ' . $logofile . '<br />';
	$sitetitle		= '';
	if ($params['sitetitle'])
	{
		$sitetitle	= $params['sitetitle'];
	}
	echo 'site title = ' . $sitetitle . '<br />';
}
Toivo Talikka, Global Moderator
troubleshooting smtp and other articles http://talikka.com/joomla


Locked

Return to “General Questions/New to Joomla! 3.x”