I will be blogging tutorials on wordpress at http://tutorial.wpexpo.com . Let me know what you want to know about wordpress. I will try my best to put it up at tutorial.wpexpo.
yes a long awaited wordpress 3.0 is out now. Go download it from wordpress.org now and update your website.
Posted in wordpress
|
Tagged wordpress
|
This will add empire avenue badge widget to your blog. I did this plugin for Kublé AG
Download
Download plugin
Installation
Upload the empire avenue badge widget plugin to your blog, Activate it.
Go to widget management page and select the widget empire avenue badge and put in desired sidebar.
You’re done!
Hi this post is just to say hello world as m using my n900 to post this blog.
Today i flashed my n900 to new firmware pr1.2 There are lot’s of improvement over it’s previous versions. I am going to show you a step forward way to flash your n900 to pr1.2 from your windows pc.
1.Go here: http://tablets-dev.nokia.com/nokia_N900.php
2.Input your IMEI no. that you can get from settings > about product.
3.Download the PR 1.2 version 10.2010.19-1 from the download list.
http://tablets-dev.nokia.com/nokia_N900.php?f=RX-51_2009SE_10.2010.19-1_PR_COMBINED_MR0_ARM.bin
4.Download flasher from here: http://tablets-dev.nokia.com/maemo-dev-env-downloads.php?f=maemo_flasher-3.5_2.5.2.2.exe
5. Install flasher in your pc.
6.Copy the downloaded pr1.2 image file to the flasher installed location. that would probably be at C:\Program Files\maemo\flasher-3.5 folder.
7.Open command prompt.
8.Change the directory to the flasher using the command cd C:\Program Files\maemo\flasher-3.5
9.Switch off your device and then press and hold the u key on the n900 keyboard and connect your usb cable to the pc and your n900. Your device should be now set to the flashing mode. A usb icon should appear on the upper right hand corner.
10. Run following command on the command prompt.
flasher-3.5.exe -F RX-51_2009SE_10.2010.19-1_PR_COMBINED_MR0_ARM.bin -f -R
This should execute a series of command and reboot your n900 to latest pr1.2 maemo successfully.
I SEE GOOD BATTERY IMPROVEMENTs IN THIS VERSION
Here is a piece of code i used for generating breadcrumbs for one of my project.
Function for generating breadcrumb
first parameter an array with key and values, value is used for link where as keys are used for link name.
second optional parameter for sending class of ul in the breadcrumb listing.
<?php
function breadcrumb_generate($paths = array(), $ul_class = 'breadcrumb')
{
$forward_icon = '<img src="'.base_url().'images/front_img/icons/forward.png" alt="»" />';
$breadcrumb = '<ul class="'.$ul_class.'">';
$i=1;
$total_paths = count($paths);
foreach($paths as $path=>$link)
{
if($link!='nolink')
{
$breadcrumb .= '<li><span><a href="'.site_url($link).'">'.$path.'</a></span></li>';
}
else
{
$breadcrumb .= '<li><span>'.$path.'</span></li>';
}
$i++;
}
$breadcrumb .= '</ul>';
return $breadcrumb;
}
?>
usage
<?php echo breadcrumb_generate(array('Home'=>'', 'Group'=>'group/browse', ucfirst($row->name)=>'group/'.$row->permalink, 'Forum'=>'group/'.$row->permalink.'/topic', $topic_row->title=>'nolink'), 'topicBreadcrumb');?>
css styles for listing breadcrumbs
ul.breadcrumb{
padding-top:5px;
width:400px;
}
ul.breadcrumb li{
float:left;
list-style:none;
background:url(../images/front_img/icons/forward.png) no-repeat 0.2em 0;
padding-left:17px;
}
ul.breadcrumb li span{
padding:5px;
}
ul.breadcrumb li span:hover{
padding:4px;
border:1px solid #090;
-moz-border-radius:5px; -webkit-border-radius:5px;
}
ul.breadcrumb li:first-child{
background:none;
padding-left:0px;
}
This is just a rough usage of this function. you can hack it up and use as needed.
In a recent project i had to change the time displayed in the wordpress posts to spanish language. I think there are other better ways than mine to change the time and locale in wordpress but what i came up with quickly was to set the locale to spanish and then use strftime function to change the time to spanish language.
- set the locale in the theme header.php file.
setlocale(LC_ALL, ‘es_ES.UTF8′); //at the very top of the theme header file.
- using strftime function to change the time in the wordpress loop function.
<?php echo strftime(“%A, %d”,strtotime(get_the_time(‘d M Y’)));?> de <?php echo strftime(“%B”,strtotime(get_the_time(‘d M Y’)));?> de <?php echo strftime(“%Y”, strtotime(get_the_time(‘d M Y’)));?>
This was how i set the locale for time to spanish in wordpress. if you have better ways out please comment.
Ever wanted to generate routing from database with codeigniter? I had to for one of my recent project. Here goes the detailed instruction on doing it.
Extend the Router class. Create new file My_Router.php in your application libraries folder with following content.
class MY_Router extends CI_Router {
function MY_Router()
{
parent::CI_Router();
}
function _validate_request($segments)
{
// Does the requested controller exist in the root folder?
if (file_exists(APPPATH.'controllers/'.$segments[0].EXT))
{
return $segments;
}
// Is the controller in a sub-folder?
if (is_dir(APPPATH.'controllers/'.$segments[0]))
{
// Set the directory and remove it from the segment array
$this->set_directory($segments[0]);
$segments = array_slice($segments, 1);
if (count($segments) > 0)
{
// Does the requested controller exist in the sub-folder?
if ( ! file_exists(APPPATH.'controllers/'.$this->fetch_directory().$segments[0].EXT))
{
show_404($this->fetch_directory().$segments[0]);
}
}
else
{
$this->set_class($this->default_controller);
$this->set_method('index');
// Does the default controller exist in the sub-folder?
if ( ! file_exists(APPPATH.'controllers/'.$this->fetch_directory().$this->default_controller.EXT))
{
$this->directory = '';
return array();
}
}
return $segments;
}
$user_routes = $this->user_routing($segments);
if($user_routes !== FALSE)
{
return $user_routes;
}
show_404($segments[0]);
}
function user_routing($segments)
{
if($this->check_username_exist($segments[0]))
{
//only profile
if(count($segments)==1)
{
return array('user','profile',$segments[0]);
}
}
return FALSE;
}
function check_username_exist($username)
{
//connect to database and find the category
include(APPPATH.'config/database'.EXT);
$conn = mysql_connect($db['default']['hostname'], $db['default']['username'], $db['default']['password']);
mysql_select_db($db['default']['database'],$conn);
$sql = sprintf("SELECT COUNT(id) as count FROM users WHERE username = '%s'", mysql_real_escape_string($username));
$query = mysql_query($sql);
$row = mysql_fetch_object($query);
mysql_close($conn);
if($row->count)
{
return TRUE;
}
return FALSE;
}
}
The above code checks for the username in database table user and routes them to controller user/profile. Offcourse you could use simple routing rules but there can be case when you specifically route for the records in the database only. So this method comes handy in that condition.
phpQuery is very useful for server based DOM manipulation. Where jquery is famous for client side Dom manipulation and traversing. Here comes phpQuery based on jquery for server Dom manipulation.
Recently i needed to use phpQuery in one of my project based on codeigniter. I would like to show you ease of usage of phpquery for dom manipulation and getting it to work with codeigniter. First get the phpQuery http://code.google.com/p/phpquery/
Extract the phpquery you will get several folders like api-reference, cli, jqueryServer, phpQuery, test-cases.. copy the phpQuery folder and drop it in to libraries folder of you codeigniter application.
Now to use it in any of your controller.
do this:
class PhpQueryTest extends Controller{
function PhpQueryTest(){
parent::Controller();
}
function index(){
//include phpQuery for dom manipulations
require_once('application/libraries/phpQuery/phpQuery.php');
//getting html from url
$html = @file_get_contents('http://www.yalamber.com');
//response from the curl
$html = $response;
$doc = phpQuery::newDocument($html);
//getting title of the url
$title = $doc['title']-&amp;gt;text();
echo 'title of the site is '. $title;
//here title is the selector you can use any selector like # for id and .(dot) for class similar to jquery and the function like text(), html() etc similar to jquery. I will add more tutorial on phpquery like getting video embed code from site and other parts later.
}
}