6/21/2010

Refresh page Using Javascript

we can Refresh a page Using Meta tag and javascript
By Meta tag

<meta http-equiv="refresh" content="600">

By Javascript

<a href="javascript:location.reload(true)">Refresh this page</a>


Click here to Refresh this page

How to Get Current Category in Magento

There are Many way to get Current category in magento
I am showing here two way
If you wish to check the current category in everypage(including Homepage as default category is 2) then you can write these code $_cat = new Mage_Catalog_Block_Navigation();
$curent_cat = $_cat->getCurrentCategory();
$curent_cat_id = $curent_cat->getId();

$category = Mage::registry('current_category')->getName();

By the Help of registry()function of magento we can get the Current category ,For get name of that category we can use getName() function .If you need the Id then write getId() instead of getName();

6/07/2010

How to Use Custom Font By CSS

Most of the programmer use Machine font like Verdana, Aria, Tahoma, Times New Roman, Georgia, Trebuchet MS etc...This is because Every Operating system have this font. But They never use other font Like "OCR A Extended" , "Tempus Sans ITC" etc. If anybody wants to use these fonts then they needs to paste this font into the Server, And by css they can use that font into their website.
First paste the font into your website with proper location/path. e.g :- I have paste "OCR A Extended.ttf" file into a font folder then I wrote my css like the example given below.

@font-face {
 font-family: OCR;
 src: url(../fonts/OCR A Extended.ttf); /* For IE */
 src: url(../fonts/OCR A Extended.ttf) format("opentype");
 /* For non-IE */
}

body{font-family:OCR;}



You can change URL/path according to your website . Now you can see the effect in every Operating System