Posts Tagged ‘PHP’

PHP: Text cropping with defining the number of characters, words or sentences

// March 18th, 2009 // 2 Comments » // PHP, PHP Tips, Web Development

I have recently been working on PHP RSS reader script that was supposed to do three different things with RSS description text. To make a teaser RSS text, I was asked to develop the functionality in a such a way that text can be cropped in these three ways.

  • with defining the number of words.
  • with defining the numbers of characters.
  • with defining the number of sentences.

Here is a set of functions that helps you crop a text in three different ways. The usage of the function is also mentioned at the end f the script. (more…)

How to make sure your PHP RSS feed reader doesn’t mess up

// March 18th, 2009 // No Comments » // PHP, PHP Tips, Web Development

I was recently working on a custom RSS feed reader where the prior most concern of the client was being able to crop the text with respect to the

  1. Number of words.
  2. Numbers of characters.
  3. Number of sentences. (more…)

I am on home page of oDesk, feels great

// March 17th, 2009 // 1 Comment » // PHP, Portfolio, Web Development, Wordpress

Hi guys

I am feeling good right now. Have been working on oDesk from Feb 17, 2009. And its good you get paid on hourly basis. I like oDesk the most among freelancing sites I have worked on. Anyhow, I took a few screen shots to show you that I was once featured on home page on oDesk.

(more…)

PHP: How to rewmove last comma from a string

// November 25th, 2008 // No Comments » // PHP Tips

Hello readers

A few minutes ago, I had a situation where

For example you have a string which is like “cat,cow,hamster,owl,”

and you want to remove the last comma from the string

then you can use this code

<?php
$string="cat,cow,hamster,owl,";
echo $string."<br/>";
$string= substr($string, 0, strlen($string)-1);
echo $string;
?>

This comes really handy in many situations.

Thanks Rasmus Lerdorf, you made my day

// September 12th, 2008 // 2 Comments » // General

OK folks, I think I had announced on my blog that I am under contract with Packt Publishing to write a book about PHP team oriented development. The official title would be “PHP Team Development”.

This is not a publicity campaign of my book yet another sigh of relief that what I am doing is even supported by the creator of PHP. Yes his name is Rasmus Lerdorf. The guy has been doing quite a research about PHP frameworks. Anyhow, the great news is that he found CodeIgniter the best optimal framework for PHP MVC based  application development. OK so I am sharing the complete article from sitepoint where I read the news.

(more…)

Convert date formats between PHP and MySQL (mm/dd/yyyy to yyyy-mm-dd)

// September 8th, 2008 // 1 Comment » // CodeIgniter, PHP, Web Development

I have a view in HWC where I am using Javascript DHTML date picker script to pick the date and insert into test field. By the way HWC is the PHP-MVC (using codeigniter) application I am working on.

Date Picker in dhtml/Javascript

Date Picker in dhtml/Javascript

(more…)

WordPress Plugin: Get recent posts within a dynamic wordpress content page or post from 2 different categories

// March 15th, 2008 // No Comments » // Blogging Engines, Open Source, PHP, Plugins, Web 2.0, Web Development, Web Development Software, Wordpress

OK I usually work on the wordpress stuff and do all the fancy things with wordpress on these two Blogs of Josh Freedman

His press room at http://www.6seconds.org/press/
His blog is at http://6seconds.org/blog/


I spent my times for release and support my plugin. If you like my plugin and enjoy the support, do consider to make a donation to me. Thank you :D . I am available for hire too :)

You can view the plugin working at his press room at http://www.6seconds.org/press/

Its showing the 2 different categories’ recent posts. The number of the posts can be defined in the plugin’s only php file.
WordPress Plugin: Get recent posts within a dynamic wordpress content page or post

OK how to do such thing?

I am going to release a modified generic open source version if Josh allows me.

Update 1:33 AM : Yeah he allows me :) so here is the download material (on full post page).. (more…)

Mining the Web using PHP

// March 4th, 2008 // 2 Comments » // Databases, Open Source, PHP, Web 2.0, Web Development, Web Development Software, data-mining

There are many ways for Extracting or fetching desired data or content from an html pages. During my work, i had to build a Miner to get news from multiple sites & update a wordpress blog with the latest news, daily.I had many choices to accomplish this task, few of them are
- Regular expressions
- PHP string functions.
- Using DOM Parsing
- Using Xpath.

First of all i used regular expressions to (more…)

CodeIgniter: How to set your images path automatically for your site

// February 13th, 2008 // No Comments » // CodeIgniter, Open Source, PHP, Web Development, Web Development Software

Well I was thinking that the old source code I got from the other guy Nouman who was working on this Home Work Center Project that was and is being coded in CodeIgniter was not very much upto date. I fixed the Javascript issues; in fact a lot of them including the JavaScript date picker calendar. It fits well, works on IE 6, IE7, Safari and Firefox; haven’t yet checked with others. But I am sure it will!. Anyhow the problem I was facing was that in different folders in Views for CodeIgniter , if we are using images, we have to use relative URLs in most of the pages, which gets quite troublesome sometimes. As long as it is the CodeIgniter I am working on, I don’t want to use my own includes having setting of the site because this is why we are using CodeIgniter .

Solution:

So cutting short the details, if you want to use the site’s URL and relative paths according to your site’s base url, here is the solution use site_url(). The link contains all the details you will need to use for your views and it also tells which helpers you need to load.