Thursday, 30 May 2013

Android view output in logcat

How to view android output in logcat:


Log.i("ref_name", String.valueOf(jArray.length()) );

Tuesday, 28 May 2013

Limit total words to be displayed - PHP

How to limit total words to be display in php



<?php
function get_words($text, $len){
$array = explode(" ", $text, $len+1);
if(count($array)>$len){
unset($array[$len]);
}
return implode(" ", $array);
}

$text = "This is a testing for limit word display.";

echo get_words($text, 3);
?>

Monday, 27 May 2013

Get tweets from twitter

How to get tweets in twitter


<?php
function get_tweet($username, $numberTweets)
{
$output = "";
$displayed = 0;
$url = "http://search.twitter.com/search.atom?q=from:$username&rpp=$numberTweets";
$xml = simplexml_load_file($url);
return $xml;
}
$tweet = get_tweet('your_name', 5);
foreach($tweet as $tweets){
echo $tweets->content.'<br />';
}
?>

Tuesday, 21 May 2013

Difference between bloginfo() and get_bloginfo()

Difference between get_bloginfo('template_url') and bloginfo('template_url')


1. <?php bloginfo('template_url'); ?>
2. <?php echo get_bloginfo('template_url'); ?>

echo is the only difference from both the function. 

Relative path in wordpress

How to use relative path in wordpress :


    In wordpress to solve relative path problem you can use a function and call it.

1. get_bloginfo('template_url')2. get_bloginfo('template_url')/path/file