Re: Getting 5 Related Books via multiple Genres (HABTM ) from within Book view() and without requestAction

2009-04-17 Thread Mike Cook
Okay, so I just couldn't leave this alone :) I implemented the following, which works and even brings in the 'contain' info. However there is still a small problem... // books_controller.php view() $similar = $this-Book-similar_books($genre_id, $limit); // model book.php $similarBooks =

Re: Getting 5 Related Books via multiple Genres (HABTM ) from within Book view() and without requestAction

2009-04-14 Thread Mike Cook
, 2009 at 4:48 AM, Mike Cook m...@epubbooks.com wrote: brian, when I try this though I get an Unknown column 'Book.genre_id' in 'where clause' error. SELECT `Book`.`id`, `Book`.`title`, `Book`.`slug`, `Language`.`id`, `Language`.`name` FROM `books` AS `Book` LEFT JOIN `languages

Re: Getting 5 Related Books via multiple Genres (HABTM ) from within Book view() and without requestAction

2009-04-13 Thread Mike Cook
'                                         )                                 )                         )                 )         ); } On Sun, Apr 12, 2009 at 8:25 AM, Mike Cook m...@epubbooks.com wrote: Okay, so after more searching around I found a post by pkclarke who makes use of a search

Re: Getting 5 Related Books via multiple Genres (HABTM ) from within Book view() and without requestAction

2009-04-12 Thread Mike Cook
= $this-Book-similar($genre_id); I was also pleasantly surprised that I could pass the $id array to 'conditions' and it would use it as an 'OR' :) Thanks for your help Joe, your comments really helped to point on the right path. Mike On Apr 11, 8:45 pm, Mike Cook m...@epubbooks.com wrote: Hi Joe

Re: Offline version of the CakePHP manual.

2009-04-11 Thread Mike Cook
Indeed you can't distribute any copies of the book's contents (regarding other comments in this thread) which prevents (~immediately outdated) copies of the book springing up and being found by the nubies. ...as the file on my is already outdated I should take your comments as an indication

Getting 5 Related Books via multiple Genres (HABTM ) from within Book view() and without requestAction

2009-04-11 Thread Mike Cook
In my books view.ctp, I want to have a list of 5 books that are related via the genres data, which has a HABTM relationship. Although I can do this by placing a function similar() in the genres_controller, I have to call it from the view with requestAction. // genres_controller.php function

Re: Getting 5 Related Books via multiple Genres (HABTM ) from within Book view() and without requestAction

2009-04-11 Thread Mike Cook
 pm, Mike Cook m...@epubbooks.com wrote: In my books view.ctp, I want to have a list of 5 books that are related via the genres data, which has a HABTM relationship. Although I can do this by placing a function similar() in the genres_controller, I have to call it from the view

Re: Offline version of the CakePHP manual.

2009-04-06 Thread Mike Cook
psykro, no offence taken :) The reason I made mine in EPUB was because that works nicely on my Sony Reader. It isn't meant as a reference manual, but something I just browse through while on the train to work -- yeah I know, while most people are reading Terry Pratchett or something of the like,

Re: Offline version of the CakePHP manual.

2009-04-04 Thread Mike Cook
Hi psykro, I'm not sure if something like what I created would be of interest to anyone but Back in January I created a version for myself so I could read it on my SonyReader. It is in the EPUB format so you will need a reader than can view these files such as Adobe Digital Editions. This

Re: $paginator-link sorting – Is this a Bug?

2009-03-22 Thread Mike Cook
FYI The latest CakePHP release (1.2.2.8120) fixes the problems I was having, now $paginator-link() can used to get the desired results. On my initial check, everything seems to be working perfect. Many thanks to the developers! Mike On Feb 27, 11:11 pm, Mike Cook m...@epubbooks.com wrote

Re: $paginator-link sorting – Is this a Bug?

2009-03-22 Thread Mike Cook
: The fix changed the behavior for all simple (single-model) paginations so that they now require the modelname in sort() to work. I suspect this was not intended? http://groups.google.com/group/cake-php/browse_thread/thread/00fc597c... On Mar 22, 1:51 pm, Mike Cook m...@epubbooks.com wrote

Similar/Related Posts: Element or Helper?

2009-03-18 Thread Mike Cook
I'm looking to implement a similar posts feature on my site where in the sidebar, each post entry shows a random list of 5 'related' posts. As I'm still new to Cake I'm not sure if this is best with an Element or as a Helper. However, looking at the manual it seems that we can pass variables to

Re: Search Function

2009-03-13 Thread Mike Cook
Hi Dave, I've just started looking into this myself. You could try these links; http://www.assembla.com/wiki/show/searchable_behavior http://thechaw.com/cakebook/source/plugins/searchable http://bakery.cakephp.org/articles/view/search-feature-to-cakephp-blog-example

Re: Media View not downloading unless I set headers

2009-03-01 Thread Mike Cook
error. On Wed, Feb 25, 2009 at 5:49 PM, Mike Cook m...@epubbooks.com wrote: I am unable to get the Media View to force the download to start, no error is given other than it just lands on a blank page. Here's the download function in my controller;  function download ($id = null

Re: What do you develop in (ide, text editor, etc.)?

2009-03-01 Thread Mike Cook
I've been using HTML-Kit for ever!! I have to say though, over this last year it's started to show its age (2002) but still, for quick XHTML/CSS design, it works a treat. Recently I changed over to Eclipse PDT, so far I'm very impressed, although like others have said, the code completion isn't

Re: $paginator-link sorting – Is this a Bug?

2009-02-27 Thread Mike Cook
', array('sort'='released', 'direction'='desc'); to echo $html-link('Recent', array('sort' = 'released', 'direction' = 'desc')); -- Mike On Feb 15, 11:49 am, Mike Cook m...@epubbooks.com wrote: I had posted about this previously but I guess the title and explanation I used were not very good

Media View not downloading unless I set headers

2009-02-25 Thread Mike Cook
I am unable to get the Media View to force the download to start, no error is given other than it just lands on a blank page. Here's the download function in my controller; function download ($id = null) { list($file_name, $file_ext) = split('[.]', $id); $this-view = 'Media';

Re: How to track # of file downloads (DB or File)

2009-02-17 Thread Mike Cook
Okay, definitely some food for thought here. @Miles J :: As brian states, this would be for stats. It's okay knowing you have 10 downloads, but knowing the time, day, week, and month can help in understanding your visitors better. If I do get to the point of implementing an API then I should

Re: How to track # of file downloads (DB or File)

2009-02-17 Thread Mike Cook
On Feb 17, 3:23 pm, Samuel DeVore sdev...@gmail.com wrote: Of course if all you want is stats on the file downloads and your server does that anyway, why not just filter/ collect stats from the log files? Sam D Even if I don't initially start out recording other data, it's probably worth me

How to track # of file downloads (DB or File)

2009-02-16 Thread Mike Cook
I want to track the number of file downloads and I'm wondering if any here have thoughts on how best to do this. At the moment I have a separate Files table for the details that stores information such as; filename, filesize, version, first_downloaded and downloads. Is incrementing the

Re: How to track # of file downloads (DB or File)

2009-02-16 Thread Mike Cook
There's never guarantees of having huge traffic but I do expect to get a considerable amount, the number of files available will also grow to several thousand within a year or so - there's certainly potential of having tens of thousands of downloads per month. This actually makes me wonder if I

$paginator-link sorting – Is this a Bug?

2009-02-15 Thread Mike Cook
I had posted about this previously but I guess the title and explanation I used were not very good. Hopefully this will be better. Here is my code; // Controller function index() { $this-paginate['Book'] = array( 'contain' = array('Author', 'Language', 'Genre'), 'order' =

Pagination Order: Title ASC or Date DESC seems to break

2009-02-11 Thread Mike Cook
I've been having some trouble with the paginator when using a different sort order on two links. 'Title' needs to default to ASC, which Cake does. 'Date' needs to default to DESC, by default it doesn't but using $paginator-link it works; $paginator-link('Date', array('sort' = 'date',

Re: paginate order A-Z and Z-A...I thought it was easy...

2009-02-05 Thread Mike Cook
. If it is ordered by another field, order by this field and default to ASC direction. On Feb 4, 1:08 am, Mike Cook m...@epubbooks.com wrote: I'm rather new to cake and I'm having trouble understanding how to have a simple sort on a title field using the pagenator. All I need is two links, one

paginate order A-Z and Z-A...I thought it was easy...

2009-02-03 Thread Mike Cook
I'm rather new to cake and I'm having trouble understanding how to have a simple sort on a title field using the pagenator. All I need is two links, one ascending and the other descending -- Title (ASC) | Title (DESC) At first I thought I could just set sort/direction, but perhaps doing this