这是客户端代码;我想在Magento字符串中包围myReplaceRR:
BEFORE
$myReplaceRRR=stripslashes($product_description);
$myReplaceRRR=str_replace("bespoke.php", "made-to-measure.php", $myReplaceRRR);
$myReplaceRRR=str_replace("***OFFER PRICE FOR A LIMITED PERIOD ONLY***", "<span style=\"color:#ed2929\">***OFFER PRICE FOR A LIMITED PERIOD ONLY***</span>", $myReplaceRRR);
echo $myReplaceRRR;
AFTER
$myReplaceRRR= $this->getChildHtml('description');
$myReplaceRRR=stripslashes($product_description);
$myReplaceRRR=str_replace("bespoke.php", "made-to-measure.php", $myReplaceRRR);
$myReplaceRRR=str_replace("***OFFER PRICE FOR A LIMITED PERIOD ONLY***", "<span style=\"color:#ed2929\">***OFFER PRICE FOR A LIMITED PERIOD ONLY***</span>", $myReplaceRRR);
echo $myReplaceRRR;
注意,我希望将其作为字符串$this->getChildHtml('description');
答案 0 :(得分:2)
你应该在你的问题中尝试更具描述性。
删除第二行?
$myReplaceRRR= $this->getChildHtml('description');
$myReplaceRRR=str_replace("bespoke.php", "made-to-measure.php", $myReplaceRRR);
$myReplaceRRR=str_replace("***OFFER PRICE FOR A LIMITED PERIOD ONLY***", "<span style=\"color:#ed2929\">***OFFER PRICE FOR A LIMITED PERIOD ONLY***</span>", $myReplaceRRR);
echo $myReplaceRRR;