nocache tags

2009-03-08 Thread Filip Camerman

When I use  tags and the page is cached, the code in the
nocache tags gets no data from the controller. That's normal, I know,
but now I'm having the problem that it gets no data (or session data
or anything) from the app_controller - beforeFilter method either,
which means I have no idea about who's logged in and in what language.
Is this normal? I think not, but just wanna make sure.

If it's not, any idea what might cause this? I recently upgraded to
1.2.1.8004 .
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Caching views like elements

2009-02-17 Thread Filip Camerman

This group is full of requests for this feature, but afaik it's still
not implemented.

Here's a thread with someone who basically coded his own caching to
deal with this:
http://groups.google.com/group/cake-php/browse_thread/thread/86ba3ee2699c9f15/826c67268f84c230?lnk=gst&q=caching+parameter#826c67268f84c230

Or you can just put your entire view in an element and accept with the
performance hit.


On Feb 1, 9:54 pm, webjay  wrote:
> Does anyone have a solution forcachingviews with keys?
>
> One could create an element that gets the content and is cached based
> on the key:http://book.cakephp.org/view/561/Caching-Elements
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: New Cake site

2009-01-25 Thread Filip Camerman

You click on the Edit link on the top left and then you change it :)

You'll need to make a bakery account if you don't have one yet.

On Jan 24, 6:40 pm, DRE  wrote:
> Anybody know how I could get my site on that list 
> ?http://book.cakephp.org/view/510/Sites-in-the-wild?

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: routes, controller name and model name

2008-12-08 Thread Filip Camerman

Meanwhile I figured I can combine all the actions in one route, but I
still have to list them all:

  Router::connect('/collections/:action/*', array('controller' =>
'collections'), array('action' => 'add|edit|delete'));

I guess that's the least unelegant way then.

Thx for your reaction though!

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Dynamic Navigation in a Layout. How?

2008-12-07 Thread Filip Camerman

What you need is indeed an element, and to query the database from
inside an element you can use requestAction in it (that's what it's
there for).

It's explained here:
http://book.cakephp.org/view/434/requestAction

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



routes, controller name and model name

2008-12-07 Thread Filip Camerman

I'm making a site for an artist and when showing image galleries of
art collections I want url's like

www.site.com/collections/name-of-collection

Now I also have a database table for collections, and hence a
collection_controller and a collection model.

First I had my routes like this
- Router::connect('/collections/:action/*', array('controller' =>
'collections'));
- Router::connect('/collections/*', array('controller' =>
'collections', 'action' => 'index'));

I thought that the first route would only catch url's with existing
actions, but instead it also caught my "/collections/name-of-
collection" url's. So I changed it to:

- Router::connect('/coll/:action/*', array('controller' =>
'collections'));

since the url's don't matter for my admin actions. But then I have to
change my forms because

create('Collection');?>

will post the form to /collections/...

Now I can solve this in several ways (change the model name; make
separate routes for all my admin actions, ...) but I was wondering if
there's an elegant way to deal with custom url's that start with a
controller/model name?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Counting views of cached pages

2008-11-09 Thread Filip Camerman

In some controller actions I do an UPDATE table SET nviews = nviews +
1 WHERE id = '{$id}'  to keep track of how often the page gets viewed
(for each record). Now I want to cache some of these actions, and I
was wondering what would be the best way to keep counting pageviews.
The first way I can think of is to put nocache tags in the view around
a requestaction that would do the update query, but that would be a
"dirty" way to do it. Maybe something with a before filter?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: html select State/Country dropdown in CakePHP ?

2008-06-18 Thread Filip Camerman

any chance to see the view code for that?

On Jun 18, 1:46 am, fr3nch13 <[EMAIL PROTECTED]> wrote:
> I accomplished something similar to this using ajax calls (ajax helper
> and cakephp 1.1). This should point you in the right 
> direction:http://calculator.boxcart.com/
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: multi language for database tables

2008-06-11 Thread Filip Camerman

If it's only one field and you're not gonna have a 100 languages, then
the easiest way is to put extra columns in the same table, e.g.:

id
name
address
shipping_terms_en
shipping_terms_fr
shipping_terms_de
shipping_terms_nl
...

then make a function that returns the correct language suffix, e.g.
langsuffix(), and just refer to the field as
$userdata['shipping_terms_'.langsuffix()]

That's the quick and dirty way to do it, but in such a simple case
also the best way imo.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Why no "powered by" logo?

2008-06-10 Thread Filip Camerman

Is there a "Powered by CakePHP" logo? I'd put it on my site.

All I find is this
http://www.cakephp.org/img/cake.power.gif

a bit meager :)

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



blank page when view has an error

2008-06-10 Thread Filip Camerman

Whenever there's a php error in a view, I get a completely blank page
in my browser. I can live with it but it's annoying and I wonder if
anyone knows a solution.

Some info
- I use Cake 1.2 on Apache
- php.ini has "display_errors = On" and "error_reporting  =  E_ALL",
and I get to see php errors in normal php scripts that I run on this
server (my PC), so I assume the server config is not the problem
- My Cake debug level = 3 and errors in controllers are reported by
Cake just fine, only errors in views cause the problem
- when I get the blank page, it seems it actually crashes the Apache
server as Apache's error.log says:

[Tue Jun 10 19:02:49 2008] [notice] Parent: child process exited with
status 3221225477 -- Restarting.
[Tue Jun 10 19:02:49 2008] [notice] Apache/2.2.8 (Win32) PHP/5.2.6
configured -- resuming normal operations


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Blank Login Page

2008-06-10 Thread Filip Camerman

On my current dev machine CakePHP gives me a completely blank page
without any indication of what went wrong whenever my view uses a non-
defined variable. So replace your view with one that just says "hello"
for a second and see if that gets printed; if so you know the prob.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Select or text field depending on another select

2008-06-10 Thread Filip Camerman

Really? Seems pretty standard to me to have a self-changing form. E.g.
you select a country in one select box and then the next box changes
to hold that country's regions or cities.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Menu on a portal

2008-06-02 Thread Filip Camerman

You'd include the menu in the layout (views/layouts/default.ctp). To
keep it in a separate file, you can put it in an element (e.g. views/
elements/menu.ctp) and include that element in the layout with renderElement('menu'); ?> .

To highlight the current menu item, you could use some algorithm that
compares the url's of the menu items with the current url. An example
is at 
http://debuggable.com/posts/macgyver-menu-for-cakephp-whats-the-active-menu-item:480f4dd6-c044-436e-bbde-4ed8cbdd56cb
. Personally, I just mark the menu item to be highlighted in each
controller action (e.g. $this->set('menu_current', 'News'); ) and then
in the menu element I highlight the menu with the name in
$menu_current .


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Best Practice Newb Question

2008-05-21 Thread Filip Camerman

MVC orthodoxy would require you to do this in the view. The controller
just sends raw data to the view, formatting that data is part of the
presentation logic and hence belongs in the view.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Problem calling user controler from app controler.

2008-05-20 Thread Filip Camerman

Hi,
The bit of code you pasted does give the impression that you have some
things mixed up. For an example of simple user login, read
http://book.cakephp.org/view/327/simple-user-authentication .


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Custom SQL queries, binding and organizing results

2008-05-19 Thread Filip Camerman

I don't think and wouldn't expect Cake to have any functionality to do
that; when you're rolling your own queries you've got to live with the
flat result. If you sort your query right (e.g. by user) then it
should be easy to rearrange the result in a hierarchical structure
though.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Headers Problem

2008-05-19 Thread Filip Camerman

Hi,

That error occurs if you try to set a http header after you've already
outputted some html. The code at  [CORE/cake/libs/controller/
controller.php, line 546] is called when you do a redirect, so I'm
guessing that you have done a $this->redirect somewhere after you've
outputted something. Is that possible?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Incorrect integer value ''

2008-05-17 Thread Filip Camerman

When I create a record with a form and leave integer fields empty,
Cake tries to insert '' into that field instead of null, leading to
the error "SQL Error: 1366: Incorrect integer value: '' for column
'year' at row 1"."

Now this is easily fixed by putting this in my controller for every
field before saving:
  if ($this->data['Text']['year'] == '') $this->data['Text']
['year'] = null;

But this is quite a hassle so I wonder if there's a way to get Cake to
use null instead of '' for integer fields?

Tia.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Associations and queries using 2 models

2008-05-16 Thread Filip Camerman

I'd reverse the question: is there any reason to NOT just write this
in SQL?

This is a genuine question; to me it seems manic inefficiency for
someone who's comfortable with SQL to struggly with another complex
query system which will just translate everything back to SQL.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Caching System with Language in the file name

2008-05-16 Thread Filip Camerman

Hi,

I've had the exact same problem: the cache prefix that you can specify
in the core config is not used for cached views - which is a major bug
imo. I solved it by hacking the core in the places where it reads/
writes cached views, since I absolutely needed this functionality.
I've described how to do it in the second message of this thread:
http://groups.google.com/group/cake-php/browse_thread/thread/62b4d61b5f5722a0/f9a3d231594801da?lnk=st&q=cache+prefix+krommenaas#f9a3d231594801da

hth

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Problem with multiple domains without a domain

2008-05-14 Thread Filip Camerman

You probably need to edit your .htaccess files (the routing/
configuration file of the web server, assuming it's Apache). They
catch everything that begins with http://waywww.probolab.com.br/ and
send it to the Cake dispatcher of your main site, which is why the /
test part is interpreted as a controller. You just need to insert a
rule that catches anything beginning with http://waywww.probolab.com.br/test/
to send it to your other site.


On May 13, 11:19 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I did a website with Cake and PHP (probolab.com.br). Until there
> everything is all right.
>
> Then my host said that I can put as many websites within my domain. I
> did create an alias and point to the same domain and also create
> folder called "test". The problem is that I send the second domain to
> this folder this waywww.probolab.com.br/test.
>
> By doing this way it's like saying to cake to do a method.
>
> Is there a way to say to cake that when I do this, don't do nothing?
> just redirect etc?
>
> I'm really stuck. I've tryied everything.
>
> Regards,
>
> SimonJPA
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: include CSS and Javascript into layout 'on demand'

2008-05-13 Thread Filip Camerman

another solution:

in app_controller I have
  var $css_files = array('site.css', 'lightbox.css');   // these are
the css files I always need

and in app_controller's beforeRender() method I have
$this->set('css_files', $this->css_files);

and in the  section of my layout I have
  
  
  

Now I can add more css files in any controller action with:
  $this->css_files[] = '';

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Getting data from a helper?

2008-05-12 Thread Filip Camerman

Thanx Tarique, exactly what I needed.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Query Question

2008-05-12 Thread Filip Camerman

I'd just use

SELECT state, city FROM skateparks ORDER BY state, city

Then loop it end everytime the state changes you print the state,
otherwise just the city.


On May 12, 12:39 pm, Kyle Decot <[EMAIL PROTECTED]> wrote:
> They're not stored in separate tables. They're stored in my skateparks
> table which has:
>
> id  |  name  |  address  |  city  |  state  ...etc
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Getting data from a helper?

2008-05-12 Thread Filip Camerman

My site has side columns that are part of the layout, and a central
content column that is filled by the current controller/action. Now in
a side column I want to show data (e.g. the most recent comments on
the site). Typically I fill side columns with helpers, but in this
case I need to access data (e.g. from the comments table). What's the
best way to do this? A link to an example would be great.

I know this is a pretty fundamental question that's probably been
discussed before, but I couldn't find a solution through search
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Paginate custom SQL queries

2008-05-11 Thread Filip Camerman

Here's an explanation of how I did custom pagination.

In app/config/bootstrap.php I include a global functions file which is
located in app/webroot/includes/

  if (file_exists("includes/global_functions.php"))
require_once("includes/global_functions.php");

In this file are my pagination functions:

  http://bin.cakephp.org/view/522546645

I use these functions for all my pagination needs, e.g. paginating a
table of texts in my texts/index actions.

In texts_controller I have a var to determine the number of records
per page:

  var $perpage = 50;

and a function to determine the number of texts:

  function nrecords() {
$res = $this->Text->query("select count(*) as n from texts");
return $res[0][0]['n'];
  }

The index action looks like this. Only four lines of code are needed
for the pagination, and they result in a LIMIT clause ($limit) which I
attach to my sql query. Also important is that the action receives the
requested page number $page. As you can see in the beginning of the
code I'm sorting queries on the result of mysql functions, which is
why I needed custom queries and pagination to begin with.

  function index($page = 1, $sort = 'title', $dir = '') {
// determine sort order
$sortdir = ($dir == 'down') ? "desc" : "asc";
if ($sort == 'year') {
  $order = "order by ifnull(texts.year,albums.year) {$sortdir},
concat(artists.sort, artists.name) {$sortdir}, texts.title
{$sortdir}";
} elseif ($sort == 'artist') {
  $order = "order by concat(artists.sort, artists.name)
{$sortdir}, texts.title {$sortdir}";
} else {
  $sort = 'title';  // default
  $order = "order by texts.title {$sortdir}, concat(artists.sort,
artists.name) {$sortdir}";
}
// paginate
$nrecords = $this->nrecords();   // get total number of records
$perpage = $this->perpage;   // get number of records per page
$npages = pag_npages($nrecords, $perpage);   // determine
number of pages
$limit = pag_sqllimit($page, $perpage, $npages);   // create the
"LIMIT" clause for SQL
// query
$this->set('texts', $this->Text->query("
  select texts.id, texts.title, texts.slug, texts.audio,
texts.video,
 length(texts.text_transl) as transl,
length(texts.text_phonetic) as phonetic,
 artists.id, artists.name, artists.sort, artists.name__AW,
artists.slug,
 ifnull(texts.year,albums.year) as year
  from texts
left join albums on texts.album_id = albums.id
left join artists on texts.artist_id = artists.id
  {$order}
  {$limit}
"));
// pass on the sort and pagination info to the view
$this->set('page', $page);
$this->set('npages', $npages);
$this->set('nrecords', $nrecords);
$this->set('sort', $sort);
$this->set('dir', $dir);
// layout
$this->set('no_right_col', true);
  }

Now in my view I add pagination links with:

  $pag_numbers = pag_numbers($page, $npages, "/tekste/", ($dir) ? "/
{$sort}/{$dir}" : "/{$sort}", 3, true);

this returns a full row of page browsing links, e.g.  "Previous | 1 |
2 | 3 | 4 | 5 | Next". The source of the pag_numbers() function
explains the parameters. I could also use pag_prev() and pag_next() to
just have Previous and Next links, but the final true parameter of
pag_numbers means the Previous and Next links get added around the
page numbers.

That's it. You can see this particular paginated table in action at
http://www.antwerps.be/teksten .

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: tempdocs.cakephp.org

2008-05-06 Thread Filip Camerman

superb, thanx, hadn't seen that link :)

On May 6, 11:45 am, "Dr. Tarique Sani" <[EMAIL PROTECTED]> wrote:
> On Tue, May 6, 2008 at 2:55 PM, Filip Camerman <[EMAIL PROTECTED]> wrote:
>
> > it was actually handy to have everything on one page, would be nice to
> > still have that as an extra.
>
> Seek and you shall find -http://book.cakephp.org/complete/3/the-manual
>
> :)
>
> Tarique
>
> --
> =
> Cheesecake-Photoblog:http://cheesecake-photoblog.org
> PHP for E-Biz:http://sanisoft.com
> =
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Paginate custom SQL queries

2008-05-06 Thread Filip Camerman

Hi,

I also needed to paginate custom queries and decided to make my own
pagination which turned out to be easier than I thought, after all
pagination is just adding LIMIT x,y to your query and determining x
based on your current page. I wrote some global functions for all my
pagination needs and now need about 5 lines of code per paginated
action. If the hack above doesn't help you (I couldn't use it because
I have various types of pagination on the same model) I can send my
code if you want.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Is Cake 1.2 ready to use in production?

2008-05-06 Thread Filip Camerman

Been using 1.2 in production since alpha, never a problem. After all,
it's all just php code and php isn't beta :)


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: tempdocs.cakephp.org

2008-05-06 Thread Filip Camerman

it was actually handy to have everything on one page, would be nice to
still have that as an extra.


On May 6, 8:18 am, "Dr. Tarique Sani" <[EMAIL PROTECTED]> wrote:
> On Tue, May 6, 2008 at 11:41 AM, . <[EMAIL PROTECTED]> wrote:
> > what happened to tempdocs.cakephp.org?
>
> Grew up to be book.cakephp.org !
>
> T
>
>
>
> --
> =
> Cheesecake-Photoblog:http://cheesecake-photoblog.org
> PHP for E-Biz:http://sanisoft.com
> =
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Paginate Sort Question

2008-05-05 Thread Filip Camerman

Hi,

If I understand correctly, you just need to sort on two fields, right?

Here's some code of a controller of mine that sorts a paginated table
of texts (lyrics). Texts belong to Albums which belong to Artists. The
table can be sorted on title, artist or year. As you can see in each
case I use the $order array to sort on multiple fields...


 function index($sort = 'title') {
if ($sort == 'artist')
  $order = array(
'Artist.sort' => 'desc',
'Artist.name' => 'asc',
'Text.title' => 'asc',
'Text.year' => 'asc'
  );
elseif ($sort == 'year')
  $order = array(
'Album.year' => 'asc',
'Artist.sort' => 'desc',
'Artist.name' => 'asc',
'Text.title' => 'asc'
  );
else  // title
  $order = array(
'Text.title' => 'asc',
'Text.year' => 'asc',
'Artist.sort' => 'desc',
'Artist.name' => 'asc'
  );
$this->paginate = array(
  'conditions' => "",
  'limit' => 50,
  'order' => $order
);
$this->Text->recursive = 0;
$this->set('texts', $this->paginate());
  }


Later I had to abandon Cake's pagination and make my own because I
wanted to be able to take the year from either the Text or the Album
when sorting on it.

Anyway you'll need something like this:

 if ($sort == 'citystate')
  $order = array(
'Skatepark.state' => 'asc',
'Skatepark.city' => 'asc'
  );
...



On May 3, 12:05 pm, Kyle Decot <[EMAIL PROTECTED]> wrote:
> I have a skatepark directory website and I want to be able to sort my
> results by park name, rating, and city/state. I am having some
> problems figuring out how to do the city/state sort with paginate. I
> want to sort the states, and then sort the cities within the states.
> Anyone have any tips on how to accomplish this? Thanks for the help.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---