duanjiati1755 2014-08-26 15:15
浏览 51

不知道如何创建一个if语句,说明<iframe> else else else

I am in Magento, but I figure this can be done with normal PHP. Maybe I am wrong. I am inexperienced when it comes to PHP.

I have an issue where I need to kill an iframe from trying to display in a dropdown. But it still needs to display when you get to that specific landing page. So I can't kill it everywhere, just on the dropdown. So what I need to write is when that iframe does try to show up in the dropdown, it gets replaced with normal text.

I tried finding an answer to this but no luck.

Thank you for your time in advance.

This is the code being used for that specific dropdown. There is no if statement running right now to kill it. I tried a couple of things that didn't come close to working.

<?php
$category = Mage::getSingleton('catalog/layer')->getCurrentCategory();
$category = Mage::getModel('catalog/category')->load(54);
$categories = $category->getCollection()
    ->addAttributeToSelect(array('name', 'thumbnail', 'description'))
    ->addAttributeToFilter('is_active', 1)
    ->addIdFilter( $category->getChildren() );
$categories->getSelect()->order('RAND()');
$categories->getSelect()->limit(1);
?>
<?php foreach ($categories as $category): ?>
<div>
    <a href="<?php echo $category->getUrl(); ?>">
        <img alt="<?php echo $category->getName(); ?>" src="<?php echo Mage::getBaseUrl('media') . 'catalog' . DS . 'category' . DS . $category->getThumbnail() ?>" alt="<?php echo $this->htmlEscape($category->getName()) ?>" style="width: 100%; max-height: 240px; box-shadow: 0px 2px 4px #aaa;-ms-box-shadow: 0px 2px 4px #aaa;-moz-box-shadow: 0px 2px 4px #aaa;-webkit-box-shadow: 0px 2px 4px #aaa;border: 1px solid #F7EBD2;" />
    </a>
    <br />    
    <h3>Spotlight Watch</h3>
    <p>
    <?php
        $sdesc = $category->getDescription();
        $sdesc = trim($sdesc);
        $limit = 300;
        if (strlen($sdesc) > $limit) {
            $sdesc = substr($sdesc, 0, strrpos(substr($sdesc, 0, $limit), ' '));
        }
    ?>
    <?php echo $sdesc."..."; ?>
    </p>
    <a href="<?php echo $category->getUrl(); ?>" class="go">View <?php echo $category->getName(); ?> Watches...</a>      
</div>
<?php endforeach; ?>
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

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