TD Creative

Intuitive and effective web development.

Archive for the ‘PHP’ Category

Tuesday
Dec 18,2007

Todays post is sponsored by: Web Inspiration.

To create a theme (since version 2.2) is to make the theme widget enabled, so this is how you do one.

In order to make a theme widgetized, we have to do this. Open sidebar.php and add this:

<?php /* Widgetized sidebar. */
if ( !function_exists(’dynamic_sidebar’) || !dynamic_sidebar() ) : ?>

// Sidebar content here.

<?php endif; ?>

Thats all there is to it!

Monday
Nov 5,2007

Fed up of spam? Fed up with spam?  Then use Captcha to stop spam bots.  Infact, stop spam; read books.  reCAPTCHA does exactly that by channeling the effort spent solving CAPTCHAs online into “reading” books.

You dont have to be an expert programmer to make a bot unfriendly captcha image.  Infact, you dont have to be a programmer at all.  You can use recaptcha and integrate it into your site.

It’s Easy. reCAPTCHA is a Web service. As such, adopting it is as simple as adding 4 lines of code on your site. For many applications and programming languages such as Wordpress and PHP we also have easy-to-install plugins available. We generate and check the distorted images, so you don’t need to run costly image generation programs.

Not only is reCaptcha free and usefull, but its also secure.  You can choose to protect all of your comment fields and integrate it in just about any way you see fit.  You can even protect your email address.

A short post this one, but nonetheless a usefull one.

Monday
Oct 29,2007

Ever wondered how to display recent wordpress posts anywhere on your site?   The answer is simple.  Simply using the following code snippet and adjust the HTML to something of your choice that matches your website.  All you need to do is include the wordpress config file of your installation you wish to retrieve posts from and use this small snippet of code on your website.

<ul>
<?php
require_once(’wp-config.php’);
$myposts = get_posts(’numberposts=5&offset=0′);
foreach($myposts as $post)
{
?>
<li><a href=”<?php the_permalink(); ?>”><?php the_title(); ?></a></li>
<?php
}
?>
</ul>

To change the number of recent wordpress posts that appear, change this part of the code to a number that suits you: “numberposts=5“.

Wednesday
Sep 5,2007

This is a very quick tip for showing your server, configuration and PHP settings.

A description from PHP.net

Outputs a large amount of information about the current state of PHP. This includes information about PHP compilation options and extensions, the PHP version, server information and environment (if compiled as a module), the PHP environment, OS version information, paths, master and local values of configuration options, HTTP headers, and the PHP License.

Because every system is setup differently, phpinfo() is commonly used to check configuration settings and for available predefined variables on a given system.

phpinfo() is also a valuable debugging tool as it contains all EGPCS (Environment, GET, POST, Cookie, Server) data.

(more…)

Monday
Sep 3,2007

This post is about the different type of white space characters that you should expect when programming.

There are different ways of representing white space characters depending on a few factors.  However, here is a quick list of the variations:

(more…)

Meta



Recent Comments