background preloader

Php

Facebook Twitter

10 life-saving PHP snippets. Highlight specific words in a phrase Sometimes, for example, when displaying search results, it is a great idea to highlight specific words. This is exactly what the following function can do: Source: Get your average Feedburner subscribers Recently, Feedburner counts had lots of problems and it’s hard to say that the provided info is still relevant.

Source: Automatic password creation Although I personally prefer leaving users to choose their password themselves, a client recently asked me to generate passwords automatically when a new account is created. Source: Compress multiple CSS files If you’re using different CSS files on your site, they might take quite long to load.

Header('Content-type: text/css'); ob_start("compress"); function compress($buffer) { /* remove comments */ $buffer = preg_replace('! How to Automatically Linkify Text with PHP Regular Expressions | Good software enables us to take a lot of niceties for granted. Intelligent interfaces handle all the simple tasks so that we don’t need to worry about them. For example, when I type “www.desktopped.com” into an email or an instant message, I expect that it will be clickable on the other end without having to manually add in HTML tags. Another example is parsing text from a twitter feed.

For example, “@desktopped is a blog about the #computers“, we expect both @desktopped and #computers to be links. The ability to “linkify” text is a great tool to have when developing a blog or website. Possible uses include: Turning URLs clickable in content, comments, and anywhere elseTurning valid email addresses clickableTurning twitter text clickable so that @desktopped, #computers, www.desktopped.com all become links. How can we do this? Regular Expressions Basics A regular expression is a pattern string that represents a set of strings by using a variety of special characters. A Simple Example Google+ Bits of PHP code - Google Calendar feed on your website - James. Google Calendar is marvellous. But you might want to use it on your own website, to show something handy like your own calendar for, say, speaking engagements or something.

Sure beats editing HTML. Well, here's how I did it, since a friend called Rick wanted to know and was really impressed at my coding skills couldn't be arsed to write his own. Configure your Google Calendar - Find the Google Calendar you want to publish in the 'Calendars' tab (lower left of the Calendar homepage). - Click the down-arrow next to it, and choose 'Calendar Settings'. - Scroll down to 'Private Calendar Address'. - Right-click the XML button and copy the URL This code is on GitHub <?

Php ///////////Configuration// // Date format you want your details to appear$dateformat="j F Y"; // 10 March 2009 - see for details$timeformat="g.ia"; // 12.15am // How you want each thing to display.// By default, this contains all the bits you can grab. ////End of configuration block///////// if (! Build An Automated PHP Gallery System In Minutes. Whether you own a business or a personal Website, you would have used html photo Web pages for either showcasing your products, or perhaps to share photos from your last holiday with friends; in either case it’s an enormous amount of manual work to build those Web pages. If you’ve tried your hand at the painstaking process of separately making thumbnails for each photo, and then maintaining individual pages for them, you know exactly what I mean.

In this article we’ll build a simple yet effective gallery system that’s easy to maintain and update. We’ll use PHP and MySQL, with a little help from GD or ImageMagick to build this automated gallery system. The focus of this article is to introduce the concept of File Uploading and using it to build an Automatic Gallery system; therefore I’ll presume that you have a basic knowledge of coding in PHP.

Getting Started Any decent gallery system should have two major capabilities: Designing the Database Schema Now, let’s build our first script. Create a dynamic photo gallery with PHP - Program - PHP - Builde. How to Update Twitter using PHP and Twitter API. In the world of socializing on internet, Twitter is a big name and for developers its Twitter’s API.

Its just Twitter’s unmatchable API that is failing all other micro-blogging services (like Tumblr) out there as it allows you to do almost everything. Once you become familiar with the Twitter API you can do innumerable number of things with it like updating your Twitter statuses remotely (Hint: We’ll be making this today!) , searching the latest tweets for a keyword, and grab someone’s or your latest Tweets. Today, we’ll be making a PHP Application that helps you update your Twitter status. The PHP script we’ll be making will consist of four files: First, lets make a form in HTML with three input boxes for username, password & the new status message respectively and one command button which would submit the values to the PHP file “Post-to-Twitter.php”.

You might have noticed that I have already attached the form action attribute to the post-to-twitter.php file. That’s it! <form.