Spam controlling your blog?

Allen Harkleroad wrote a great article about dealing with spam on blogs and other websites. The article goes into detail about some current solutions and why they work and don’t work. One such web service is Akismet, which validates comments on the fly. Worth the read if you are looking for a solution to spam.

Looping through the alphabet using PHP

So, I needed to create indexes for names in one of my websites. Instead of creating an array with each letter, you simply need to loop through the range from A to Z as shown below.

<?php foreach(range(’A',’Z') as $letter): ?>
<?php echo $html->link($letter, ‘/search/’.$letter) ?>
<?php endforeach ?>

Sitemap Generation With CakePHP

I finally decided that I needed a sitemap for my website MMAFeed.com. Since CakePHP didn’t have any built in mechanisms for this, I took to the web. I ran across the blog post Automated Sitemap Generation With CakePHP 1.2 and it proved to be an excellent tutorial for creating my own sitemap. I had to modify it slightly to work with CakePHP 1.x. Here is my code: app/views/layouts/xml.thtml

<?php header(’Content-type: text/xml’); ?><?php echo $content_for_layout; ?>

app/controllers/sitemaps_controllers.php

<?php

class SitemapsController extends AppController{

var $helpers = array(’Time’);
var $name = ‘Sitemaps’;
var $uses = array(’Event’, ‘Fighter’, ‘Pick’, ‘Post’, ‘Tag’);

function index (){
$this->layout = ‘xml’;

$this->set(’events’, $this->Event->findAll());
$this->set(’fighters’, $this->Fighter->findAll());
$this->set(’picks’, $this->Pick->findAll());
$this->set(’posts’, $this->Post->findAll(array(’status’=>’published’)));
}
}
?>

app/views/sitemaps/index.thtml

<urlset xmlns=”http://www.sitemaps.org/schemas/sitemap/0.9″>

<url>
<loc>http://www.mmafeed.com/posts</loc>
<changefreq>hourly</changefreq>
<priority>1.0</priority>
</url>
… (for each static URL)
<!– POSTS –>
<?php foreach ($posts as $post):?>
<url>
<loc>http://www.mmafeed.com/posts/view/<?php echo $post[’Post’][’id’]; ?></loc>
<lastmod><?php echo $time->toAtom($post[’Post’][’modified’]); ?></lastmod>
<changefreq>daily</changefreq>
<priority>0.8</priority>
</url>
<?php endforeach; ?>
… (for each model)

</urlset>

Wasting 8 hours a week at work?

Are you in the majority of people who waste 8 hours a week at work? If you are, then 8aweek.com has a solution for you. With their browser plugin, you can track the amount of time you waste while surfing the web.

To get it working, you simply install the Firefox plugin and start surfing. The best part, no registration required! With the tool, you can identify which the sites where you waste time and how long you are allowed to surf these sites. Then, a timer prevents you from surfing longer than you are allowed.

My favorite feature allows the user to save a site for viewing later. When I run across a site or page that is interesting, I can temporarily save it for viewing later.

I highly recommend this tool for those of you that want to be more efficient at work or simply want to track your viewing habits.  If you have tried the tool, let me know your thoughts!

Thank you Wordpress

After a long time away from this site, I decided I couldn’t maintain the site code as well as post every day. So, I decided to install WordPress to run this blog.

There were many (and I mean many) options for a theme, but I decided to start with WP Premium. The theme is very nice, but I had to make some tweaks to get it to work. First, I had to get the email subscription to work and I found the instructions here. Next, I tried using permalinks but that ended up breaking the pages and the feed links. I ended up sticking with the default setting. Finally, I added my tracking code to the theme and I was finished!

Now, lets get posting!

RSS Feed for MMAFeed.com

Today I added an rss feed to my MMAFeed blog. The site is written in cakephp, so I followed the bakery tutorial (RSS) Feed them Cake. Everything worked great except for a curious line (appearing twice) in the view: $time->nice($time->gmt()) . ‘ GMT’; I removed these lines for the view and everything worked great.

Here is the MMAFeed RSS. To promote the feed, I added some RSS buttons so users can easily add the feed to their reader. Here are the ones I created:

Cakephp Static Views

I am still trying to figure out static views in cakephp. I had read somewhere that cakephp comes with a PagesController that will display static pages. Simply put the static view under the app/views/pages/ folder. Well, when I do this I get an error saying that the PagesController cannot be found.

My solution was to create my own PagesController. Of course there isn’t an associated model, so I get an error saying that the Page model cannot be found. The solution is to set the $uses variable equal to an empty array.

var $uses = array();

You can see more on this solution in the cakephp blog.One final thought, be sure to set you page titles using the set method:

$this->set(’title’, ‘My Page Title’);

Icon search engine

I came upon this great web design resource: Icon Search Engine. The title says it all. Just enter a keyword for what icon you want to find, hit search, and after the hamsters stop running you’ve got a page full of icons.

One caveat before you start using the icon bonanza on your site. Each icon is protected by either the Creative Commons, GPL, or LGPL license. Links to the license terms are on the site, so make sure you’re aware of which you’re using.

As for the Icon Search Engine site itself, I like the clean look and simple interface. Just a search box and a submit button on the frontpage. I wish the results would be populated via ajax, but it loads fast enough so I can’t complain too much. This is a “must-bookmark” tool!

Cakephp’s Future Looks Good

When I started with cakephp, I wasn’t sure it was the best framework for building my websites. After building three sites, I have to say I made the right choice. Take a look at this post in cakephp’s Google group. Looks like I made the right choice.

Free Icons

The best free icons: