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.
Related
I am using OpenCart v 2.1.1.
In the admin area, the settings area indicates that the theme is set to Default.
On the server, I navigated to catalog -> view -> theme -> default -> template -> common
and opened up the header.tpl file for editing.
Inside the header.tpl file, I located line 115 which appears to be the last item
<li><?php echo $category['name']; ?></li>
Then on the next line I added in:
<li>Contact Us<li>
I Saved Changes, refreshed web page, and the Contact Us link does not appear in the blue menubar.
What have I done wrong..
you need to delete the cache of the template engine, else it won't update the cached template.
seems you add this line to the not correct place. you should add it before the last </ul> tag. this is 114 line in OC2.1 version.
<li>Contact Us<li>
</ul>
The last part of the header.tpl:
<?php if ($categories) { ?>
<div class="container">
<nav id="menu" class="navbar">
<div class="navbar-header"><span id="category" class="visible-xs"><?php echo $text_category; ?></span>
<button type="button" class="btn btn-navbar navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse"><i class="fa fa-bars"></i></button>
</div>
<div class="collapse navbar-collapse navbar-ex1-collapse">
<ul class="nav navbar-nav">
<?php foreach ($categories as $category) { ?>
<?php if ($category['children']) { ?>
<li class="dropdown"><?php echo $category['name']; ?>
<div class="dropdown-menu">
<div class="dropdown-inner">
<?php foreach (array_chunk($category['children'], ceil(count($category['children']) / $category['column'])) as $children) { ?>
<ul class="list-unstyled">
<?php foreach ($children as $child) { ?>
<li><?php echo $child['name']; ?></li>
<?php } ?>
</ul>
<?php } ?>
</div>
<?php echo $text_all; ?> <?php echo $category['name']; ?> </div>
</li>
<?php } else { ?>
<li><?php echo $category['name']; ?></li>
<?php } ?>
<?php } ?>
<li>Contact Us<li>
</ul>
</div>
</nav>
</div>
<?php } ?>
I have checked it works with default. Of course do not forget clear cache of your browser.
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 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
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'm trying to create a teaser node template to display all Blog teasers.
For the page tpl I have page-blogs.tpl.php
For the Blog node tpl I have node-blog.tpl.php (This one is looping to display all the blog teasers)
Now how do I create a node template to surround the node teasers?
My URL for the page with all the blog teasers is: /blogs/eric
My URL for the page with an example blog entry is: /blogs/eric/test-blog-1
I need a node template that I can use for all the Blog pages.
I tried using node-blogs-teaser.tpl.php for the individual teaser nodes and node-blog.tpl.php for the outer blog node template, but that didn't work.
Here is what I have in my node-blog.tpl.php file:
<div id="node-<?php print $node->nid; ?>" class="node<?php if ($sticky) { print ' sticky'; } ?><?php if (!$status) { print ' node-unpublished'; } ?>">
<div class="item">
<ul>
<?php print $picture ?>
<?php if ($page == 0): ?>
<?php endif; ?>
<div class="content clear-block">
<li class="title"><h4><?php print $title ?></h4></li>
<li class="photo"><img src="/<?php print $node->field_blog_image[0]['filepath']; ?>" /></li>
<li class="desc"><?php print $node->content['body']['#value']; ?></li>
<li class="link">
<?php if ($teaser): ?>
Read more | Audio/Video |
<?php endif; ?>
<?php print $submitted; ?>
</li>
<div class="clear"></div>
</div>
<div class="clear-block">
<div class="meta">
<?php if ($taxonomy): ?>
<div class="terms"><?php print $terms ?></div>
<?php endif;?>
</div>
</div>
</ul>
</div>
</div>
thanks
UPDATE: I added a page preprocessor function in template.php :
/**
* Override or insert PHPTemplate variables into the templates.
* These are the main outer templates such as page.tpl.php
*/
function phptemplate_preprocess_page(&$vars) {
// add template hints using path alias
$alias = drupal_get_path_alias($_GET['q']);
if ($alias != $_GET['q']) {
$template_filename = 'page';
foreach (explode('/', $alias) as $path_part) {
$template_filename = $template_filename . '-' . $path_part;
$vars['template_files'][] = $template_filename;
}
}
//----
}
Assuming your content type is called "blog", then node-blog.tpl.php will be used whenever a blog post needs to be displayed. The $teaser variable will be set to TRUE in node-blog.tpl.php if Drupal is wanting the teaser display, and the $page variable will be set to TRUE if the node is being shown in full page view (they will both be FALSE if the full node is being shown in a list of nodes). So you need to set up your node-blog.tpl.php to check for what type of display is being requested and return the HTML appropriate to the given type. The general setup of your node-blog.tpl.php should be along these lines:
if($teaser){
//return teaser html
}
else{
//return full node HTML
}
It's a little unclear to me from your question, but it sounds like you might have some sort of looping code in node-blog.tpl.php to iterate over the nodes on your site. You do NOT want to do this. Drupal does not work like Wordpress.
You don't mention how your list of teasers is being generated at /blogs/eric but I'd recommend using the Views module. If you use Views to generate the list of teasers then you'll be able to easily theme the list using Views' theming.
Edited since you added your example code
To stick arbitrary HTML at the top of ONLY the full node display of a blog page you could edit your node-blog.tpl.php to look something like this:
<?php if ($page): ?>
My arbitrary HTML here which will not show up in teasers and only at the top of full blog pages
<?php endif; ?>
<div id="node-<?php print $node->nid; ?>" class="node<?php if ($sticky) { print ' sticky'; } ?><?php if (!$status) { print ' node-unpublished'; } ?>">
<div class="item">
<ul>
<?php print $picture ?>
<?php if ($page == 0): ?>
<?php endif; ?>
<div class="content clear-block">
<li class="title"><h4><?php print $title ?></h4></li>
<li class="photo"><img src="/<?php print $node->field_blog_image[0]['filepath']; ?>" /></li>
<li class="desc"><?php print $node->content['body']['#value']; ?></li>
<li class="link">
<?php if ($teaser): ?>
Read more | Audio/Video |
<?php endif; ?>
<?php print $submitted; ?>
</li>
<div class="clear"></div>
</div>
<div class="clear-block">
<div class="meta">
<?php if ($taxonomy): ?>
<div class="terms"><?php print $terms ?></div>
<?php endif;?>
</div>
</div>
</ul>
</div>
</div>
Edited since finding out you're using the Blog module
To display arbitrary HTML at the top of the listing of blog teasers just stick it at the top of page-blog.tpl.php