Archive for the ‘Tutorials’ Category

WordPress 3.1 Helicon ISAPI_Rewrite Rules and Permalink Structure

One of my clients is using WordPress on an IIS server and is using a product called “Helicon” to help with rewrite rules. Having toyed with the HTACCESS and Permalink structure, I couldn’t get any page content to show up except for the home page. It appeared as if the rewriting wasn’t working.. that’s until I wrote this.

  1. In your WordPress admin dashboard, navigate to “Settings -> Permalinks”. Select the “custom structure” radio box and enter in:
    /%postname%/
  2. For the .HTACCESS, copy and paste this in
    # Helicon ISAPI_Rewrite configuration file
    # Version 3.1.0.63
    
    Options +Followsymlinks
    
    RewriteEngine On
    RewriteBase
    RewriteRule /wp-(.*) /wp-$1 [I,L]
    RewriteRule /(.*)$ /index.php/$1 [I,L]
    RewriteRule . /index.php [L]
  3. That’s it! Enjoy using Helicon ISAPI_Rewrite and WordPress Pretty URL’s.

Note: If this didn’t work for you, leave feedback to I can update the guide to better assist in different scenarios and environments.

WordPress 3.1 Upgrade – Frontend Blank Site, Backend Okay (IIS)

Shoot. You just upgraded your WordPress installation to the latest version (3.1 for me) and all of a sudden, everything is broken on the front end. You’re not on a Linux server, you’re on an IIS server and you already knew WordPress MIGHT have some incompatibilities, but haven’t see any yet.

If you’re like me and you’ve Googled your heart and and tried so many solutions and nothing works… maybe this post is for you.

Have you tried?

  1. To reupdate to the newest version by browsing to http://{mysite}/wp-admin/upgrade.php and see “No update required”.
  2. Changing your permalinks to just the default and temporarily rename your HTACCESS to see if you can pull a page.
  3. Downloading the WordPress 3.1 ZIP for IIS  http://wordpress.org/wordpress-3.1.zip and reuploading the “wp-admin, wp-includes, and all the root WordPress files (with the exception of wp-config.php, .htaccess, etc)” http://codex.wordpress.org/Upgrading_WordPress_Extended.
  4. Deactivating all your WordPress plugins, trying the site again, reactivating them, deleting them, etc.
  5. Played around with your “Site URL” in the WordPress settings.
  6. Reinstalling WordPress from scratch with a fresh brand new database and files.

AND NOT A SINGLE ONE OF THESE SOLUTIONS WORKED, AND YOUR FRONT END STILL IS A BLANK WHITE PAGE?

My Solution

  1. Open “/index.php”
  2. Replace
    require('./wp-blog-header.php');

    with

    /** Absolute path to the WordPress directory. */
    if ( !defined('ABSPATH') )
    	define('ABSPATH', dirname(__FILE__) . '/');
    
    require_once(ABSPATH . 'wp-blog-header.php');
  3. That’s it.

Looks like IIS had a bit of trouble requiring the file using a path relative to the site root. Hopefully this solution works for you.

http://wordpress.org/wordpress-3.1.zip

CodeIgniter 2 and Doctrine 2 Integration – A working setup (DoctrineIgnited)

As Widly Inaccurate states, CodeIgniter is a wonderful PHP framework which allows rapid application development. CodeIgniter lacks a base DBLayer and ORM and makes working with multiple databases that need CRUD capabilities a pain; that’s where Doctrine comes in.

Instead of writing a comprehensive guide showing how to setup Doctrine 2 and CodeIgniter 2 together, I’m going to provide a breakdown and quick-start ZIP for those who are already aware of how to use both frameworks. A little bit of explaination, some SQL insertions, and a ZIP with well commented code later.. you’ll have Doctrine 2 and CodeIgniter 2 up and running in no-time. If you need complete breakdown explanation on how to setup CodeIgniter 2 and Doctrine 2, visit Widly Inaccurate for more details.

What’s in the ZIP?

Installation Instructions

  1. Unzip the “DoctrineIgnited-TLS-Web-Solutions-v1.0.zip“.
  2. Copy the contents of the ZIP onto your server (remote or local)
  3. Your website should have the “application, system, .htaccess, index.php, and license.txt” files on the root.
    View the website and you should see “My Test message” come up. The default controller/action URL is “home/index/”.

  4. We need to create the database and a test record. Create a database and execute the following SQL.
    DROP TABLE IF EXISTS `user`;
    CREATE TABLE IF NOT EXISTS `user` (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `username` varchar(32) DEFAULT NULL,
    `password` varchar(64) DEFAULT NULL,
    PRIMARY KEY (`id`),
    UNIQUE KEY `user_username_uniq` (`username`)
    ) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=8 ;INSERT INTO `user` (`id`, `username`, `password`) VALUES
    (7, 'Bob', NULL);
  5. Modify “application/config/database.php” to match your database connection information. After updating the file, browse to “http://domain.com/home/test/” to see if you’ve got everything right. If all goes well, you should see the word “Bob” appear on the screen. That means Doctrine found your db table, found the entry, updated the entry’s username, and retrieved the name again for displaying in CodeIgniter view. Classy.If something went wrong or Doctrine cannot find the “user” table, you’ll see an error message similiar to this…
    (click to enlarge)
  6. That’s it! You should be up and running. However, I do recommend you look at the next section to see a break down of how everything works.

DOWNLOAD THE DOCTRINE 2 AND CODEIGNITER 2 ZIP

Downloaded 2505 times.

How does it all work?

  1. Doctrine 2 was installed to the “application/libraries” library and was setup to use “annotations” or PHP comments to interpret how our model’s data structure is set up.
  2. A “User” model was created in “application/models/User.php” which annotes the database table “user” is setup through PHP comments and also has a few manually created setter and getter methods (eg: $user->getUsername()).
  3. The “application/config/autoload.php” was modified to autoload the “doctrine” and “session” libraries, url and form libraries (in case you want to get fancy in your views for testing).
  4. The “/.htaccess” and “application/.htaccess” were both modified in preparation for a “index.php”less URL. It’s just annoying and most Linux servers have mod_rewrite setup.
  5. The “application/config/config.php” has the “index_page” set to blank, enable_hooks turned on, encryption_key set, global_xss_filtering turned on.
  6. The “application/config/database.php” has the database connection information changed to match the right database connectivity.
  7. The “application/config/hooks.php” as the “UhOh!” error reporting added to it.
  8. The “application/config/routes.php” has the default controller set to “home”.
  9. The “application/controllers/home.php” has a few base functions and a bunch of commenting to help guide you in making magic with Doctrine 2.
  10. The “MY_Exceptions.php” and “MY_Controller.php” were both added to “application/core/”. MY_Exceptions extends CodeIgniter’s error reporting and MY_Controller extends CodeIgniter’s base Controller class to include a public Doctrine Entity Manager variable.
  11. A few files were added to “application/errors/” to spice up the error reporting HTML output thanks to UhOh!.
  12. The “application/hooks/uhoh.php” was added, to well, hook onto the core Exceptions.
  13. The “application/libraries/Doctrine/” and “application/libraries/Doctrine.php” were both added and setup and is required for Doctrine 2 to run. Doctrine.php is where most of the Doctrine setting up and configuring will take place. It inherits the DB connectivity from the “database.php” config file.
  14. A base view called “home.php” was added along with some style and script assets to “application/views” thanks to HTML5 Boilerplate. Those guys rock.

That’s it!

Still getting errors?

Make sure you’ve got all of the following installed or enabled on your server.

  1. PHP 5.3+
  2. Apache Rewrite module enabled
  3. PHP short_open_tag enabled

DOWNLOAD THE DOCTRINE 2 AND CODEIGNITER 2 ZIP (1.1mb)

Downloaded 2505 times.

HTML Elements Testing Template

Testing HTML elements is a web designer must

Let’s say you’ve got a brand new HTML template you’ve just chopped up from a Photoshop document. You’ve styled the body content’s footer, headers, paragraphs, and maybe some pseudo lipsum text that match the Photoshop document. But when you hand it off to a developer to integrate into a content management system, is it ready for all the variable content HTML has to offer?

There’s one way to be sure templates are up to the snuff, and that’s making sure you’ve tested as many basic HTML elements that can be fit into  editable content regions. HTML5 Boilerplate is a “professional badass’s base HTML/CSS/JS template for a fast, robust and future-proof site” and gives quite a few documents for HTML designers to work with when building templates.

One of the files HTML5 Boilerplate provides is a demo HTML page of various HTML elements including: form labels and inputs, paragraphs and headings, tables, strong and em, captions, lists, and much more.

I’ve stripped down the demo page HTML5 Boilerplate provides down to just the elements and none of the head, body, and other stuff. You can view the DEMO PAGE or download it below.
Be sure to leave the commented credit to HTML5 Boilerplate where credit is due.

VIEW THE ELEMENTS TESTING TEMPLATE (13kb)

DOWNLOAD THE TEMPLATE (4kb)

Downloaded 283 times.

The Web Designer’s Guide to Font Replacement Methods

This article discusses various font replacement techniques, including: Cufon, SIFR, FLIR, Typekit, Fontdeck, @font-face, CSS, Font Spring and others.

via The Web Designer’s Guide to Font Replacement Methods.

Object-relational mapping with Doctrine, Flash Builder, and PHP

Original Article: http://devzone.zend.com/article/11512
Richard Bates | Tuesday, December 22, 2009 reblogged by Tim Selaty

TLS Web Solutions comment:
I am reblogging this article because I found it to be human-readable and informative to those wanting to get started with ORM’s or Doctrine.

Rich Internet applications built with Adobe Flex and Flash Builder have been steadily gaining a foothold in enterprise development for quite some time. As the platform has grown and evolved, PHP has also made amazing progress toward becoming a mature, powerful object-oriented language with rapid adoption and dozens of frameworks and design pattern implementations. As PHP continues to prosper, developers are able to borrow more and more of the things Java has got right, taking one check after another from the “Java-only” column. One outstanding example of this is object-relational mapping (ORM). A few different PHP ORM implementations are available, and all of them have positive attributes. However, after some experimentation, I’ve found that Doctrine is my favorite.

For those who haven’t used ORM before, I don’t expect it to be a hard sale. Before I used ORM, I had wished for it a thousand times in ignorance. ORM is, simply put, a way of mapping the objects you use in development to their representation in relational databases. Doesn’t it just seem natural that your Customer object should have a Sav method that automatically translates the object’s properties into persistent data? Take this pseudo-code as an example: [...] Read More

Setup Gmail with Outlook 2003, Outlook 2007 and Outlook Express

Google Mail, the beloved backbone of many small business email communications. Gmail is seen as more professional than your average ‘@yahoo.com’ and ‘@aol.com’, but it shares the same favored monthly fee, free. One service Yahoo! does not offer for free is POP while Gmail does. POP does not mean anything to you other than a fancy name for soda? Click the “What’s POP?” tab below. This article will describe and provide picture perfect, simple screenshots for configuring Outlook 2003, Outlook 2007 and Outlook Express to download and view your Gmail emails from your computer. Let’s face it, words just aren’t as simple as pictures. Read the rest of this entry »

Google AJAX API and jQuery integration, bandwidth free!

As we all know Google has released some pretty nifty things in the past. Today, we’re going to look at one of its most delightful additions for web developers. Google AJAX API.

What is Google AJAX API?

Google’s AJAX APIs let you implement rich, dynamic web sites entirely in JavaScript and HTML. You can add a map to your site, a dynamic search box, or download feeds with just a few lines of JavaScript. Read the rest of this entry »

Page 1 of 11

Latest Posts

The United West

March 29th, 2011 by Tim Selaty

WordPress 3.1 Helicon ISAPI_Rewrite Rules and Permalink Structure

March 6th, 2011 by Tim Selaty

One of my clients is using WordPress on an IIS server and is using a product called “Helicon” (more…)

WordPress 3.1 Upgrade – Frontend Blank Site, Backend Okay (IIS)

March 6th, 2011 by Tim Selaty

Shoot. You just upgraded your WordPress installation to the latest version (3.1 for me) and all of a (more…)

CodeIgniter HTACCESS remove index.php and add trailing slash

February 18th, 2011 by Tim Selaty

Here is a quick HTACCESS snippet that will add the trailing slash (ex: http://domain.com/mycontroller to http://domain.com/mycontroller/) and will (more…)