Re: Using 2.2.0-RC2 dynamic validation API from the Controller

2012-11-28 Thread Lukman Hussein

>
> When the model saves ($this->Campaign->save($this->
> request->data)), the validation list does not appear to have the new 
> validation rule in it. I have traced out the validation set that the 
> validator is using at save, and it is using only the validation rules that 
> were initially set in the model.
>

try;
$this->Campaign->save($this->request->data, *array('validate' => false)*)



On Thursday, 21 June 2012 08:23:33 UTC+8, Adam Duro wrote:
>
> I am trying to use the CakePHP 2.2.0-RC2 dynamic validation API to create 
> a new validation rule for a Model via a Controller.
>
> First of all, is this possible at all?
>
> So far when I try and run this in a controller:
>
> $this->Campaign->validator()->add('advertiser_id', 'notEmpty', array(
>   'rule'  => 'notEmpty',
>   'required'  => true,
>   'message'   => 'Assigning an advertiser is required' 
> ));
>
> When the model saves ($this->Campaign->save($this->request->data)), the 
> validation list does not appear to have the new validation rule in it. I 
> have traced out the validation set that the validator is using at save, and 
> it is using only the validation rules that were initially set in the model.
>
> Any ideas? Am I going about this the wrong way? Am I missing anything?
>
> The Book only show examples being done from within a Model class. Can we 
> not use this API from the Controller?
>
> Any insight is appreciated.
>
> AD
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/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.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Completely Stuck trying to list names of Contacts class

2012-11-28 Thread Andrew Cook
I just don't even kind of understand how to access my data..  I went 
through the blog tutorial and that was all fine, but for my application all 
I'm wanting to do is this:

I want to create a new Client via a form, which I've created.. in a 
dropdown list box I want to list all of the names in the Contact table 
I can't figure out how to do it at all...  I am just not getting how things 
are related I guess..


-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/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.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Re: Including an External Library file that has functions that aren't in a class?

2012-11-28 Thread bluesclues9
Hi
I ran into a similar situation in which I need to write up my own functions
that are to be used in multiple views(jquery calls). For example: I need to
check existence of a file in my file library and I need to do this in
multiple controllers.

I am thinking of writing commonly used functions in a php file and use them
in jquery calls.

Would you let me know how I do that?

I tried creating a php file called myutil.php and kept it under /app/libs
folder.
I have also added this in app_controller.php as App::Import('Lib',
'myutil');

However, when I made a call to this, I was getting errors like
myutil.phpController does not exist under app/controllers.

Where am I going wrong with this?

-Sri Adhi




--
View this message in context: 
http://cakephp.1045679.n5.nabble.com/Including-an-External-Library-file-that-has-functions-that-aren-t-in-a-class-tp1331401p5712490.html
Sent from the CakePHP mailing list archive at Nabble.com.

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/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.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Re: 502 Bad Gateway Error

2012-11-28 Thread lowpass
I was just seeing 502s on Cake's API site yesterday. Maybe a bug. Check here:

http://cakephp.lighthouseapp.com/dashboard

I would have taken 3 seconds to run a search and include a direct link
if there is one but I can't see how to search the damn bug tracking
site.

On Wed, Nov 28, 2012 at 1:25 PM, Advantage+  wrote:
> I have the site running fine on Cake 2.2.3 but trying to configure Memcache
> as the Cache engine.
>
>
>
> As soon as I uncomment my memcache Cache block below I get hit with a 502
> Bad Gateway error. So it’s a bit hard to figure out if its cake or the
> server since both work but when I add this bit of code it breaks so I am a
> bit stumped. Can you use multiple Cache engines? File for somethings and
> memcahe for others? Anyone have any ideas? Suggestions?
>
>
>
>
>
>
>
> /*Cache::config(
>
> 'inmemory', array(
>
> 'engine' => 'Memcache',
>
> 'duration' => 3600,
>
> 'serialize' => true,
>
> 'servers' => array(
>
> '127.0.0.1:11211'),
>
> 'persistent' => true,
>
> 'compress' => false));*/
>
>
>
> Thanks
>
>
>
> Dave
>
>
>
>
>
> --
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/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.
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/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.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Re: setting custom error messages for validators in all my projects

2012-11-28 Thread lowpass
Perhaps you could set the default ones up in AppModel, then fold that
into a local $validate array in each child model. But I suppose you'd
need to create a constructor for each model.

Actually, you'd need to define an empty $validate array as well as an
array with a different name, eg. $_validate, for your local rules.
Then, in the constructor, merge that with parent::validate and assign
to $validate.

Or something.

On Tue, Nov 27, 2012 at 8:33 AM, vitor gomes  wrote:
> Hi,
>
> I'm starting two different projects using cake, but there are several
> validations in my forms that will be the basically the same, like notempty
> for exemple. I will use Bake to generate my CRUDs.
>
> What I need to know is if there is any option to set custom message errors
> for those default validators and some how don't need to set it in every
> single model in both projects.
>
> There is some option to set custom messages for validators in some place and
> it Cake display everytime I use this validator?
>
> Best regards,
> Vitor.
>
> --
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/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.
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/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.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Re: autopopulating fields

2012-11-28 Thread lowpass
echo $this->Form->hidden(...);

Your question is a bit too vague to reply to beyond that. Does each
example have the same kanji? Does new example bring up a random kanji?

On Tue, Nov 27, 2012 at 3:29 AM, Jeff Smith  wrote:
> I am working on a site to help me (and hopefully others) learn Japanese
> kanjis.  The site is located at http://galacticcartel/kanjis (temporary
> url).
>
> I want to make it so when I am viewing a kanji (example
> http://www.galacticcartel.com/kanjis/view/1) and I click New example I would
> like the kanji field to auto populate with the correct id (which I would
> hide).
>
> --
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/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.
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/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.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Re: XML doctype

2012-11-28 Thread lowpass
Unfortunately, this ability was left out of Cake's XML class, which is
just a wrapper for returning either a SimpleXML or DOMDocument object.
The latter's doctype property is read-only. In order to have a doctype
one needs to jump through some hoops:

http://pointbeing.net/weblog/2009/03/adding-a-doctype-declaration-to-a-domdocument-in-php.html

With SimpleXML, you can include the doctype in the string that you
feed to the constructor. See here (not the accepted answer but those
below):

http://stackoverflow.com/questions/1397036/how-to-convert-array-to-simplexml



On Wed, Nov 28, 2012 at 1:44 AM, technobulka  wrote:
> How to add doctype after ?
>
> --
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/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.
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/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.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




502 Bad Gateway Error

2012-11-28 Thread Advantage+
I have the site running fine on Cake 2.2.3 but trying to configure Memcache
as the Cache engine.

 

As soon as I uncomment my memcache Cache block below I get hit with a 502
Bad Gateway error. So it's a bit hard to figure out if its cake or the
server since both work but when I add this bit of code it breaks so I am a
bit stumped. Can you use multiple Cache engines? File for somethings and
memcahe for others? Anyone have any ideas? Suggestions?

 

 

 

/*Cache::config(

'inmemory', array(

'engine' => 'Memcache',

'duration' => 3600,

'serialize' => true,

'servers' => array(

'127.0.0.1:11211'), 

'persistent' => true,

'compress' => false));*/

 

Thanks

 

Dave

 

 

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/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.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Re: combine multiple foreach statements

2012-11-28 Thread lowpass
On Wed, Nov 28, 2012 at 12:30 AM, Chris  wrote:
> I don't think it's possible to do that,... each Model has its own
> comments,... and there is not only Blogs and Photos, there are Groups,
> Videos, Dba, etc,...

Comment:

public $belongsTo = array(
'User',
'Blog' => array(
'className'  => 'Blog',
'conditions' => array(
'Comment.foreign_key' => 'Blog.id',
'Comment.model' => 'Blog'
),
'foreignKey' => false
),
'Photo' => array(
'className'  => 'Photo',
'conditions' => array(
'Comment.foreign_key' => 'Photo.id',
'Comment.model' => 'Photo'
),
'foreignKey' => false
),
...
);

Blog:

public $hasMany = array(
'Comment' => array(
'className' => 'Comment',
'foreignKey' => 'foreign_key',
'conditions' => array('Comment.model' => 'Blog'),
'dependent' => true
)
);

etc.


> and I need to display them on Home page on first come
> first served bases

Then you would only need to order them by created date.

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/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.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Re: can anyone help me how to print the data in new window with the controller action.

2012-11-28 Thread Marcelo F Andrade
On Tue, Nov 27, 2012 at 4:23 AM, nama venkatesh  wrote:
> Subject: can anyone help me how to print the data in new window with the 
> controller action.

I'm not sure about what you need exactly.  But if you're trying to
print a content opened in a new window, you can just do it with
JavaScript code like window.opener.print().

Cheers.

--
MARCELO F ANDRADE
Belem, Amazonia, Brazil

"I took the red pill"

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/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.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




can anyone help me how to print the data in new window with the controller action.

2012-11-28 Thread nama venkatesh


-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/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.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Problem in I18n table

2012-11-28 Thread jatin.bhatt
Hi.
I have model "I18n" which stores turkish and english language content of 
different fileds.
I have another model called "CompetitionAwards" which have title fields in 
turky and english language.
The title field is stored in i18n table in both language perfectly.
Now my problem is that when i fetch data from CompetitionAward data it is 
not fetch data from i18n table.
This same thing is work in CompetitionCat model.
i want somithing like :
CompetitionAwards['title']['tur'] = "xyz"
CompetitionAwards['title']['eng'] = "abc"

at present i just get
CompetitionAwards['title'] = "xyz"

tur and eng is coming from i18n table.

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/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.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




autopopulating fields

2012-11-28 Thread Jeff Smith
I am working on a site to help me (and hopefully others) learn Japanese 
kanjis.  The site is located at http://galacticcartel/kanjis (temporary 
url).  

I want to make it so when I am viewing a kanji (example 
http://www.galacticcartel.com/kanjis/view/1) and I click New example I 
would like the kanji field to auto populate with the correct id (which I 
would hide).

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/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.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




setting custom error messages for validators in all my projects

2012-11-28 Thread vitor gomes
Hi,

I'm starting two different projects using cake, but there are several 
validations in my forms that will be the basically the same, like notempty 
for exemple. I will use Bake to generate my CRUDs.

What I need to know is if there is any option to set custom message errors 
for those default validators and some how don't need to set it in every 
single model in both projects. 

There is some option to set custom messages for validators in some place 
and it Cake display everytime I use this validator?

Best regards,
Vitor.

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/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.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Re: Plugin Facebook

2012-11-28 Thread Cyril CHARLIER
Hi Saran,

You can go to : http://www.tournoi-doa.fr/

And you will see that on the first load, the share button is here on the
top of the page.
If you refresh the page, it disappear..

thanks!

--
Cyril Charlier

http://www.orionbanque.fr/
http://www.orionbanque.fr/wiki/doku.php




On Tue, Nov 27, 2012 at 9:05 AM, Saran Pal  wrote:

> Hi Cyril,
>
> Yes, I am using, please explain your problem, as your problem, you should
> create an ctp which have only these two lines
>  
> window.close();
>  window.opener.location.reload(true);
> 
> and render it while you fb things done.
>
> Cheers..!
>
> Saran Pal
>
>
> On Mon, Nov 26, 2012 at 1:21 AM, Cyril CHARLIER 
> wrote:
>
>> Hello,
>>
>> Is there somoene using this plugin on cake 2.x ?
>> I have a little pb using it after the 2nd load of the page.
>>
>> thank.
>> Cyril
>>
>>  --
>> Like Us on FaceBook https://www.facebook.com/CakePHP
>> Find us on Twitter http://twitter.com/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.
>> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>>
>>
>>
>
>  --
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/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.
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>
>
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/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.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Re: Adding multple records through REST XML web services

2012-11-28 Thread Tony Messias
You have to parse the XML to Cake's pattern and then you can use saveMany,
for example.
http://book.cakephp.org/2.0/en/models/saving-your-data.html#model-savemany-array-data-null-array-options-array

Att,


--

Luiz Antonio S Messias
Desenvolvedor Web


@tonyzrp 
*LinkedIn* 



On 28 November 2012 04:18, Sam  wrote:

> Dear CakePHP experts,
>
> I have an add() record function that is used as a REST web service via
> XML. The code is very simple. Something like below;
>
> $this->Object->create();
> $this->Object->save($this->request->data);
>
> The limitation is that this function can only add one record at a time.
> What I want is to add multiple records at one time. The XML file can
> contain multiple records. So, I would like the function to be able to add
> multiple records via REST XML. May I know if CakePHP can be made to do this?
>
>  I tried googling for a solution but could not find any. Can the experts
> here advise or provide some hints on how to start?
>
> Thank you very much
>
> --
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/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.
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>
>
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/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.
Visit this group at http://groups.google.com/group/cake-php?hl=en.