Category Archives: Code

Using Adobe Dreamweaver to color code modules, zend templates, & other file types

Getting Dreamweaver to open template files

dreamweaver-preferencesAdobe Dreamweaver makes coding easier with it’s color coding and auto-complete features. I use the Zend Framework on many of my projects and I wanted to take advantage of features in Dreamweaver for my template files that have an extension of .tpl that are basically PHP files. Here’s how I added the file type to Dreamweaver.

  • Open Dreamweaver
  • Open Edit>Preferences
  • Select “File Types / Editor”
  • Add .tpl to items in “Open in Code View”
  • Click “OK”

Updating your Dreamweaver Extension File

Open Extensions.txt in the Configuration directory where you installed Dreamweaver. Adobe Dreamweaver default install directory is “/Program Files/Adobe/Adobe Dreamweaver{version}/Configuration”.

Open Extensions.txt with your text editor (notepad). You should see a line towards the top of the files that ends in “:All Documents”. Update this to “,TPL:All Documents”. Note the extension is added in uppercase without a period. Now look for a line that ends with “:PHP Files”. Update this to “,TPL:PHP Files”. Save this file.

Updating your Dreamweaver Document Types

Open “Configuration\DocumentTypes\MMDocumentTypes.xml” in your text editor. Update the documenttype section with the id of “PHP_MySQL”. Add “tpl” to the winfileextension list. Add “tpl” to the macfileextension list. Save this file.

Zend Template files treated as PHP files in Dreamweaver

Open your template files (.tpl) in Adobe Dreamweaver. Now Dreamweaver will treat these files as PHP files and give you the proper color-coding & PHP auto-complete features.

Using this technique with Smarty, Drupal, Zend, & other file types

You can use these same steps to help Dreamweaver understand your other file types. I have other file type associated with PHP in Dreamweaver. I use .phtml files for a template engine and other special extensions for a wide variety of Content Management Systems.

Associating these file types with the right tools has improved my work flow and I hope it helps you. Please feel free to share your tips here.

Improve your Google Page Rank with URL Mapping

You may wonder about the mysterious Google Page Rank and why it’s different when you check you site with and without the leading “www” for you domain.

Now this web strategy will point all that Google page rank power to one domain with simple URL Mapping. This will also fix the broken links when friendly fans have linked to you site, but forgot a “w” or added too many.

How to use URL Mapping

Let’s say your site is: “yoursite.com” just make these instructions easy.

This method takes advantage of mod_rewrite, make sure your server supports mod_rewrite additional URL Rewriting is available on the Apache site here.

Modify your server configuration file

Add the following entry:  ServerAlias *.yoursite.com

Create a DNS entry for your site

DOMAIN = *
TTL = 14400
RECORDTYPE = CNAME

Modify your htaccess file

<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On

#Fix leading w problem by WebTechMan.com
#This will permanently redirect all calls to
#your site with one or more leading w to your site.
RewriteCond %{HTTP_HOST} ^(w+\.)(.+)$ [NC]
RewriteRule (.*) http://%2/$1 [R=301,L]
</IfModule>

Restart your Server

Now go to your site and test it out, try WwwwW.yoursite.com, Ww.yoursite.com, www.yoursite.com, …  These should all redirect to yoursite.com

Notes

You may not be concerned about your page rank in your Enterprise 2.0 deployment of your social media platform, but you may be interested in similar techniques for pretty / future proof URLs.  This is another part of Strategy 2.0 that will make your cool AJAX and other Web 2.0 calls to data much easier with a RESTful architecture.

Instead of “yoursite.com/index.php?a=2&m=239″, you could have “yoursite.com/members/webtechman/edit”.

You could use this strategy in your enterprise 2.0 platform by adding the following lines to your .htaccess file and capture the information in you social media platform.

# URL Mapping for pretty/future proof URLs
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1

Contact me or leave a comment here if you would like to know more about this.

WEB 2.0 A STRATEGY GUIDE By Amy Shuen

Web 2.0: A Strategy Guide
Web 2.0: A Strategy Guide

Amy Shuen has a firm grip on the long tail. Get your face in this book and don’t blink while she takes you on a fascinating journey to the tipping point fueled by the wisdom of crowds. My space on the shelf for this book is empty because her book is always in my hand. I bought several copies of her book as gifts for friends.

Amy Shuen is to the world of Web 2.0 as Ludwig van Beethoven’s influence is to the world of music. Her impact on web strategy is comparable to da Vinci’s impact on art. She is ahead of her time. Get her book before the ground swell from tribes of new influencers leaves you in a wikinomic downturn.

I have been in the web business since the early 90s. I am a professional technology consultant and thought leader. I have a huge collection of books, papers, & resources related to my industry and Amy’s book is my most prized possession. I recommend getting extra copies for you and your colleagues.

One snippet from this book clearly explains how a small strategy adjustment saved a tremendous amount of money for a well known company. Depending on your reach, this tiny snippet can help save you $1,000’s – $1,000,000’s. I would spend far more than the price of this whole book for this one snippet.

One last flckr of thought. What if your competition already has this book?

Get yours now.

Please feel free to check these youtube videos of Amy presenting some of the information in this amazing book.

WEB 2.0 A STRATEGY GUIDE
Amy Shuen on How Users Create Value

WEB 2.0 A STRATEGY GUIDE
Amy Shuen on How People Build Connections

WEB 2.0 A STRATEGY GUIDE
Amy Shuen on how Networks Multiply Effects

What is XFN (XHTML Friends Network)?

XFN (XHTML Friends Network) is a simple way to represent human relationships using hyperlinks. In recent years, blogs and blogrolls have become the fastest growing area of the Web. XFN enables web authors to indicate their relationship(s) to the people in their blogrolls simply by adding a ‘rel’ attribute to their <a href> tags, e.g.:

<a href=”http://jeff.example.org” rel=”friend met”>…

Learn more at http://www.gmpg.org/xfn/

XFN PLUGINS FOR WORDPRESS

There are a few XFN – XHTML Friends Network plugins already created for WordPress. You can find XFN plugins by searching Google for “WordPress plugin xfn” or you can see a list of the stored plugins at WordPress here http://wordpress.org/extend/plugins/search.php?q=xfn

Here’s a couple of my favorite FXN plug-ins for WordPress.

Blogroll Links

http://wordpress.org/extend/plugins/blogroll-links/

Author: Rajiv Pant

For people who maintain their Web site or blog using the WordPress blog content management system, blogroll-links is an open source WordPress plugin that uses WordPress built-in Blogroll feature and presents links to friends’ home pages and own pages on social networking sites using XFN in the links.

Features of this plugin

  • It can show the links by category in blog posts and WordPress Pages.
  • It uses WordPress standard built-in Blogroll links database. There is no hassle of another list of links to maintain.
  • It can be used to show only the links assigned to a particular category, by stating the category slug as defined in that category’s setting in WordPress.
  • It honors the Show/Hidden setting as defined for each link in WordPress.
  • It displays the link in the same window or new window, as specified for each link in WordPress.

XFN Icons

http://wordpress.org/extend/plugins/xfn-icons/

Author: Samuel Elliott

Adds Icons after links according to whether you’ve specified XFN or not. XFN (XHTML Friends Network) is a way of adding properties to links to specify relationships between the two sites, or the two subjects of the sites. WordPress supports them by default, and you can add them by looking further down the page on the “Add Links” Page in the Admin Area.

ADDITIONAL RESOURCES

The Friend of a Friend (FOAF) project

http://www.foaf-project.org/

foaf project Friend of a Friend
foaf project Friend of a Friend

FOAF is about your place in the Web, and the Web’s place in our world. FOAF is a simple technology that makes it easier to share and use information about people and their activities (eg. photos, calendars, weblogs), to transfer information between Web sites, and to automatically extend, merge and re-use it online.

The Friend of a Friend (FOAF) project is creating a Web of machine-readable pages describing people, the links between them and the things they create and do.

Google’s Social Graph API

http://code.google.com/apis/socialgraph/

The public web is made up of linked pages that represent both documents and people. Google Search helps make this information more accessible and useful. If you take away the documents, you’re left with the connections between people. Information about the public connections between people is really useful — as a user, you might want to see who else you’re connected to, and as a developer of social applications, you can provide better features for your users if you know who their public friends are. There hasn’t been a good way to access this information. The Social Graph API now makes information about the public connections between people on the Web, expressed by XFN and FOAF markup and other publicly declared connections, easily available and useful for developers.

Google Social Graph
Google Social Graph

Google API video overview

The Google Data APIs provide a simple standard protocol for reading and writing data on the web.

These REST-style APIs are based on the Atom Publishing Protocol (AtomPub), using the standard Atom syndication format to represent data and HTTP to handle communication. The Google Data API protocol also extends AtomPub for processing queries, authentication, batch requests, and providing alternate output formats (JSON, RSS).

Learn more about the Google API at http://code.google.com/apis/gdata/index.html