不确定如何创建if语句,说明<iframe> else else else </iframe>

时间:2014-08-26 15:15:13

标签: javascript php jquery magento iframe

我在Magento,但我认为这可以用普通的PHP完成。也许我错了。在PHP方面我没经验。

我有一个问题,我需要通过尝试在下拉列表中显示来杀死iframe。但是当你到达那个特定的登陆页面时,它仍然需要显示。所以我无法在任何地方杀死它,就在下拉列表中。所以我需要写的是当iframe尝试在下拉列表中显示时,它会被普通文本替换。

我试着找到答案,但没有运气。

感谢您提前抽出时间。

这是用于该特定下拉列表的代码。现在没有if语句可以杀死它。我尝试了一些并没有接近工作的事情。

<?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 个答案:

没有答案