betweenbrain 2.1

Componenet Only Template

Attention: open in a new window. E-mail

Sunday, 20 December 2009 17:03

The power and flexibility of Joomla allows for the creative use of template techniques to expand its capabilities. One such technique is the use of a component only template. It expands the possibilities of a Joomla website by providing the ability to include content such as splash pages, full-screen Flash movies, and even pseudo 404 pages for hiding a website from a casual passerby. The following tutorial will show you how to implement a component only template.

To give you an idea of what can be accomplished with a component only template, we have put together the following demos. Each one is an article contained in this website. The only difference is the template.

Demo: Pseudo 404 Not Found

Demo: Loading Page

Demo: Flash Map

A component only template is exactly as the name implies, only the component. No module positions or other elements are included in this type of template. This allows for the possibility to exclusively display the content of an article.

 

 

Modify RokDownloads Date Format

Attention: open in a new window. E-mail

Monday, 23 November 2009 08:30

RocketTheme produces some great Joomla! templates and extensions. Of them, we find ourselves using RokDownloads quite often. One of the most requested change that we need to make to it is the date format.Originally posted by Brian Towles of Team RocketTheme at the RocketTheme Forum:

Add this line for the languages/en-GB/en-GB.com_rokdownloads.ini

DATE_FORMAT_LC4=%m-%d-%Y
   

Web Hosting and Property Taxes

Attention: open in a new window. E-mail

Friday, 20 November 2009 08:16

Web hosting is a lot like property taxes. Think about it...

Let's say you invest $500,000 in building a custom home, a modest home of your dreams. It's not unrealistic to expect, and easily accept, paying $500 a month in property taxes. That's .1% of the cost to build your home, not including the cost to furnish and maintain it. So what does that $500 a month get you? It gets you  Police (security), City Hall (support), Public Works (maintenance) and a road department (connection to the outside world). Without property taxes, and subsequently these services, your home would end up being in a run down area that yo may not want to live in.

The same thing can be said for websites and web hosting. When considering a web hosting partner, ask yourself where you would want to live.

   

Redirecting Joomla's View (MVC)

Attention: open in a new window. E-mail

Wednesday, 09 September 2009 09:52

In some cases, redirecting the view of a component of module can be easily accomplished by a bit of JavaScript. For instance, the component ccNewsletter doesn't allow for an option (as of this writing) to redirect after a successful event occurs. To accomplish this task, simply add the following code at the end of a template override for the view of the component.

<script language="javascript" type="text/javascript">
 <!--
 window.setTimeout('window.location="http://betweenbrain.com/"; ',1000);
 // -->
</script>


You can control the time and destination of the redirect. Time is 1000 milliseconds in this case, and the destination is http://betweenbrain.com/.

For example, ccNewsleter's activate view was:

<?php 
defined('_JEXEC') or die('Restricted access');
?>
<div>
 <?php echo $this->pageTitle; ?>
</div>
<table>
<tr>
 <td>
 <?php echo $this->operationStatus; ?>
 </td>
</tr>
</table>
<br/>


After the redirect code addition, it is now:

<?php 
defined('_JEXEC') or die('Restricted access');
?>
<div>
 <?php echo $this->pageTitle; ?>
</div>
<table>
<tr>
 <td>
 <?php echo $this->operationStatus; ?>
 </td>
</tr>
</table>
<script language="javascript" type="text/javascript">
 <!--
 window.setTimeout('window.location="http://betweenbrain.com/"; ',1000);
 // -->
 </script>
<br/>

Download the ccNewsletter overrides. Extract the contents to the HTML folder of your template and enjoy.

   

Customizing the print pop-up

Attention: open in a new window. E-mail

Tuesday, 08 September 2009 14:26

As Andrew Eddie at The Art of Joomla reports, the file /templates/$template/component.php controls the print view of a given article. Component.php acts just like index.php, which controls your template layout, module positions and CSS, among other things.

Component.php can be equally customized with features like module positions and custom CSS files. This is done using the same methods as with index.php.

At the heart of component.php is:

<head>
    <jdoc:include type="head" />
    <link rel="stylesheet" href="/<?php echo $this->baseurl ?>/templates/system/css/general.css" type="text/css" />
    <link rel="stylesheet" href="/<?php echo $this->baseurl ?>/templates/<?php echo $this->template; ?>/css/template.css" type="text/css" />
<?php if($this->direction == 'rtl') : ?>
    <link rel="stylesheet" href="/<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/css/template_rtl.css" type="text/css" />
<?php endif; ?>
</head>
<body class="contentpane">
    <jdoc:include type="message" />
    <jdoc:include type="component" />
</body>
</html>


Pop-up only Styles

To add a specific stylesheet for your print pop-up, simply change the stylesheet in the head section to one that suits your needs. I'd also recommend using the media attribute to limit this new stylesheet to print and / or screen. For example our head may now look like:

<head>
<jdoc:include type="head" />
<link rel="stylesheet" href="/<?php echo $this->baseurl ?>/templates/<?php echo $this->template; ?>/css/screen.css" type="text/css" media="screen print" />
</head>

Depending on whether or not you have separated your stylesheets by form and function, you could even use @import to grab your typography, module overrides, browser normalization rules and other styles. In some cases you may need to add a few extra lines of CSS to our new screen.css file to override some of your other rules. For example, screen.css could look like:

@import url('normalization.css');
@import url('typography.css');
@import url('modules.css');
@import url('style.css');
html, body{background: #FFF}
input {border:1px solid #666;}
img{border:none}
.componentheading {background:none;color:#000;font-weight:bold;padding-top:20px;width:100%;text-align:center}

Pop-up only Modules

Component.php allows for the same code to be used for creating module positions. This can be especially useful if you want a specific header image or content displayed on only certain articles when they are printed. To add a module position, use the same code that you would with index.php.

<jdoc:include type="modules" name="popup" />

Since we want this to be displayed only certain print pop-ups, I use the countModules method. For example:

<?php if ($this->countModules('popup')) : ?>
  <jdoc:include type="modules" name="popup" style="raw" />
<?php endif; ?>


Now, you can create a new module to contain whatever content or images that you'd like, assign it to your newly created position ("popup" in this example) and control when it appears by use of menu assignments.

The final contents of your new component.php could look like:

<head>
<jdoc:include type="head" />
<link rel="stylesheet" href="/<?php echo $this->baseurl ?>/templates/<?php echo $this->template; ?>/css/screen.css" type="text/css" media="screen print" />
</head>
<body class="contentpane">
        <?php if ($this->countModules('popup')) : ?>
        <jdoc:include type="modules" name="popup" style="raw" />
      <?php endif; ?>
    <jdoc:include type="message" />
    <jdoc:include type="component" />
</body>
</html>


Refrences:
The Popup Template File
Creating a Basic Joomla Template
Counting Modules in a given module position

   

Page 1 of 3