duandui2803 2016-09-18 16:14
浏览 38

显示图像而不是文本

I am very new in php. I have a site with the CMS joomla 3.6. In the register of a third part component I have a select box to the members inform his gender. In the html of the page, returns the text 'male' and 'female'. What I need is to replace the text 'male' and 'female' with images.

In the PHP file I have this:

public function getFieldData($field) {
    $options = array("COM_COMMUNITY_MALE" => "COM_COMMUNITY_MALE", "COM_COMMUNITY_FEMALE" => "COM_COMMUNITY_FEMALE");
    $value = strtoupper($field['value']);
    if ( isset($options[$value])) {
        return JText::_($options[$value]);
    }else {
        return '';
    }
}

So, I know that the second "COM_COMMUNITY_MALE" and "COM_COMMUNITY_FEMALE" are the output html and I have tried to replace them with that code <img src="image/image.png"/>. But no luck, can someone tell me what is the path to do this?

Thank you in advance for your attention.

  • 写回答

1条回答 默认 最新

  • duan0403788996 2016-09-27 13:14
    关注

    The problem is that you are using a dropdown box, and, for example, COM_COMMUNITY_MALE is the value and the label of one of the options in that dropdown box, and you can't have a value in a dropdown that is HTML code (for example, an img tag). You will need to review your requirements.

    评论

报告相同问题?

悬赏问题

  • ¥17 pro*C预编译“闪回查询”报错SCN不能识别
  • ¥15 微信会员卡接入微信支付商户号收款
  • ¥15 如何获取烟草零售终端数据
  • ¥15 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向