如何从首页隐藏 joomla 内容,但不从内页隐藏内容

发布于 2024-09-18 18:14:07 字数 2249 浏览 7 评论 0原文

我在 joomla 1.5.x 中使用 yotheme joomla 模板,我的问题是我想

  • 在首页上显示模块(如果启用),没有 joomla 内容(即 localhost/project 或 localhost/project/index.php)

  • 显示内容和内容。模块(如果启用)都在内页上,

我的问题是在首页(template/yoo_symphony/index.php)上,如果我写

然后在前面页面仅显示内容,不显示模块:(

如果我按照 上的建议编写这里这里

$pageview = JRequest::getVar('option','','GET');
if(!empty($pageview) ) : ?>
  <jdoc:include type="component" />
<?php endif; ?>  

然后首页显示所有模块但内页不显示任何内容

我已经阅读了很多关于此的文章,但没有希望...:(

请提供我是一个完美的解决方案,这样我就可以在首页上显示模块以及内页上的内容


注意:如果我在http://localhost/project 或 http://localhost/project/index.php 那么结果

Array
(
    [option] => com_content
    [view] => article
    [id] => 44
    [Itemid] => 53
)

意味着首页有 url 重写,我的主要问题是如何区分首页来自其他页面??

答案:

我从我的前辈那里得到了答案,需要执行以下步骤

1>转到joomla管理员端
2>然后导航到菜单-->主菜单 [菜单项管理器:[mainmenu] ]
3>单击主页(即您的默认菜单项)[菜单项:[编辑]]
4>现在单击更改类型[更改菜单项]
5>选择内部链接-->文章-->首页-->首页博客布局
6>申请&保存
7>现在转到index.php并将替换为

<?php  if($_GET['view'] !== 'frontpage' ) :?>
     <jdoc:include type="component" />
<?php endif;?>

注意:如果我在http://localhost/projecthttp://localhost/project/index.php 然后它返回

Array
(
    [option] => com_content
    [view] => frontpage  // see now 
    [id] => 44
    [Itemid] => 53
)

i m using yootheme joomla template in joomla 1.5.x, my problem is that i want to

  • display modules (if enabled ) on front page, no joomla content ( i.e. localhost/project or localhost/project/index.php)

and

  • display contents & modules ( if enabled ) both on inner pages

my problem is that on front page (template/yoo_symphony/index.php) if i write

<jdoc:include type="component" />

then front page display only contents , no modules :(

and if i write as suggested on here and here

$pageview = JRequest::getVar('option','','GET');
if(!empty($pageview) ) : ?>
  <jdoc:include type="component" />
<?php endif; ?>  

then front page display all modules but inner pages not display any contents

i have read many articles regarding this, but no hope...:(

please provide me a perfect solution so that i can display modules on front page as well as content on inner pages


NOTE: if i write print_r($_GET) on http://localhost/project or http://localhost/project/index.php then it results

Array
(
    [option] => com_content
    [view] => article
    [id] => 44
    [Itemid] => 53
)

means there is url rewriting on front page, my main problem is that how to distiniguish front page from other pages??

ANSWER:

I got answer from my senior, Need to do below steps

1> go to joomla administrator side
2> then navigate to menu-->main menu [ Menu Item Manager :[mainmenu] ]
3> click to Home ( i.e. your default menu item )[ Menu Item: [ Edit ] ]
4> now click on change type [ Change Menu Item ]
5> select Internel link-->Articles -->Front Page -->Front Page Blog Layout
6> Apply & save
7> now go to index.php and replace <jdoc:include type="component" /> with

<?php  if($_GET['view'] !== 'frontpage' ) :?>
     <jdoc:include type="component" />
<?php endif;?>

NOTE : if i write print_r($_GET) on http://localhost/project or http://localhost/project/index.php then it returns

Array
(
    [option] => com_content
    [view] => frontpage  // see now 
    [id] => 44
    [Itemid] => 53
)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

往事随风而去 2024-09-25 18:14:07

当我除了主页上的模块之外不需要任何东西时,我会在几个站点上执行此操作。在我使用过的任何地方,这都非常有效。只需将其添加到您的模板中即可。

<?php
$menu = &JSite::getMenu();
if ($menu->getActive() != $menu->getDefault()) {
?>
    <jdoc:include type="component" />
<?php } ?>

还要提一下,这样您将不会获得搜索结果,因为它们显示在默认页面上。 - 如果您创建一个搜索页面菜单项(如果您想控制该页面上的模块,则应该创建该菜单项),那么这根本不会影响搜索页面。

I do this on several sites when I really don't need anything but modules on the home page. This works perfectly everywhere I have ever used it. Just add this in your template.

<?php
$menu = &JSite::getMenu();
if ($menu->getActive() != $menu->getDefault()) {
?>
    <jdoc:include type="component" />
<?php } ?>

One more thing to mention, In this way you will not get the Search results, as they are displayed on default page. - If you create a search page menu item, which you should if you want to control the modules on that page, then this will not affect the search page at all.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文