Posts with the name or tag of PHP;

by admin

SEO friendly URL in PHP

2:29 pm in CMS, Elgg, PHP by admin

You can make SEO Friendly url easily in php.

function friendlyURL($string){
	$string = preg_replace("`\[.*\]`U","",$string);
	$string = preg_replace('`&(amp;)?#?[a-z0-9]+;`i','-',$string);
	$string = htmlentities($string, ENT_COMPAT, 'utf-8');
	$string = preg_replace( "`&([a-z])(acute|uml|circ|grave|ring|cedil|slash|tilde|caron|lig|quot|rsquo);`i","\\1", $string );
	$string = preg_replace( array("`[^a-z0-9]`i","`[-]+`") , "-", $string);
	return strtolower(trim($string, '-'));
}

usage:

$myFriendlyURL = friendlyURL("Barca rejects FIFA statement on Olympics row");
echo $myFriendlyURL; // will echo barca-rejects-fifa-statement-on-olympics-row

by emran

Use Jquery with Smarty Template Engine

4:11 pm in Jquery, PHP by emran

Smarty is the template engine which is fast and nicely design for php programmers. Smarty makes your PHP code cleaner and promotes the V in MVC.

Jquery is the another lightweight JavaScript Library for rapid web development.

Anyway, do you see the problem that might arise when you try to embed your jQuery code or any other javascript library (like Prototype, MooTools, Extjs, etc.) that uses $ as a function name in the ?

The solution:
Use Smarty’s {literal}…{/literal} directives to tell Smarty parsing engine that it should not interpret the code within the block. Smarty will not parse the code which is inside of literal block.

Example:

User
<script type=”text/javascript”>// <![CDATA[
{literal}
$(document).ready(function(){
$(".clazz").css("color", "red");
});
{/literal}
// ]]></script>

User Information:

Name: {$name}

by admin

How to make money from Twitter

8:23 pm in CMS, Linux, Others, PHP by admin

If you have a twitter account with many followers or just a few, you still can make money through a Twitter advertising company called Ad.ly.

You set the price and once an advertiser is interested to put an ad in your tweet, you’ll earn money. For how much? It depends on how much price you have set.

by admin

How to disable PHP warning

7:50 am in PHP by admin

Just type starting of php script:

error_reporting(0);