Module development

For Joomla! 3.x Coding related discussions, you could also use: http://groups.google.com/group/joomla-dev-general

Moderators: ooffick, General Support Moderators

Forum rules
Locked
roman5555
Joomla! Intern
Joomla! Intern
Posts: 67
Joined: Tue Aug 17, 2010 9:58 pm

Module development

Post by roman5555 » Fri May 18, 2018 7:01 am

Hi, i develop my first module.

I have xml field :

Code: Select all

<field name="show_title" type="radio" default="1" label="MOD_TESTIMONIAL_SHOW_TITLE_LABEL" description="MOD_TESTIMONIAL_SHOW_TITLE_DESC" class="btn-group btn-group-yesno">
					<option value="1">MOD_TESTIMONIAL_SHOW_TITLE_SHOW</option>
					<option value="0">MOD_TESTIMONIAL_SHOW_TITLE_HIDE</option>
				</field>
and in module.php :

Code: Select all

$show_title = modTestimonialHelper::getShowTitle($params);
and in helper.php :

Code: Select all

function getShowTitle(&$params){
	$show_title = $params->get( 'show_title' );
 }
and in default.php :

Code: Select all

<?php if($show_title == 1) : ?>
                    <h2 class="text-center mt-5 mb-5 pb-2 text-uppercase text-dark"><strong><?php echo JText::_('MOD_TESTIMONIAL_TITLE'); ?></strong></h2>
					<?php endif; ?>
but it dont work. Can you help me fix it ? thanks

User avatar
H13
Joomla! Ace
Joomla! Ace
Posts: 1545
Joined: Sun Dec 10, 2006 6:39 pm
Location: Czech Republic
Contact:

Re: Module development

Post by H13 » Fri May 18, 2018 2:42 pm

Hi,

in helper.php you ask for value of $show_title but you don't return it, maybe it should be:

Code: Select all

function getShowTitle($params){
   $show_title = $params->get( 'show_title' );
   return $show_title;
 }
when you don't do anything with variable $params, you don't need to make it as reference (&$params -> $params)

Jan
- Phoca Cart - Joomla eCommerce App - https://www.phoca.cz/phocacart
- Phoca Gallery - powerful image gallery
- Phoca Restaurant Menu - https://www.phoca.cz/phocamenu
- Phoca Download - download manager for Joomla

roman5555
Joomla! Intern
Joomla! Intern
Posts: 67
Joined: Tue Aug 17, 2010 9:58 pm

Re: Module development

Post by roman5555 » Tue Jun 12, 2018 7:01 am

Thanks .

I have one more question.

My module is testimonial module . Do not you have any instructions how to create individual testimonial in the administration?

thanks

User avatar
pmleconte
Joomla! Guru
Joomla! Guru
Posts: 591
Joined: Fri Mar 17, 2017 12:55 pm
Location: France

Re: Module development

Post by pmleconte » Tue Jun 12, 2018 3:30 pm

Hi,

In this case, this is not a module anymore, it becomes a component.

Check https://docs.joomla.org/J3.x:Developing ... _Component

Pascal
If anything can go wrong, it will.
https://www.conseilgouz.com/en

roman5555
Joomla! Intern
Joomla! Intern
Posts: 67
Joined: Tue Aug 17, 2010 9:58 pm

Re: Module development

Post by roman5555 » Tue Jun 12, 2018 5:14 pm

Hi, ok thanks.


Locked

Return to “Joomla! 3.x Coding”