有两种方法可以编写 php 片段以将 html 放在主页上,然后将 html 放在所有其他页面上......这是针对 Joomla 3.++
<?php
$menu = & JSite::getMenu();
if ($menu->getActive() == $menu->getDefault()) {
echo 'HTML for HOME PAGE HERE';
} else {
echo 'HTML for ALL OTHER PAGES HERE';
} ?>
此代码仅允许仅关注主页:
<?php
$menu = & JSite::getMenu();
if ($menu->getActive() == $menu->getDefault()) {
echo 'HTML FOR HOME PAGE HERE';
}
?>
我想做的,特别是第二个代码片段,专注于网站上的特定页面......
原因是 A. 我不想为我正在创建的所有其他页面类型创建一个模板...... B. 我不想在我的 html 模块位置放置样式模板元素。我觉得自定义 HTML 或博客/文章帖子应该只是用于内容插入。
那么有没有办法代替调用 $menu->getDefault()) <<<< 使 getPage ???