Saturday, April 30, 2011

Insert Google Translater tool into your website

Add Google's website translator to your webpages, and offer instant access to automatic translation of the pages. Adding the website translator is quick and easy.

Just you need to copy and paste these code into your webpage where you want a translater tool.

<div id="google_translate_element"></div>
function googleTranslateElementInit() {
  new google.translate.TranslateElement({
    pageLanguage: 'en',
    includedLanguages: 'af,sq,ar,be,bg,ca,zh-CN,zh-TW,hr,cs,da,nl,en,et,tl,fi,fr,gl,de,el,ht,iw,hi,hu,is,id,ga,it,ja,ko,lv,lt,mk,ms,mt,no,fa,pl,pt,ro,ru,sr,sk,sl,es,sw,sv,th,tr,uk,vi,cy,yi',
    layout: google.translate.TranslateElement.InlineLayout.HORIZONTAL
  }, 'google_translate_element');

<script src=""></script>
Enjoy the google translater tool...

Thursday, April 21, 2011

session_register() is deprecated in oscommerce

Just open sessions.php file inside

And find this line -
return session_is_registered($variable);

And replace with this line -
if (PHP_VERSION < 4.3) {
return session_is_registered($variable);
} else {
return isset($_SESSION) && array_key_exists($variable, $_SESSION);

Reload window javascript

<head><title>Reload Script</title>
<script type="text/javascript">
function reloadPage() {
<input type="button" value="Reload Page" onclick="reloadPage()">

Saturday, April 9, 2011

Jquery Confliction with Plugin

when some jquery developers written or used same function name or same methods then jquery conflicts is happening. In wordpress when jQuery confliction occured than some plugin's with jquery not work perfectly. You could try to execute your jquery with a noConflict option -

<script type="text/javascript">
var j = jQuery.noConflict();
j("div p").hide();
$("content").style.display = 'none';

Use this javascript code after <?php wp_head(); ?> code in the header.php file in your theme folder.
And add below line in your functions.php in your theme folder.

function my_init_method() {
    if (!is_admin()) {
        wp_deregister_script( 'jquery' );
        wp_register_script( 'jquery', 'wp-content\themes\thebusinessoctopus-wordpress-theme\images\slideshow\js\jquery.js');
        wp_enqueue_script( 'jquery' );

add_action('init', 'my_init_method');

That's all done..

Friday, April 8, 2011

Show some line of content with Read more

Show some lines of huge content with Read more link in php

$content = "Integer pretium vehicula molestie. Nunc nec enim dui, sit amet auctor mauris. Integer in urna vel magna elementum fermentum. Integer a sem in mi eleifend adipiscing. Pellentesque ultrices egestas adipiscing. Nulla placerat enim at lorem ornare sed cursus mauris fringilla. ";

echo substr(strip_tags($content), 0, 100) . "...     " . "<a href='#'>Read more</a>";