Archive

Posts Tagged ‘cakePHP’

Guide to start a popular blog to earn money

November 21st, 2008

The main reason why I blog is money. And to be honest I’m currently doing a really bad job in that sense (zero income from blogging so far). I asked myself today whether I actually have the right approach in order to succeed. I’m currently blogging mostly about cakePHP and search engine optimization. I get the most traffic out of my cakePHP posts because some of them are ranked really high on Google. For example, if you searched for

cakephp breadcrumbs
cakephp mac

you would find posts from my blog about those topics ranked 3rd and 6th on Google respectively. Those are really good ranks and I’m more than happy with that. If somebody searches for those terms I’m pretty confident that they eventually happen to visit my blog as well. But does this mean my blog will be successful? Does this mean my blog will make a lot of money through advertising? Unfortunately the answer to both questions is no - big time, no. So today I had some thoughts about this and found some great infos that can help you (and me that is) to start a blog that will actually become popular over time and will also be able to generate some cash flow!

How to get rich with a blog - a 5 step tutorial

Ok, this header is a little bit catchy, but essentially this is the main theme I’m going to cover with this post. I already wrote an article in the past, esentially saying that content is the key to your success. Now this time I am not only going to clarify what good content actually should be, but also give you an extensive step-by-step explenation of how to start a blog with successful content that will actually get you some cash!

1. Get content that people care about

As mentioned before, I have some articles about cakePHP online. Is this a hugely popular topic? Your (and my) guess would probably be no (maybe you do not even know what cakePHP is … it’s a framework for building websites… if you don’t know what a framework is you can probably tell why cakePHP is not going to be a major topic for most of the people out there). But there is a more advanced way to find out. Google Insights for Search - another free and great tool brought to us by Google. Google Insights for Search allows to monitor what is being searched for at Google and you can also determine how popular a specific search term is. If you want to give this a try with “cakePHP” follow this link. As you can see there has been a huge increase in search requests for cakePHP over the past three years. You can also see where most of the requests are coming from - Bangladesh and other Far Eastern Asian Countries. I would assume this is because a lot of outsourced developing of websites is going on there. Anyway, the question now is - cakePHP has been on the rise lately, but is it really popular? To answer this have a lookt at this link. This link shows you the 10 most requested search terms in 2008 in the United States. As you can tell - no cakePHP anywhere.

Now Google Insights for Search is a really great tool to identify content that is currently requested by users all over the world. While it is not possible to get the most requested search terms worldwide you can drill down to your specific target market and obtain data for it. Also keep an eye on the rising searches figures - they tell you what keywords are currently on the rise! I would suggest you look for content that is popular and has a rising trend. Play around with the different tools! Try different key words, different countries, different time ranges and so forth. There is only one thing to note: Google does not provide absolute search request figures but instead normalizes the data. They say that they do this in order to keep the data comparable between different countries of different size. I would guess they do this, because otherwise it would be obvious how much traffic Google gets in different countries and what the hot topics really are. But because this data is not available you have to play around and follow your guts feeling to find different areas of content that are really popular at the moment.

2. Get content advertisers care about

Say you have come up with a list of 5 different content topics that seem promising. You see an uprising search trend in your target markets and believe those are blockbuster themes. Before you go on to produce content in those fields hold on one second. While it is great to get a blog with a lot of readers it’s even better to get a blog that earns you a lot of money. So you should check first, whether the topics you have identified are actually relevant to advertising.

Let’s get back to our example “cakePHP”. Our first check is to fire up Google and search for cakePHP. If you do so have a look at the advertisings that are displayed. If nothing has changed since this was written you will see absolutely no advertising. This is not a good sign because it means that nobody actually pays for advertising related to the keyword cakePHP. But there is an even more detailed way to find out whether a topic is hot for advertisers or not. Check out this link which leads to the Google AdWords Keyword Tool. Enter cakePHP and have a look at the results. This nice little tool not only tells you what Cost per Click to expect for cakePHP ($0.45 when writing this), but also other keywords to consider. What you want to see here are keywords that have a high CPC, because this means that advertisers care about this topic! If you think 45 cents is a lot enter “insurance” as a keyword… you will see CPC estimates up to €25!

Now the only thing you have to do is find a topic for content that is both popular and highly requested by advertisers!

3. Create your content

After you have decided what topic you want to go with you will have to create a website that provides relevant content in this area. You basically have to options - create a website or blog. If you are new to programming you might want to stick to the second alternative. It is actually really easy to start writing a blog and I have wrote a short article on this here. If you decide to build a new website there are dozens or hundreds alternatives out there. You could use an Open Source CMS for example or design static webpages with Word or Dreamweaver and the likes. If you are looking for something more powerful you will have to program. I can recommend cakePHP as a framework for building websites with PHP & MySQL but there are tons of alternatives out there. I have written a short article on how to start building websites with cakePHP.

Once you have your blog or website set up you will actually have to create the content. And really I think now is the first time that you should worry about how you can create the content yourself. I assume the topic you have chosen is not “PhD programs in biotech” or something similar, where you would probably have a hard time writing content about. I assume your topic is going to be a popular one and in this case most of the people will understand it and now something about it. If you don’t know anything about it, it doesn’t matter at all. See, I had almost no clue about Search Engine Optimization just a couple of days ago. Still I’m writing articles about Search Engine Optimization. And this is easily possible because I’m writing about the new things I learn and things I have tried out along the way. You don’t have to be an expert already on your topic. You just have to show interest and learn! Read other blogs about your topic, read articles, books and so forth and present your readers the exciting information that you will find along your way. Eventually you may become an expert in the field that you are blogging about.

I think it’s even an advantage if you write about something you haven’t been too much involved in the past. As an example consider you were writing about car insurances. Car insurances are a complex topic but nothing like rocket science. If you document your way of finding an optimal car insurance, points to consider, price comparisons, terms that should be closely watched etc. I believe this would appeal to a lot of readers because most of them won’t be experts on car insurances either.

4. Get your content out

What I mean by this is, that you also have to spread the word. The great area of content you identified before and the great content that you produced for this is not of any help, if nobody has the chance to actually consume this content. This is basically the field of so called Search Engine Optimization. There are tons of guides out there on how to improve the ranking of your site with search engines and how to make your blog or website more popular. I have written a short introduction on search engine optimization for blogs here and this should give you a good start.

I would also strongly recommend using two other great Google tools: Google Webmaster Tools and Google Analytics. Both tools help you to monitor and improve how your website or blog interacts with searchengines and your users. I have written a short article on both of them here and here.

5. Maximize your revenue income

This is the last step. You have identified a promising topic. You have created a blog or website, optimized it for being found on the Internet and traffic is starting to flow in. The question now is how to turn this traffic into money. The answer -once more- is Google. They have this great service called AdSense that allows webmasters to include text advertising on their site.

Of course there are many other alternatives for online advertising including ad-networks or individual deals with advertisers. To be honest, I haven’t gotten to step 5 of starting a popular blog to earn cash myself (as mentioned in the beginning) so I cannot really give an advice on this yet. As soon as I have experience with this, I will write an article and post a link here. In the meantime feel free to post any comments and thoughts on this (and others of course)!

Summary

So to sum this up for today: Use Google Insights for Search to indentify content that is popular. Use Google AdWords to see what of this content is most relevant to advertisers. Decide what content you want to go with and create that content. Use Search Engine Optimization, Google Webmaster Tools and Google Analytics to get your content out to the people. Finally use Google AdSense and specific advertising deals to maximize your revenue income, sit back and enjoy! Did you notice that Google almost covers the entire value chain in this process? There is only one thing that’s missing: a free Blog service by Google!

Blogging , , , , ,

Using Breadcrumbs with cakePHP

November 15th, 2008
Generating neat looking breadcrumbs (or breadcrumb trails) with cakePHP is almost too easy to write an extra article for it… but I’ll do it anyway. There are actually only two things that have to be done: Add the following line of code where you want your breadcrumbs to appear (that is the exact place in your design template):
<?php echo $html->getCrumbs(' > ','Home'); ?>

The first parameter of getCrumbs is the placeholder between two trail entries, which can be freely chosen. You can also replace “Home” with anything you like - this is going to be the first element of your breadcrumbs. And then second, add the specific bread crumbs to each view using this type of code:

<?php $html->addCrumb('Something', '/controller'); ?>
<?php $html->addCrumb('Something else', '/controller/method'); ?>

That’s it! You can add as many breadcrumbs to a view as you like - you also don’t have to worry about the location where you add the addCrumb call as it doesn’t matter. It just has to be somewhere in your view file. The navigation entries don’t have to belong to the same controller, so you can even combine different controllers and methods. There is only really one thing to notice: on your homepage where you usually only have the getCrumbs method called and no addCrumb call, there will be no breadcrumb trail shown! So don’t expect just a single “Home” or something to appear on the mainpage. Only “Home > First Entry” will be shown with additional crumbs added to your trail. If you want to have “Home” on your mainpage you can add an empty breadcrumb which will return “Home >”. I don’t think this is particularly nice, but have no better solution to offer at the moment. If you know a more elegant way of just displaying “Home” please let us know by commenting this entry!

cakePHP ,

cakePHP: Baking the Controllers & Views

November 13th, 2008

After baking the models the next step is to bake the controllers.

This is very similiar you just chose C at the main menu and then go through the questions asked. You should not choose to build your controller interactively because then some basic functionality can be added automatically (Choose “Yes” on the next question). Adding admin routing is a good idea. If you are asked to enter a path for the admin routing stick with “admin” - the admin views will be named “admin_view.ctp” then. Admin views are handy because you can edit the regular methods and keep the functionality to easily edit anything in the database with the admin methods.

Baking the Controller

After you have baked all your controllers its time to bake the views. Again - same procedure:

Baking the Views

Now it’s time to have a look at your folders. In the controllers folder of your app you will finde all the controllers we just baked and in the views folder of your app you will find severl subfolders each filled with the views we just baked (and also the “admin_” views if you have chosen to create them). Believe it or not, your website has its full fundamental functionality already at this point! What follows now is just tweaking and designing… well, almost! ;-)

cakePHP , ,

cakePHP: Baking the Models

November 13th, 2008

After you have created your tables in your database you are ready to start Baking!

Bake is a command line tool that can be executed as a script. Open up terminal (Mac OS X) and go to your cake/console directory. From there you can start the command line tool for baking with

./cake bake

This works similiar if you are running Windows - for details on this check the docs. So after the script has launched you will see a screen similiar to this one:

Using Command Tool to Bake the Models

Choose M and the Baking for the models begins. You a first asked what kind of database configuration you would like to use. Just hit enter to use the default one. Then you can select what model you would like to bake. The list of possible models corresponds to the tables that you have created in the database:

Baking the models

After you have chosen the first table a series of questions will be asked. I would recommend not to use validation at this point as it can be done afterwards quite easy. But you should definitely bake the associations. Specific questions will be answered on your database model and you should select the right data associations (prerry straight forward):

Baking the models

After everything has been defined and looks good the model will be baked. You have to repeat those steps for every table that you want to access through a data model (most likely all of them). When you are done have a look at your app/models folder - in there you will find a PHP file for each model you have baked! Beautiful, isn’t it! The next step would be to bake the controllers.

cakePHP , , ,

Building websites with cakePHP

November 13th, 2008

In the last article I described how to set up a smooth Apache, PHP & MySQL configuration using as much built in features of Mac OS X as possible and how to get cakePHP up and running.

The intention was to have a local cakePHP setup for developing a website. The website can later on be easily transfered to an external web hosting provider. The reason to do it this way is convenience! Because we’re running everything on our local machine we have full administrative rights AND the power to BAKE! Baking is one of the great tools of cakePHP that allows you to rapidly start with your website development. Building websites with cakePHP follows ideally this way:

  1. Design your database model on paper, in your head or using available software.
  2. Create the tables in the database using phpMyAdmin and following Cake convention (more on this later)
  3. Bake your Models
  4. Bake your Controllers
  5. Bake your Views - your website structure is ready at this point
  6. Add functionality, design etc.

So basically it all comes down to three points: your database design, the MVC-pattern & Baking. While I’m not a database expert myself it’s actually quite easy if you stick to one important rule: try not to have redundancy! I’ll show you later on what I mean by that when we design the database model for django.at (and the other sites that is). The MVC pattern is another important concept when developing with cakePHP (and most other frameworks as ZEND). It basically means that you try to split your application data (models), from the logic (controllers), from the layout (views). There is quite a good introduction available in The Cookbook that I would recommend to read.

And now onto Baking. You actually don’t have to use Baking to build a website with cakePHP as you can create everything manually as well. But Baking saves you tons and tons of time because what Baking does is to create your model, controller and view files automatically based on the database design documented through the tables you have created in your database.

cakePHP ,

Setting up cakePHP on Mac OS X

November 13th, 2008

It’s actually quite simple to set up cakePHP with Mac OS X because most of the functionality you need comes already shipped with your system. Therefore I’m showing here how to use as much of the built in software such as Apache as possible to get cake up and running. Of course, alternatively you could use a local development environment such as MAMP. But why bother with an additional piece of software when Apache & PHP are already integrated in your Mac? And also you have greater flexibility when it comes to using virtual hosts (unless you buy the Pro version of MAMP). I recommend to give it a try - it’s not that hard: just follow these steps:

Prepare your Mac with Apache, PHP and MySQL

  1. Activate your built-in apache webserver by going to the system settings -> Sharing -> Web-Sharing and checking the box to enable it
  2. In the web-sharing options it should now give you an URL of the website of your computer and your personal website. Try accessing both by clicking on the links. The first link should give you an “Apache it works screen”. The second link should show you an intro page in Mac design.
  3. If you get the error message “Forbidden” on the second like (I did…) follow these steps to fix this. One note: Open finder and use the “Go to” feature to get to the directory /etc/apache2/users/
  4. Now our webserver is running and we can display static html webpages. The path where your website is stored is: /Users/yourusername/Sites/
  5. In order to run cakePHP we need to activate PHP. This guide basically gives you all the info you need to succeed with this task. In this article you will also find useful information on working with virtual hosting (ie having multiple websites on your computer).
  6. Next we want to install MySQL. This is described in the article above as well, but since this is already about a year old life is actually much easier. Just download the latest MySQL Package and start the installer. Then start the MySQL server from the command line or control panel and give your root user a new password.
  7. What is always nice to have is phpMyAdmin - this is a great web interface to control your MySQL database. Download it and put it in a directory of your Websites folder. From there you can access it using the URL: http://localhost/~yourusername/thedirectory/

Installing cakePHP

  1. Download the latest version of cakePHP (use the .dmg File).
  2. Mount the file, copy its content to a directory in your Websites folder and unmount the file again.
  3. If you point your browser to this directory (as shown above) you should be able to see the first output of cakePHP - and quite some errors. So let’s fix those:
Warning (512): /.../app/tmp/cache/ is not writable

To fix this you have to make the cache directory writeable. In fact you should make the whole tmp directory writeable. Go to your app/tmp directory and change the read/write permissions for “everyone” to read & write (do this for all subfolders as well using the option just below the permissions field).

Notice (1024): Please change the value of 'Security.salt'...

For this just go to your app/config/core.php file and change the value of the string where it says:


Configure::write('Security.salt', 'DYhG93b0qyJfIxfs2guVoUubWwvniR2G0FgaC9mi');

and change the value of the string to something else. The length doesn’t matter, but I recommend to keep it this length and also in this form (random).

Your database configuration file is NOT present.

To configure the database rename the file database.php.default to database.php and set the parameters in it according to your setup. E.g. you can add a new user with a new database using phpMyAdmin and set those values in the database.php

Now all error messages should be gone. But there is still one thing to do - the design is not working as it is plain text only and the CSS does not seem to load. To fix this we need to set the DocumentRoot of Apache to the /app/webroot directory. To do this we have to define a virtual host and the corresponding DocumentRoot. How to do this is explained here again. Just extend the path of the virtual server with /app/webroot in your username.conf as shown in the guide and things should work. Don’t forget to restart your Apache (by deactivating and activating the Web-Sharing in your control panel) for the changes to take effect!

And then… there is actually one more last thing. Apache on Mac OS X is by default configured not to work with .htaccess files! That’s something we have to change in order to get cakePHP to work. And because we have a virtual server environment set up we can do this in the username.conf file again. Add the following bold lines of code for every virtual host definition:

<virtualhost *:80>
    DocumentRoot /Users/yourusername/Sites/pathttocake/app/webroot
    ServerName pathtocake
    <Directory "/Users/yourusername/Sites/pathtocake">
    Options Indexes FollowSymLinks
    AllowOverride All
    </Directory>
</virtualhost>

Now everything should be set up! If anything was unclear please comment on this post - I’ll try to answer your questions and/or improve the describtions!

cakePHP , , , ,

Web Development Frameworks - cakePHP vs. ZEND

November 13th, 2008

If you want to create websites fast, and I mean really fast you sooner or later will look into using a framework. Frameworks are a great way to save time and nerves because they have a lot of often used functionality (e.g. user login etc.) already built in and also help you by providing a certain structure for your coding.

There are a lot of web development frameworks out there. One of the best known is probably Ruby on Rails. What I’ve seen this framework is really great, so if you happen to have no programming experience at all and want to learn a new programming language from scratch RoR is definitely going to be a good choice. I, for my part, have been coding PHP since 5 years or so and didn’t feel like learning a new language. But that’s not a big problem because there are several frameworks available for PHP as well. But which one to choose? I first had a look at the ZEND framework which is very popular. But I wasn’t really satisfied with it and kept looking. I finally found cakePHP and have never thought about switching to something else since then…

CakePHP

cakePHP is sometimes refered to as a PHP clone of RoR. I cannot comment on this really, because I have never used RoR myself but some features (e.g. Scaffolding) seem to be very similiar indeed. What is so great about the cakePHP framework is that you basically build your website based entirely on the framework. With ZEND you have far more freedom (e.g. with the database model) and that’s why it doesn’t support the development process as much. Another great thing about cakePHP is the community - although documentation is sometimes out of date, there are great tutorials and discussion groups to help you learning cakePHP and with problems that might occur.

cakePHP , , ,

Content is Key

November 13th, 2008

While I’d love to get my hands dirty on SEO as soon as possible there is one major reason why I won’t: it simply wouldn’t work. As long as there is no relevant content on my websites search engine optimization is useless and a waste of time.

The good news is, that I figured out exactly what type of content I want for my three websites (apart from this one) last night in bed.

django.at is going to be a showcase site for websites powered by the django Framework - users can upload their project URL and add some additional infos. The system will then automatically generate a visual snapshot of the website and create an entry in the database. Users can then rate and comment the different django websites and of course there will be different ways to browse the database. I think it would be cool to have urls such as django.at/tobman.com (ie “django framework is used at tobman.com”) but this needs to be checked for technical possibility.

videopodcast.tv is going to be an online directory for videopodcasts, where user upload their podcast URL and data. Users can then rate and comment the different video podcasts and of course there will be different ways to browse the database.

advertbreak.com is going to be an online directory for funny advertisings, where user upload the link to an embeded flash movie (Youtube works great as posted yesterday) and add some stuff. Users can then rate and comment the different advertisings and of course there will be different ways to browse the database.

If you think I’m a little bit confused at the moment let me explain… those repetitions are the real beauty of all this. Because: the three websites are going to be based on exactly the same principles and therefore basically it will be only required to program one website & copy -> paste!

I will show how this can be done as efficiently as possible over the next couple of days using the magic of cakePHP.

Project WebMoney ,