CakePHP Routing

December 08, 2006 Add Comment
CakePHP Routing 


I'm currently playing around a bit more with CakePHP. I'm rewriting our CMS system based on the CakePHP framework. It's a great learning exercise because you constantly have to deal with real life problems!

Just now I was wondering about the url structure of the website. The CMS has two different "areas" designed for two different end users. First there is the site itself (displayed to the visitor of the website) and second there is the CMS administration panel. Because I started designing the system from the administration panel's perspective, I soon discovered that thát part of the website was going to be accessed at the root (/). This of course isn't a logical structure, as it would require the pages the visitors visit to have a prefix or something.. So I looked into CakePHP's routing system and came up with some solutions to my problem.

First of all, there is CakePHP's CAKE_ADMIN config setting. This is a routing solution that allows a function called: index() in controller: users to be accessed like this: /admin/users/index. All you need to do is rename the method to: admin_index() and set the CAKE_ADMIN variable to 'admin'. This seemed like a nice solution, but frankly it wasn't. You can still access the controller without the /admin/ prefix, but it will then give out errors (view for admin_index() could not be found). So I went to play a bit more, and found out the following:



  • You can easily reconstruct Cake's default routing (i.e.: /controller/action/param1/param2/...) by using the following route: $Route->connect('/:controller/:action/*', array());

  • The order in which routes are set matter: if one route is successful, Cake will not bother to look at the rest of the routes.So I designed my own /admin/ prefix, like so: $Route->connect('/admin/:controller/:action/*', array());


Then by changing the default route (for '/') to the following line:
$Route->connect('/:page/*', array('controller' => 'posts', 'action' => 'output'));

I can have nice page structures, which are rerouted to /posts/output... Using this structure /posts/output knows which page to load by looking at $this->params['page'] (:page is a custom parameter!). Even better, secondary parameters are still passed (thanks to the trailing /*)!

Since CakePHP uses ordering in the routing, it stops routing after a route was successful. So if you place the /admin/ route above the /:page/* route, administration should be fine!
Also, you might want /admin/ to be accessible without passing on controller/action, etc. (i.e. you would end up at the start page for the administration panel). To do this, include the following route (place it at the top):
$Route->connect('/admin*', array('controller' => 'posts', 'action' => 'index', 'page'));

This will reroute a request to /admin to a default routing location (for me: /posts/index/page)

What I find strange is the fact that the above route doesn't stop Cake from looking on (it will still find the more elabore one; /admin/:controller/:action/*). This is possibly because of the trailing Asterix (*)?

You can of course use these techniques to set up different "areas" for your website (while physically all files are located in the same Cake folder). For instance you could have the following areas:
/blog/
/shop/
/customer_service/

simply by setting up your routings properly.

Please note the 'standard' routing variables:
/somedir/:controller/:action

Here: :controller sets the controller Cake will use and :action sets the action that will be invoked. Furthermore you can set custom parameters with this:
/blog/:page
Now the value for page will be available by using: $this->params['page'].
By the way, other parameters are available in the following array: $this->params['pass']!

Increase Your Google Page Rank: SEO tips

December 06, 2006 1 Comment

Increase Your Google Page Rank: SEO tips


Google Page rank is based on back links. Back links are Links pointing to your website from another website. The more back links you have the higher your PR will be.

1. Join forums, forums are a great way to achieve links to your website. In most forums you are allowed to have a signature and in your signature you can put a link to your website. But another important note to look on is making sure the forum is somewhat related to your website. You will still get credit if it's not, but if it's related to your website than you will be accomplishing two tasks at once.

You will be advertising for your website (bringing in targeted traffic) You will also be building your websites presence.

Your websites presence is very important to your survival. The more people see, or hear about your website the more credibility you will have and this increases your chances of having these visitors come back and possibly become leads.

2. Submit to search engine directories. Search engine directories are a good way to get a free link to your website. They also increase your chances at being listed higher on popular search engines like Google, and overture.

Most search engine directories allow you to submit to their website for free. This will allow you to increase your web presence by being listed on another search engine, and it will also be a free link.

Remember the more links you have the higher your PR will be

3. Using ezine ads (or newsletters). Creating an ezine will probably be the most beneficial step you can take to increasing your web presence. When you create an ezine you will be able to keep visitors coming back to your website for more by using signatures and giving special deals.

Ezine's will also allow you to increase your back links. By creating an ezine you can submit your information about your ezine to an ezine directory. This directory will than link to your website(thus giving you a free link).

4. Creating and publishing articles. Articles are an easy source of generating new traffic. You can include your signature in your article. This will bring in more traffic from article submission directories.

Your signature usually consists of 4 to 8 lines. Usually the first line would be the title of the website that you are trying to advertise. The last line would be the link to the website and the lines in between these would be a sales pitch to draw your viewers into your website. 

5. Links from related websites. Gaining links from related websites can be one of the most frustrating tasks you can attempt. 

They are very easy to find, but can be somewhat difficult to obtain links from.

To find related websites, all you have to do is go to a search engine... say Google... and type in your subject. Maybe your website is based on ford mustangs. 

You go to Google and type in ford mustangs, than you look around for pages that are somewhat related to your website. After you have done this (which should be very easy) you have to contact them in some way to get your link posted on their website. This can be the most difficult task because a lot of webmasters ignore e-mail's from people requesting links because they don't see the importance of it at the time. Some other reasons could be that they are rarely online, or they delete spam mail and sometimes delete their important emails in the process.

Important note: When looking for link partners don't just link with websites that have a page rank of 4 or higher. Link with anyone and everyone you get a chance to. If you link to someone that has a page rank of zero, this will not hurt your page rank. It will only increase it because you are getting a link back to your website. Google doesn't look at your back links page ranks to determine what yours is going to be. It simply looks at how many back links you have. 

So if Google one day decided to link to a website that was just created and this website has a page rank of 0 and has a domain that goes something like this: mywebsite.geocities.com it's page rank wouldn't increase even though Google's page rank is 10, it's rank would still be zero because it would only have that one back link.

Microsoft Word Helpful tips

December 05, 2006 Add Comment

Microsoft Word Helpful tips




Evidently the chap who said there are no shortcuts to any place worth going was not a practical sort of fellow. Quite unlike us who dote on the shortest route to success with application like MS Word.

Our series on making you an expert at Microsoft Word continues with more tips and tricks for the world’s most ubiquitous word processing application.

Formatting Killer

Want to kill all formatting in Word doc? Select the whole document by pressing Ctrl+A, or select just a portion of the document that you want to remove formatting from, And simply press Ctrl+Shift+N.

Password Protection

To prevent all and sundry from opening sensitive Word document, open the file you want to protect. Select Tools > Option and click on the Security tab. Against the “Password to open” box, type in your password and click on the OK. In the “Reenter password to open” box, key in the password again. Click on the OK. If you want a more than 15-character password, hit the ‘Advanced’ button and select RC4 encryption. Remember, these passwords are case-sensitive. And just ensure that you never forget the password…

Professor Calculus Here!

If you need to do a lot of calculation in Word, do not flap your arms around looking for a calculator, or sit around sighting with pencil and paper. Use Word’s calculator. First add the Tools Calculate button to your Word toolbar. Click on the Tools in the Word menu. Or right-click on the toolbar. Then click on Customize. In the Commands tab, find Tools in the left pane (Categories) and click on it. Next, in the right pane (Commands), scroll down the tool calculate, click on it and drag it to your Word menu, placing it between the existing icons. Releasing the mouse button creates the toolbar button. Close to the Customize dialog box. Now for calculations in your Word doc, select the numbers you want to add/subtract/multiply etc. and click the Tools Calculate button. You will see the total in the status bar below.

Where's that file?

Want Word to remember more than just five of your recent documents that appear that the bottom of the file drop down menu? Select Tools > Options, and click on the General tab. Next to the text “Recently used file list”, key in 9. Click on OK.

Need for Speed

If you have a slow PC, navigating and editing complex Word docs can be a real drag. To speed up the display, you can choose view your document in a draft font. This really speeds up screen rendering by hiding all complex screen formatting while retaining all the content intact.
For this, go to Tools > Option and select the view tab. Here, check the “Draft Font” box to enable it and click on OK. Then in the Word menu, click on View >Normal. Now you entire document will appears in a draft font with basic formatting like bold, italic, or underlined text. The change is only in the onscreen appearance of the document; the original formatting of the document is retained.

Table Magic

You can easily create a table in Word 2003 without clicking and editing data in each and every cell. To do this you need to key in you table data in a ‘comma-delimited format’. And that means something as simple as this:
Antenorio, 101
Tina Hancock, 95
Tara, 94
Smith , 76
John, 89

Highlight this text. In the Word menu go to Table > Insert >Table. That’s it. You can also work on its appearance via the Table > Table Auto format command to apply various style, or edit the table’s display properties manually.

WordPress Plugin: show Google Analytics & FeedBurner Reports Statistics

December 01, 2006 Add Comment

WordPress Plugin: show Google Analytics & FeedBurner Reports Statistics



If you’re using WordPress as your blogging platform, and also use Google Analytics to track web traffic statistics reporting and tracking tool, and FeedBurner to manage your web feeds and track the feed stats and syndicated traffic, then you will like the Google Analytics and Feedburner Reports plugin for WordPress. The plug-in allows WordPress users to easily view the Google Analytics and Feedburner website traffic reports, both are popular third-party web analytics and traffic tracking tools, from WordPress administration area by adding a top-level Reports tab.

At the Reports tab, WordPress users will be able to view 7 day overview of important web traffic statistics, including daily page views  daily unique visits, daily circumlocution  referrers, and etc. Other features include:

Provides a birds-eye view of what’s going on with your site.
Retrieves data from Google Analytics and Feedburner.
Reports are represented visually with graphs.
Choose the reports you want to view.
Ability to automatically install the Google Analytics tracking code for you, along with optional outbound link tracking.