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.
Related
I'm currently using Cycle2 with scrollHorz on full screen (100% width and height) with background images with their size to 'cover', besides that there are no callbacks or much else on the page so its a very basic slider.
I find that when the browser is too big, the slide transition appears jagged, not smooth. However its somewhat better when the screen is smaller. I also do not experience any issues with 'fade', or at least its not noticeable at all.
I have tried with various combination of easing and speed, but haven't had much luck.
I'm not sure if its a css thing or a cycle2 thing, and I'm unable to find a similar issue via google, can someone please shed some light to this?
HTML
<ul id="homepage-carousel" class="hero">
<li class="homepage-carousel-item" style="background-image: url('hero1.jpg');">
<div class="homepage-carousel-info">
<h1 class="homepage-carousel-title">Title</h1>
<h2 class="homepage-carousel-subtitle">Subtitle</h2>
<div class="homepage-carousel-desc">
<p>some info here</p>
</div>
<div class="homepage-carousel-link"><a class="homepage-carousel-url" href="#" title=""><span>Read More</span></a></div>
</div>
</li>
<li class="homepage-carousel-item" style="background-image: url('hero2.jpg');">
<div class="homepage-carousel-info">
<h1 class="homepage-carousel-title">Title</h1>
<h2 class="homepage-carousel-subtitle">Subtitle</h2>
<div class="homepage-carousel-desc">
<p>some info here</p>
</div>
<div class="homepage-carousel-link"><a class="homepage-carousel-url" href="#" title=""><span>Read More</span></a></div>
</div>
</li>
<li class="homepage-carousel-item" style="background-image: url('hero3.jpg');">
<div class="homepage-carousel-info">
<h1 class="homepage-carousel-title">Title</h1>
<h2 class="homepage-carousel-subtitle">Subtitle</h2>
<div class="homepage-carousel-desc">
<p>some info here</p>
</div>
<div class="homepage-carousel-link"><a class="homepage-carousel-url" href="#" title=""><span>Read More</span></a></div>
</div>
</li>
</ul>
CSS
#homepage-carousel {
width: 100%;
height: 100%;
.homepage-carousel-item {
height: 100%;
background-repeat: none;
background-position: top center;
background-size: cover;
}
}
This isn't a cycle issue
background-size: cover just has horrible performance.
You can ease the pain some by adding transform: translate3d(0,0,0) to the slides as well, but it will still be choppy.
Replacing the background with an actual image normally increases the performance for me, like this fiddle. Though, the larger the image is the slower the performance will be in any browser; rendering large moving images is hard for them.
Then it's just a matter of sizing and positioning the images, for that you could use something like:
.homepage-carousel-item > img, .homepage-carousel-info { position:absolute; }
.homepage-carousel-item > img {
/*img size*/
min-width:100%;
min-height:100%;
width:auto;
height:auto;
/*img pos*/
top:50%;
left:50%;
transform:translate(-50%,-50%);/*offset position based on img size*/
}
If you need to support legacy browsers, then you would run a routine through the images to size and offset like this does.
There are other solutions that only work in certain browsers (like object-fit: cover), but these options should work in all browsers.
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.
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
here's the site I'm working on: http://antidote.treethink.com/about/
I am trying to get it so that the footer is always at the bottom of the screen unless the content runs past the screen, then it will sit below the content.
To do this, I thought to have the "wrapper" div be 100% min-height then tell the footer to sit at the bottom of that div. I tried putting min-height classes on the body, html and wrapper tags but it didn't work.
This is my css: http://antidote.treethink.com/wp-content/themes/antidote-new/style.css
Thanks,
Wade
You can try classic solution
<div id="header-content">
<div id="header">
bar
</div>
<div id="content">
bar
</div>
</div>
<div id="footer">
foo
</div>
main.css
html,
body {
height:100%;
}
#header-content {
position:relative;
min-height:100%;
}
#content {
padding-bottom:3em;
}
#footer {
position:relative;
height:3em;
margin:-3em 0 0;
}
ie.css
* HTML #header-content {
height:100%; /* min-height for IE<7 */
}
This is just off the top of my head. My thought create a container div that holds your content. Put the footer at an relative position of bottom: 0px; within that.
<div id="content-container">
<div id="page-content" style="position: relative;"><p>This holds my content</p></div>
<div id="footer" style="position: relative; bottom: 0px;">
<p>Footer content in here</p>
</div>
</div>
I think that should work...
Edit
Actually the top of my head is not right. This post has helped me in the past though...
http://ryanfait.com/resources/footer-stick-to-bottom-of-page/
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;
}