Highlight search text in wordpress search

Posted by on May 9, 2012 in WORD PRESS | 0 comments

To show search term highlight into wordpress code just replace the_exerpt() with below code in you theme’s search.php

and write the css for search-excerpt class.

<?php
// Replace the_exerpt() with:
$excerpt = get_the_excerpt();
$keys = explode(" ",$s);
$excerpt = preg_replace('/('.implode('|', $keys) .')/iu', '<strong>\0</strong>', $excerpt);
echo $excerpt;
?>;

All Done :)


Read More

PHP : Scope Resolution Operator (::)

Posted by on May 8, 2012 in PHP | 0 comments

Scope Resolution Operator is useful when you want to refer functions and variable from base classes or the classes that don’t have any instance.

class A {
function example()
{
echo "I am in function A::example()";
}
}

 

A::example();  //Output will be : I am in function A::example()

Read More

Trimming Blanks from a String – PHP

Posted by on Oct 1, 2011 in PHP | 0 comments

You want to remove whitespace from the beginning or end of a string. For example, you want to clean up user input before validating it.

Use ltrim( ) , rtrim( ), or trim( ). ltrim( ) removes whitespace from the beginning of a string, rtrim( ) from the end of a string, and trim( ) from both the beginning and end of a string:

$zipcode = trim($_REQUEST['zipcode']);
 $no_linefeed = rtrim($_REQUEST['text']);
 $name = ltrim($_REQUEST['name']);

For these functions, whitespace is defined as the following characters: newline, carriage return, space, horizontal and vertical tab, and null.

Trimming whitespace off of strings saves storage space and can make for more precise display of formatted data or text within tags,


Read More

Implement Content delivery network(CDN) into Word press

Posted by on Sep 30, 2011 in WORD PRESS | 0 comments

CDN is short for Content Delivery Network.

This has been a constant ongoing debate for SEOs on whether or not it’s wise to implement a CDN system for their clients.

Well, now that Google has declared “site speed” a determining factor in ranking your site, I think it is

time to look a little more seriously at how we can use CDN to speed up our WordPress sites.

A content delivery network or content distribution network (CDN) is a system of computers containing copies of data,  placed at various points in

a network so as to maximize bandwidth for access to the data from clients throughout the network.


Read More

Save server bandwidth using .htaccess

Posted by on Aug 31, 2011 in MISCELLANEOUS | 1 comment

Today i find the most effective and useful trick to save server bandwidth.

This trick is useful for who are paying for their server bandwidth.

Put below code in your .htaccess and done.

All it does is enables PHP’s built-in transparent zlib compression.


Read More

How to use joomla session

Posted by on Aug 18, 2011 in JOOMLA, MISCELLANEOUS, PHP | 0 comments

Today i will explain you, “how to user session variable into joomla site”.

I was trying to use joomla session like $_SESSION['my_variable']=’some value’;

but whenever i was trying to access $_SESSION['my_variable'], it returns nothing.

After struggling with that i found the way how to use joomla session variable.

I don’t see a way of passing $_ SESSION variables in or out of joomla pages,


Read More
Page 1 of 3123