Wednesday, February 27, 2013

Hide dropdown on clicking outside when using JQuery Toggle

This is slightly better, as it also check the parent(s) of the element being clicked:
$(document).click(function(e) {
    var target = e.target;

    if (!$(target).is('#menu') && !$(target).parents().is('#menu')) {
        $('#menu').hide();
    }
});

Call a Module inside a component



$modName = 'mod_refinesearch '; // not mod_mostread
$modTitle = 'Refine Search';
$mod = JModuleHelper::getModule($modName, $modTitle);
$content = JModuleHelper::renderModule($mod);
echo $content;

Friday, February 22, 2013

JQUERY GET CURRENT PAGE URL


$(document).ready(function() { &nbsp; &nbsp; //jquery &nbsp; &nbsp; $(location).attr('href'); &nbsp; &nbsp; //pure javascript &nbsp; &nbsp; var pathname = window.location.pathname; &nbsp; &nbsp; &nbsp; &nbsp; // to show it in an alert window &nbsp; &nbsp; alert(window.location); });<br />Javascript Functionfunction getAbsolutePath() { &nbsp; &nbsp; var loc = window.location; &nbsp; &nbsp; var pathName = loc.pathname.substring(0, loc.pathname.lastIndexOf('/') + 1); &nbsp; &nbsp; return loc.href.substring(0, loc.href.length - ((loc.pathname + loc.search + loc.hash).length - pathName.length)); }

Dynamically checked radio button, based on 'value' attribute


$(function() {
    var $213 = "Yes";
    $("input[name=sv_213][value="+$213+"]").attr('checked', true);

    });

Refer : http://jsfiddle.net/CW8AC/

Tuesday, February 19, 2013

Monday, February 18, 2013

Find current template name in module


<?php
$app = JFactory::getApplication();
$templateDir = JURI::base() . 'templates/' . $app->getTemplate();
?>

Wednesday, June 27, 2012

Display Pages as Menu in WordPress


Adding the pages as menu's in wordpress is very simple. Only this simple piece of code makes this possible.

Where to add?
Find the place where your menus were displayed in your template files.

In most cases it will be in header.php file.
Look for the navigation links which shows the menu.
Delete all the links between <ul> and </ul> tags.
Add the following piece of code instead.

<?php wp_page_menu('show_home=1&sort_column=menu_order'); ?>

Thats it!! Done!!