添加 alt img 标签到现有的 php 网站
我目前正在尝试为运行 interspire 购物车平台的现有网站添加 alt img
标签,我已经非常接近了,但我似乎无法做到正确。 任何帮助将不胜感激。
// Is there a thumbnail image we can show?
$thumb = $GLOBALS['ISC_CLASS_PRODUCT']->GetThumb();
$alttext = $GLOBALS['ISC_CLASS_PRODUCT']->GetProductName();
if ($thumb == '' && GetConfig('DefaultProductImage') != '') {
if (GetConfig('DefaultProductImage') == 'template') {
$thumb = GetConfig('ShopPath').'/templates/'.GetConfig('template').'/images/ProductDefault.gif';
} else {
$thumb = GetConfig('ShopPath').'/'.GetConfig('DefaultProductImage');
}
$thumbImage = '<img src="'.$thumb.'" alt="->GetProductName" />';
} else if ($thumb != '') {
$thumbImage = '<img src="'.GetConfig('ShopPath').'/'.GetConfig('ImageDirectory').'/'.$thumb.'" alt=""'.$alttext.'" />';
}
我尝试发布代码,但它说新用户由于某种原因无法发布图像标签
I am currently trying to add in alt img
tags for an existing website running the interspire shopping cart platform, I have gotten pretty close I bleieve, but i cannot seem to get it right. Any help would be grealty appreciated.
// Is there a thumbnail image we can show?
$thumb = $GLOBALS['ISC_CLASS_PRODUCT']->GetThumb();
$alttext = $GLOBALS['ISC_CLASS_PRODUCT']->GetProductName();
if ($thumb == '' && GetConfig('DefaultProductImage') != '') {
if (GetConfig('DefaultProductImage') == 'template') {
$thumb = GetConfig('ShopPath').'/templates/'.GetConfig('template').'/images/ProductDefault.gif';
} else {
$thumb = GetConfig('ShopPath').'/'.GetConfig('DefaultProductImage');
}
$thumbImage = '<img src="'.$thumb.'" alt="->GetProductName" />';
} else if ($thumb != '') {
$thumbImage = '<img src="'.GetConfig('ShopPath').'/'.GetConfig('ImageDirectory').'/'.$thumb.'" alt=""'.$alttext.'" />';
}
I have tried posting the code but it says new users cannot post image tags for some reason
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
在我看来,打开 alt 属性后,您有两个双引号,然后是文本,然后是另一个结束引号。
It looks to me like you have two double quotes after you open the alt attribute, then the text, then another closing quote.
这条线行不通
你可能想要这样的东西
This line won't work
You probably want something like this
ylebre 的意思是:(将代码框向右滚动)
末尾多了一个“!
ylebre meant: (scroll the code box to the right)
there is one extra " at the end!