We have been working on building a multi-school Joomla! website and there have been many hurdles to overcome since Joomla! isn’t a multi-site CMS. After searching for anything that’s common across each school, I realized the menu for each school could be used as a common denominator. If I could set a variable depending on which menu is loaded on the page then I can do just about anything I want, such as change the logo, set a unique CSS class, etc. After meeting with our developers we figured out how to do this and I’ll share it with all of you in case you ever need to do the same.
Read the rest of this entry »
Posts Tagged ‘PHP’
Controlling Joomla! templates depending on menu you use
Thursday, August 26th, 2010 by JonathanSetting up a Joomla! Development Environment
Wednesday, August 18th, 2010 by Dustin CluteIf you are new to web development and are interested in using Joomla!, you may have used Google to try and find info to help you out. You may have done a search for “joomla development” or “joomla development tools” and got Setting up your workstation for Joomla! development as one of the results. This explains how to set up XAMPP and Eclipse on Windows, Linux and OS X. Now this document has some extremely useful information for people looking to get started. They even state that there are many possible configurations of environments for developing for Joomla!. I’m going to talk about how I have my environment setup for web development.
How to use countModules in any Joomla! file
Friday, August 6th, 2010 by JonathanOne of the core parts of creating Joomla! templates is using $this->countModules to show or hide code depending on if a module is in a particular position on the page. It is very powerful and it makes your templates very dynamic according to what is happening on the page. So what happens if you need to do this outside of the template index.php file? Save yourself a huge headache and use the following code in any file to check for a module position:
jimport( 'joomla.application.module.helper' );
if(count(JModuleHelper::getModules('left'))) {
put your code here
}A very powerful addition to you Joomla! PHP library!
Debugging with Krumo
Thursday, July 29th, 2010 by Bernard RobbinsSome websites do not require advanced debugging with an IDE. If you just want to know the value of a variable without having to step through a site, Krumo may be for you.
The easiest way I have found to add the Krumo library is to use the auto_prepend_file for php. The auto_prepend_file declaration can be inserted into either the php.ini (for your entire web server), the httpd.conf file if you want it for just one site, or in your .htaccess file for a particular sub-directory. This will allow you to prepend a php script before any of your scripts run.
Create a new file on your web server called prepend.php.
include_once('krumo/class.krumo.php');For php.ini, use:
auto_prepend_file = “auto_prepend.php"
For .htaccess or httpd.conf, use:
php_value auto_prepend_file auto_prepend.php
Resources:
http://krumo.sourceforge.net/
http://php.net/
Cutting down on lines of code with array_walk()
Monday, July 19th, 2010 by Adam DochertyHello there!
Today I am going to be talking about the array_walk php function which can help you cut down on lines of code and organize your code better.
An easy way to think of array_walk() is think of it as an automatic way to loop through arrays of data. From time to time in your coding duties there are likely to be occasions when you find yourself writing these kind of loops over and over again:
Handling Joomla! dates
Thursday, January 29th, 2009 by Rafael CorralFor the longest time, I’ve had troubles parsing the Joomla! date. It is normally found in this format: “Y-m-d H:i:s” which translates to: year-month-day hour:minute:second or 2009-01-29 22:05:15
Many times before I have parsed this date to change to a format that is more user friendly, but it had never been a one liner.
Read the rest of this entry »