当前位置: 动力学知识库 > 问答 > 编程问答 >

php - Problem with call to img in Joomla!

问题描述:

to whomever it is that can help me thank you in advance. Can anybody tell me how to call an image within this piece of code or what I'm doing wrong?

In the header of a default.php file within a module I have

$iseta = $params->get ('iseta');

Then several lines down I have

<img src="<?php echo $path; ?>modules/mod_chat/Set_<?php echo'.$iseta.'?>.gif" alt="Chat Now" title="Chat Now" height="127" width="200" style="margin-right:6px;"/>

Note that all images in the image folder are titled Set_Aon.gif and Set_Aoff.gif etc. The values in the parameter are value="Aon" value="Aoff".

<param name="iseta" type="list" default="Aon" label="Online Image" description="The online chat icon that will be displayed on the front. A online = A offline">

<option value="Aon">Blue</option>

<option value="Bon">White</option>

</param>

The variable $params calls a parameter in Joomla where 'iseta' is the parameter name. Within this parameter I have created a type="list" for the front-end of the module. Each item in the list being a different image for 'iseta'. Maybe I'm missing a call to 'iseta' from the .xml document that it is located in? I'm not sure if I'm setting this up wrong, but some suggestions would be greatly appreciated.

Respectfully,

David

网友答案:
<?php echo'.$iseta.'?> 

Single-quoted strings in PHP do not interpolate variables within them. This will generate HTML that looks something like

<img src="blah/blah/Set_.$iseta..gif" alt="Chat Now" title="etc..." />

Note that the variable's name and the two periods have been inserted literally. Most likely what you'd want is

<?php echo $iseta ?>

instead.

分享给朋友:
您可能感兴趣的文章:
随机阅读: