Whilst many advanced form components are available for Joomla (such as the excellent RS Forms Pro), creating a fully functioning contact page with a form is actually very easy to build natively within Joomla. No additional components are required as everything you need is built into Joomal by default.
This tutorial will walk you through the steps to create a contact form (as pictured below), and also point out a small glitch within Joomla and how to solve it.
The Joomla Works All Videos plugin is a great addition to your Joomla website to display videos directly within your articles. Videos's can be hosted on a third party service such as Youtube or Vimeo, or can be hosted directly on your own webserver alongside your Joomla website.
However, in my experience I've found that there are a couple of issues that need to be resolved when hosting videos on your own web server:
These issues only arise with vidoes hosted on your own server, and not those hosted on a service such as Youtube or Vimeo.
This tutorial video addresses both those problems, and provides solutions to have your locally hosted videos displaying as anticipated.
There is some additional CSS code that is required, which can be found on my Bit Bucket page over here. This CSS snippet needs to be added to your Joomla theme's style sheet.
Note: In this tutorial video I use the Kraken template for Joomla, and the Kraken template for Joomla. Whilst it's not neccessary to use both of these it's worth mentioing that I add the CSS hack above directly into the Gantry parameters rather than append it into my themes style sheet. Both methods will work just fine.
This is a super handy cheat sheet compiled by the K2 team that solves many PHP conditional statements:
https://github.com/kricore/Advanced-templating-with-K2/blob/master/_inc/cheatsheet.php#L28-L55
Here's a very handy snippet to create a PHP conditional if statement based on a specific K2 item ID:
<?php
$itemid = JRequest::getInt('Itemid');
if( $itemid == 123 ) {
echo 'do something';
} else {
echo 'these are not the droids you are looking for';
}
?>
<?php
$itemid = JRequest::getInt('Itemid');
if( $itemid == 123 ) {
echo 'do something';
} else {
echo 'these are not the droids you are looking for';
}
?>
The code above can be altered using the following hooks from the page URL:
$option = JRequest::getCmd('option');
$view = JRequest::getCmd('view');
$layout = JRequest::getCmd('layout');
$page = JRequest::getCmd('page');
$task = JRequest::getCmd('task');
$id = JRequest::getInt('id');
Here's a weird bug that I have identified from time to time. In the template options of T3, the layout field is displaying the full path to each laout option, rather than display each layout name.
In the following example I will be doing an override to the Category blog layout. If you want to do overrides to the article layouts use the same method but make modifications as required.
The layout changes that I'm going to make are changes to the article feature image and article heading
Notice how the path name (after the word render) is typed using a series of dots rather than slashes to indicate each directory that the file can be found in.
<?php echo JLayoutHelper::render('joomla.content.blog_style_default_item_title', $this->item); ?>
<?php echo JLayoutHelper::render('blog_style_default_item_title_etsy', $this->item); ?>
The Note field of a Joomla module is intended to display some comment for admin use in the back end, but it's such a handy parameter that it would be a real shame to just waste it on the back end.
One handy use I have for the note field is to use it to display some information on the front end, essentially turning it into a custom field. I quite commonly use it to create a button, using the note field to store the URL link, although it can for virtually any purpose.
The following is an example of how it can be incorporated into the module template file:
<?php
$menuitemid = JRequest::getInt('Itemid');
$db =& JFactory::getDBO();
$query = "SELECT note FROM #__modules WHERE id = '".$module->id."' ";
$db->setQuery($query);
$note = $db->loadResult();
echo $note;
?>
Occasionaly it's neccessary to display a module title in a different position within your module overide. I've found that I most commonly need to do this with joomla's built in Custom HTML module. The solution is rather easy:
<?php if ($module->showtitle) {
echo '<h3>' .$module->title .'</h3>';
} ?>
I've just recently had to work through an issue where I needed to do an override to the pagination.php file. Any attempts to make changes and place it directly into the templates HTMl directory would break the website. Of course, information on why this was happening was pretty much non-existant at the Joomla forums.
The fix became apparent when I inspected (and tested) the pagination.php override that can be found in one of Joomla's pre-packaged templates protostar. Copying that override and placing it in my own templates HTML directory worked.
For ease of use I have included a gist of the working modified pagination.php file here.
Using this code, you can place a module position inside any php file in joomla:
<?php
$myblurb_modules = &JModuleHelper::getModules( 'my-new-position' );
foreach ($myblurb_modules as $myblurb) {
$_options = array( 'style' => 'xhtml' );
echo JModuleHelper::renderModule( $myblurb, $_options );
}
?>