- Establish naming conventions. Do not assume you'll always be the one coding for a particular site. Never use generic names for classes, IDs and form names in your code like “comment” or “article”. Someone else may do so too, so you can kiss your app’s functionality bye-bye!
- Avoid inline CSS like the plague.
- Try to squeeze as much CSS code as possible into one file. Less CSS files means faster loading of your site's design on the browser.
- Avoid placing UI images inside your HTML code. UI images belong to given UI templates (home, category lists, product catalog, article etc.) and therefore are loaded on every page request. Placing such images as "background images" in your CSS file allows the browser to cache them the first time it renders them, which means your site will load faster on subsequent requests for your visitors.
- If you code on PHP, check out the Tidy library. Enable it when you can as it will easily point out (and fix) bad markup in your HTML.
- For God’s sake use an open source CMS, don’t re-invent the wheel, make it possible to contribute back. Joomla, Drupal, Wordpress are enterprise class CMSs to get started with and some of the most popular websites in the world are powered by these open source CMSs.
I was recently looking for a clean solution to prevent the display of module positions on gazzetta.gr - the 2nd most high traffic Joomla website, after joomla.org.
The first thing that came to mind was the htaccess trick I had spotted on the Joomla forums here: http://forum.joomla.org/viewtopic.php?p=1887090#p1887090
Thing is, this rule does not work if you have SEF on and you’re in some inside page.
So I just wrote a simple solution which is PHP based and you can include right at the top of your Joomla template for ease of maintenance (template designers can use this too as an XML option ;) )…
Make sure the following code goes at the very top of your template's index.php file, but within <?php and ?> tags:
// Properly prevent ?tp=1 module position exposure on Joomla sites using PHP only$currentURL = explode('?',substr(JURI::base(),0,-1).$_SERVER['REQUEST_URI']);if($_GET['tp']) header('Location: '.$currentURL);
UPDATE: There seems to be a Joomla API solution for that. Thanks to Cory Webb for letting me know. Both solution follow...