Tags: development
New Release CakePHP Geotargeting Helper
Do you need to find out geological information out about users that use your web app? Look no further! This helper utilizes IPInfoDB's geolocation tools to find out geographical information about your users from their IP address.
Tagcloud Plugin for Croogo
Wow, it's been about two weeks since my last post. I have been quite busy in the last month finishing up a custom social network that I developed in CakePHP.
Fahad the author of Croogo has added some great new functionality to Croogo especially when it comes to extending the system and creating your own plugins/hooks. I will be writing up some tutorials once the hook system is complete (hopefully in the next few days).
To test out the new plugin/hook system I developed a Tagcloud plugin with it's own admin panel that will allow you to add a tagcloud to your Croogo install. Check out the plugin page for more details and to download.
Add Monthly Archives to Your Croogo Blog
Most popular blogging engines allow you to categorize your blog posts by month. This is a simple code snippet to achieve monthly archives in your Croogo installation. You can find the code and installation instructions in the link below. If you have any questions, comments or find a bug leave a comment on the code's page.
CakePHP Github Roundup
Github is a great resource for any developer. Other developers are constantly publishing new code to Github but sometimes it's hard to find what you are looking for. I will attempt to find some of the better pieces of code hosted on Github for your CakePHP programming pleasure.
Matt Curry probably has one of the best selections of CakePHP code on Github. He has published components, datasources, helpers and plugins. I have used many of libraries in my work, most recently the chat plugin.
Neil Crookes also has some great code in his repository. He recently launched his searchable plugin for in site searching. He also has an accompanying blog post with instructions on how to use the searchable plugin.
Joel Moss has published probably the best migration system for CakePHP that works with YAML files. I have used it in many projects and it has saved me a lot of time setting up my databases. He also has named scope behavior which emulates named scope from Ruby on Rails.
Fabio Kreusch has published a CakePHP Newsletter Plugin that works quite well if you are looking to implement a newsletter into your CakePHP application.
Are you looking to add some ecommerce to your site? Take a look at Sam Anzaroot's CakeCart which is a shopping cart built ontop of CakePHP although he says it is currently in "pre-pre-alpha" stage it is a good place to start.
This is by no means a complete list, just some of the pieces of code I have found useful on Github. If there are any other interesting projects that you know of on Github leave the url in the comments.
Auto Create Slugs in Croogo with jQuery
I got tired of hand writing slugs for my blog posts, I am used to using the acts_as_sluggable behavior. I thought about implementing the behavior into Croogo but realized this might be better implemented as some simple Javascript. Initially I wrote a simple find and replace function with Javascript that converted spaces to hyphens but realized it didn't take into account special characters or more than one space so I did a quick search on Google and came across the jQuery Slug Plugin. It took me about 2 minutes to download and implement.
All you need to do is download the plugin and place it into your webroot/js directory and then modify a few lines in app/views/nodes/admin_add.ctp. The changes I made are below.
$javascript->link(array('nodes', 'jquery.slug'), false);
Include the jQuery slug plugin at the top of the page.
<script type="text/javascript">
$(document).ready(function(){
$("#title").slug({
slug:'permalink',
});
});
</script>
Set up the plugin and let it know the title field's ID and the class of the slug field.
echo $form->input('title', array('id' => 'title'));
echo $form->input('slug', array('class' => 'permalink'));
Add an ID to the title field and a classname to the slug field. That's about it, hope this saves you some time when you are writing your next article.
