spit out the sql code just for one line?

2011-10-30 Thread iphone5
$this -> Question-> deleteAll( array( 'survey_question_id' =>
$question[ 'SurveyQuestion'][ 'id' ] ) );
Is there any way to show the sql code for this line?
I know if I turn on the debug = 2 it will show all the sql code for
the whole page but I just want to do it for a single line of code.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


CakePHP 2.0.1 is out!

2011-10-30 Thread José Lorenzo
The CakePHP core team is proud to announce the immediate availability of 
CakePHP 2.0.1 [1]. 2.0.1 is the first bugfix/maintenance release for the 
2.0 branch. Since the very well received release of 2.0 stable two weeks 
ago there have been 95 commits, and 6 issues resolved. For people still 
hesitant on upgrading from 1.3 good news is that we have improved the 
effectiveness of the UpgradeShell, which eases a lot the migration efforts. 
A quick summary of all the changes that made it into2.0.1 [2]:

Params in router are now correctly urlencoded/urldecoded
Added automatic Content-Length header to hint browser of the end of the 
response when using persistent connections
AuthComponent deny() when called with now parameters will deny all actions
Prevented unneeded afterFind callback triggering on associated models
Added Opera Mobi to mobile detectors.
RedirectRoute will now terminate the script execution after setting the 
headers
Better support for email sending in japanese charsets

Development on 2.1 has started and is progressing well, and we hope to have 
a alpha release soon. A huge thanks to all involved in terms of both 
contributions through commits, tickets, documentation edits, and otherwise 
contribute to the framework. Without you there would be no CakePHP.

Download a packaged release [1]
View the changelog [2]
Links

[1] http://github.com/cakephp/cakephp
[2] http://cakephp.org/changelogs/2.0.1

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Question about login function (cakephp 2.0)

2011-10-30 Thread euromark
i wanted to post the link with hash:
http://book.cakephp.org/2.0/en/core-libraries/components/authentication.html?highlight=login#identifying-users-and-logging-them-in

On 31 Okt., 00:51, euromark  wrote:
> http://book.cakephp.org/2.0/en/core-libraries/components/authenticati...
>
> On 30 Okt., 22:01, gloop  wrote:
>
>
>
>
>
>
>
> > Hello everybody,
>
> > i try cakephp 2.0 and the login sequence is very diffrent to cakephp
> > 1.3.
>
> > In 1.3 its "magic" and you can type function login(){}
>
> > In 2.0 i must write a bit more:
>
> > public function login() {
> >     if ($this->Auth->login()) {
> >         $this->redirect($this->Auth->redirect());
> >     } else {
> >         $this->Session->setFlash(__('Invalid username or password, try
> > again'));
> >     }
>
> > }
>
> > Now i have the problem when i open /users/login i have always the
> > flash message.
>
> > What is the correct way to set the message only when i submit?
>
> > Thank you!
>
> > gloop

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Question about login function (cakephp 2.0)

2011-10-30 Thread euromark
http://book.cakephp.org/2.0/en/core-libraries/components/authentication.html?highlight=login

On 30 Okt., 22:01, gloop  wrote:
> Hello everybody,
>
> i try cakephp 2.0 and the login sequence is very diffrent to cakephp
> 1.3.
>
> In 1.3 its "magic" and you can type function login(){}
>
> In 2.0 i must write a bit more:
>
> public function login() {
>     if ($this->Auth->login()) {
>         $this->redirect($this->Auth->redirect());
>     } else {
>         $this->Session->setFlash(__('Invalid username or password, try
> again'));
>     }
>
> }
>
> Now i have the problem when i open /users/login i have always the
> flash message.
>
> What is the correct way to set the message only when i submit?
>
> Thank you!
>
> gloop

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Using javascript

2011-10-30 Thread flo.kl...@googlemail.com
Just put your Javascript in the view file. You can either import an external 
.js file or echo the javascript directly (I recommend the JsHelper for that).

-flosky



Justin Edwards  schrieb:

There are many ways to handle that, and there are many javascript libraries 
with different ways of doing it.  Unless you were using something like 
http://banchaproject.org/ there is nothing cakephp has to do with it.  

Here is my recommendation on learning javascript, the DOM, and events.

http://www.w3schools.com/js/


On Sun, Oct 30, 2011 at 4:18 AM, arti grover  wrote:

thanks a lot..but plz considr this question

I have made a function chat() in my users_controller and I want to add
certain conditions like if a user cancels session before chat starts
than a button should appear naming CANCEL_SESSION.but the moment
session starts that button should dissapear and anothr button naming
end session should appear..How can I achieve these things with conditions 
mentioned in controller??I am stuck
at this problem since last 1 day..somebody plz guide ASAP.



On Sun, Oct 30, 2011 at 2:41 PM, WebbedIT  wrote:

This is not a CakePHP question.  CakePHP is a PHP framework which
produces HTML, so anything you can do with HTML and javascript can be
done in CakePHP.

Go find a javascript tutorial that matches your requirements and give
it a go, you will feel better for being able to find the answer to
such a simple task yourself!

But just to whet your whistle, here's a little tip from me:
http://jqueryui.com/demos/dialog/

HTH, Paul.


On Oct 29, 6:16 am, arti grover  wrote:
> Hi all,
>
> I want to call a javascript alert box the moment A user clicks on CANCEL
> SESSION link.where should i put the javascript alert box in view and what
> how to code that javascript function inside view??
>
> --
> Regards
> Arti Grover

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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




-- 
Regards
Arti Grover

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.
 
 
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


-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.
 
 
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

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: missing ) after argument list error - how does that make sense?

2011-10-30 Thread flo.kl...@googlemail.com
I always use “ to encapsulate the string I want to echo. Then you can use ' 
within and it will be echoed as well.
A short example:
echo ““.$array['fieldName'].““;

-flosky



Tomfox Wiranata  schrieb:

lets say i wanna go with echo, how do i need to quote or escape the
current code, that it works?
cause i have no idea how to implement the value thing..

thanks..appreciate it

On 30 Okt., 05:52, Ryan Schmidt  wrote:
> On Oct 29, 2011, at 10:56, Tomfox Wiranata wrote:
>
> > echo ' > style="float:right;cursor:pointer;">'.$html->image("icons/map.png",
> > array("alt" => "Google Map anzeigen")).'';
>
> [snip]
>
> > now when I hit
> > the icon to open the map, firebug says this:
> >_

>
> > missing ) after argument list
> > showGoogleMap(207,47.378824,8.548737,Tag Heuer Carrera Chronograph)
>
> As you see from the error message (or by viewing source on the page), your 
> PHP code generated the following HTML code:
>
>  Heuer Carrera Chronograph)" style="float:right;cursor:pointer;">...
>
> What got generated inside the onclick attribute is not valid JavaScript code, 
> because the title string is not quoted or escaped properly. You probably want 
> to use JsHelper::value($all['title']) instead of just echoing $all['title'] 
> directly.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Question about login function (cakephp 2.0)

2011-10-30 Thread gloop
Hello everybody,

i try cakephp 2.0 and the login sequence is very diffrent to cakephp
1.3.

In 1.3 its "magic" and you can type function login(){}

In 2.0 i must write a bit more:

public function login() {
if ($this->Auth->login()) {
$this->redirect($this->Auth->redirect());
} else {
$this->Session->setFlash(__('Invalid username or password, try
again'));
}
}

Now i have the problem when i open /users/login i have always the
flash message.

What is the correct way to set the message only when i submit?

Thank you!

gloop

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Cached Forms Don't Submit

2011-10-30 Thread 0x20h
When beforeFilter() gets called cake is already rendering the "cached
version".
(see dispatcher::cached() and ViewHelper#__writeFile()).
Regarding to the docs its not recommended to use the callbacks (
http://book.cakephp.org/view/1380/Caching-in-the-Controller ) .
I would probably try to separate the "display" and "save" part into 2
actions or put the form into an
element and cache that element manually, not via cacheAction.
e.g. in your view script

if($this->data || !($content = Cache::read('big_form', 'persistent'))) {
$content = $this->element('big_form');
if (!$this->data) {
Cache::write('big_form', $content, 'persistent');
}
}
echo $content;



Am 30.10.2011 19:26, schrieb BlenderStyle:
> I have setup the index and edit actions to be cached in my
> PostsController as follows:
>
> var $cacheAction = array(
>   'index' => array('callbacks' => true, 'duration' => '7 days'),
>   'edit' => array('callbacks' => true, 'duration' => '7 days'),
> );
>
> Everything is cached as expected, but the edit form doesn't submit.
> This is expected as well, if you think about it, but is there anyway
> to bypass caching when a user submits a form?
>
> I set callbacks to true to allow AuthComponent to do its magic, so if
> I could put some code in beforeFilter(), it's executed dynamically
> (not cached). I have tried each of the following in beforeFilter(),
> one by one, but none of them did the trick:
>
> if(!empty($this->data)) clearCache();
> if(!empty($this->data)) Configure::write('Cache.check', false);
> if(!empty($this->data)) $this->cacheAction = false;
>
> To avoid the "why would you even want to do that" argument I see in
> other forums, I'll explain a little further. My edit action is fairly
> intensive since it's such a long form with a lot of "stuff" in it and
> caching definitely improves the performance. To avoid writing extra
> code, the edit action displays the form as well as saves it.
>


-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Using javascript

2011-10-30 Thread Justin Edwards
There are many ways to handle that, and there are many javascript libraries
with different ways of doing it.  Unless you were using something like
http://banchaproject.org/ there is nothing cakephp has to do with it.
Here is my recommendation on learning javascript, the DOM, and events.
http://www.w3schools.com/js/

On Sun, Oct 30, 2011 at 4:18 AM, arti grover  wrote:

> thanks a lot..but plz considr this question
> I have made a function chat() in my users_controller and I want to add
> certain conditions like if a user cancels session before chat starts
> than a button should appear naming CANCEL_SESSION.but the moment
> session starts that button should dissapear and anothr button naming
> end session should appear..How can I achieve these things with conditions
> mentioned in controller??I am stuck
> at this problem since last 1 day..somebody plz guide ASAP.
>
>
> On Sun, Oct 30, 2011 at 2:41 PM, WebbedIT  wrote:
>
>> This is not a CakePHP question.  CakePHP is a PHP framework which
>> produces HTML, so anything you can do with HTML and javascript can be
>> done in CakePHP.
>>
>> Go find a javascript tutorial that matches your requirements and give
>> it a go, you will feel better for being able to find the answer to
>> such a simple task yourself!
>>
>> But just to whet your whistle, here's a little tip from me:
>> http://jqueryui.com/demos/dialog/
>>
>> HTH, Paul.
>>
>> On Oct 29, 6:16 am, arti grover  wrote:
>> > Hi all,
>> >
>> > I want to call a javascript alert box the moment A user clicks on CANCEL
>> > SESSION link.where should i put the javascript alert box in view and
>> what
>> > how to code that javascript function inside view??
>> >
>> > --
>> > Regards
>> > Arti Grover
>>
>> --
>> Our newest site for the community: CakePHP Video Tutorials
>> http://tv.cakephp.org
>> Check out the new CakePHP Questions site http://ask.cakephp.org and help
>> others with their CakePHP related questions.
>>
>>
>> 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
>>
>
>
>
> --
> Regards
> Arti Grover
>
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> 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
>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Cached Forms Don't Submit

2011-10-30 Thread BlenderStyle
I have setup the index and edit actions to be cached in my
PostsController as follows:

var $cacheAction = array(
'index' => array('callbacks' => true, 'duration' => '7 days'),
'edit' => array('callbacks' => true, 'duration' => '7 days'),
);

Everything is cached as expected, but the edit form doesn't submit.
This is expected as well, if you think about it, but is there anyway
to bypass caching when a user submits a form?

I set callbacks to true to allow AuthComponent to do its magic, so if
I could put some code in beforeFilter(), it's executed dynamically
(not cached). I have tried each of the following in beforeFilter(),
one by one, but none of them did the trick:

if(!empty($this->data)) clearCache();
if(!empty($this->data)) Configure::write('Cache.check', false);
if(!empty($this->data)) $this->cacheAction = false;

To avoid the "why would you even want to do that" argument I see in
other forums, I'll explain a little further. My edit action is fairly
intensive since it's such a long form with a lot of "stuff" in it and
caching definitely improves the performance. To avoid writing extra
code, the edit action displays the form as well as saves it.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: DebugKit Toolbar timeline isn't adding up

2011-10-30 Thread AD7six


On Oct 30, 11:54 am, Alex Bovey  wrote:
> Hi all,
>
> I'm trying to optimise a controller action in my app (a product
> search) and the debug toolbar timeline isn't adding up properly at all
> - please see this screenshot:
>
> http://www.bovey.co.uk/debugkit.png

It doesn't necessarily have to add up. Timers have a start and an end
time - and apparently a lot happened inbetween your controller action
and the render process.

>
> The total request time is 7152ms but none of my actions or views
> account for this, as if some phantom code is at work.  

That's a dramatized but more or less accurate description of the
truth.

> Equally the
> peak memory usage is way higher than the breakdown below it shows.

which just means (can you guess? the numbers aren't lying).

>
> Any ideas where this may be coming from?  This is v1.2.7.

Well that's an old version of cake.

Maybe by investigating the old fashioned way - from the numbers you've
posted you can start by investigating if it comes from: some code that
gets executed inbetween your controller and view rendering.

If debug kit is not the first component in your components array
(that's a bad idea), that would explain both the holes and the numbers
- I'd fix that first if I were you.

AD

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Using javascript

2011-10-30 Thread AD7six


On Oct 30, 10:18 am, arti grover  wrote:
> thanks a lot..but plz considr this question
> I have made a function chat() in my users_controller and I want to add
> certain conditions like if a user cancels session before chat starts
> than a button should appear naming CANCEL_SESSION.but the moment
> session starts that button should dissapear and anothr button naming
> end session should appear..How can I achieve these things with conditions
> mentioned in controller??I am stuck
> at this problem since last 1 day..somebody plz guide ASAP.

Plz ASAP create new threads for new questions (you again Arti?).

AD

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: About hiding/showing buttons with respect to certain conditions mentioned in controlller

2011-10-30 Thread AD7six


On Oct 30, 9:05 am, arti grover  wrote:
> Why MY POSTS Are not considered..i really need help..regarding this..plz
> moderator help!!!

Patience Arti - you're going to burst something.

Expecting your posts to be moderated in less than 2 hours, on a Sunday
morning/Saturday night is a bit UNREASONABLE.

AD

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: DebugKit in 2.0

2011-10-30 Thread zhaff
Hi,

I just want to share, I have no luck trying to get DebugKit working in
CakePhp version 2.0, its does not properly route to the DebugKit's css
and js files. I don't want to manually copy the files to webroot. :)

But after I upgraded to Cakephp version 2.1, it worked like a charm.
Just follow the instruction in the readme file, no need to adjust
anything.

Zhaff


On Oct 30, 7:01 pm, Jeremy Burns | Class Outfit
 wrote:
> Worked perfectly thanks (although I had also commented the component out of 
> my AppController, which stumped me for a few moments):
>
> public $components = array('DebugKit.Toolbar');
>
> Jeremy Burns
> Class Outfit
>
> http://www.classoutfit.com
>
> On 30 Oct 2011, at 06:04, LunarDraco wrote:
>
>
>
>
>
>
>
> > I was able to get DebugKit working by
> > cd to Plugins
> > git clonehttps://github.com/cakephp/debug_kit.gitDebugKit
> > After I had a copy I cd into the DebugKit folder then I switched to
> > the 2.0 via
> > git checkout 2.0
> > Updating bootstrap.php to load the plugin (new CakePHP 2.0
> > requirement):
> > CakePlugin::load('DebugKit');
>
> > Modified the View/Layouts/default.ctp by commenting out the following
> > line
> > element('sql_dump'); ?>
>
> > I've got DebugKit working but I'm struggling with DebugKit.FireCake
> > I'm sure it something to do with the changes to App::Import vs
> > App::uses and the App::build paths.
>
> > Morgan
>
> > On Oct 29, 11:16 pm, Jeremy Burns  wrote:
> >> Anyone got any tips for getting DebugKit working in 2.0? I've run the
> >> upgrade script over it and am loading it in bootstrap.
>
> > --
> > Our newest site for the community: CakePHP Video 
> > Tutorialshttp://tv.cakephp.org
> > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help 
> > others with their CakePHP related questions.
>
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> > athttp://groups.google.com/group/cake-php

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


How to use and connect alternative database config when it's failed to connect to DB?

2011-10-30 Thread seandy
Hi all,
My Question is How to use and connect alternative database config when
it's failed to connect to DB?

Based on my question above, just give you the idea that on traditional
php programming, we can do like this :

$db_configs=array(
 
0=>array('host'=>'localhost1','user'=>'root1','password'=>'password1'),
 
1=>array('host'=>'localhost2','user'=>'root2','password2'=>'password2')
);

foreach($db_configs as $db_config)
{
   if(!mysql_connect($db_config['host'],$db_config['user'],
$db_config['password'])
   {
  // DB Connection Failed, do nothing and try next db config...
   }
   else
   {
 echo 'DB Connection Success, Break';
 break;
   }
}

So the idea is, the script try to reconnect to database when it's
failed and using alternative config variable.

How can we do like that on CakePHP ?

Thank you.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


DebugKit Toolbar timeline isn't adding up

2011-10-30 Thread Alex Bovey
Hi all,

I'm trying to optimise a controller action in my app (a product
search) and the debug toolbar timeline isn't adding up properly at all
- please see this screenshot:

http://www.bovey.co.uk/debugkit.png

The total request time is 7152ms but none of my actions or views
account for this, as if some phantom code is at work.  Equally the
peak memory usage is way higher than the breakdown below it shows.

Any ideas where this may be coming from?  This is v1.2.7.

Thanks all,

Alex

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


DebugKit Toolbar timeline isn't adding up

2011-10-30 Thread Alex Bovey
Hi all,

I'm trying to optimise a controller action in my app (a product search) and
the debug toolbar timeline isn't adding up properly at all - please see
this screenshot:

http://www.bovey.co.uk/debugkit.png

The total request time is 7152ms but none of my actions or views account
for this, as if some phantom code is at work.  Equally the peak memory
usage is way higher than the breakdown below it shows.

Any ideas where this may be coming from?  This is v1.2.7.

Thanks all,

Alex





-- 
Alex Bovey
Web Developer | Alex Bovey Consultancy Ltd
Registered in England & Wales no. 6471391 | VAT no. 934 8959 65
a...@bovey.co.uk | t 0844 567 8995 | m 07828 649386 | f 0870 288 9533
PHP | MySQL | AJAX | XHTML | CSS | Javascript | XML | W3C Accessibility

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Using javascript

2011-10-30 Thread arti grover
thanks a lot..but plz considr this question
I have made a function chat() in my users_controller and I want to add
certain conditions like if a user cancels session before chat starts
than a button should appear naming CANCEL_SESSION.but the moment
session starts that button should dissapear and anothr button naming
end session should appear..How can I achieve these things with conditions
mentioned in controller??I am stuck
at this problem since last 1 day..somebody plz guide ASAP.

On Sun, Oct 30, 2011 at 2:41 PM, WebbedIT  wrote:

> This is not a CakePHP question.  CakePHP is a PHP framework which
> produces HTML, so anything you can do with HTML and javascript can be
> done in CakePHP.
>
> Go find a javascript tutorial that matches your requirements and give
> it a go, you will feel better for being able to find the answer to
> such a simple task yourself!
>
> But just to whet your whistle, here's a little tip from me:
> http://jqueryui.com/demos/dialog/
>
> HTH, Paul.
>
> On Oct 29, 6:16 am, arti grover  wrote:
> > Hi all,
> >
> > I want to call a javascript alert box the moment A user clicks on CANCEL
> > SESSION link.where should i put the javascript alert box in view and what
> > how to code that javascript function inside view??
> >
> > --
> > Regards
> > Arti Grover
>
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> 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
>



-- 
Regards
Arti Grover

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Please give me some suggestions on this

2011-10-30 Thread bigahuna
Hi Tom,

we use ckeditor with the ckfinder plugin for such tasks. We tried
several alternatives but this combination is very easy to implement
and works good and stable. You can customize the editor the way you
want and with the ckfinder plugin you can browse server side
directorys, resize images, copy, delete, rename and so on.
ckeditor is for free and ckfinder is about 50$ for one site.

For the integration of the ckeditor in cake apps, you can find a
helper in the bakery

http://ckeditor.com/
http://ckfinder.com/


Hope that helps.

Greetings
Mike


On 29 Okt., 18:40, MetZ  wrote:
> Hi all..
>
> I am looking to implement a wysiwyg editor with a media library plugin
> of some kind.. Have been looking at Tinymce and elfinder for library,
> but I am not sure if I should go this way, or if there are any other
> solutions that meets my requirements.
>
> Requirements:
> - Simple wysiwyg (only simple regular text buttons bold, italic, left
> align and so on)
> - possible to tie in a media/file plugin button for images and other
> files
> - access to whole media library trough GUI
>
> I am currently using markitup, and for me, it is perfect, but for
> other admins/moderators that do not know any html, it is not good.
>
> Do any of you have experince with a similar setup for cake
> application?
> Please share your knowledge on how to proceed..
>
> Thanks all!
> -Tom

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: About hiding/showing buttons with respect to certain conditions mentioned in controlller

2011-10-30 Thread arti grover
Why MY POSTS Are not considered..i really need help..regarding this..plz
moderator help!!!

On Sun, Oct 30, 2011 at 11:46 AM, jovial  wrote:

> Hi All,
>
> I have made a function chat() in my users_controller and I want to add
> certain conditions like if a user cancels session before chat starts
> than a button should appear naming CANCEL_SESSION.but the moment
> session starts that button should dissapear and anothr button naming
> end session should appear..How can I achieve these things??I am stuck
> at this problem since last 1 day..somebody plz guide ASAP.




-- 
Regards
Arti Grover

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


About hiding/showing buttons with respect to certain conditions mentioned in controlller

2011-10-30 Thread jovial
Hi All,

I have made a function chat() in my users_controller and I want to add
certain conditions like if a user cancels session before chat starts
than a button should appear naming CANCEL_SESSION.but the moment
session starts that button should dissapear and anothr button naming
end session should appear..How can I achieve these things??I am stuck
at this problem since last 1 day..somebody plz guide ASAP.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


ACL and mapActions problem

2011-10-30 Thread Stollie
Hello all :)

I have a problem with the ACL en Auth mapActions  function. I can't
set the rights (read, edit, add, delete) to each function in de
controller as I want. With the plugin I use I have to set all the
right to true to even view a dashboard page at the page controller.

So want I'm using.
CakePHP 1.3.13 and a plugin to manage the ACL, 
https://github.com/interlock/acl_plugin.

I build the acos list with the build_acl function provided in the cake
book. The rights I want to mange by groups so I have set that up in
the models of users en goups.

I have the following code at my pages controller:
function beforeFilter() {
parent::beforeFilter();
$this->Auth->mapActions(
array(
'read' => array('display','dashboard')
)
);
}

By setting this it should be able to set read to true in my aros_acos
row for the Pages controller, right?
controllers > Pagesdelete -> false update -> false  read -> true
create -> false.

I did this for my editors group, but I still cant view this dashboard
as an editor. I get an end less refresh so the browser stops it.
Probably to refresh to the login page. When I set all right true I can
see the page.

The code is avaible here to view.
https://bitbucket.org/Davidvdv/sociale-kaart/src/bef7409f36b1/app

What should I change to make this work?

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: DebugKit in 2.0

2011-10-30 Thread LunarDraco
As the App::import no longer recursively scans the sub directories you
need to be specific about the path for FireCake to load.
Both of these worked for my setup where DebugKit is installed in the
main "Plugin" folder
App::import('Lib', 'DebugKit.FireCake');
App::import('Lib', 'DebugKit.FireCake', array('file' =>
'Plugin'.DS.'DebugKit'.DS.'Lib'.DS.'FireCake.php'));

This one did NOT work with my setup: App::import('Vendor',
'DebugKit.FireCake');

This was a clean install of (FireFox, FireBug and FirePHP) and I had
forgot to enable FirePHP from the tools menu. Spent a bit of time on
that because it looks like its loaded and working when you look at
FireBug. But without the FirePHP->enabled checked the UserAgent sent
to the server does not contain the FirePHP version. When FireCake.php
does a check to see if its enabled via the UserAgent version, its
missing, and exits early.

On Oct 30, 5:01 am, Jeremy Burns | Class Outfit
 wrote:
> Worked perfectly thanks (although I had also commented the component out of 
> my AppController, which stumped me for a few moments):
>
> public $components = array('DebugKit.Toolbar');
>
> Jeremy Burns
> Class Outfit
>
> http://www.classoutfit.com
>
> On 30 Oct 2011, at 06:04, LunarDraco wrote:
>
>
>
>
>
>
>
> > I was able to get DebugKit working by
> > cd to Plugins
> > git clonehttps://github.com/cakephp/debug_kit.gitDebugKit
> > After I had a copy I cd into the DebugKit folder then I switched to
> > the 2.0 via
> > git checkout 2.0
> > Updating bootstrap.php to load the plugin (new CakePHP 2.0
> > requirement):
> > CakePlugin::load('DebugKit');
>
> > Modified the View/Layouts/default.ctp by commenting out the following
> > line
> > element('sql_dump'); ?>
>
> > I've got DebugKit working but I'm struggling with DebugKit.FireCake
> > I'm sure it something to do with the changes to App::Import vs
> > App::uses and the App::build paths.
>
> > Morgan
>
> > On Oct 29, 11:16 pm, Jeremy Burns  wrote:
> >> Anyone got any tips for getting DebugKit working in 2.0? I've run the
> >> upgrade script over it and am loading it in bootstrap.
>
> > --
> > Our newest site for the community: CakePHP Video 
> > Tutorialshttp://tv.cakephp.org
> > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help 
> > others with their CakePHP related questions.
>
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> > athttp://groups.google.com/group/cake-php

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: DebugKit in 2.0

2011-10-30 Thread Jeremy Burns | Class Outfit
Worked perfectly thanks (although I had also commented the component out of my 
AppController, which stumped me for a few moments):

public $components = array('DebugKit.Toolbar');

Jeremy Burns
Class Outfit

http://www.classoutfit.com

On 30 Oct 2011, at 06:04, LunarDraco wrote:

> I was able to get DebugKit working by
> cd to Plugins
> git clone https://github.com/cakephp/debug_kit.git DebugKit
> After I had a copy I cd into the DebugKit folder then I switched to
> the 2.0 via
> git checkout 2.0
> Updating bootstrap.php to load the plugin (new CakePHP 2.0
> requirement):
> CakePlugin::load('DebugKit');
> 
> Modified the View/Layouts/default.ctp by commenting out the following
> line
> element('sql_dump'); ?>
> 
> I've got DebugKit working but I'm struggling with DebugKit.FireCake
> I'm sure it something to do with the changes to App::Import vs
> App::uses and the App::build paths.
> 
> Morgan
> 
> On Oct 29, 11:16 pm, Jeremy Burns  wrote:
>> Anyone got any tips for getting DebugKit working in 2.0? I've run the
>> upgrade script over it and am loading it in bootstrap.
> 
> -- 
> Our newest site for the community: CakePHP Video Tutorials 
> http://tv.cakephp.org 
> Check out the new CakePHP Questions site http://ask.cakephp.org and help 
> others with their CakePHP related questions.
> 
> 
> 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

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Going back to school: ACL

2011-10-30 Thread Eric Blanpied
Jeremy,

I've done a number of cakephp apps (1.1, 1.2, 1.3 - starting a 2.0,
too), and have also always been flummoxed by ACL and gone back to my
own code to deal with it. A current project (1.3) has *lots* of roles,
however, including enough overlap that a many-many groups-users setup
seemed like what I wanted. I persevered with ACLs this time, though,
and I'm ending up glad that I did. As others have said, pulling access
control out of most of the code is very, very nice, and the
flexibility to add new roles with mixed degrees of access via the
database is great. I'm experimenting with hierarchical groups to
handle some of the overlap (add a parent_id to your groups table).

One thing that's helped me is Alaxos' acl plugin (thanks, nIcO!) -
while it doesn't map to what I'm doing exactly, having some tools to
manage the tables is vital, and I'm sure glad I didn't have to write
any myself. One thing I'm curious about, nIcO, is the 2.0 story for
your plugin.

Zuha, can you explain a bit further about mixing prefix routing with
ACLs? Our setup is currently still using admin_ prefixes, but as far
as I can tell that's pretty redundant here, unless it could provide a
second angle of access control.

Thanks, everyone!

-eric

On Fri, Oct 28, 2011 at 11:08 AM, alaxos  wrote:
> Hi Jeremy,
>
> As far as I know, the core ACL does not support multiple groups per
> user.
>
> Before using ACL, I used myself a home made component that allowed to
> grant/deny access based on roles membership and action prefixes like
> you do. It used to work :-) and it also supported many-to-many users-
> groups. But since I have changed my habit, and I now use ACL. As
> mentionned by zuha, I prefer the idea to have the possibility to grant/
> deny specific permission to someone or some people without having to
> update the code. Even if it now does not support many-to-many users-
> groups anymore, I think it is more flexible. But I also have to admit
> that I never developped an application with a lot of different
> profiles (so far 4-5 max).
>
> nIcO
>
> On Oct 27, 6:48 pm, Jeremy Burns | Class Outfit
>  wrote:
>> Thanks Richard.
>>
>> Your point about flexibility and extensibility is a good one. You'd define 
>> specific views to do specific functions and then restrict them with 
>> permissions rather than a prefix. That also means one view can be used by 
>> more than one group (although I guess you could equally do that with 
>> $this->render).
>>
>> My second question is the one that puzzles me most. I've designed some 
>> systems where this is very typical; members of staff are department heads, 
>> managers, subordinates, team members, committee members and so on. So one 
>> person changes his role (group) throughout a single session. I'd be 
>> interested to see what others have to say too.
>>
>> I have some SQL that could speed up the acl table reads if you are using 
>> Innodb.
>>
>> Jeremy Burns
>> Class Outfit
>>
>> http://www.classoutfit.com
>>
>> On 27 Oct 2011, at 17:32, zuha wrote:
>>
>>
>>
>>
>>
>>
>>
>> > #1 : Would require a prefix for every role.   admin_index, manager_index, 
>> > user_index, guest_index, etc.   With ACL being database driven you can 
>> > have unlimited user roles and not be required to add new prefixes every 
>> > time you add a role.
>>
>> > #2 : I don't know, interesting question.  It sounds kind of a-typical to 
>> > me though.  You would probably add a 3rd group in that rare case called 
>> > something like, "board-teachers".
>>
>> > #3 : Yes and its not small.  It can be large and a major slow down.
>>
>> > ACL is very flexible but the flexibility comes with the downside of speed 
>> > performance.  I'm quite sure there are caching solutions to get around it, 
>> > but I have not gotten that far yet (even after 2 years of using ACL 
>> > extensively).
>>
>> > --
>> > Our newest site for the community: CakePHP Video 
>> > Tutorialshttp://tv.cakephp.org
>> > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help 
>> > others with their CakePHP related questions.
>>
>> > To unsubscribe from this group, send email to
>> > cake-php+unsubscr...@googlegroups.com For more options, visit this group 
>> > athttp://groups.google.com/group/cake-php
>
> --
> Our newest site for the community: CakePHP Video Tutorials 
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help 
> others with their CakePHP related questions.
>
>
> 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
>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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/

Re: missing ) after argument list error - how does that make sense?

2011-10-30 Thread Tomfox Wiranata
lets say i wanna go with echo, how do i need to quote or escape the
current code, that it works?
cause i have no idea how to implement the value thing..

thanks..appreciate it

On 30 Okt., 05:52, Ryan Schmidt  wrote:
> On Oct 29, 2011, at 10:56, Tomfox Wiranata wrote:
>
> > echo ' > style="float:right;cursor:pointer;">'.$html->image("icons/map.png",
> > array("alt" => "Google Map anzeigen")).'';
>
> [snip]
>
> > now when I hit
> > the icon to open the map, firebug says this:
> > -
>
> > missing ) after argument list
> > showGoogleMap(207,47.378824,8.548737,Tag Heuer Carrera Chronograph)
>
> As you see from the error message (or by viewing source on the page), your 
> PHP code generated the following HTML code:
>
>  Heuer Carrera Chronograph)" style="float:right;cursor:pointer;">...
>
> What got generated inside the onclick attribute is not valid JavaScript code, 
> because the title string is not quoted or escaped properly. You probably want 
> to use JsHelper::value($all['title']) instead of just echoing $all['title'] 
> directly.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Using javascript

2011-10-30 Thread WebbedIT
This is not a CakePHP question.  CakePHP is a PHP framework which
produces HTML, so anything you can do with HTML and javascript can be
done in CakePHP.

Go find a javascript tutorial that matches your requirements and give
it a go, you will feel better for being able to find the answer to
such a simple task yourself!

But just to whet your whistle, here's a little tip from me:
http://jqueryui.com/demos/dialog/

HTH, Paul.

On Oct 29, 6:16 am, arti grover  wrote:
> Hi all,
>
> I want to call a javascript alert box the moment A user clicks on CANCEL
> SESSION link.where should i put the javascript alert box in view and what
> how to code that javascript function inside view??
>
> --
> Regards
> Arti Grover

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Please give me some suggestions on this

2011-10-30 Thread WebbedIT
Have you had a look at Croogo to see if they're implementation would
work for you?

On Oct 29, 4:40 pm, MetZ  wrote:
> Hi all..
>
> I am looking to implement a wysiwyg editor with a media library plugin
> of some kind.. Have been looking at Tinymce and elfinder for library,
> but I am not sure if I should go this way, or if there are any other
> solutions that meets my requirements.
>
> Requirements:
> - Simple wysiwyg (only simple regular text buttons bold, italic, left
> align and so on)
> - possible to tie in a media/file plugin button for images and other
> files
> - access to whole media library trough GUI
>
> I am currently using markitup, and for me, it is perfect, but for
> other admins/moderators that do not know any html, it is not good.
>
> Do any of you have experince with a similar setup for cake
> application?
> Please share your knowledge on how to proceed..
>
> Thanks all!
> -Tom

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: The new 2.0 Exceptions

2011-10-30 Thread AD7six


On Oct 30, 1:48 am, euromark  wrote:
> One needs to get used to them, I guess.
> My current problem is that exceptions jump out of the current method
> if triggered.
>
> So in test cases for example not all tests get executed.
> This can be a good thing.
> But sometimes it would be better if it behaved like errors in 1.3
>
> lets say we are testing an Inflector method.
> And we use a testInflector() method and 10-20 asserts.
> If the first one fails, all others won't even be triggered. What if
> all would pass except the first one?

You are describing a bad test.

> It would help to see them all at once.
>
> Or the other way around.
> The first one fails - and it displays: 1 fail. (it used to display all
> fails - like 14 fails).
> Now we could make the false assumption that 13 of 14 pass...

Why would you assume that.

> At the beginning I didnt even notice that most of the asserts of some
> test cases are not checked due to a single fail.
>
> Yes, I could make an own method for each and every assert.

Don't do that. A test should test one specific case; not 20 similar
cases that call the same method.

> But I was kinda hoping that they can be adjusted to not jump out of
> the current method...
> at least for test cases this would help :)

welll i doubt it. i think you are comparing simpletest (its so long
since ive used it,does it do what you describe?) to phpunit without
realizing - phpunit will stop the test as soon as it has failed, by
any means.
AD

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: How to Paginate Search Results?

2011-10-30 Thread WebbedIT
In recent projects I use CakeDC's searchable plugin, but before that I
simply did the following in my view:
if (!empty($this->passedArgs)) {
  $this->Paginator->options(array('url' => $this->passedArgs));
}

HTH, Paul

On Oct 29, 9:15 pm, Andras Kende  wrote:
> You can do it either with PRG (post redirect get) concept:
>
> http://bakery.cakephp.org/articles/luciansabo/2011/08/12/post_redirec...http://cakedc.com/downloads/view/cakephp_search_plugin
>
> or with write the posted form data  to a session once and keep reading it 
> through pagination
>
> something like:
>
>                 if(!empty($this->data['User']['search_name'])) {
>                         $this->Session->write('conditions.firstname', 
> $thisis->data['User']['search_name']);
>                 }
>
>                 if($this->Session->check('conditions')) {
>                         $conditions = $this->Session->read('conditions');
>                 } else {
>                         $conditions = null
>                 }
>
>                 $this->paginate = array(
>                         'recursive' => -1,
>                         'conditions' => $conditions,
>
> Andras Kendehttp://www.kende.com
>
> On Oct 29, 2011, at 1:27 PM, andrewperk wrote:
>
>
>
>
>
>
>
> > Hello,
>
> > I've implemented a user model and I have a simple search form for
> > searching by gender, age, location. I'm using the paginator to
> > paginate the results. The problem is that it's only remembering the
> > search criteria on the first page. When I click on page 2, or next
> > etc.. It defaults back to searching all users.
>
> > Here's my dirty search code in my controller, basically it just checks
> > the submitted form fields and does a query on the matching field in
> > the Users table and then paginates the results:
>
> > if (!empty($this->data)) {
> >    // by name
> >    if (!empty($this->data['User']['search_name'])) {
> >    $this->paginate = array('conditions' => array('visible'=>1,
> > 'OR'=>array(
> >            'User.username LIKE' => 
> > '%'.$this->data['User']['search_name'].'%',
> >            'User.firstname LIKE' => '%'.$this->data['User']['search_name'],
> >            'User.lastname LIKE' => '%'.$this->data['User']['search_name'])
> >             ), 'limit'=>'10', 'order'=>'User.username');
> >   }
> >   // by gender
> >   else if (!empty($this->data['User']['search_gender'])) {
> >    $this->paginate = array('conditions' => array(
> >            'visible'=>1,
> >            'User.gender' => $this->data['User']['search_gender']
> >            ), 'limit'=>'10', 'order'=>'User.username');
> >  }
> >  // by state
> >  else if (!empty($this->data['User']['search_state'])) {
> >    $this->paginate = array('conditions' => array(
> >            'visible'=>1,
> >            'User.state' => $this->data['User']['search_state']
> >            ), 'limit'=>'10', 'order'=>'User.username');
> >  }
>
> >   // Send the results for the above criteria to the view
> >   $results = $this->paginate('User');
> >   $this->set('users', $results);
>
> >     }
> >     // Default retrieval of all users
> >    else {
> >    $this->paginate = array('conditions'=>array('visible'=>1),
> > 'limit'=>'10', 'order'=>'User.username');
> >            $this->set('users', $this->paginate('User'));
> >    }
>
> > I'm trying to figure out how to make subsequent pages of the
> > pagination remember my search criteria. Thanks for any help.
>
> > --
> > Our newest site for the community: CakePHP Video 
> > Tutorialshttp://tv.cakephp.org
> > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help 
> > others with their CakePHP related questions.
>
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> > athttp://groups.google.com/group/cake-php

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


query

2011-10-30 Thread SERKAN TURAN
Hi,
I have an query and I could not figure it out what is the cakephp form of
it.

query:
---
SELECT *
FROM
  tags`
  INNER JOIN `tags_articles` ON (`tags`.`id` = `tags_articles`.`tag_id`)
  INNER JOIN `articles` ON (`tags_articles`.`article_id` = `articles`.`id`)
WHERE
  `articles`.`isRead` = 'Not' AND
  `tags`.`id` = 3 AND
  `articles`.`status` = 'New'
ORDER BY
  `articles`.`name` DESC
--

Thnks..
ST

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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