CakePHP

Clear Cache plugin for CakePHP

Posted by Fahad on Mon, Nov 08 2010

I have been responsible for updating a number of CakePHP applications lately, and needed to delete the cache files every time I did a 'git pull' on the server. I couldn't find any existing shell that takes care of a task like this, so decided to write one quickly.

What it does

At the moment, the plugin deletes each and every file in /app/tmp with a prefix 'cake_'.

How to use it?

You have to to use it from CakePHP console for now. If I have time later, may be I will make it a Croogo supported plugin so that cache files can be deleted from admin panel too.
$ ./cake clear_cache all

Download

Get it from GitHub here: https://github.com/fahad19/clear_cache.

Happy Caching!

Note: I just found out about another CakePHP plugin by Ceeram, and surprisingly it has the same name. I just wish I found it earlier: https://github.com/ceeram/clear_cache.

Posted in Plugins, CakePHP | 8 Comments

Markdown plugin

Posted by Fahad on Thu, Sep 09 2010

I have been writing documentation for Croogo for the past few weeks in markdown format. The more I use it, the more I like it. It is really very nice to write in plain text and be able to convert it to proper (X)HTML when it is finally shown in the browser. So I decided to write a plugin for converting markdown to html. It can be used in Croogo for writing content, as well as manually in your CakePHP applications.

What is Markdown?

Markdown is a text-to-HTML conversion tool for web writers by John Gruber. Markdown allows you to write using an easy-to-read, easy-to-write plain text format, then convert it to structurally valid XHTML (or HTML).

Learn more about markdown here: http://daringfireball.net/projects/markdown/.

I have used the PHP Markdown_Parser class by Michel Fortin for this plugin.

Download

Get the plugin from GitHub: http://github.com/fahad19/markdown.

How to use this plugin with Croogo?

Read the wiki for information on how to upload and activate the plugin. Once active, you can start writing content in markdown format.

You don't need to convert your already existing content (in HTML) into markdown because it is aware of what is already in HTML and won't convert them twice. It is recommended that you deactivate any WYSIWYG editors (like TinyMCE) before using this plugin.

Using the plugin in CakePHP applications manually

After placing the plugin at /app/plugins/markdown, let you Controller know to load the plugin's Helper:

<?php
class PostsController extends AppController {

    pubic $helpers = array('Markdown.Markdown');

}
?>
Now, in your views:
<?php
    // will output in HTML format
    echo $this->Markdown->transform($textInMarkdownFormat);
?>