Archive

Archive for March, 2010

Find second largest element

March 22, 2010 1 comment

A query to find out nth maximum number in a table.
Let consider a example:

Table name is ‘test’ and this table has two field i.e id and element. Table structure looks like..

————————
| id      | element
————————
|1        | 2
|1        | 4
|1        | 1
|1        | 7
|1        | 5
|1        | 9
————————

Now write a query to find second max element in this table.

SELECT element FROM test ORDER BY element DESC LIMIT 1,1;
above query output is:7

Now common query is:
SELECT element FROM test ORDER BY element DESC  LIMIT ( n – 1 ) , 1 ;
Here n is maximum number, which you want to find.

Open modal box window

March 5, 2010 Leave a comment

ModalBox is a JavaScript technique for creating modern (Web 2.0-style) modal dialogs or even wizards (sequences of dialogs) without using conventional popups and page reloads. Joomla gives simple way to open this window it uses moo tool’s library. Let’s start ..

To open modal box add this very top of your template in php tag.
JHTML::_(‘behavior.modal’);
Now you are ready to open modal box window.
Write this code ……….
in anchor tag
href=”your Url” rel=”{handler:’iframe’, size:{x:500, y:500}}” close anchor.
To close modal window
window.parent.document.getElementById(‘sbox-window’).close();

To open modal box add this very top of your template in php tag.JHTML::_(‘behavior.modal’);
Now you are ready to open modal box window.Write this code ……….in anchor taghref=”your Url” rel=”{handler:’iframe’, size:{x:500, y:500}}” close anchor.

To close modal windowwindow.parent.document.getElementById(‘sbox-window’).close();

%d bloggers like this: