S
S
Sergey Goryachev2016-10-14 15:18:49
CMS
Sergey Goryachev, 2016-10-14 15:18:49

Joomla module, how to output data from settings file to template?

Question on Joomla, but it seems to me that any PHP specialist will help here.
When creating a template or module, the *.xml settings file is used with something like this.

<?xml version="1.0" encoding="utf-8"?>
<extension type="module" version="3.0.0" method="install">
<name>mod_module</name>
<files>
<filename module="mod_module">mod_module.php</filename>
<folder>tmpl</folder>
<filename>index.html</filename>
<filename>mod_module.xml</filename>
<filename>helper.php</filename>
</files>
<config>
<fields name="params">
<fieldset name="basic">
<field name="modulename" type="text" label="Название" description="Название" />
</fieldset>
</fields>
</config>
</extension>

I'm especially interested in the block right now.
The same thing happens in the template.
To display the $modulename variable on the site, it must be declared at the beginning of the template.
<?php
  defined('_JEXEC') or die;
  $modulename = $this->params->get('modulename');
?>

And then just using <?php echo $modulename ?>you bring it to the right place on the site.
But I can't figure out how to do the same with the module.
Where to declare a variable to call.
Typical module structure.
<filename module="mod_module">mod_module.php</filename>
<folder>tmpl</folder>
<filename>index.html</filename>
<filename>mod_module.xml</filename>
<filename>helper.php</filename>

Here you can see more details on the modules .
But there is nothing about the mod_module.xml file.
If I don’t explain clearly, I can explain in more detail)))

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
pashted, 2016-10-14
@webirus

i would write in mod_module.php
$modulename = $params->get('modulename');

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question