Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Abhinav Singh's Blog:
Wordpress style "Duplicate comment detected" using Memcached and PHP
Jan 02, 2010 @ 13:36:27

Abhinav Singh has a new post today looking at his method for preventing duplicate comments (similar to a method used on Wordpress blogs) using memcached.

In this blog post, I will put up some sample PHP code for Duplicate comment detection using Memcached without touching the databases. Towards the end, I will also discuss how the script can be modified for usage in any environment including forums and social networking websites.

His method uses a custom function (is_repetitive_comment) to create an md5 hash of the comment and username to check against the stored values on the memcached server. Code is included as is an explaination of how it all works together.

tagged: memcached duplicate comment wordpress

Link:

Giorgio Sironi's Blog:
Never write the same code twice: Dependency Injection
Jul 29, 2009 @ 15:27:12

In a new post to his blog Giorgio Sironi looks at how using dependency injection in your applications can help keep you from writing the same code over and over:

Is Dependency Injection difficult? Is it hard to do? Certainly it provides value. Particularly in Php, but also in other object-oriented languages, Dependency Injection gives steroids to the process of class reuse, designing components as loosely coupled objects.

He explains a bit of what dependency injection is all about, how it fits in with unit testing applications and a few examples of how it might look in some sample PHP classes. He shows how a bit of refactoring can remove dependence of one class on another and how the factory pattern can be used to correctly create an instance your first class might need.

tagged: dependency injection duplicate code tutorial

Link:

DevShed:
Managing Secure Protocol in Apache-Based Websites using PHP
May 29, 2009 @ 12:55:25

On DevShed today there's a new tutorial that walks you through tips on two things that can help you keep your https site running smoothly and keep in favor with the major search engines - duplicate content and correct 301 redirects.

When trying to maintain a secure protocol on an Apache-based website, you can expect to deal with certain issues, especially if you're also trying to rank well in the search engines. [...] This article provides tips and solutions to help any web developer effectively manage the two most difficult problems in maintaining the secure protocol side of any website. These are the: Duplicate content and 301 redirection from the non-https to http version.

They recommend two things to handle the duplicate content issues: placing a meta tag on the https pages to keep them from being indexed (keeping the search engines from seeing the http and htttps as two different resources, thus two different sites to index) and using a canonical value in a link tag.

As far as the 301 redirects go, they include some PHP code that, if placed at the top of your pages, can detect if the protocol is https or not. If its not, it uses header to perform the 301 redirect.

tagged: tutorial content duplicate redirect https

Link:

Jani Hartikainen's Blog:
Reusable "generic" actions in Zend Framework
Dec 29, 2008 @ 13:55:13

In this recent blog entry Jani Hartikainen looks at the creation of generic actions for Zend Framework applications - methods that can be used to help eliminate code duplication:

Sometimes you will need nearly the same functionality in many actions. [...] There are several ways to deal with this, such as moving the code into a separate function, or an action helper. But in this post, I'm going to introduce so called "generic actions" - parametrized, easy to reuse actions - which is an idea similar to django generic views.

His example takes a generic action - one that grabs and output records from a table - and modifies it to take in parameters from the defining function as to which action/controller/model and ID to use. Then this action can be used over and over in multiple places without having to do any copy and paste coding.

tagged: generic zction zend framework reuse duplicate

Link:

Knut Urdalen's Blog:
Washing emails
Nov 27, 2008 @ 20:42:56

Knut Urdalen has posted a new blog item about something he calls "washing emails":

In this tutorial I’ll show you how to create a simple PHP script to cleanup a list of email addresses. As a web developer you have probably been asked to wash a list of emails from a manager or marketer some times. Here’s the ultimate solution.

His script does a few things - removes duplicates, validates that the email address exists, uses pipes for communication and is as flexible as possible to work on most PHP distributions. You can download the simple script here.

tagged: washing email script duplicate valid address pipe flexible

Link:

PHPro.org:
SQLite-ON DUPLICATE KEY UPDATE
Nov 10, 2008 @ 18:58:18

This new tutorial on the PHPro.org website shows how to implement a common database feature, ON DUPLICATE KEY UPDATE, in a SQLite database with PHP.

SQLite is an ultra lite database replacement that comes bundled with PHP. Because of its light weight it lacks many of the features found in more robust applications such as MySQL, PostgresQL and others. One of the features that is lacking is the ON DUPLICATE KEY UPDATE that is often used to automatically UPDATE a record, should a duplicate field be found. Here a demonstration is provided to duplicate this behaviour using PHP Exceptions.

Their example creates a table of animals and inserts several to act as a base. They show insert method, how to get the information back out and what happens when you try add a duplicate value to the table. Normally this just results in an exception being displayed but, when caught with exception handling, it can be redirected into an update statement to change that animal's current information.

tagged: tutorial exception sqlite update duplicate key

Link:

Mindoop Blog:
SEO Warning : Zend framework and duplicate content
Nov 21, 2007 @ 13:54:00

On the Mindoop blog, there's a new post talking about some of the issues that the Zend Framework could cause with the SEO for your site - a simple reason, really.

Zend framework is becoming a first choice framework for a large percentage of PHP developers. It's native support for advanced URL routing makes implementing search engine optimized URLs a breeze. Or not?

Because of the reserved words for the controllers and the multiple ways to access the actions below it (his example is case_studies, case-studies and case)studies) make three different ways to get to the same content - a SEO no-no.

tagged: seo warning zendframework duplicate content seo warning zendframework duplicate content

Link:

Mindoop Blog:
SEO Warning : Zend framework and duplicate content
Nov 21, 2007 @ 13:54:00

On the Mindoop blog, there's a new post talking about some of the issues that the Zend Framework could cause with the SEO for your site - a simple reason, really.

Zend framework is becoming a first choice framework for a large percentage of PHP developers. It's native support for advanced URL routing makes implementing search engine optimized URLs a breeze. Or not?

Because of the reserved words for the controllers and the multiple ways to access the actions below it (his example is case_studies, case-studies and case)studies) make three different ways to get to the same content - a SEO no-no.

tagged: seo warning zendframework duplicate content seo warning zendframework duplicate content

Link:

Brian Moon's Blog:
ForceType for nice URLs with PHP
Oct 04, 2007 @ 14:37:00

On his blog today, Brian Moon talks about setting up ForceType directives in Apache, specifically how to make "friendly URLs" without having to use mod_rewrite (which might not be installed on your server).

This has been covered before, but I was just setting up a new force type on our servers and thought I would mention it for the fun of it. You see lots of stuff about using mod_rewrite to make friendly URLs or SEO friendly URLs. But, if you are using PHP (and I guess other Apache modules) you can do it without mod_rewrite.

There's three steps to the process - adding the directive to your Apache config, making the script able to handle the request, avoiding duplication of content and returning a 404 error when there's no matching data.

tagged: forcetype url modrewrite duplicate content forcetype url modrewrite duplicate content

Link:

Brian Moon's Blog:
ForceType for nice URLs with PHP
Oct 04, 2007 @ 14:37:00

On his blog today, Brian Moon talks about setting up ForceType directives in Apache, specifically how to make "friendly URLs" without having to use mod_rewrite (which might not be installed on your server).

This has been covered before, but I was just setting up a new force type on our servers and thought I would mention it for the fun of it. You see lots of stuff about using mod_rewrite to make friendly URLs or SEO friendly URLs. But, if you are using PHP (and I guess other Apache modules) you can do it without mod_rewrite.

There's three steps to the process - adding the directive to your Apache config, making the script able to handle the request, avoiding duplication of content and returning a 404 error when there's no matching data.

tagged: forcetype url modrewrite duplicate content forcetype url modrewrite duplicate content

Link:


Trending Topics: