I have a CSS class like this:
.divTourCategorySummaryBoxLeft, .divTourCategorySummaryBoxRight {
width: 98%;
min-height: 350px;
border: 1px dashed #9CAAC6;
padding: 2px;
margin-bottom:3px;
background: #DEE7EF;
color: #000063;
line-height: 1.4em;
display:block;
overflow:auto;
}
Then I include the module like this in index.php:
<div class="divTourCategorySummaryBoxRight">
<jdoc:include type="modules" name="modTourCategorySummaryRight" />
</div>
This appears perfectly. Howerver, I need to have multiple modules of this on the same page. So when I add nother module it appears in the same div. This is not the way I want it. For every module, there must be a separate div. And the number of modules is unknown.
So I tried this:
<jdoc:include type="modules" name="modTourCategorySummaryLeft" style="divTourCategorySummaryBoxLeft" />
But the styling fails here. How do I get this to show a new set of divs for each module?
Please advise.
This is my own template I built from scratch looking at the joomla docs. I'm pretty new to this.
Thanks!
You need to create a new module chrome. In your template html folder, create file called modules.php.
Inside, make a function like this
defined('_JEXEC') or die;
function modChrome_customstyle($module, &$params, &$attribs)
{
if (!empty ($module->content)) : ?>
<div class="divTourCategorySummaryBoxRight">
<div class="moduletable">
<?php if ($module->showtitle != 0) : ?>
<h3><?php echo $module->title; ?></h3>
<?php endif; ?>
<?php echo $module->content; ?>
</div>
</div>
<?php endif;
}
This way you can create custom module outputs.
Then, in your template file, include the module like this:
<jdoc:include type="modules" name="modTourCategorySummaryLeft" style="customstyle" />
After adding style="customstyle" your new function will be used to render the module. The default style is xhtml, and you can find it's code in the templates/system/html folder in modules.php file
Related
i create new template for j2.5,
i need to add many module only show on home,
now i need to show many module all page without home,
pleas see my code below :
<div class="row" style="margin-top:20px;">
<div class="col-xs-12 co-md-12">
<?php if($this->countModules('adsright')) : ?>
<div class="col-xs-12 col-md-2">
<jdoc:include type="modules" name="adsright" style="custom" />
</div>
<?php endif; ?>
<div class="col-xs-12 col-md-10">
<div class="content">
<jdoc:include type="message" />
<jdoc:include type="component" /> </div></div>
</div>
</div>
when add module to adsright position and unchecked home page,was not show on my content,
how can i solve that ?
please tell me full way for create position conditional.
thanks.
please give some clear description of your problem.
And if you want certain positions and div structure on home page and not require same on inner pages then you can set condition based on this code. I hope this will help.
$app = JFactory::getApplication();
$menu = $app->getMenu();
if ($menu->getActive() == $menu->getDefault()) {
echo 'Home page';
}
I have a joomla 3.0 custom template, with no overrides. The issue I am having is that the Print, Email and Edit icons do not show, instead, these show in form of a vertical list. Also note that I have enabled "Show Icons" in both Article Options and Menu Items. I know the code in default.php is what is mean't to display these icons, see below: -
<?php if (!$this->print) : ?>
<?php if ($canEdit || $params->get('show_print_icon') || $params->get('show_email_icon')) : ?>
<div class="btn-group pull-right">
<a class="btn dropdown-toggle" data-toggle="dropdown" href="#"> <span class="icon-cog"></span> <span class="caret"></span> </a>
<?php // Note the actions class is deprecated. Use dropdown-menu instead. ?>
<ul class="dropdown-menu actions">
<?php if ($params->get('show_print_icon')) : ?>
<li class="print-icon"> <?php echo JHtml::_('icon.print_popup', $this->item, $params); ?> </li>
<?php endif; ?>
<?php if ($params->get('show_email_icon')) : ?>
<li class="email-icon"> <?php echo JHtml::_('icon.email', $this->item, $params); ?> </li>
<?php endif; ?>
<?php if ($canEdit) : ?>
<li class="edit-icon"> <?php echo JHtml::_('icon.edit', $this->item, $params); ?> </li>
<?php endif; ?>
</ul>
</div>
<?php endif; ?>
<?php else : ?>
<div class="pull-right">
<?php echo JHtml::_('icon.print_screen', $this->item, $params); ?>
</div>
<?php endif; ?>
But I see no problem in the above code, I have even created overrides and still no change which means the template is not the problem. Why is this so? do I need to change the location of the images folder? what should I do to replace the links with the icons?
Regards.
I've been working on migrating a 1.5 template to 3.0 as well. The reason the icons are gone is that Joomla no longer uses them or adds them in the same way. In current template they are using Bootstrap and for good reason (as bakual indicated). If you are doing a direct port of an old template and want to keep the old look and feel you can add the following css to your template.
.pull-right{
float:right;
}
.btn-group{
position:relative;
margin-top:-30px;
}
.btn-group ul{
list-style:none;
display: inline;
padding-left:4px;
}
.print-icon{
background: url(../images/printButton.png) no-repeat;
height: 16px;
width: 16px;
overflow: hidden;
display: inline-block;
}
.email-icon{
background: url(../images/emailButton.png) no-repeat;
height: 16px;
width: 16px;
overflow: hidden;
display: inline-block;
}
.print-icon a,
.email-icon a{
color:transparent;
}
You may have to massage the numbers a bit depending on your template and add some stuff to get other icons I didn't add but you get the idea at least. Also to get the icon I just looked at an old version of the site and copied them into my template in the image folder.
The default output uses Bootstrap markup. The icons are generated by the Icomoon fontset and the Javascript included in Bootstrap will wrap the list together into a dropdown menu.
If you only see a flat list of those items, that means you neither have the Bootstrap CSS loaded nor the Bootstrap Javascript framework.
The Javascript framework can be loaded using JHtml::_('bootstrap.framework');
The CSS can be loaded by included one of the files found in media\jui\css. Or by compiling your own from the LESS files in media\jui\less.
Okay,
I'm sure this has been answered before and also I believe this link could help me http://docs.joomla.org/Hide_column_to_avoid_width_issues
I'm not very familiar with syntax or php coding so I had trouble following what I'm trying to do..
I'm building a joomla 2.5 template and I'm using countmodules to hide 'divs' or entire positions when there are no modules published there. My problem is let's say in my main column of 100% width I want to sometimes display a module to the right of the content within the main content box of only 25% width of the whole columns width. Okay this works.
I want to however float the content to the left and this 25% width module we will call 'right1' and it floats to the right, so I need to give my main content around a 75% width to make everything float nicely and display properly and it does! My question is I don't understand how to make my main content a 100% width if 'right1' does not exist. If I display no modules in 'right1' so it does not display how would I change my css of the main content to adjust to 100% instead of being shrunk to 75% to make up for the missing right1 position.
I'm probably really stupid and there's a simple solution right in front of me I cannot remember. Thanks in advance!
-edited-
It goes along the lines of something like this
<div id="contentcontainer">
<jdoc:include type="message" /><jdoc:include type="component" />
<?php if ($this->countModules( 'right1' )) : ?>
<div id="right1"><jdoc:include type="modules" name="right1" style="xhtml" /></div>
<div class="clearfix"></div><?php endif; ?><?php if ($this->countModules('right2')): ?>
<div id="right2"><jdoc:include type="modules" name="right2" style="xhtml" /></div>
<div class="clearfix"></div>
<?php endif; ?>
</div></div></div>
I just added the contentcontainer to make sure they are within a 100% width container to work with
#contentcontainer{
width:100%;
position:relative;
}
#right1, #right2 {
border: 1px solid #990000;
border-radius: 18px 18px 18px 18px;
box-shadow: 5px 3px 5px #990000;
display: block;
float: right;
height: auto;
width: 25%;
}
I put whatever tag the content uses to float:left; and what I tried doing is using 'min-width:' to the main content and min-widths don't seem to be working. So what could be a solution and hopefully I don't have to turn to jQuery as suggested once. Is this enough information?
-edited-
You can do it using some simple PHP and an inline style. I'm not an expert on PHP so this may not be as elegant as it could be however I'm sure someone will correct it.
<div id="contentcontainer">
<?php
//column calculation
$columns == 0;
if($this->countModules( 'right1' )) {$columns++;}
if($this->countModules( 'right2' )) {$columns++;}
$centercolumnwidth = 100 - (25 * $columns);
?>
<jdoc:include type="message" />
<div id="maincolumn" style="width:<?php echo $centercolumnwidth ?>%">
<jdoc:include type="component" />
</div><!--/maincolumn-->
<?php if ($this->countModules( 'right1' )) : ?>
<div id="right1">
<jdoc:include type="modules" name="right1" style="xhtml" />
</div><!--/right1-->
<div class="clearfix"></div>
<?php endif; ?>
<?php if ($this->countModules('right2')): ?>
<div id="right2">
<jdoc:include type="modules" name="right2" style="xhtml" />
</div><!--/right2-->
<div class="clearfix"></div>
<?php endif; ?>
</div><!--/contentcontainer-->
I have just typed this out without testing but it should set the width of the #maincolumn to either 100%, 75% or 50% depending on whether right1 and/or right2 are published.
You will need to float #maincolumn to the left in your CSS as well.
I desperately need help. I am trying to customize main menu (only) in Drupal 7 so that it suits my blueprintcss needs. I tried to find the answer in the documentation, but there is no straightforward example for this, which makes it a bit difficult.
Basic requirement is to have other menus (navigation etc) not affected by the main menu styling.
My page.tpl.php includes this code:
<?php if ($main_menu): ?>
<div class="span-9" id="topmenu">
<?php print theme('links__system_main_menu', array(
'links' => $main_menu,
'attributes' => array(
'id' => 'main-menu',
'class' => array('links', 'inline', 'clearfix'),
),
)); ?>
</div>
<?php endif; ?>
The output shows:
<div class="span-9" id="topmenu">
<ul id="main-menu" class="links inline clearfix">
<li class="menu-151 first">Home</li>
<li class="menu-152">Contact Us</li>
<li class="menu-153 last">About Us</li>
</ul>
</div>
Whereas the desired output should be something like this:
<div class="span-9" id="topmenu">
<div class="span-3 menu-151">Home</div>
<div class="span-3 menu-152">Contact Us</div>
<div class="span-3 menu-153 last">About Us</div>
</div>
You can override the theme function to modify the generated markup.
To achieve this :
Locate the theme function you are calling (shall be
theme_links__system_main_menu).
Copy and paste the code of this function into a custom theme function (could
be done in phptemplate or custom module)
Customise your theme function to use divs instead of ul li
See the offical Drupal documentation : Overriding themable output Section "How to change HTML the Drupal way"
I need to create user control where <sc:text/> element should showed over the <sc:image>.
I know this can be achieved via CSS but in this case control cannot be configured as we cannot override inline styles.
Any hints?
You can achieve this using the sc:fld extension function and wrapping sc:text in markup, adding class names or ids (or inline styles if you must!).
<img src="{sc:fld( 'graphic', $sc_currentitem, 'src’ )}" class="head" />
<span class="txt"><sc:text field="txtField" /></span>
You can then style these as normal
img.head {}
span.txt {}
I don't understand the problem. This seems like more of a front-end problem than a Sitecore issue. CSS will work fine. Here's a rough example (not tested but gets you the idea):
Sample HTML:
<div class="my-container">
<div class="img">
<sc:image Field="Bar" runat="server" />
</div>
<div class="txt">
<sc:text Field="Foo" runat="server" />
</div>
</div>
Sample CSS:
.my-container {
position: relative;
}
.my-container .txt {
position: absolute;
z-index: 50;
top: 0px;
}
.my-container .img {
z-index: 10;
}