How to get joomla sections to display only on certain pages?
I am brand new to joomla, and am trying to have a few sections, such as a featur开发者_运维百科e slider, show up only on homepage, and some other stuff show only on internal pages. I thought I was on the right track with this code, but does not work correctly. What is the best way to do this? Thank you.
<div id="wrapper">
<!--====================HOME PAGE ONLY========================-->
<?php if(JRequest::getVar('view') == "frontpage" ) : ?>
<div id="feature_slides" class="featuredbox-wrapper"><!--Featured Content Slider-->
<jdoc:include type="modules" name="feature_slides" />
</div><!-- end #feature_slides -->
<?php endif; ?>
<!--====================END HOME PAGE ONLY========================-->
<div id="main_content">
<!--====================INTERNAL PAGE ONLY========================-->
<?php if(!JRequest::getVar('view') == "frontpage" ) : ?>
<h2 class="page_name">I Am An Internal Page</h2>
<h4 class="breadcrumbs">Breadcrumbs</h4>
<?php endif; ?>
<!--====================END INTERNAL PAGE ONLY========================-->
<!--====================HOME PAGE ONLY========================-->
<?php if(JRequest::getVar('view') == "frontpage" ) : ?>
<div id="intro">
<jdoc:include type="modules" name="home_intro" />
</div><!-- end #intro -->
<?php endif; ?>
<!--====================END HOME PAGE ONLY========================-->
<div id="main_area" class="clearfix">
<jdoc:include type="component" />
</div><!-- end #main_area -->
<div id="certifications">
<jdoc:include type="modules" name="certifications" />
</div><!-- end #certifications -->
</div><!-- end main_content -->
<div id="right_sidebar">
<jdoc:include type="modules" name="right_sidebar" />
</div><!-- end #right_sidebar -->
<div class="separator"></div><!-- end .separator -->
</div><!-- end wrapper -->
Just use a module and define which page you want to show it on using the admin menu.
You can do all of this through your Joomla administrative back end. You can define which modules show up where inside each individual module on the bottom left side. Additionally, in the menu manager you can define a menu tab to only display a certain section, category or article, amongst other things.
When logged into the administrator site, select Content > Article Manager.
When you create a new article, you will see radio button options to display it on the Front Page (as well as assign the article to a section or category you have already defined).
If the article already exists, just click on its title to edit it--the edit screen will display the available options.
I am assuming you mean modules instead of sections. Here is a link to the official Joomla wiki with instructions how to do that. http://docs.joomla.org/How_do_you_assign_a_module_to_specific_pages%3F
If you are trying to stop an empty position from showing up, you can use:
<?php if($this->countModules('position_name')) : ?>
<!-- html code if position has a module -->
<?php else : ?>
<!-- otherwise do this -->
<?php endif; ?>
Doesn't give you much to work with divs and formatting if you use a module.. I like to keep modules for editing text only.
精彩评论