我正在尝试在Magento的CMS页面上使用一些PHP。我试过this solution - 但没有运气。当我检查它时,html就在那里,但它不执行php代码。
我在页面目录中创建了文件featured_solutions.phtml
。以下是该文件的内容
<h2>Featured Solutions</h2>
<p>Our Featured VoIP Solutions are selected by our experienced engineers to be Industry leading technologies that you’ll want to consider when choosing the best VoIP solution for your business or customers.</p>
<p>With in-depth VoIP product overviews and reviews, tutorials and videos, our Featured VoIP Solutions will advise you on what VoIP equipment to use, how to implement it, and why you should choose it.</p>
<div class="featured-solutions">
<?php
$directory="/skin/frontend/default/ultimento-custom/images/featured";
$featured_images = preg_grep('/^([^.])/', scandir ($directory));
$count=1;
foreach ($featured_images as $feat){
$feat_solution = basename($feat, ".png");
if($count % 3 == 0) { ?>
<div class="featured-right">
<?php } else { ?>
<div class="featured-left">
<?php }
echo '<a class="featured" href="../featured-solution/'.$feat_solution.'">
<img src="/skin/frontend/default/ultimento-custom/images/featured/'.$feat.'" class="img-featured" />
<p>Featured Solution: '.$feat_solution.'</p>
</a>
</div>';
$count++;
}
?>
</div>
然后在我的CMS页面中,我有这一行
{{block type="core/template" template="page/featured_solutions.phtml"}}
结果是,html被执行,但不是PHP。标签内的任何内容都不会显示出来。
任何想法我做错了什么?谢谢!
答案 0 :(得分:0)
AleksandrIvashchenko指出我错过了一个。在我的第一个/我的$目录之前