Monday, October 18, 2010

htaccess Code Snippet - Exclude folder from htaccess rewrites

When you are running a CMS, or for example a Blog you might also have SEO url's enabled through .htaccess rewrites. A common problem with these rewrites can be that you are no longer able to install a second application in a subfolder since those foldernames are included in the rewrites and can cause 404 errors.

Joomla Snippet - Strict valid You Tube movies in your articles


If you want to put movies in your articles on a site with a strict doctype you will run into problems with the embed tag that is used by the default code YouTube gives you for example. Embed is actually not XHTML strict valid and this is because embed has been deprecated from XHTML 1.0.

Joomla Snippet - layout switching

Here's some code you can use in your template index file to switch between different layouts based on the menu tree -> menu item ID. You can do all kinds of funky stuff with this.

Using JPane and laoding templates from within a template

Well, let us assume our template is called form.php. My template holds this code to create a pane and to display some content in the pane:
<?php
jimport('joomla.html.pane');

/* creating the pane */
$pane =& JPane::getInstance('tabs'); // change "tabs" to "sliders" or other way round to get the different behaviour

/* creating a content area */
echo $pane->startPane("somecontent-area");

echo $pane->startPanel("panel-name-one","panel1_id");
echo $this->loadTemplate("some-content");
echo $pane->endPanel();

echo $pane->startPanel("panel-name-two","panel2_id");
echo "some content for panel two";
echo $pane->endPanel();

echo $pane->endPane();
?>



The "difficult" thing to remember is, if you want to load a template from within a template... your template to be loaded has to be named like "your-current-template"_"template-to-be-loaded.php"

e.g.

Saturday, October 16, 2010

Joomla Codes

Code snippets for Joomla. Learn how to customize joomla by coding.