Return of the Demos
24 Sep 2006
A brief not to say that I'll be putting a couple of Demos back on the site, and I'll be adding to the main demo page as I go. All of the demos will be put up as plugins.
The pagination demo and source has always been available, and adding to that, the the next example is the Title tutorial. A very simple example based on the original tutorial from the wiki demonstrating the use of associations, requestAction, class/method inheritance and AJAX.
Next on the list is to tidy up and make useful the ajax-chat that I wrote a while back, with any luck that will pop up tomorrow.
If you find the demos/code useful please let me know, and bear in mind that I believe in demonstrating something works rather than documenting to the nth degree how to do something ;).
olivvv, on 1/1/70
Andy, on 1/1/70
I recently added this route:
Router::connect('/MiBlog/:title', array('controller' => 'miBlog', 'action' => 'blogs', 'view','title'=>null));
which allows the url for blogs to be shorter; but I forgot to define a route for the download controller before that - Just corrected that.
I hope you find it useful,
Cheers,
AD7six
olivvv, on 1/1/70
I tried to install it, but I stumbled upon a "*The page isn't redirecting properly* Firefox has detected that the server is redirecting the request for this address in a way that will never complete."
I tried to find out why but I don't understand the
$this->redirect ("/MiBlog");
die;
in mi_blog_controller.php
Any idea ?
PS: I forgot to congratulate you for your new design, it really good!
Andy, on 1/1/70
I haven't had time to check my blog code in a new install - I should remove that redirect, as it relies on a route being in place and if it isn't.. you get an infinite loop.
The reason for the redirect is because that controller is inaccessible for this site, but there is a route for /MiBlog (note the capital M) to go to the blog Index. It's an overcomplex pedantic means of ensuring that there is a capital M in "MiBlogs" probably uninteresting for other users.
If you remove it and put a requestAction call in the view (for whichever default page you want) you'll probably get a step further - I'll do some testing and include that in the next site update.
You may find some other quirks as you click around, as there is some code that is specific to this site, and some of it should be commented/explained but isn't. For example there will be no menu - the code that handles that is inherited but not in the download.
If you check how this site reacts - you should find that with a few minor changes you can achieve a similar result; I provided the download to give ideas on how to solve problems rather than to provide a fully functional blog plugin - but perhaps I should change that idea ;). One of the things that I don't like about 3rd party cake code is that often provides functionality that isn't desired (ACL, Menu Logic, general Fluff) which if you want to use the code you have to break out of. Anyway, hope you find the code useful, I'd welcome any and all comments.
Cheers,
AD7six
PS. These are all of the routes currently defined (in this order):
Router::connect('/MiBlog/', array('controller' => 'miBlog', 'action' => 'blogs', 'index'));
Router::connect('/MiBlog/Blogs/', array('controller' => 'miBlog', 'action' => 'blogs', 'index'));
Router::connect('/MiBlog/comments/', array('controller' => 'miBlog', 'action' => 'comments', 'index'));
Router::connect('/MiBlog/Tags/', array('controller' => 'miBlog', 'action' => 'tags', 'index'));
Router::connect('/MiBlog/Tags/*', array('controller' => 'miBlog', 'action' => 'tags', 'view'));
Router::connect('/MiBlog/DownloadMe', array('controller' => 'miBlog', 'action' => 'DownloadMe', 'index'));
Router::connect('/MiBlog/:title', array('controller' => 'miBlog', 'action' => 'blogs', 'view','title'=>null));
olivvv, on 1/1/70
(I kept some warning:
Warning: file_put_contents( ......... \default_treecms_list) [function.file-put-contents]: failed to open stream: No such file or directory in c:\ ....... cake\basics.php on line 835
and also : default_mi_blogs, default_mi_comments, default_mi_tags
)
The admin_index seems to be dependant on _accessDenied() but I should play with some dummy content in my tables.
Andy, on 1/1/70
If you are just looking for a blog, I would recommend rdBloggery, which my code is based upon. I tried to write the code to be easily understsandable/editable, which I found rdBloggery not to be.
The file_put_contents errors are not related to the plugin you have downloaded.
Not sure what error you are referring to with the model (?) names, that looks like confused table prefixes (there is nothing in my code referring to default_mi_anything).
The admin index has no dependency on the method _accessDenied, but that method is used to process requests for invalid views or for spammed form submissions.
I will duplicate the relavent inherited methods/variables/files when I get a chance so that the download is self sufficient.
Cheers,
AD7six
PS. I see that there are still to many extra line breaks in comments :).
olivvv, on 1/1/70
Andy, on 1/1/70
Cheers,
AD7six
olivvv, on 1/1/70
function _setTitle () {
$pageTitle = Inflector::humanize($this->plugin)." : ";
if (low($this->action)=="view") {
$pageTitle .= $this->data['Blog']['title'];
} else {
$pageTitle .= Inflector::humanize($this->action);
}
$this->pageTitle = $pageTitle;
}
The downloadMe class is clever, but I'd love to see the ZIP component also.
Andy, on 1/1/70
The zip component isn't included in my code because I didn't write it, it's also publicly available ;)
Try this http://cakephp.org/search?q=zip+component
Cheers,
AD7six
olivvv, on 1/1/70
olivvv