1

I would like to add an image instead of greeting text "Hello" under that code -

$mootoolsButton = $params->get('mootoolsbutton','');
if(empty($mootoolsButton)){
    $mootoolsButton = Jtext::_('Hello');
    // $mootoolsButton = echo '<img src="images/main/nl_03.png" />';
}else{
    if(!empty($mootoolsButton) && preg_match('#^[A-Z_]*$#',$mootoolsButton)){
        $mootoolsButton = JText::_($mootoolsButton);
    }
}
2

You do not need to use JText in case of rendering images. Just put:

$this->mootoolsButton = 'images/main/nl_03.png';

JText is used to translate string.

If you are working on custom component then add above code to view.html.php file. And then access it to "tmpl/default.php" with below code.

<img src="<?php echo $this->mootoolsButton; ?>" alt="Button" />
  • sorry, that line is comment line to note. That's not work to load image. which way can i put that image? – Si Thu Apr 19 '15 at 6:54
  • Are you working on creating custom template or component? – Sahil Purav Apr 19 '15 at 7:07
  • yes, modifying one module - that module shows only text not image – Si Thu Apr 19 '15 at 7:09
  • ok I updated my answer. For double checking, can you provide the path of your file where you are updating the things. Just making sure, which type of extension you are updating. – Sahil Purav Apr 19 '15 at 7:12
  • Thanks for replying Sahil Purav, I tried again and again but not worked so I posted at their forum. I gona wait sometimes. – Si Thu Apr 19 '15 at 12:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.