Archive for the ‘Programming & Design’ Category

What is the php regular expression to get everything before a certain character?

Posted on May 27th, 2010 in Programming & Design | 4 Comments »

John C asked:


For instance, I have the following string:

table:column

I need to get “table” as the result of the php regular expression.

So, I need everything before the “:” symbol

After that regular expression is performed, I would also like to get everything after the “:” symbol, or “column” as well.

How to include elements from different webpages using PHP or JavaScript to my home page?

Posted on April 30th, 2010 in Programming & Design | 3 Comments »

ElQuestionaire asked:


I have a homepage (MyHome.php). On the homepage, I’d like to display the latest 3 posts from another page (Post.php). For example. I want to include the first 3

tags from Post.php into a
tag on MyHome.php. Is it possible to do this?

How to write a PHP coding to list out all files and directories as links to them?

Posted on April 15th, 2010 in Programming & Design | 1 Comment »

kr16kr asked:


How to write a PHP coding to list out all files and directories as links to them?

This is somewhat similar to some index pages. When new file or folder is added to the directory, HTML page should display the newly created file/folder together with previous ones after it is being refreshed. (prefer in alphabatical order)

How to achieve this sort of functionality in PHP? Please provide sample coding as well. (and any references)

Thanks.