Php 试图让str_replace在自定义Magento代码中工作

Php 试图让str_replace在自定义Magento代码中工作,php,string,magento,Php,String,Magento,这是我的密码: <?php $_rtl = Mage::getStoreConfig('custom_menu/general/rtl') + 0; $_categories = $this->getStoreCategories(); if (is_object($_categories)) $_categories = $this->getStoreCategories()->getNodes(); ?> <

这是我的密码:

<?php
    $_rtl           = Mage::getStoreConfig('custom_menu/general/rtl') + 0;
    $_categories    = $this->getStoreCategories();
    if (is_object($_categories)) $_categories = $this->getStoreCategories()->getNodes();
?>
<div class="nav-container">
<div style="z-index:999;position:relative;top:-8px;left:979px;cursor:pointer;"><img src="<?php echo $this->getSkinUrl('images/Truck-Prince-text.png'); ?>" height="91" width="123" style="position:absolute;" onclick="location.href='<?php echo Mage::getUrl('checkout/cart'); ?>'"></div>
    <div id="custommenu" class="<?php echo $_rtl ? ' rtl' : ''; ?>">
        <?php if ($this->showHomeLink()) : ?>
        <div class="menu">
            <div class="parentMenu menu0">
                <a href="<?php echo $this->getUrl('') ?>">
                    <span><?php echo $this->__('Home'); ?></span>
                </a>
            </div>
        </div>
        <?php endif ?>
        <?php foreach ($_categories as $_category): ?>
            <?php echo $this->drawCustomMenuItem($_category) ?>
        <?php endforeach ?>
    <?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('nav-links-after')->toHtml() ?>
        <div class="clearBoth"></div>
    </div>
</div>

getSkinUrl('images/Truck Prince text.png');?>“height=“91”width=“123”style=“位置:绝对;“onclick=“location.href=”>

我终于能够得到它:)以下是我所做的

<?php
    $_rtl           = Mage::getStoreConfig('custom_menu/general/rtl') + 0;
    $_categories    = $this->getStoreCategories();
    if (is_object($_categories)) $_categories = $this->getStoreCategories()->getNodes();
?>
<div class="nav-container">
<div style="z-index:999;position:relative;top:-8px;left:979px;cursor:pointer;"><img src="<?php echo $this->getSkinUrl('images/Truck-Prince-text.png'); ?>" height="91" width="123" style="position:absolute;" onclick="location.href='<?php echo Mage::getUrl('checkout/cart'); ?>'"></div>
    <div id="custommenu" class="<?php echo $_rtl ? ' rtl' : ''; ?>">
        <?php if ($this->showHomeLink()) : ?>
        <div class="menu">
            <div class="parentMenu menu0">
                <a href="<?php echo $this->getUrl('') ?>">
                    <span><?php echo $this->__('Home'); ?></span>
                </a>
            </div>
        </div>
        <?php endif ?>
        <?php foreach ($_categories as $_category): ?>
            <?php $_category = $this->drawCustomMenuItem($_category) ?>

    <?php // We must replace URLs on the fly to use landing pages and not break subcat navigation
    $_category = str_replace('wild-bird-feed-supplies.html', 'landing-wild-bird-feed-supplies', $_category);
    $_category = str_replace('lawn-garden-supplies.html', 'landing-lawn-garden-supplies', $_category);
    $_category = str_replace('pet-food-supplies.html', 'landing-pet-food-supplies', $_category);
    $_category = str_replace('animal-feed-supplies.html', 'landing-animal-feed-supplies', $_category); ?>

    <?php echo $_category; ?>


        <?php endforeach ?>
    <?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('nav-links-after')->toHtml() ?>
        <div class="clearBoth"></div>
    </div>
</div>

getSkinUrl('images/Truck Prince text.png');?>“height=“91”width=“123”style=“position:absolute;”onclick=“location.href=”>
<?php
    $_rtl           = Mage::getStoreConfig('custom_menu/general/rtl') + 0;
    $_categories    = $this->getStoreCategories();
    if (is_object($_categories)) $_categories = $this->getStoreCategories()->getNodes();
?>
<div class="nav-container">
<div style="z-index:999;position:relative;top:-8px;left:979px;cursor:pointer;"><img src="<?php echo $this->getSkinUrl('images/Truck-Prince-text.png'); ?>" height="91" width="123" style="position:absolute;" onclick="location.href='<?php echo Mage::getUrl('checkout/cart'); ?>'"></div>
    <div id="custommenu" class="<?php echo $_rtl ? ' rtl' : ''; ?>">
        <?php if ($this->showHomeLink()) : ?>
        <div class="menu">
            <div class="parentMenu menu0">
                <a href="<?php echo $this->getUrl('') ?>">
                    <span><?php echo $this->__('Home'); ?></span>
                </a>
            </div>
        </div>
        <?php endif ?>
        <?php foreach ($_categories as $_category): ?>
            <?php $_category = $this->drawCustomMenuItem($_category) ?>

    <?php // We must replace URLs on the fly to use landing pages and not break subcat navigation
    $_category = str_replace('wild-bird-feed-supplies.html', 'landing-wild-bird-feed-supplies', $_category);
    $_category = str_replace('lawn-garden-supplies.html', 'landing-lawn-garden-supplies', $_category);
    $_category = str_replace('pet-food-supplies.html', 'landing-pet-food-supplies', $_category);
    $_category = str_replace('animal-feed-supplies.html', 'landing-animal-feed-supplies', $_category); ?>

    <?php echo $_category; ?>


        <?php endforeach ?>
    <?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('nav-links-after')->toHtml() ?>
        <div class="clearBoth"></div>
    </div>
</div>