Re: Email Notification Problem

2009-02-11 Thread Kyle Decot

For anyone that is attempting the same thing as me, I solved the
problem by doing:

App::import("Component","Email");
$this->Email = new EmailComponent();
$this->Email->startup($this);

--~--~-~--~~~---~--~~
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: How to use cakephp core utility library (Set::combine ) to transform array?

2009-02-11 Thread brian

On Thu, Feb 12, 2009 at 1:09 AM, mscdex  wrote:
>
> On Feb 11, 11:58 pm, Andre  wrote:
>> Hi all,
>> Can anyone help on writing the snippet using cakephp core utility
>> library to combine array?
>
> If you look at Set::combine (http://book.cakephp.org/view/662/
> combine), you'll notice that both the path for the key and/or the path
> for the value can be specially formatted instead of just specifying a
> normal path for each. There are many examples on that link that show
> the many different possibilities for generating the combined array.
>
> Here is an example snippet ($array contains the array you specified):
>$service_name = $array[0]['Service']['name'];
>$new_array = Set::combine($array, "0.Member.{n}.id", array("{1}, {0}-
> $service_name", "0.Member.{n}.first_name", "0.Member.{n}.last_name"));

Neato. I think I'm begining to understand combine().

You'd need to loop through the results, though, to deal with
$array[{n}] results. Would this work:

function afterFind($results, $primary = false)
{
if ($primary)
{
foreach($results as $k => &$v)
{
$v = Set::combine(
$v,
'Member.{n}.id',
array(
'{1}, {0}-Service.name',
'Member.{n}.first_name',
'Member.{n}.last_name'
)
);
}
$v = Set::merge($v);
}
return $results;
}

--~--~-~--~~~---~--~~
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: Cron Job Hostgator

2009-02-11 Thread Kyle Decot

I've put what you suggested into my Cron Manager on my HostGator admin
panel but I am receiving an email that says:

TERM environment variable not set.
1

Any ideas? Thank you as always!


On Jan 21, 2:53 am, Martin Westin  wrote:
> You type (paste) something like this into a terminal window:
>
> /path/to/cake/console/cake -app /path/to/cake/app
>
> you then add the name of theshellyou want to run. My cron task is
> called "hourly" as in my previous post.
> When running this as a cron job (= automatically) I have found the
> return from theshellcauses problems so I add " >>/
> dev/null 2>&1 " at the end which swallows any output.
>
> On your Mac you might not want to run it as a cron. But if you do
> there are applications to download that give you a graphical tool to
> set cron jobs (or Apple's replacement as the case may be). The actual
> "cron" tools are aparently now seen av deprecated by Apple (sigh) but
> they are still there.
>
> /Martin
>
> On Jan 20, 2:57 pm,KyleDecot wrote:
>
> > I'm really confused aboutshelltasks. How would I invoke the task? I
> > know that I would use terminal (I'm on a mac) but how would I do this?
> > Second, how do you automate this process so that it would run every
> > hour?
--~--~-~--~~~---~--~~
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: How to use cakephp core utility library (Set::combine ) to transform array?

2009-02-11 Thread mscdex

On Feb 11, 11:58 pm, Andre  wrote:
> Hi all,
> Can anyone help on writing the snippet using cakephp core utility
> library to combine array?

If you look at Set::combine (http://book.cakephp.org/view/662/
combine), you'll notice that both the path for the key and/or the path
for the value can be specially formatted instead of just specifying a
normal path for each. There are many examples on that link that show
the many different possibilities for generating the combined array.

Here is an example snippet ($array contains the array you specified):
$service_name = $array[0]['Service']['name'];
$new_array = Set::combine($array, "0.Member.{n}.id", array("{1}, {0}-
$service_name", "0.Member.{n}.first_name", "0.Member.{n}.last_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 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: paginate with "having"

2009-02-11 Thread brian

On Thu, Feb 12, 2009 at 12:43 AM, mscdex  wrote:
>
> On a somewhat unrelated note, your use of the avg() (or any other)
> mysql function in the field list will make the result of that function
> be stored in index zero of the array returned after executing the
> pagination query. There's several ways to go about remedying that,
> although IIRC teknoid had a post about using the afterFind() callback
> to do manual adjusting of the results array.

here's the link
http://teknoid.wordpress.com/2008/09/29/dealing-with-calculated-fields-in-cakephps-find/

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Errors in PDF Generated with TCPDF

2009-02-11 Thread AL

Hello,

I am using the TCPDF method published in the Bakery to generate pdfs.
The pdf generated has this error Too Many Operands.

Also when the file was opened initially, the content is visible but
with error, part of the content on page 3 is rendered on page 2. But
when I start to scroll to the next page, the content disappears,
leaving page 1 and 2 blank, page 3 is the last page.

Have any one encountered such errors with TCPDF? Did you managed to
solve it?
My Codes:

App::import('Vendor','xtcpdf');
$tcpdf = new XTCPDF();
$tcpdf->SetFont('dejavusans', '', 8);
$tcpdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);

if(!is_array($content)) {
$content = array($content);
}

$tcpdf->AddPage();
$tcpdf->WriteHTML(implode('', $content));
switch($dest) {
case 'F':
if(!is_dir($pdf_dir)) {
mkdir($pdf_dir);
}
$pdf_name = $pdf_dir.$pdf_name;
break;
}
$tcpdf->lastPage();
return $tcpdf->Output($pdf_name, $dest);

Thanks,
Ai Leen
--~--~-~--~~~---~--~~
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: custom error pages -> how to make cake redirect to another page

2009-02-11 Thread mscdex

On Feb 11, 9:35 pm, MarcS  wrote:
> Hello everyone,
>
> I know that I can change the default cake error messages by changing
> the templates for them.
> Is there a way so I can configure cake to redirect to another page
> when I specify the URL?

I think this may help you: 
http://cakebaker.42dh.com/2006/06/15/writing-a-custom-error-handler/
Just make sure you use the Cake 1.2 code shown there.
--~--~-~--~~~---~--~~
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: paginate with "having"

2009-02-11 Thread mscdex

On Feb 11, 6:21 pm, welzie  wrote:
> What I don't know is how to get the "having" to work.  Please help.

Have you tried adding a condition to your condition subarray in your
controller's $paginate variable that says: "1=1 GROUP BY candidates.id
HAVING avg_overall_rating > 3"

e.g. var $paginate = array('conditions' => array('1=1 GROUP BY
candidates.id HAVING avg_overall_rating > 3', ''), 'fields' =>
array(), .);

Fill in the 's with your other appropriate options ;-)

On a somewhat unrelated note, your use of the avg() (or any other)
mysql function in the field list will make the result of that function
be stored in index zero of the array returned after executing the
pagination query. There's several ways to go about remedying that,
although IIRC teknoid had a post about using the afterFind() callback
to do manual adjusting of the results array.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



How to use cakephp core utility library (Set::combine ) to transform array?

2009-02-11 Thread Andre

Hi all,
Can anyone help on writing the snippet using cakephp core utility
library to combine array?
I want to get this array:
Array
(
[13] => Chang, Jonathan-Chinese
[28] => Hidayat, Alexander-Chinese
)

>From the following array possibly, using Set:extract or Set::combine?


Array
(
[0] => Array
(
[Service] => Array
(
[id] => 1
[name] => Chinese
[description] => Chinese Service
[created] => 2009-01-31 20:59:33
[modified] => 2009-02-08 19:53:16
)

[Member] => Array
(
[0] => Array
(
[id] => 13
[first_name] => Jonathan
[last_name] => Chang
[MembersService] => Array
(
[id] => 9
[member_id] => 13
[service_id] => 1
[created] =>
[modified] =>
)

)

[1] => Array
(
[id] => 28
[first_name] => Alexander
[last_name] => Hidayat
[MembersService] => Array
(
[id] => 14
[member_id] => 28
[service_id] => 1
[created] =>
[modified] =>
)

)

)

)

)


Thanks


--~--~-~--~~~---~--~~
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: load view in iframe

2009-02-11 Thread brian

On Wed, Feb 11, 2009 at 9:30 PM, mscdex  wrote:
>
> On Feb 11, 6:05 pm, brian  wrote:
>> But, if anyone knows how to get an iframe to load an admin view, I'd
>> love to know.
>
> I'm wondering if it's an issue with the iframe not having the proper
> authentication cookies set somehow. What browser(s) have you tried the
> admin view with? If you're trying to view it in IE, perhaps try
> lowering the "security" level in the browser options temporarily or
> try viewing it in a different browser such as Firefox.

Yup, that's what I think, also. I did some more searching, once I
figured out what the problem was, but didn't turn up a whole lot more
specific to Cake. For now, it works, so I'm just going to move on.

This was in FF, btw.

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



paginate with "having"

2009-02-11 Thread welzie

I am trying to use paginate for a paged, sortable, searchable list of
candidates.   Below is an example of the query that I would like
paginate to execute.

select candidates.name, avg(candidate_ratings.overall_rating) as
avg_overall_rating
from candidates
join candidate_ratings on candidates.id =
candidate_ratings.candidate_id
join candidates_candidate_types on candidates.id =
candidates_candidate_types.candidate_id
where
candidates_candidate_types.id IN (1,2,3,4)
group by candidates.id
having avg_overall_rating > 3

I have used
-custom paginate and paginateCount methods in my model
-conditions array for the IN
-edited controller.php to get the sorting to work for fields that are
not part of the model

What I don't know is how to get the "having" to work.  Please 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 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



dashes in action names

2009-02-11 Thread spence

Hi,

Are you allowed to use dashes in action names. IE: domain.com/
controllerName/action-name

I know underscores work, but I did not have any luck with dashes? Do
you need to configure something for it to work?

Thanks,
Spence

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



custom error pages -> how to make cake redirect to another page

2009-02-11 Thread MarcS

Hello everyone,

I know that I can change the default cake error messages by changing
the templates for them.
Is there a way so I can configure cake to redirect to another page
when I specify the URL?
--~--~-~--~~~---~--~~
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: load view in iframe

2009-02-11 Thread mscdex

On Feb 11, 6:05 pm, brian  wrote:
> But, if anyone knows how to get an iframe to load an admin view, I'd
> love to know.

I'm wondering if it's an issue with the iframe not having the proper
authentication cookies set somehow. What browser(s) have you tried the
admin view with? If you're trying to view it in IE, perhaps try
lowering the "security" level in the browser options temporarily or
try viewing it in a different browser such as Firefox.

Those are just some things I can think of off the top of my head. I
haven't worked with admin stuff yet in Cake, but I know iframes in
general can be a pain to work with at times when writing code that
deals with them.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Alternative Routing for RSS

2009-02-11 Thread maestro777

I'm trying to create an alternative routing for my RSS feed. In my
Route config,  I have the following:

Router::connect('/presses/rss', array('controller' => 'presses',
 'action' => 'rss_feed',
 'url' => array('ext' => 'rss')
) );

I have a  rss_feed action created in the Presses controller.

I could get to the feed without problem using the url :
 http://localhost/mysite/presses/rss_feed.rss

But when I tried using the alternative route I have an error:

 Error:  The view for PressesController::rss_feed() was not found.

Apparently it was looking for the view at ..\mysite\app\views\presses
\rss_feed.ctp instead of mysite\app\views\presses\rss\rss_feed.ctp

I'd appreciate very much if someone should help shed some light on
what I am not doing right. I have spent hours trying to figure this
thing out without success.

Thanks in advance.


--~--~-~--~~~---~--~~
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: first program in cakephp

2009-02-11 Thread Son Dat Giang
Yeah, and you have to build your own application from cake. And you should
try http://book.cakephp.org/view/330/Creating-the-Blog-Database  to build
your 1st cake app with database.
Good luk
-
Best regards !
Giang Son Dat
Mobile: +84 988114164
Email giangson...@gmail.com, giangson...@yahoo.com


On Wed, Feb 11, 2009 at 3:51 AM, dr. Hannibal Lecter wrote:

>
> Hmmm, well what did you expect? CakePHP is a framework, not an
> application.
>
> http://book.cakephp.org/view/9/where-to-get-help
>
> On Feb 11, 9:12 am, kapil  wrote:
> > i want to run my first cakephp program. but after installation nothing
> > is happened just database is connected nothing
> > more. plz help me
> >
> > thanks in advance
> >
>

--~--~-~--~~~---~--~~
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: odd database problem

2009-02-11 Thread mscdex

On Feb 3, 9:30 am, hellfish  wrote:
> The tables are there, the app does connect without error but all I get
> is the "Missing Database Table".

How are you importing/adding the tables to the database on the ISP's
end? Did you do an export (using PHPMyAdmin for example) from your
local database and then import/execute that sql script on the remote
database?

If it wasn't an exact duplicate of your local database in this way,
then I'm wondering if it is a "small" error on the ISP database end.
For example model table(s) that may not be plural or join table names
not in alphabetical order or something along those lines?
--~--~-~--~~~---~--~~
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: view pdf files?

2009-02-11 Thread justclint

Thanks Brian. That helps a lot. The only thing Ive been using webroot
for was just images and my ccs and js. I didnt realize it was meant to
be (literally) the webroot. This is the first MVC framework I've used.

Well my forms finally link correctly now.

However I did notice one little detail. It doesnt bother me, I dont
need to fix it but I just thought Id throw this out there.

I noticed that if I had a directory in my views like:

/fitness_lab/forms (forms being a folder with views in it)

then I could not make the same directory in the webroot. I had to
change it to:

/fitness_lab/form (no 's').

Brian, thanks again for all your help!

justclint



On Feb 9, 6:23 pm, brian  wrote:
> You don't need the controller serve PDFs unless you have some reason
> to keep them inaccessible to casual browsers and want to use some kind
> of authorisation. In that case, you'd want to look at MediaView.
> Otherwise, just let Apache serve it as any other file. Hence, you put
> it under webroot. Anything that's under that directory is accessible
> with a direct link--images, javascript, CSS files, etc. So, you can
> create whatever directory structure you want in there if you have
> reason to.
>
> Perhaps the confusion stems from the fact that the HtmlHelper has a
> method to create image links. But, if you look carefully, you'll see
> that the URL points directly to the image file under webroot, not a
> controller. I think that maybe the only reason $html->image() exists
> is because too many people were becoming confused by Cake's mysterious
> DOCUMENT_ROOT shuffling (I was) that they were messing up their img
> links.
>
> To answer your other question about the views dir, all those files in
> there are basically templates for displaying a controller's output.
> That's not the webroot, but simply a convenient directory in which to
> store template files. What mscdex was suggesting is, if you happened
> to have a controller action where you wanted to redirect the request
> to somePDFfile, you'd use the public URL as the param to redirect().
> Something like
>
> $this->redirect('/fitness_lab/forms/health_questionnaire.pdf');
>
> But I'm pretty sure that's not what you're after here. Just leave the
> controller out of it.
>
> On Mon, Feb 9, 2009 at 8:01 PM, justclint  wrote:
>
> > Thanks mscdex. Your 2nd suggestion is exactly what Im trying to do.
> > Brian suggested adding the directory to webroot which works as
> > intended.
>
> > However, I did have the pdfs in a the views folder and I tried the
> > redirect() but I run into the same problem trying to define what the
> > controller and action would be for apdffile.
>
> > How would I use this redirect to show thepdffile?
>
> > Thanks!
>
> > justclint
>
> > On Feb 8, 10:08 pm, mscdex  wrote:
> >> Generally if you are manually rendering a view, you should do: 
> >> $this->autoRender = false;
>
> >> If you are trying to get thePDFto show up instead of the controller
> >> action's view, you could try doing a $this->redirect() as documented
> >> here:http://book.cakephp.org/view/425/redirect
--~--~-~--~~~---~--~~
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: Validation rule with or

2009-02-11 Thread Smelly_Eddie

I finished a quick mockout of the code for my article. I am still
adding the finishing touches, but you can get the idea.

The one main change I hope to make by the time this gets read is to
handle all the logic upfront, and only once, instead of for each
field.

So here it is.. Validating dependent fields in CakePHP... THe dreaded
OR rule
http://edwardawebb.com/programming/php-programming/cakephp/validating-optional-fields-cakephp-dreaded-scenario

On Feb 11, 11:07 am, WebbedIT  wrote:
> Sounds like a more elegant approach than mine .. look forward to the
> article :)
--~--~-~--~~~---~--~~
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: load view in iframe

2009-02-11 Thread brian

I just figured it out. I removed the 'admin' => 1 from the route and
the 'admin_' from the view filename and it worked. Like a charm, in
fact.

But, if anyone knows how to get an iframe to load an admin view, I'd
love to know.

On Wed, Feb 11, 2009 at 5:19 PM, brian  wrote:
> Can someone point out the (I'm sure) obvious thing I'm missing to get
> a view to load in an iframe?
>
> I'm trying to create an interface to SwiftMailerComponent which has
> batch sending capabilities. It can also print out a progressive list
> of recipients and whether the message was successfully sent or not.
> This is handy in case the batch fails for some reason--the list of
> successful recipients up until that point will be printed out already.
>
> So, what I'm trying to do is to load the message form inside of an
> iframe so that the submit won't refresh the page and SwiftMailer's
> progressive output can be received. I have to use an iframe because
> ajax won't deal with the progressive output (correct me if I'm wrong).
>
> The situation looks like this:
>
> admin.ctp [ layout ]
>  admin_contact.ctp [ action view ]
>iframe [ url: /admin/members/contactForm ]
>  admin_contact_form.ctp [ form view ]
>
>
> There's also a 'contact_form' layout, which is just a basic wrapper to
> complete the form HTML page.
>
> admin_contact.ctp contains:
>  height="600">
>
> The created url looks good.
>
> In MembersController, I have an admin_contact() method to deal with
> sending the message. When there's no data, it simply renders the main
> view.
>
> The only way I could think to get the iframe contents rendered was to do this:
>
> public function admin_contactForm()
> {
>$this->layout = 'contact_form';
>$this->render('admin_contact_form');
> }
>
> But I'm not seeing anything, including the layout contents. I stuck a
> Debugger::log in there but not a peep. And no errors, either.
>
> And, if anyone can think of a better way (anything that works,
> actually) I'm all ears.
>

--~--~-~--~~~---~--~~
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: help with complex condations brian-9

2009-02-11 Thread monirr444


Thank you Man your The besst

monirr444 wrote:
> 
> here is the code i want to search but not inactive ones i have this code
> so far it wont work
> thank you helping the other  time 
> if u can help with that would be great 
> 
>   function search($item = null) {
>$item = $this->params['url']['q'];
> $recipes = $this->Recipe->find('all', array('conditions' => array(
> 'OR' =>array(
>  'Recipe.name LIKE' => '%' . $item . '%',
>  'Recipe.seasonal LIKE' => '%' . $item . '%',
>  'Recipe.ingredients  LIKE' => '%' . $item . '%')),
>  'AND' => array(
>  array(
>  'OR'=>array(
>  'Recipe.active' =>'1'),
>  'NOT'=>array(
>  'Recipe.active'=> array('0')),
> 'order' => 'Recipe.name',
> 'recursive' => 1,
>  
>
> ;
> 

-- 
View this message in context: 
http://n2.nabble.com/help-with-complex-condations-brian-9-tp2310476p2311928.html
Sent from the CakePHP mailing list archive at Nabble.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 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: can sombody help me here plz

2009-02-11 Thread monirr444


ok here it is 
this is in my public website its search thing to search recipes 
i put these 3 condations it works fine but only things i dont want them to
see the inactive recipes 
there is field active when is active its "1" when its not its '0'
when i search it show all the inactive one i wanna exclude inactive ones
sorry for the english 

Miles J wrote:
> 
> 
> Can you tell as what exactly your trying to query, OR what the query
> should look like.
> > 
> 
> 

-- 
View this message in context: 
http://n2.nabble.com/can-sombody-help-me-here-plz-tp2311545p2311879.html
Sent from the CakePHP mailing list archive at Nabble.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 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: help with complex condations brian-9

2009-02-11 Thread Martin Radosta
Try this:

function search($item = null) {
$item = $this->params['url']['q'];
$recipes = $this->Banco->find('all',
array('conditions' => array(
'AND' => array(
'OR' =>array(
'Recipe.name LIKE'  => '%' . $item . '%',
'Recipe.seasonal LIKE'  => '%' . $item . '%',
'Recipe.ingredients  LIKE' => '%' . $item . '%'),
'Recipe.active' =>'1',
'NOT'=>array('Recipe.active'=> '0'))),
 'order' => 'Recipe.name',
 'recursive' => 1));
}

Or even simple, because if it's active = 1, can't be active = 0 at same
time. Don't know if you have other possibles values, but take a look at
this:

function search($item = null) {
$item = $this->params['url']['q'];
$recipes = $this->Banco->find('all',
array('conditions' => array(
'AND' => array(
'OR' =>array(
'Recipe.name LIKE'  => '%' . $item . '%',
'Recipe.seasonal LIKE'  => '%' . $item . '%',
'Recipe.ingredients  LIKE' => '%' . $item . '%'),
'NOT'=>array('Recipe.active'=> '0'))),
 'order' => 'Recipe.name',
 'recursive' => 1));
}

On Wed, Feb 11, 2009 at 4:37 PM, monirr444  wrote:

>
>
> here is the code i want to search but not inactive ones i have this code so
> far it wont work
> thank you helping the other  time
> if u can help with that would be great
>
>function search($item = null) {
> $item = $this->params['url']['q'];
>$recipes = $this->Recipe->find('all', array('conditions' => array(
> 'OR' =>array(
>  'Recipe.name LIKE' => '%' . $item . '%',
>  'Recipe.seasonal LIKE' => '%' . $item . '%',
>  'Recipe.ingredients  LIKE' => '%' . $item . '%')),
>  'AND' => array(
>  array(
>  'OR'=>array(
>  'Recipe.active' =>'1'),
>  'NOT'=>array(
>  'Recipe.active'=> array('0')),
>'order' => 'Recipe.name',
>'recursive' => 1,
>
>
> ;
> --
> View this message in context:
> http://n2.nabble.com/help-with-complex-condations-brian-9-tp2310476p2310476.html
> Sent from the CakePHP mailing list archive at Nabble.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 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: switching databases on dev and production

2009-02-11 Thread BrendonKoz

I'm looking in to using Capistrano (or Fredistrano, built with CakePHP
- http://code.google.com/p/fredistrano/) to automate this task, if
possible.  I don't know much about these tools, but I *think* they're
capable of automating these tasks without creating code that gets sent
to the server (though you'd have to write scripts for (Cap|Fred)
istrano.

On Feb 11, 2:22 pm, gerhardsletten  wrote:
> Read this today:
>
> switch($_SERVER['SERVER_NAME']){
> case ‘digbiz.localhost’:
> $this->default = $this->dev;
> break;
> case ‘digbiz.example.com’:
> $this->default = $this->prod;
> break;
> default:
> // we are likely baking, use our local db
> $this->default = $this->dev;
>
> }
>
> viahttp://edwardawebb.com/programming/php-programming/cakephp/automatica...
>
> My own solution, since I am using code.google.com for some of my
> projects:
>
> database.php:
>
>  include dirname(__FILE__) . '/../../database_site.php';
> ?>
>
> Moving my database settings out of the app directory
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



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', 'direction' =>
'desc'));

If I click on 'Date' the direction shown in the link remains on DESC -
this is okay for what I need as I don't especially need Cake to flip
the order desc/asc on the Date sort. However, I'm having problems with
the Date LINK inheriting the sort order from a previous sort.

I'll try to explain, I hope this is clear :)

When sorting first by Date, then by Title, and then re-sorting by
Date, the default sort order for the 'Date' link ignores the
'direction' => 'desc'.

There does not seem to be a problem if I first sort by Title, the URL
on the Date link actually resets itself to DESC.

Is there a bug here?

If not can anyone help me understand how I might set the Date link to
always use DESC.

Many thanks for your 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 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



load view in iframe

2009-02-11 Thread brian

Can someone point out the (I'm sure) obvious thing I'm missing to get
a view to load in an iframe?

I'm trying to create an interface to SwiftMailerComponent which has
batch sending capabilities. It can also print out a progressive list
of recipients and whether the message was successfully sent or not.
This is handy in case the batch fails for some reason--the list of
successful recipients up until that point will be printed out already.

So, what I'm trying to do is to load the message form inside of an
iframe so that the submit won't refresh the page and SwiftMailer's
progressive output can be received. I have to use an iframe because
ajax won't deal with the progressive output (correct me if I'm wrong).

The situation looks like this:

admin.ctp [ layout ]
  admin_contact.ctp [ action view ]
iframe [ url: /admin/members/contactForm ]
  admin_contact_form.ctp [ form view ]


There's also a 'contact_form' layout, which is just a basic wrapper to
complete the form HTML page.

admin_contact.ctp contains:


The created url looks good.

In MembersController, I have an admin_contact() method to deal with
sending the message. When there's no data, it simply renders the main
view.

The only way I could think to get the iframe contents rendered was to do this:

public function admin_contactForm()
{
$this->layout = 'contact_form';
$this->render('admin_contact_form');
}

But I'm not seeing anything, including the layout contents. I stuck a
Debugger::log in there but not a peep. And no errors, either.

And, if anyone can think of a better way (anything that works,
actually) I'm all ears.

--~--~-~--~~~---~--~~
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: can sombody help me here plz

2009-02-11 Thread Miles J

Can you tell as what exactly your trying to query, OR what the query
should look like.
--~--~-~--~~~---~--~~
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: getting information from all your plugins

2009-02-11 Thread Matt Curry

Since you asked...it depends...

If this is an system you're going to be distributing and others will
write plugins for it (like Wordpress), then I would assume the plugin
would need to be installed/activated somehow (meaning NOT just dropped
into the plugin dir). In which case you could read the menu info once
from a config file or from the controller like we are doing and store
it in your db plugins table.  Then you would be able to use your
Plugin model to get all the menu items.

Alternately, if this is a system you're just going to be using, then
you can skip the whole install/active process and just keep a list of
your plugin menu items somewhere (bootstrap, db...)

Another option is the keep the system you have coded above, but add
caching (http://book.cakephp.org/view/764/Cache)

-Matt
http://www.pseudocoder.com




On Feb 11, 4:14 pm, Evert  wrote:
> Hmm, for some reason everybody on IRC is telling me to not use
> controllers for that.
> Most say I should use views and some say I should use models.
> What do you think? And why?
>
> If I should use views, then should I use elements or what? That would
> kinda suck, cause most plugins have just one menu-item. So that would
> mean I'd have to create element-files with just one line of code.
>
> If I should use models, why? how?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



can sombody help me here plz

2009-02-11 Thread monirr444


here is the code i want to search but not inactive ones i have this code so
far it wont work 



function search($item = null) { 
 $item = $this->params['url']['q']; 
$recipes = $this->Recipe->find('all', array('conditions' => array( 
'OR' =>array( 
 'Recipe.name LIKE' => '%' . $item . '%', 
 'Recipe.seasonal LIKE' => '%' . $item . '%', 
 'Recipe.ingredients  LIKE' => '%' . $item . '%')), 
 'AND' => array( 
 array( 
 'OR'=>array( 
 'Recipe.active' =>'1'), 
 'NOT'=>array( 
 'Recipe.active'=> array('0')), 
'order' => 'Recipe.name', 
'recursive' => 1, 
  

; 
-- 
View this message in context: 
http://n2.nabble.com/can-sombody-help-me-here-plz-tp2311359p2311359.html
Sent from the CakePHP mailing list archive at Nabble.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 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: php|tek - any CakePHP devs going to the conference?

2009-02-11 Thread NicholasZ

I am attending ... my first PHP conference ever.  Looking forward to
it greatly!

On Feb 11, 10:30 am, BrendonKoz  wrote:
> ...because apparently there's a "Hackathon" going on.  Both symfony
> and Zend Framework (as well as Solar) are represented, so I was just
> curious.  For more information:http://tek.mtacon.com/c/s/hackathon
>
> If you go to Chicago, I hope you guys blog about it so we can benefit
> too!  :D
>
> I should have gone to php|tek when it was on the cruise...

--~--~-~--~~~---~--~~
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: getting information from all your plugins

2009-02-11 Thread Evert

Hmm, for some reason everybody on IRC is telling me to not use
controllers for that.
Most say I should use views and some say I should use models.
What do you think? And why?

If I should use views, then should I use elements or what? That would
kinda suck, cause most plugins have just one menu-item. So that would
mean I'd have to create element-files with just one line of code.

If I should use models, why? how?
--~--~-~--~~~---~--~~
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: Turning $_GET/$_POST into named params

2009-02-11 Thread Miles J

Anyone have an idea how to do the .htaccess?
--~--~-~--~~~---~--~~
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: getting information from all your plugins

2009-02-11 Thread Matt Curry

You can pass a second value to init, which is the type.  Not really
clear what the options are, but I think "Controller" would work.

Your code looks fine, although you don't need to call constructClasses
and Component->initialize just to get the menu items.  Although maybe
you're doing something later where you need that...

-Matt
http://www.pseudocoder.com


On Feb 11, 2:57 pm, Evert  wrote:
> What do you think about this code?
>
>          class AppController extends Controller {
>                 var $plugins = array();
>                 var $normalMenu = array();
>                 var $adminMenu = array();
>
>                 function beforeFilter() {
>                         $this->plugins = Configure::listObjects('plugin');
>                         $cnt = count($this->plugins);
>
>                         for ($i=0;$i<$cnt;++$i) {
>                                 $this->plugins[$i] = 
> Inflector::camelize($this->plugins[$i]);
>                                 App::import ('Controller', 
> $this->plugins[$i].'.'.$this->plugins
> [$i]);
>                                 $this->plugins[$i] = 
> $this->plugins[$i].'Controller';
>                                 $this->plugins[$i] =& new $this->plugins[$i];
>
>                                 $this->plugins[$i]->constructClasses();
>                                 
> $this->plugins[$i]->Component->initialize($controller);
>
>                                 if (isset($this->plugins[$i]->menuLinks)) 
> {$normalMenu[] = $this->plugins[$i]->menuLinks;}
>
>                                 if (isset($this->plugins[$i]->adminLinks)) 
> {$adminMenu[] = $this->plugins[$i]->adminLinks;}
>
>                         }
>                 }
>         }
> ?>
--~--~-~--~~~---~--~~
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: odd database problem

2009-02-11 Thread hellfish

I'm not using any prefixes on the tables.

I'm sure I can connect to the DB because if I change any of the DB
connection params I get errors (I suppose that this is a good way).

Debugging is also set to level 2

:|

On Feb 4, 4:08 pm, Smelly_Eddie  wrote:
> Are you using different prefixes for the tables?
>
> How are you sure you can connect to the DB?
>
> Have you tried turning on debugging?
>
> On Feb 4, 4:24 am, hellfish  wrote:
>
> > I've already done that, several times.
>
> > On top of this, the logs show no errors at all.
>
> > On Feb 3, 7:21 pm, Braindead  wrote:
>
> > > Did you already delete the cached files? I guess this should solve
> > > your problem.
--~--~-~--~~~---~--~~
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: getting information from all your plugins

2009-02-11 Thread Evert

What do you think about this code?

plugins = Configure::listObjects('plugin');
$cnt = count($this->plugins);

for ($i=0;$i<$cnt;++$i) {
$this->plugins[$i] = 
Inflector::camelize($this->plugins[$i]);
App::import ('Controller', 
$this->plugins[$i].'.'.$this->plugins
[$i]);
$this->plugins[$i] = 
$this->plugins[$i].'Controller';
$this->plugins[$i] =& new $this->plugins[$i];

$this->plugins[$i]->constructClasses();

$this->plugins[$i]->Component->initialize($controller);

if (isset($this->plugins[$i]->menuLinks)) 
{$normalMenu[] = $this-
>plugins[$i]->menuLinks;}
if (isset($this->plugins[$i]->adminLinks)) 
{$adminMenu[] = $this-
>plugins[$i]->adminLinks;}
}
}
}
?>
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



HABTM Search Problem

2009-02-11 Thread Jesse

I know that HABTM problems are pretty frequnt. I've been doing lots of
research and almost got this figured out. A little boost would really
be appreciated.

The Downlow...

Merchants
Merchants hasMany Addresses
Merchants hasMany Coupons
Coupons HABTM tags
tags HABTM coupons

I've got a search for the tags area that then returns the Coupon
information. Everything works fine except I need to pull some more
information. My problem is I am unbinding/binding information on the
fly to do the search and I think this is causing my recursion problem.
Here's the code.

$cat_count = count($conditions['OnsaleCouponsCategory.id']);



$this->OnsaleCoupon->unbindModel(array
('hasAndBelongsToMany' => array('OnsaleCouponCategory')));
$this->OnsaleCoupon->bindModel(
array(
'hasOne' => array(
'OnsaleCouponsOnsaleCouponsCategory' =>
array(
'foreignKey' => false,
'type' => 'INNER',
'conditions' => array
('OnsaleCouponsOnsaleCouponsCategory.onsale_coupon_id =
OnsaleCoupon.id')
),
'OnsaleCouponsCategory' => array(
'foreignKey' => false,
'type' => 'INNER',
'conditions' => array(
'OnsaleCouponsCategory.id =
OnsaleCouponsOnsaleCouponsCategory.onsale_coupons_category_id',
//'OnsaleCouponsCategory.id' =>
array(14)
'OnsaleCouponsCategory.id' =>
$conditions['OnsaleCouponsCategory.id']
)
)
)
)

);

$found_coupons = $this->OnsaleMerchant->OnsaleCoupon-
>find('all', array(
'recursive' => 1,
'group' => array(
'OnsaleCoupon.id',
//'OnsaleCoupon.title HAVING COUNT(*) = 1'
'OnsaleCoupon.title HAVING COUNT(*) = ' .
$cat_count
)
));

Here a print_r for $found_coupons:
Array
(
[0] => Array
(
[OnsaleCoupon] => Array
(
[id] => 38
[onsale_merchant_id] => 16
[title] => Free Soft Drink!
[content] => Get a free soft drink with the
purchase of any meal!
[datestart] => 2009-02-05 08:14:00
[dateend] => 2009-02-05 08:14:00
[retail_price] =>
[sale_price] =>
)

[OnsaleMerchant] => Array
(
[id] => 16
[name] => Happy Joes Pizza
[website] => http://www.happyjoes.com
[about_us] => About us!
[hours] => Hours!
[logo] => image/jpeg
[onsale_merchants_category_id] => 2
)

[OnsaleCouponsOnsaleCouponsCategory] => Array
(
[id] => 115
[onsale_coupon_id] => 38
[onsale_coupons_category_id] => 14
)

[OnsaleCouponsCategory] => Array
(
[id] => 14
[title] => American
[onsale_coupons_categories_division_id] => 3
[0] => Array
(
[id] => 3
[title] => Golfing
[onsale_coupons_categories_division_id] =>
4
[OnsaleCouponsOnsaleCouponsCategory] =>
Array
(
[id] => 117
[onsale_coupon_id] => 38
[onsale_coupons_category_id] => 3
)

)

[1] => Array
(
[id] => 11
[title] => Chinese
[onsale_coupons_categories_division_id] =>
3
[OnsaleCouponsOnsaleCouponsCategory] =>
Array
(
[id] => 116
[onsale_coupon_id] => 38
[onsale_coupons_category_id] => 11
)

)

[2] => Array
(
[id] => 14
[title] => American
[onsale_coupons_categories_division_id] =>
3
 

Re: getting information from all your plugins

2009-02-11 Thread Evert

It's not working and from what I can understand from the API, that
function only works with Model and AppModel.
But, I'll try other things with ClassRegistry, thanks anyway.
--~--~-~--~~~---~--~~
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: switching databases on dev and production

2009-02-11 Thread gerhardsletten

Read this today:

switch($_SERVER['SERVER_NAME']){
case ‘digbiz.localhost’:
$this->default = $this->dev;
break;
case ‘digbiz.example.com’:
$this->default = $this->prod;
break;
default:
// we are likely baking, use our local db
$this->default = $this->dev;
}

via 
http://edwardawebb.com/programming/php-programming/cakephp/automatically-choose-database-connections-cakephp

My own solution, since I am using code.google.com for some of my
projects:

database.php:



Moving my database settings out of the app directory
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



help with complex condations brian-9

2009-02-11 Thread monirr444


here is the code i want to search but not inactive ones i have this code so
far it wont work
thank you helping the other  time 
if u can help with that would be great 

function search($item = null) {
 $item = $this->params['url']['q'];
$recipes = $this->Recipe->find('all', array('conditions' => array(
'OR' =>array(
 'Recipe.name LIKE' => '%' . $item . '%',
 'Recipe.seasonal LIKE' => '%' . $item . '%',
 'Recipe.ingredients  LIKE' => '%' . $item . '%')),
 'AND' => array(
 array(
 'OR'=>array(
 'Recipe.active' =>'1'),
 'NOT'=>array(
 'Recipe.active'=> array('0')),
'order' => 'Recipe.name',
'recursive' => 1,
 
   
;
-- 
View this message in context: 
http://n2.nabble.com/help-with-complex-condations-brian-9-tp2310476p2310476.html
Sent from the CakePHP mailing list archive at Nabble.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 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Logging system for CAKEPHP

2009-02-11 Thread mscdex

On Feb 11, 9:27 am, "marco.rizze...@gmail.com"
 wrote:
> I have set these options but my error.log inside app/tmp/log   isn't
> updated if I set the debug to 0.

Looks like you'll need to override the default ErrorHandler. There is
a blog post on how to do this here:
http://teknoid.wordpress.com/2008/08/29/dealing-with-errors-in-cakephp/
--~--~-~--~~~---~--~~
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: Linking three tables?

2009-02-11 Thread jtc2

Did you ever find a solution to this? I have a similar situation.
Looks like your fourth table structure would be correct and I guess
the table name could be whatever you want it to be though from what
I've seen in cake conventions and practices (so far), it would be
something like "employees_employers_ratings" though I'm not sure this
is best.

Anyone else have any suggestions???

--~--~-~--~~~---~--~~
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: using ajax helper to reload an element

2009-02-11 Thread brian

On Wed, Feb 11, 2009 at 10:35 AM, Corey Crawford
 wrote:
>
> Hmm I think I see what you are saying, but I don't think that'll work
> in an ajax request ... since it won't refresh the view, I need to
> return only the html that's changed, not have the whole page refresh.
> But this gives me an idea that I'll play with ..

Sorry, I forgot something, actually

$this->layout = false;
$this->set('new_param', $new_param);

$this->viewPath = 'elements';

/*
OR:
$this->viewPath = 'elements'.DS.'some_other_dir';
*/

$this->render('search_element_1');

This will force Cake to use only the element to render 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 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



GIT colne thechaw.com projects on Windows, tutorial, link, how to

2009-02-11 Thread majna

FYI: http://nathanj.github.com/gitguide/pushing.html

This step can be skipped:
"Now github has our public key, but we do not yet have github's. To
remedy this, launch putty.exe, connect to github.com, and click Yes to
accept github's public key. You can safely close the login window that
opens up after accepting the key. "

--~--~-~--~~~---~--~~
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: using ajax helper to reload an element

2009-02-11 Thread WebbedIT

As this is an AJAX request you are interfacing with the DOM and as
such it does not matter whether the element to be updated was built
with a view or element.  As long as you have the link/observer calling
a new instance of ajax.updater and have set it to update the required
element id then all should be happy.  Your refreshSearchElement action
needs a /home/refresh_search_element.ctp view and if you are using the
RequestHandler component  Cake should do all the rest for you.

Have you got FireBug installed? If so what POST and Response data does
it show for the ajax request?
--~--~-~--~~~---~--~~
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: Validation rule with or

2009-02-11 Thread WebbedIT

Sounds like a more elegant approach than mine .. look forward to the
article :)
--~--~-~--~~~---~--~~
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: Validation rule with or

2009-02-11 Thread Smelly_Eddie

Henrik:

Seems like a pretty common need doesn't it.  The solution is pretty
simple.

You call the same validation rule for every related field.

$validate=
array(
'field1'=>array('rule'=>'dependentFields'),
'field2'=>array('rule'=>'dependentFields')
)


Then the method

function dependenFields()
{
$return=false;

logic based on fields to do the comparison etc.

// if dependencies pass
$return=true;


//otherwise unique errors
$return="You provided your Company Name, but forgot Phone"

}

and those messages ()if your logic is right) will show only under the
failing boxes.

I will post the full details in an article on my site which is not
quite complete (and I am at work right now :/).  Check back tonight
perhaps.
}

On Feb 10, 4:35 am, WebbedIT  wrote:
> I do not believe there are any built-in validation rules to do this so
> you need to specify your own custom validation method such as:
>
> function __validateFieldDependancy($data, $field1, $field2) {
>   // return false if ThisModelName.field1 and ThisModelName.field2 are
> empty
>   return empty($this->data[$this->name][$field1']) && empty($this->data
> [$this->name][$field2]) ? false : true;
>
> }
>
> This would go in your model and would be called by the following
> validation rule:
>
> var $validate = array(
>   'field_name' => array(
>     'rule' => array('__validateFieldDependancy', 'fieldName1',
> 'fieldName2'),
>     'message' => 'Your error message'
>   )
> )
>
> Not sure if it is neccessary to make this method private (named
> starting with double underscores) but thought it was more secure to do
> so.
>
> There is probably a better way to test both fields are empty ... happy
> for people to better educate me on this as I'm self-taught with PHP.
>
> If you are going to use this type of validation rule regularly across
> multiple models it may be worth aking it available to all models by
> placing it in /app/app_model.php
>
> Hope this helps,
>
> Paul (WebbedIT)
--~--~-~--~~~---~--~~
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: Read Excel files

2009-02-11 Thread nAcho

Thanks, i'll try those.

On 21 ene, 16:04, Martin Westin  wrote:
> I have usedhttp://sourceforge.net/projects/phpexcelreader
> It is quite basic (and therefore lightweight) but does the trick so
> far.
>
> Example from the dist:
>
> $data = new Spreadsheet_Excel_Reader();
> $data->read('jxlrwtest.xls');
> for ($i = 1; $i <= $data->sheets[0]['numRows']; $i++) {
>         for ($j = 1; $j <= $data->sheets[0]['numCols']; $j++) {
>                 echo "\"".$data->sheets[0]['cells'][$i][$j]."\",";
>         }
>         echo "\n";
>
> }
>
> On Jan 21, 6:21 pm, nAcho  wrote:
>
> > Hi, I've managed to write excel files using an article in the bakery.
>
> > Now, I'd like to importa some data from some Excel files. I couldn't
> > find an Excel Reader or anything like it. Is there something I could
> > use to this purpose?
>
> > Note: I don't want to make people save xls files into csv (at least
> > for now...)
>
> > Thanks!
>
> > Ignacio
> > (Cake noob)

--~--~-~--~~~---~--~~
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: using ajax helper to reload an element

2009-02-11 Thread Corey Crawford

Hmm I think I see what you are saying, but I don't think that'll work
in an ajax request ... since it won't refresh the view, I need to
return only the html that's changed, not have the whole page refresh.
But this gives me an idea that I'll play with ..

 - Corey

On Feb 10, 12:14 pm, brian  wrote:
> not sure this is the best way to do this
>
> function refreshSearchElement()
> {
>   $this->layout = false;
>   // get your new param ...
>   $this->set('new_param', $new_param);
>
> }
>
> refresh_search_element.ctp:
>
> echo $this->element('search_element_1', array('the_param', $new_param));
>

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



php|tek - any CakePHP devs going to the conference?

2009-02-11 Thread BrendonKoz

...because apparently there's a "Hackathon" going on.  Both symfony
and Zend Framework (as well as Solar) are represented, so I was just
curious.  For more information:
http://tek.mtacon.com/c/s/hackathon

If you go to Chicago, I hope you guys blog about it so we can benefit
too!  :D

I should have gone to php|tek when it was on the cruise...
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Auth redirect after controller based isAuthorized returns false

2009-02-11 Thread WebbedIT

Easy question, hopefully an easy answer ...

Can I control what page Cake redirects a user too when authorisation
fails due to my controller::isAuthoirzed() method returning false.

At present it returns them to my home page, but would like it to
return to the referring page ($this->referer()).
--~--~-~--~~~---~--~~
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: how to generate views for "recursive 2" associations?

2009-02-11 Thread die...@be



On Feb 11, 12:18 pm, "die...@be"  wrote:
> I think I'll try to fix the code and file a bug/patch


I fixed it :) https://trac.cakephp.org/ticket/6087
--~--~-~--~~~---~--~~
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: Prevent direct action request

2009-02-11 Thread guigouz

Check if function A2 couldn't be in the model.

You can always prepend your function names with _ to make them
private. function _A2() { } for example.

On 11 fev, 11:22, AD7six  wrote:
> On Feb 11, 1:39 pm, Bogdan Ursu  wrote:
>
> > Hey guys,
>
> > I have this setup: Controller C has two actions A1 and A2. In the view
> > of A1, in a loop I am doing requestAction(A2). My problem is that A2
> > can also be requested directly, by writing in the address bar of the
> > browser: C/A2.
> > Is there anyway of preventing the execution of A2 directly?
>
> > PS: Don't argue with the current code structure, because I am not
> > willing to change it. I just want to disable direct access to A2, if
> > possible; so that it will only be accessible from A1's view via the
> > requestAction.
>
> Is that because you already realize it's a silly design? Leaving aside
> the usual logic/objections regarding requestAction, using it to get to
> a function on the *same controller*?
--~--~-~--~~~---~--~~
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: Stop code execution in beforeFilter() and render a view

2009-02-11 Thread grigri

Try this (it's just an idea, not tested)

class SomeController extends AppController {
  var $_cancelAction = false;

  function beforeFilter() {
if (!$answerMeTheseQuestionsThree) {
  // Aaarghh...
  $this->_cancelAction = $this->params['action'];
  return;
}
  }

  function dispatchMethod($method, $params = array()) {
if ($method == $this->_cancelAction) {
  return false;
}
return parent::dispatchMethod($method, $params);
  }
}

hth
grigri

On Feb 11, 2:39 pm, guigouz  wrote:
> Returning false keeps the flow running (cake will execute further
> actions).
> Any other workaround ?
>
> On 20 jan, 16:48, brian  wrote:
>
> > I think you need to return false.
>
> > On Tue, Jan 20, 2009 at 11:53 AM, Ron  wrote:
>
> > > I am creating a check in my app_controller beforeFilter() method and
> > > if the check fails I want to stop execution of the action and render a
> > > view.
>
> > > I have something like this
>
> > > function beforeFilter()
> > > {
> > > .
>
> > > if (!$check)
> > > {
> > >   $data = array('msg'=>'my message');
> > >    $this->set('data', $data);
> > >    $this->layout = 'json';
> > >    $this->viewPath = 'json';
> > >    $this->render('index');
> > >    exit();
> > > }
>
> > > }//end beforeFilter()
>
> > > The problem is the code will not render the view, and if i take out
> > > the ( exit(); ) the action will go on. Any help would be appreciated.
>
> > > Thank You,
>
> > > Ronald Almeida
--~--~-~--~~~---~--~~
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: Stop code execution in beforeFilter() and render a view

2009-02-11 Thread guigouz

And by the way, calling exit() after $this->render('view') used to
work on 1.1

On 11 fev, 12:39, guigouz  wrote:
> Returning false keeps the flow running (cake will execute further
> actions).
> Any other workaround ?
>
> On 20 jan, 16:48, brian  wrote:
>
> > I think you need to return false.
>
> > On Tue, Jan 20, 2009 at 11:53 AM, Ron  wrote:
>
> > > I am creating a check in my app_controller beforeFilter() method and
> > > if the check fails I want to stop execution of the action and render a
> > > view.
>
> > > I have something like this
>
> > > function beforeFilter()
> > > {
> > > .
>
> > > if (!$check)
> > > {
> > >   $data = array('msg'=>'my message');
> > >    $this->set('data', $data);
> > >    $this->layout = 'json';
> > >    $this->viewPath = 'json';
> > >    $this->render('index');
> > >    exit();
> > > }
>
> > > }//end beforeFilter()
>
> > > The problem is the code will not render the view, and if i take out
> > > the ( exit(); ) the action will go on. Any help would be appreciated.
>
> > > Thank You,
>
> > > Ronald Almeida
--~--~-~--~~~---~--~~
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: Stop code execution in beforeFilter() and render a view

2009-02-11 Thread guigouz

Returning false keeps the flow running (cake will execute further
actions).
Any other workaround ?

On 20 jan, 16:48, brian  wrote:
> I think you need to return false.
>
> On Tue, Jan 20, 2009 at 11:53 AM, Ron  wrote:
>
> > I am creating a check in my app_controller beforeFilter() method and
> > if the check fails I want to stop execution of the action and render a
> > view.
>
> > I have something like this
>
> > function beforeFilter()
> > {
> > .
>
> > if (!$check)
> > {
> >   $data = array('msg'=>'my message');
> >    $this->set('data', $data);
> >    $this->layout = 'json';
> >    $this->viewPath = 'json';
> >    $this->render('index');
> >    exit();
> > }
>
> > }//end beforeFilter()
>
> > The problem is the code will not render the view, and if i take out
> > the ( exit(); ) the action will go on. Any help would be appreciated.
>
> > Thank You,
>
> > Ronald Almeida
--~--~-~--~~~---~--~~
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: Credit Card Expiration Date Validation

2009-02-11 Thread grigri

Here's an excerpt from a model I had for validating this sort of
thing:

class Order extends AppModel {
  var $name = "Order";

var $validate = array(
// ...
'card_valid_from' => array(
'on' => 'card',
'allowEmpty' => false,
'rule' => array('validateRelativeDate', false),
'message' => 'Time travellers are not allowed to shop 
here'
),
'card_valid_to' => array(
'on' => 'card',
'allowEmpty' => false,
'rule' => array('validateRelativeDate', true),
'message' => 'That card has expired'
),
// ...
);

function deconstruct($field, $data) {
if ($field == 'card_valid_from' || $field == 'card_valid_to') {
$data['day'] = '01';
}
return parent::deconstruct($field, $data);
}

function validateRelativeDate($date, $inFuture) {
$now = date('Y-m') . '-01';

$date = reset($date);

if ($inFuture) {
return $date >= $now;
}
else {
return $date <= $now;
}
}
}

The view form elements look like this (excerpt):

echo $form->inputs(array(
'legend' => 'Pay by Credit Card',
'card_valid_from' => array('type' => 'date', 'dateFormat' => 'MY'),
'card_valid_to' => array('type' => 'date', 'dateFormat' => 'MY')
));

hth
grigri

On Feb 10, 7:38 pm, JoshSchramm  wrote:
> Hey all,
>
> I cant seem to find anything online to explain this so i'm hoping you
> all can help a bit.
>
> I am validating credit card information and right now i'm working on
> ensuring the user enters an expiration date.
> For this i have to fields one for month and one for year both using
> $form->input('type'='date')
>
> When they post the data looks like
> [ExpirationMonth] { [month]=>XX }, [ExpirationYear] { [year]=>}
>
> On the back end I'm trying to validate this and it doesnt want to
> work. My validate array looks like this.
>
> 'ExpirationMonth.month'=>array(
>                         'numeric'=>array(
>                                 'rule'=>'numeric',
>                                 'allowEmpty'=>false,
>                                 'required'=>true,
>                                 'message'=>'ExpirationMonthInvalid'
>                         ),
>                         'between'=>array(
>                                 'rule'=>array('between', 1, 12),
>                                 'allowEmpty'=>false,
>                                 'required'=>true,
>                                 'message'=>'ExpirationMonthInvalid'
>                         ),
>                 ),
>                 'ExpirationYear.year'=>array(
>                         'notEmpty'=>array(
>                                 'rule'=>'notEmpty',
>                                 'allowEmpty'=>false,
>                                 'required'=>true,
>                                 'message'=>'ExpirationYearInvalid'
>                         ),
>                         'numeric'=>array(
>                                 'rule'=>'numeric',
>                                 'allowEmpty'=>false,
>                                 'required'=>true,
>                                 'message'=>'ExpirationYearInvalid'
>                         )
>                 )
>
> no matter what i do i don't get an error message back.
>
> To clarify a bit more i have a 'empty'=>'Choose Month (or year)' in
> the drop downs so I'm just trying to make sure the user selected
> something other than that option.
>
> Any ideas?
--~--~-~--~~~---~--~~
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: Logging system for CAKEPHP

2009-02-11 Thread marco.rizze...@gmail.com

I have set these options but my error.log inside app/tmp/log   isn't
updated if I set the debug to 0.

On Feb 10, 6:55 pm, mscdex  wrote:
> marco.rizze...@gmail.com wrote:
> > Now I must create a logging system in order to register all possible
> > errors (PHP execution error or MySQL error etc. )
>
> If you are wanting to log to a file, you can edit your php.ini and
> change the following two values:
>
> error_log = /var/log/php.log
> display_errors = Off
>
> Substitute "/var/log/php.log" with a path of your choosing
--~--~-~--~~~---~--~~
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: Help with calculated field being backticked to death

2009-02-11 Thread Martin Westin


Thanks a lot, That saved the day :)

For reference, what worked was this set of parenthesis:

'((Modelname.foreign_id>0)) AS result'

/Martin


On Feb 11, 12:40 pm, grigri  wrote:
> I haven't tried this in a while, but I seem to remember adding extra
> parentheses helped.
>
> Try these:
>
> '(Modelname.foreign_id>0 AS result)'
> '(Modelname.foreign_id>0) AS result'
> '((Modelname.foreign_id>0) AS result)'
> '(((Modelname.foreign_id>0) AS result))'
>
> One of them _should_ work
>
> hth
> grigri
>
> On Feb 11, 11:34 am, Martin Westin  wrote:
>
> > Hi,
> > I am trying to order by a calculation (in a pagination) but my
> > calculation is being backticked to death. I can't find a way to write
> > this so that is works.
>
> > I have:
>
> > var $paginate = array(
> >         'Modelname' => array(
> >                 'fields'=>array(
> >                         'Modelname.id',
> >                         'Modelname.fieldname',
> >                         'Modelname.foreign_id',
> >                         'Modelname.foreign_id>0 AS result' // no matter 
> > what I put here I
> > get an sql syntax error
> >                 ),
> >                 'limit' => 10,
> >                 'order' => 'result ASC, Modelname.fieldname ASC'
> >         )
> > );
>
> > This results in:
> > SELECT `Modelname`.`id`, `Modelname`.`fieldname`,
> > `Modelname`.`foreign_id`, `Modelname`.`foreign_id>0` AS `result`
> > FROM...
>
> > and about 10 other variations I have tried. If I just copy the query
> > and remove the badly placed backticks I get a working query. I just
> > can't figure out how to "trick" Cake into not messing with the
> > calculation. Doing simple SUM(somefield) AS some_sum has never caused
> > any problems but I have not been able to find a "function" in MySQL
> > that would do a simple "greater than" comparison.
>
> > thanks in advance
> > /Martin
--~--~-~--~~~---~--~~
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: Prevent direct action request

2009-02-11 Thread AD7six



On Feb 11, 1:39 pm, Bogdan Ursu  wrote:
> Hey guys,
>
> I have this setup: Controller C has two actions A1 and A2. In the view
> of A1, in a loop I am doing requestAction(A2). My problem is that A2
> can also be requested directly, by writing in the address bar of the
> browser: C/A2.
> Is there anyway of preventing the execution of A2 directly?
>
> PS: Don't argue with the current code structure, because I am not
> willing to change it. I just want to disable direct access to A2, if
> possible; so that it will only be accessible from A1's view via the
> requestAction.

Is that because you already realize it's a silly design? Leaving aside
the usual logic/objections regarding requestAction, using it to get to
a function on the *same controller*?

--~--~-~--~~~---~--~~
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: Prevent direct action request

2009-02-11 Thread grigri

class ControllerC extends AppController {
  function A1() {
// blablabla
  }

  function A2() {
if (empty($this->params['requested']) || ($this->params
['requested']!=1)) {
  $this->redirect('http://www.milinkito.com/swf/bart.php?texto=I
+will+not+call+this+action+directly');
}
// blablabla
  }
}

hth
grigri

On Feb 11, 12:39 pm, Bogdan Ursu  wrote:
> Hey guys,
>
> I have this setup: Controller C has two actions A1 and A2. In the view
> of A1, in a loop I am doing requestAction(A2). My problem is that A2
> can also be requested directly, by writing in the address bar of the
> browser: C/A2.
> Is there anyway of preventing the execution of A2 directly?
>
> PS: Don't argue with the current code structure, because I am not
> willing to change it. I just want to disable direct access to A2, if
> possible; so that it will only be accessible from A1's view via the
> requestAction.
>
> Thanks a lot
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Prevent direct action request

2009-02-11 Thread Bogdan Ursu

Hey guys,

I have this setup: Controller C has two actions A1 and A2. In the view
of A1, in a loop I am doing requestAction(A2). My problem is that A2
can also be requested directly, by writing in the address bar of the
browser: C/A2.
Is there anyway of preventing the execution of A2 directly?

PS: Don't argue with the current code structure, because I am not
willing to change it. I just want to disable direct access to A2, if
possible; so that it will only be accessible from A1's view via the
requestAction.

Thanks a lot

--~--~-~--~~~---~--~~
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: Turning $_GET/$_POST into named params

2009-02-11 Thread grigri

I generally do what Martin suggests - with a redirect.

However, you can speed up the process (for the user, not the
developer!) like this:

* Add an .htaccess rewrite rule to rewrite the url before it even hits
cake. This is much faster that redirecting from a cakephp controller
action.

* With unobtrusive javascript, intercept the form submission/link
click and alter the url on-the-fly. For javascript users this means no
server redirect and faster response times.

hth
grigri

On Feb 11, 8:40 am, Miles J  wrote:
> So I have a search/browse system thats plugged into pagination.
> Everything works fine as a $_POST, the data is returned and paginated
> BUT the second I resort the results using the pagination, I lose all
> the search queries/terms.
>
> How can I turn $_GET or $_POST into named params so that they are
> continually passed to pagination?
--~--~-~--~~~---~--~~
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: Bug? Order isn't respected when doing a cascade delete

2009-02-11 Thread AD7six



On Feb 11, 5:04 am, nebbian  wrote:
> Hi,
>
> I have the following models:
>
> class Competition extends AppModel {
>
>         var $name = 'Competition';
>         var $useTable = 'Competition';
>         var $primaryKey = 'CompetitionID';
>
>         var $recursive = 2;
>
>         var $hasMany = array(
>                         'CompetitionAnswers' => array(

^^ CompetitionAnswer""

>                                                                 'className' 
> => 'CompetitionAnswer',
>                                                                 'foreignKey' 
> => 'CompetitionID',
>                                                                 'conditions' 
> => '',
>                                                                 'fields' => 
> '',
>                                                                 'order' => 
> array('CompetitionAnswers.CompetitionID DESC',
>                                                                               
>           'CompetitionAnswers.CompetitionAnswerOrder ASC'),

^^ CompetitionAnswer"" x2

>                                                                 'dependent' 
> => true
>                         )
>         );
>
> class CompetitionAnswer extends AppModel {
>
>         var $name = 'CompetitionAnswer';
>         var $useTable = 'CompetitionAnswer';
>         var $primaryKey = 'CompetitionAnswerID';
>
>         var $recursive = 2;
>
>         var $displayField = 'CompetitionAnswerText';
>
>         var $order = array(
>                                                                         
> 'CompetitionAnswer.CompetitionID DESC',
>                                                                         
> 'CompetitionAnswer.CompetitionAnswerOrder ASC'
>                                                                 );
>
>         var $belongsTo = array(
>                         'CompetitionID' => array(

^^ Is that a typo
>                                                                 'className' 
> => 'Competition',
>                                                                 'foreignKey' 
> => 'CompetitionID',
>                                                                 'conditions' 
> => '',
>                                                                 'fields' => 
> '',
>                                                                 'order' => ''
>                         )
>         );
>
> Everything works fine, until I try a cascade delete:
>                 if ($this->Competition->del($id)) { ...
>
> When I get the following error:
>
> SQL Error: 1109: Unknown table 'CompetitionAnswer' in order clause
> [CORE/cake/libs/model/datasources/dbo_source.php, line 512]

>From the errors in your model file that's to be expected.
>
> "SELECT `CompetitionAnswers`.`CompetitionAnswerID` FROM
> `CompetitionAnswer` AS `CompetitionAnswers`   WHERE
> `CompetitionAnswers`.`CompetitionID` = 21   ORDER BY
> `CompetitionAnswer`.`CompetitionID` DESC[...]"
>
> It appears as if this is not loading the order field that I specified
> in my HasMany clause, instead it is loading the default order field
> for my class, but still calling the table the same way that was
> specified in the HasMany clause.
>
> I can't get rid of the table specification in the order clause,
> because then I get an ambiguous table name error.
>
> Is this a bug in Cake?  It sure looks like it to me.  It only happens
> on a cascade delete, not any other form of database access.

Try again after correcting your model definitions. I hope that's a
legacy database - otherwise why have you created such a repetitive and
unconventional schema (e.g.
"CompetitionAnswer.CompetitionAnswerText")? You can and should delete
anything that is the default/following convention too.

hth,

AD
--~--~-~--~~~---~--~~
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: first program in cakephp

2009-02-11 Thread dr. Hannibal Lecter

Hmmm, well what did you expect? CakePHP is a framework, not an
application.

http://book.cakephp.org/view/9/where-to-get-help

On Feb 11, 9:12 am, kapil  wrote:
> i want to run my first cakephp program. but after installation nothing
> is happened just database is connected nothing
> more. plz help me
>
> thanks in advance
--~--~-~--~~~---~--~~
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: Help with calculated field being backticked to death

2009-02-11 Thread grigri

I haven't tried this in a while, but I seem to remember adding extra
parentheses helped.

Try these:

'(Modelname.foreign_id>0 AS result)'
'(Modelname.foreign_id>0) AS result'
'((Modelname.foreign_id>0) AS result)'
'(((Modelname.foreign_id>0) AS result))'

One of them _should_ work

hth
grigri

On Feb 11, 11:34 am, Martin Westin  wrote:
> Hi,
> I am trying to order by a calculation (in a pagination) but my
> calculation is being backticked to death. I can't find a way to write
> this so that is works.
>
> I have:
>
> var $paginate = array(
>         'Modelname' => array(
>                 'fields'=>array(
>                         'Modelname.id',
>                         'Modelname.fieldname',
>                         'Modelname.foreign_id',
>                         'Modelname.foreign_id>0 AS result' // no matter what 
> I put here I
> get an sql syntax error
>                 ),
>                 'limit' => 10,
>                 'order' => 'result ASC, Modelname.fieldname ASC'
>         )
> );
>
> This results in:
> SELECT `Modelname`.`id`, `Modelname`.`fieldname`,
> `Modelname`.`foreign_id`, `Modelname`.`foreign_id>0` AS `result`
> FROM...
>
> and about 10 other variations I have tried. If I just copy the query
> and remove the badly placed backticks I get a working query. I just
> can't figure out how to "trick" Cake into not messing with the
> calculation. Doing simple SUM(somefield) AS some_sum has never caused
> any problems but I have not been able to find a "function" in MySQL
> that would do a simple "greater than" comparison.
>
> thanks in advance
> /Martin
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Help with calculated field being backticked to death

2009-02-11 Thread Martin Westin

Hi,
I am trying to order by a calculation (in a pagination) but my
calculation is being backticked to death. I can't find a way to write
this so that is works.

I have:

var $paginate = array(
'Modelname' => array(
'fields'=>array(
'Modelname.id',
'Modelname.fieldname',
'Modelname.foreign_id',
'Modelname.foreign_id>0 AS result' // no matter what I 
put here I
get an sql syntax error
),
'limit' => 10,
'order' => 'result ASC, Modelname.fieldname ASC'
)
);

This results in:
SELECT `Modelname`.`id`, `Modelname`.`fieldname`,
`Modelname`.`foreign_id`, `Modelname`.`foreign_id>0` AS `result`
FROM...

and about 10 other variations I have tried. If I just copy the query
and remove the badly placed backticks I get a working query. I just
can't figure out how to "trick" Cake into not messing with the
calculation. Doing simple SUM(somefield) AS some_sum has never caused
any problems but I have not been able to find a "function" in MySQL
that would do a simple "greater than" comparison.

thanks in advance
/Martin
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



first program in cakephp

2009-02-11 Thread kapil

i want to run my first cakephp program. but after installation nothing
is happened just database is connected nothing
more. plz help me

thanks in advance

--~--~-~--~~~---~--~~
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: how to generate views for "recursive 2" associations?

2009-02-11 Thread die...@be

I've been going through the sources and I think I've found out why
cake behaves like this.

Check 
https://trac.cakephp.org/browser/trunk/cake/1.2.x.x/cake/console/libs/tasks/view.php#L372

It seems that here only first level associations are set, independent
of any $recursive parameter.

I think I'll try to fix the code and file a bug/patch
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Skipping Validation on Date Fields

2009-02-11 Thread overture

I am having issues with validation on date fields.  I need to ignore
validation for a date field, however, I have tried everything and
can't find a solution.  I have changed the validation on the model
to:-

'actual_start_date' => array(
  'rule'=>'date',
  'required' => false,
  'allowEmpty' => true)

I have also tried omitting this code altogether, but it still doesn't
work.

Does anyone have any ideas what I'm doing wrong?
--~--~-~--~~~---~--~~
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: how to generate views for "recursive 2" associations?

2009-02-11 Thread die...@be

On Jan 26, 4:52 pm, RoVo  wrote:
> Hi Dieter,
>
> an example. We have 3 models (HABTM):
> Posts <-> PostsTag <-> Tag
>
> If I bake only Posts and Tag (model, controller and views), I get a
> results like yours . NO related Tags
>
> NOW I bake the PostsTag-model with belongsTo Post and belongsTo Tag.
> If I bake the Post-controller and views again...
> UUPS!?!
> Related Tags are in the view.ctp :)

Do you mean related "PostTag"s ?
I really don't understand how to get any associatons other then direct
ones when baking.
Even when I set $var recursive = 3; in the model, and $this->model-
>recursive = 3; in all functions of the controller, when I do "print_r
($associations); die();" in the view.ctp template, I only see the
direct associatons.

also, in the default view.ctp template only $associations
['hasAndBelongsToMany'], $associations['hasMany']. $associations
['belongsTo'] and $associations['hasOne'] are iterated, not the
elements of their elements (eg 2nd level associatons).  I wouldn't
mind writing the code for this myself, if only $associations would
contain the metadata (fields etc) of 2nd level associatons.
--~--~-~--~~~---~--~~
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: How to do Data Sanitization in CakePHP 1.2.9?

2009-02-11 Thread majna

What you need is XSS cleanup.
Try with 
http://bakery.cakephp.org/articles/view/brita-component-with-html-purifier
You can use Sanitize::stripScripts(), but htmlpurifier is much better.

On Feb 11, 7:13 am, Yogesh  wrote:
> Hi,
> I want to avoid the script tag so that no one do the hack or insert
> the records using script tag.
> I don't know what it should be called exactly, but in my database some
> times records get inserted automatically and continuously about 100 to
> 150 records, these are seems to be inserted using some script and all
> the records are like some javascript code or some links. and if Model
> does this automatically how can these records get inserted. or I am
> understanding the Data sanitization meaning in wrong way.
>
> On Feb 10, 2:20 pm, Miles J  wrote:
>
> > The model automatically sanitizesdatawhen inserting and selecting
> > queries.
--~--~-~--~~~---~--~~
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: Turning $_GET/$_POST into named params

2009-02-11 Thread Son Dat Giang
I have my URL using paginator like:
http://localhost/accounts/index/page:1/sort:Account.cutoff_time/direction:asc/

So if I want to attach more parameters like keyword (for example), I have
URL like:

http://localhost/accounts/index/page:1/sort:Account.cutoff_time/direction:asc/keyword:sport

if you want to add keyword:somekey at the end you have to use helper
$paginator->sort like

array('keyword'=>$somekeyword))) ?>

array('url'=>array('keyword'=>$somekeyword)) is very importal, because it
make keyword:$somekeyword at the end of the default URL.

you can get your value from URL by

$keyword = isset($this->params['named']['keyword']) ?
$this->params['named']['keyword'];

and later pass $keyword value in your find condition

Have a good time.


-
Best regards !
Giang Son Dat
Mobile: +84 988114164
Email giangson...@gmail.com, giangson...@yahoo.com


On Wed, Feb 11, 2009 at 12:40 AM, Miles J  wrote:

>
> So I have a search/browse system thats plugged into pagination.
> Everything works fine as a $_POST, the data is returned and paginated
> BUT the second I resort the results using the pagination, I lose all
> the search queries/terms.
>
> How can I turn $_GET or $_POST into named params so that they are
> continually passed to pagination?
> >
>

--~--~-~--~~~---~--~~
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: Turning $_GET/$_POST into named params

2009-02-11 Thread Miles J

@majina - I know that, but I need to CREATE the named params from the
get or post.

@martin - Yeah thats what I was thinking, just wondering if theres
another way.
--~--~-~--~~~---~--~~
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: switching databases on dev and production

2009-02-11 Thread majna

...Like this:
 if (env('SERVER_ADDR') == '127.0.0.1')
Configure::write('WebApp.mode', 'devel');

On Feb 11, 9:05 am, Braindead  wrote:
> Instead of changing a value in core.php you could switch the database
> depending on the current DOCUMENT_ROOT or SERVER_NAME or some other
> server variable that fits for the distinction between development
> server and production server.
>
> That's the way I do it and it works very well for me.
--~--~-~--~~~---~--~~
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: Turning $_GET/$_POST into named params

2009-02-11 Thread majna

http://book.cakephp.org/view/166/Pagination-in-Views

To pass all URL arguments to paginator functions, add the following to
your view:

$paginator->options(array('url' => $this->passedArgs));



On Feb 11, 9:40 am, Miles J  wrote:
> So I have a search/browse system thats plugged into pagination.
> Everything works fine as a $_POST, the data is returned and paginated
> BUT the second I resort the results using the pagination, I lose all
> the search queries/terms.
>
> How can I turn $_GET or $_POST into named params so that they are
> continually passed to pagination?
--~--~-~--~~~---~--~~
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: Turning $_GET/$_POST into named params

2009-02-11 Thread Martin Westin

Hi Miles,
One way that works really well is to have a "proxy" action accepting
the initial search. This action reorganizes the get or post parameters
into named ones and redirects to the "real" action. It sound a bit
convoluted but it is a pretty common technique that offers a lot of
flexibility

In its simplest form it could simply look like:

function proxy_search() {
if ( !empty($this->params['url']['name']) ) {
$this->redirect('search/name:'.$this->params['url']['name']);
}
}



On Feb 11, 9:40 am, Miles J  wrote:
> So I have a search/browse system thats plugged into pagination.
> Everything works fine as a $_POST, the data is returned and paginated
> BUT the second I resort the results using the pagination, I lose all
> the search queries/terms.
>
> How can I turn $_GET or $_POST into named params so that they are
> continually passed to pagination?
--~--~-~--~~~---~--~~
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: Curious problem with img, css, and js in plugin

2009-02-11 Thread nomen

¿Nobody has this problem?
¿Nobody has idea about what should be the problem?

On 6 feb, 10:52, nomen  wrote:
> Hello everyone:
>
>    I am developing a plugin and i have a curious problem.
>    In my first version I've got all the img, js and css in webroot.
>    Rereading the doc I have seen that they go in plugins/mi_plugin/
> vendors.
>    So I've decided to put it there and everything is perfect. I mean:
> it loads the css, the js and images.
>    But I've noticed that, when accessing the homepage of the plugin in
> the previous version, which I have saved a copy,I need about 4 or 5
> seconds, while the new version requires 8 or 9. I investigate
> something and I discorver that all the images, css and javascript are
> reloading again and again, every time you reload the page.
>    I have to configure any special way to behave as in webroot?
>
>    Thanks in advance.
--~--~-~--~~~---~--~~
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: Firefox Search Engine Plug-In

2009-02-11 Thread j0n4s.h4rtm...@googlemail.com

Thanks both of you. Do not fight. Thanks for contributions, helps a
lot.
--~--~-~--~~~---~--~~
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: Auth problem, login not working.

2009-02-11 Thread Son Dat Giang
Everything looks ok. And I guess something as follow:
1.
Is your users table has both username and password fields.

2.
How about the hash password stored after registration action.

3.
Try this code in Users::login action, you should remove comment at
//print_r($user) for debug


if(!empty($this->data))
{
$user = $this->Auth->user();
//$user = false;
if($user){
//print_r($user);
$this->redirect('/', null, true);
}
$this->Session->setFlash("Check your account");

-
Best regards !
Giang Son Dat
Mobile: +84 988114164
Email giangson...@gmail.com, giangson...@yahoo.com


On Tue, Feb 10, 2009 at 11:38 PM, Dcahrakos  wrote:

>
> oops, sorry, was in a rush to leave for work didnt have time to post
> it.
>
> The login function is empty, which according to the docs on the auth
> component, thats the way its supposed to be since auth does it all.
>
> my config for auth in the AppController is:
>
>var $components = array('Auth');
>
>function beforeFilter() {
>
>$this->Auth->loginAction = array('controller' => 'users',
> 'action' => 'login');
>$this->Auth->loginRedirect = array('controller' =>
> 'members',
> 'action' => 'home');
>$this->Auth->loginError = "Incorrect Password!";
>$this->Auth->authError = "Sorry, you cannot access this
> page.";
>
> }
>
> On Feb 10, 2:49 pm, Miles J  wrote:
> > Can we see your login action() and all the config for auth.
> >
> > On Feb 10, 1:29 pm, Dcahrakos  wrote:
> >
> > > Hi,
> >
> > > I am using the Auth component for registration and login, registration
> > > is working perfectly, but login doesnt seem to be doing anything at
> > > all,
> >
> > > I have Auth loaded in the AppController since I will be using it site
> > > wide, however when I try to log in I just return to the login page
> > > because the page it is supposed to redirect me to requires you to be
> > > logged in.
> >
> > > The only message I get from auth is the message I set "Sorry you
> > > cannot access this page"
> >
> > > my login.ctp is just a simple login form with a username and password
> > > field,  and my Users controller has an empty login function at the
> > > moment.
> >
> > > from what i've read everything should work, however it is not...
> >
> > > am I missing something here? do I need to add code to the login
> > > function of the controller? or add anything to the user model?
> >
> > > Thanks.
> >
>

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Turning $_GET/$_POST into named params

2009-02-11 Thread Miles J

So I have a search/browse system thats plugged into pagination.
Everything works fine as a $_POST, the data is returned and paginated
BUT the second I resort the results using the pagination, I lose all
the search queries/terms.

How can I turn $_GET or $_POST into named params so that they are
continually passed to pagination?
--~--~-~--~~~---~--~~
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: switching databases on dev and production

2009-02-11 Thread Braindead

Instead of changing a value in core.php you could switch the database
depending on the current DOCUMENT_ROOT or SERVER_NAME or some other
server variable that fits for the distinction between development
server and production server.

That's the way I do it and it works very well for me.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---