CakePHP 1.3.2 Pagination Error under Plugin

2010-07-20 Thread Bryan de Asis
I'm having errors when trying to execute Pagination I'm not having
this kind of problem on version 1.2.x:

Warning (4096): Object of class JsHelper could not be converted to
string [CORE/cake/libs/view/helpers/javascript.php, line 259]
Notice (8): Object of class JsHelper to string conversion [CORE/cake/
libs/view/helpers/javascript.php, line 259]

Fatal error: Cannot use object of type JsHelper as array in /home/
bdeasis/lib/cakephp-1.3.2/cake/libs/view/helpers/javascript.php  on
line 260


And this is my controller look like:
class ClientsController extends CoreAppController
{

  public $name = 'Clients';
  public $paginate = array(
'limit' => 1,
'order' => array(
'Client.created, Client.modified'=>'DESC'
)
);

public function beforeFilter()
{
parent::beforeFilter();
}

public function index()
{
$data = $this->paginate('Client');
$this->set('data',compact('data'));
}
}

but if I comment $data = $this->paginate('Client'); or just using find
it is working fine. i think it is in the paginate method.

Can any one help me... Thanks...

Bryan de Asis

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: checking posted data

2010-07-20 Thread rakeshyadav rakeshyadav
On Tue, Jul 20, 2010 at 9:48 PM, cricket  wrote:

> On Tue, Jul 20, 2010 at 9:20 AM, rakeshyadav rakeshyadav
>  wrote:
> > hi all,
> >
> >   I am trying to execute query with some posted value the query
> is
> > like this
> >
> >  $sql = "SELECT DISTINCT `csd`.`store_id` ,`csd`.`campaign_id`,
> `csd`.`date`
> > , `c`.`campaign_id` ,`c`.`supplier_id` , `cm`.`sub_category_id`
> > FROM `campaign_store_dates` AS `csd`
> > LEFT JOIN `campaigns` AS `c` ON `csd`.`campaign_id` = `c`.`campaign_id`
> > LEFT JOIN `campaign_media` AS `cm` ON `c`.`campaign_id` =
> `cm`.`campaign_id`
> > WHERE `c`.`status` NOT
> > IN (
> > 'request', 'cancelled'
> > ) AND `csd`.`store_id` != '0'
> > ";
> > if (!empty($strDate) and !empty($endDate)){
> > $sql .= " AND `csd`.`date` BETWEEN '$strDate' AND
> > '$endDate'";
> > }
> > if (isset($sub_category_id)){
> > $sql .= " AND `cm`.`sub_category_id` =
> {$sub_category_id}";
> > }
> > in if condition i am checking wether the value is there r not the query
> is
> > working fine when value is set.
>
> Which value?

   I am sorry the value is  $sub_category_id

>
> > if value is not set at that time the query
> > is not working and giving error like
> >
> > SQL Error: 1054: Unknown column 'empty' in 'where clause'
> > please give me sugitions
>
> debug($sql);
>
> It's a somewhat complicated query but, at a glance, it looks like you
> could do this same thing using find() and ContainableBehavior.
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> 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.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: Unicode problem between controller and view

2010-07-20 Thread Kirk
I thought it might get annoying... my conversation with myself. But I hope
it helps someone!

On Tue, Jul 20, 2010 at 7:47 PM, MattyHead  wrote:

> Thank you for posting your whole experience with this!  And congratulations
> for figuring it out so quickly.
>
> Cheers,
> Matt
>
> On Tue, Jul 20, 2010 at 7:15 PM, Kirk  wrote:
>
>> i found the solution here:
>> http://www.jotlab.com/2009/03/03/cakephp-utf-8/
>>
>> all you have to do is add 'encoding' => 'UTF8' to database.php
>>
>> doh!
>>
>>
>> On Tue, Jul 20, 2010 at 6:59 PM, Kirk  wrote:
>>
>>> And the plot thickens...
>>>
>>> If I change the character encoding in core.php to:
>>>
>>> Configure::write('App.encoding', 'ISO-8859-1');
>>>
>>> Then suddenly the text shows up correctly. Which means that even though
>>> I'm specifying UTF-8 as the character encoding, cake is still using
>>> ISO-8859-1 (or Windows-1252?) encoding while saying that it's using UTF-8.
>>> How frustrating!
>>>
>>>
>>> On Tue, Jul 20, 2010 at 6:17 PM, Kirk  wrote:
>>>
 As an extra piece of information, if I specify the escape option
 as 'ISO-8859-1' in the link method of the html helper (
 http://book.cakephp.org/view/1442/link), the non-ascii characters are
 substituted for html entities, and it renders fine (without the little
 question marks). (I am using Windows, btw)


 On Tue, Jul 20, 2010 at 5:37 PM, Kirk  wrote:

> I thought someone here may have some experience with this. I fetch
> utf-8 data from a mysql db using:
>
> $this->data = find('all',$options);
>
> From within the controller, if I debug($this->data), I get something
> like:
>
> [1] => Array
> (
> [Subdivision] => Array
> (
> [name] => Aïn Témouchent
> )
>
> But if I debug($this->data) in the view, I get something like:
>
> [1] => Array
> (
> [Subdivision] => Array
> (
> [name] => A�n T�mouchent
> )
>
> The non-ascii characters don't show up correctly. I can't figure out
> why this is happening. In my core.php, I have the following option:
>
> Configure::write('App.encoding', 'UTF-8');
>
> I'm not sure what else I need to check. Any help would be greatly
> appreciated.
>
> Thanks,
> ~Kirk
>


>>>
>>  Check out the new CakePHP Questions site http://cakeqs.org and help
>> others with their CakePHP related questions.
>>
>> 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.comFor
>>  more options, visit this group at
>> http://groups.google.com/group/cake-php?hl=en
>>
>
>  Check out the new CakePHP Questions site http://cakeqs.org and help
> others with their CakePHP related questions.
>
> 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.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: Email Component

2010-07-20 Thread Hugo M
Mm... if you have Linux you can check in /etc/php5/apache2/php.ini the
sendmail configuration and the sendmail path. Maybe is put as a relative
path (I don't see a good reason to do that but... who knows :P)

2010/7/20 Ed Propsner 

> Nope, nothing. I originally used it right out of the box and I didn't have
> to change a thing.
>
> It was working perfectly until I changed to a new dir on my server. It
> really makes no sense.
>
>
> On Tue, Jul 20, 2010 at 8:49 PM, Hugo M  wrote:
>
>> Strange, do you have any configuration related with Email component? if I
>> can send mail with mail() I can send with the component :S
>>
>> 2010/7/20 Ed Propsner 
>>
>>> I recently changed names on one of my sites and moved the entire site to
>>> a different dir on the server.
>>>
>>> Everything went smooth enough except now I'm unable to send emails.
>>> Mail sends ok using  PHP mail() function but not when using the email
>>> component.
>>> The email is NOT set up for SMTP.
>>>
>>> Am I overlooking something here? I'm not sure what the problem is.
>>>
>>> Check out the new CakePHP Questions site http://cakeqs.org and help
>>> others with their CakePHP related questions.
>>>
>>> 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.comFor
>>>  more options, visit this group at
>>> http://groups.google.com/group/cake-php?hl=en
>>>
>>
>>  Check out the new CakePHP Questions site http://cakeqs.org and help
>> others with their CakePHP related questions.
>>
>> 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.comFor
>>  more options, visit this group at
>> http://groups.google.com/group/cake-php?hl=en
>>
>
>  Check out the new CakePHP Questions site http://cakeqs.org and help
> others with their CakePHP related questions.
>
> 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.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: Email Component

2010-07-20 Thread Ed Propsner
Nope, nothing. I originally used it right out of the box and I didn't have
to change a thing.

It was working perfectly until I changed to a new dir on my server. It
really makes no sense.

On Tue, Jul 20, 2010 at 8:49 PM, Hugo M  wrote:

> Strange, do you have any configuration related with Email component? if I
> can send mail with mail() I can send with the component :S
>
> 2010/7/20 Ed Propsner 
>
>> I recently changed names on one of my sites and moved the entire site to a
>> different dir on the server.
>>
>> Everything went smooth enough except now I'm unable to send emails.
>> Mail sends ok using  PHP mail() function but not when using the email
>> component.
>> The email is NOT set up for SMTP.
>>
>> Am I overlooking something here? I'm not sure what the problem is.
>>
>> Check out the new CakePHP Questions site http://cakeqs.org and help
>> others with their CakePHP related questions.
>>
>> 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.comFor
>>  more options, visit this group at
>> http://groups.google.com/group/cake-php?hl=en
>>
>
>  Check out the new CakePHP Questions site http://cakeqs.org and help
> others with their CakePHP related questions.
>
> 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.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: Email Component

2010-07-20 Thread Hugo M
Strange, do you have any configuration related with Email component? if I
can send mail with mail() I can send with the component :S

2010/7/20 Ed Propsner 

> I recently changed names on one of my sites and moved the entire site to a
> different dir on the server.
>
> Everything went smooth enough except now I'm unable to send emails.
> Mail sends ok using  PHP mail() function but not when using the email
> component.
> The email is NOT set up for SMTP.
>
> Am I overlooking something here? I'm not sure what the problem is.
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> 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.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 can i realize this in cake? clicking on a DIV field opens a popup

2010-07-20 Thread cricket
On Tue, Jul 20, 2010 at 4:46 PM, Tomfox Wiranata
 wrote:
> hi.
>
> i'll try to make it quick :) here is what i wanna do:
>
> a user has the opportunity to place information about him on my
> website. for that i wanna provide a template. and this i want the user
> being able to to.
>
> he has an empty page in front of him, divided by areas, that need to
> be filled with information. these areas will be DIV containers. if the
> user clicks on such a area a popup opens with a form where he can
> enter his information. after cklicking "ok" the information will be
> written directly in this div, but NOT saved to the database
> already
>
> after filling out all the areas he clicks "save" and the whole form/
> page will be store in the database.  what i need to know:
>
> 1) is this whole "clicking on a div and open a popup" possible? if so,
> how? jquery?

Yes, this is a javascript issue, not PHP.

> 2) where can i temporary save the information before the user finally
> stores everything in the database? in hidden fields?

In the form?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: Phrase inflections

2010-07-20 Thread MattyHead
I know you can fake it with Routes, but I fear you'd end up tweaking URLs in
your views like crazy.

http://book.cakephp.org/view/46/Routes-Configuration

Sorry, I have nothing better.

Matt

On Tue, Jul 20, 2010 at 1:36 PM, desheffer  wrote:

> I have a model called LeaveOfAbsence. The proper English name for the
> pluralized controller would be "LeavesOfAbsence" rather than
> "LeaveOfAbsences" (similar to the plural "mothers-in-law").
>
> Does anyone know to set up inflections for this specific case? It
> seems that CakePHP only looks at the last word in the phrase, never
> the entire phrase.
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> 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.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: Unicode problem between controller and view

2010-07-20 Thread MattyHead
Thank you for posting your whole experience with this!  And congratulations
for figuring it out so quickly.

Cheers,
Matt

On Tue, Jul 20, 2010 at 7:15 PM, Kirk  wrote:

> i found the solution here:
> http://www.jotlab.com/2009/03/03/cakephp-utf-8/
>
> all you have to do is add 'encoding' => 'UTF8' to database.php
>
> doh!
>
>
> On Tue, Jul 20, 2010 at 6:59 PM, Kirk  wrote:
>
>> And the plot thickens...
>>
>> If I change the character encoding in core.php to:
>>
>> Configure::write('App.encoding', 'ISO-8859-1');
>>
>> Then suddenly the text shows up correctly. Which means that even though
>> I'm specifying UTF-8 as the character encoding, cake is still using
>> ISO-8859-1 (or Windows-1252?) encoding while saying that it's using UTF-8.
>> How frustrating!
>>
>>
>> On Tue, Jul 20, 2010 at 6:17 PM, Kirk  wrote:
>>
>>> As an extra piece of information, if I specify the escape option
>>> as 'ISO-8859-1' in the link method of the html helper (
>>> http://book.cakephp.org/view/1442/link), the non-ascii characters are
>>> substituted for html entities, and it renders fine (without the little
>>> question marks). (I am using Windows, btw)
>>>
>>>
>>> On Tue, Jul 20, 2010 at 5:37 PM, Kirk  wrote:
>>>
 I thought someone here may have some experience with this. I fetch utf-8
 data from a mysql db using:

 $this->data = find('all',$options);

 From within the controller, if I debug($this->data), I get something
 like:

 [1] => Array
 (
 [Subdivision] => Array
 (
 [name] => Aïn Témouchent
 )

 But if I debug($this->data) in the view, I get something like:

 [1] => Array
 (
 [Subdivision] => Array
 (
 [name] => A�n T�mouchent
 )

 The non-ascii characters don't show up correctly. I can't figure out why
 this is happening. In my core.php, I have the following option:

 Configure::write('App.encoding', 'UTF-8');

 I'm not sure what else I need to check. Any help would be greatly
 appreciated.

 Thanks,
 ~Kirk

>>>
>>>
>>
>  Check out the new CakePHP Questions site http://cakeqs.org and help
> others with their CakePHP related questions.
>
> 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.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


cake_1.2.3.8166 and AdminAuth

2010-07-20 Thread simon...@terra.com.br
Good Night,

I'm trying to make the AdminAuth component work on cake_1.2.3.8166.

I did uncomment Configure::write('Routing.admin', 'admin'); on line 67
of the file app/config/core.php.

On the file app/app_controller.php lines 49-50 I have this code:

$this->AdminAuth->msgError = "Error.";
//$this->AdminAuth->init($this);


On the file app\controllers\components\admin_auth.php line 110, I had
this code loadModel("Admin"), it was depreceated so I did change it to
App::Import('Admin');. I don't know if I should use
App::Import('Admin'); or ClassRegistry::init('Admin');?

When I uncomment the line 50 of the file app/app_controller.php
( $this->AdminAuth->init($this); ). Instead of showing my site when I
enter my domain, it shows directly the administrator.

What I'm doing wrong?


Regards,

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: cron_dispatcher 1.3.2 import plugin models

2010-07-20 Thread trav
Hi,

I can't seem to import a plugin model when running controller from the
cron_dispatcher.  Here is a simple test result.

ver: 1.3.2
cron_dispatcher: http://tricks.cakephp.in.th/comland-line-and-cronjob

1. running from web . [WORKS]
2. running testA function WITHOUT model import from cmd line.
[WORKS]
3. running testB function WITH model import from cmd line.
[FAILED] - No errors given

code:
---
class CronsController extends PluginAppController {

var $uses = array();


function testA()
{
echo 'Working';
die;
}


function testB()
{
App::import('Model', 'Plugin.Report');
$report = new Report();

echo 'Working';
die;
}

}

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: Unicode problem between controller and view

2010-07-20 Thread Kirk
i found the solution here:
http://www.jotlab.com/2009/03/03/cakephp-utf-8/

all you have to do is add 'encoding' => 'UTF8' to database.php

doh!

On Tue, Jul 20, 2010 at 6:59 PM, Kirk  wrote:

> And the plot thickens...
>
> If I change the character encoding in core.php to:
>
> Configure::write('App.encoding', 'ISO-8859-1');
>
> Then suddenly the text shows up correctly. Which means that even though I'm
> specifying UTF-8 as the character encoding, cake is still using ISO-8859-1
> (or Windows-1252?) encoding while saying that it's using UTF-8. How
> frustrating!
>
>
> On Tue, Jul 20, 2010 at 6:17 PM, Kirk  wrote:
>
>> As an extra piece of information, if I specify the escape option
>> as 'ISO-8859-1' in the link method of the html helper (
>> http://book.cakephp.org/view/1442/link), the non-ascii characters are
>> substituted for html entities, and it renders fine (without the little
>> question marks). (I am using Windows, btw)
>>
>>
>> On Tue, Jul 20, 2010 at 5:37 PM, Kirk  wrote:
>>
>>> I thought someone here may have some experience with this. I fetch utf-8
>>> data from a mysql db using:
>>>
>>> $this->data = find('all',$options);
>>>
>>> From within the controller, if I debug($this->data), I get something
>>> like:
>>>
>>> [1] => Array
>>> (
>>> [Subdivision] => Array
>>> (
>>> [name] => Aïn Témouchent
>>> )
>>>
>>> But if I debug($this->data) in the view, I get something like:
>>>
>>> [1] => Array
>>> (
>>> [Subdivision] => Array
>>> (
>>> [name] => A�n T�mouchent
>>> )
>>>
>>> The non-ascii characters don't show up correctly. I can't figure out why
>>> this is happening. In my core.php, I have the following option:
>>>
>>> Configure::write('App.encoding', 'UTF-8');
>>>
>>> I'm not sure what else I need to check. Any help would be greatly
>>> appreciated.
>>>
>>> Thanks,
>>> ~Kirk
>>>
>>
>>
>

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: HABTM - can't get model back

2010-07-20 Thread Andrew
Thanks, I'll give it a go

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: Unicode problem between controller and view

2010-07-20 Thread Kirk
And the plot thickens...

If I change the character encoding in core.php to:

Configure::write('App.encoding', 'ISO-8859-1');

Then suddenly the text shows up correctly. Which means that even though I'm
specifying UTF-8 as the character encoding, cake is still using ISO-8859-1
(or Windows-1252?) encoding while saying that it's using UTF-8. How
frustrating!

On Tue, Jul 20, 2010 at 6:17 PM, Kirk  wrote:

> As an extra piece of information, if I specify the escape option
> as 'ISO-8859-1' in the link method of the html helper (
> http://book.cakephp.org/view/1442/link), the non-ascii characters are
> substituted for html entities, and it renders fine (without the little
> question marks). (I am using Windows, btw)
>
>
> On Tue, Jul 20, 2010 at 5:37 PM, Kirk  wrote:
>
>> I thought someone here may have some experience with this. I fetch utf-8
>> data from a mysql db using:
>>
>> $this->data = find('all',$options);
>>
>> From within the controller, if I debug($this->data), I get something like:
>>
>> [1] => Array
>> (
>> [Subdivision] => Array
>> (
>> [name] => Aïn Témouchent
>> )
>>
>> But if I debug($this->data) in the view, I get something like:
>>
>> [1] => Array
>> (
>> [Subdivision] => Array
>> (
>> [name] => A�n T�mouchent
>> )
>>
>> The non-ascii characters don't show up correctly. I can't figure out why
>> this is happening. In my core.php, I have the following option:
>>
>> Configure::write('App.encoding', 'UTF-8');
>>
>> I'm not sure what else I need to check. Any help would be greatly
>> appreciated.
>>
>> Thanks,
>> ~Kirk
>>
>
>

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Phrase inflections

2010-07-20 Thread desheffer
I have a model called LeaveOfAbsence. The proper English name for the
pluralized controller would be "LeavesOfAbsence" rather than
"LeaveOfAbsences" (similar to the plural "mothers-in-law").

Does anyone know to set up inflections for this specific case? It
seems that CakePHP only looks at the last word in the phrase, never
the entire phrase.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: Unicode problem between controller and view

2010-07-20 Thread Kirk
As an extra piece of information, if I specify the escape option
as 'ISO-8859-1' in the link method of the html helper (
http://book.cakephp.org/view/1442/link), the non-ascii characters are
substituted for html entities, and it renders fine (without the little
question marks). (I am using Windows, btw)

On Tue, Jul 20, 2010 at 5:37 PM, Kirk  wrote:

> I thought someone here may have some experience with this. I fetch utf-8
> data from a mysql db using:
>
> $this->data = find('all',$options);
>
> From within the controller, if I debug($this->data), I get something like:
>
> [1] => Array
> (
> [Subdivision] => Array
> (
> [name] => Aïn Témouchent
> )
>
> But if I debug($this->data) in the view, I get something like:
>
> [1] => Array
> (
> [Subdivision] => Array
> (
> [name] => A�n T�mouchent
> )
>
> The non-ascii characters don't show up correctly. I can't figure out why
> this is happening. In my core.php, I have the following option:
>
> Configure::write('App.encoding', 'UTF-8');
>
> I'm not sure what else I need to check. Any help would be greatly
> appreciated.
>
> Thanks,
> ~Kirk
>

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 same functions in several views

2010-07-20 Thread euromark
careful with
foreach(Cache::read('userCapList') as $userCap)...
!!!

Cache::read() is not in all cases a array to iterate over
sometimes its false etc
so make sure to cast it to an array:

foreach((array)Cache::read('userCapList') as $userCap)...

or do it in 2 steps


On 20 Jul., 16:48, "mattmoy...@gmail.com" 
wrote:
> Your life would be soo much easier if you were using cake's ACL in
> your application.  It handles all of the stuff you are trying to do
> automagically.  It can be a little intimidating for new users but once
> you figure it out you will never use anything else again.  Here is a
> great 2 part tutorial from one of Cake PHP's 
> developershttp://mark-story.com/posts/view/auth-and-acl-an-end-to-end-tutorial-...
>
> On Jul 20, 6:29 am, "Mike Karthauser"  wrote:
>
>
>
> > hi Petter;
>
> > On Tue, July 20, 2010 9:12 am, Petter Andreas Str m wrote:
> > > Well, I have to explain the topic for the discussion too;
>
> > > I'm looking for a solution where I can make a function to check if
> > > user have this capability like if(userHasCap('user_edit')). How can i
> > > make a function like this and include it into every view i need it?
> > > Component?
>
> > you could do this in a view helper if you are expecting logic to go into a
> > view page (.ctp).
>
> > ideally the logic should go in the action for the view in which case you
> > could either use a component or more simply just a function in
> > app_controller which will make it available to each controller.
>
> > --
> > Mike Karthauser
> > Managing Director - Brightstorm Ltd
>
> > Email: mi...@brightstorm.co.uk
> > Web:http://www.brightstorm.co.uk
> > Tel:  07939 252144 (mobile)
> > Fax: 0870 1320560
>
> > Address: 1 Brewery Court, North Street, Bristol, BS3 1JS

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 add global variable

2010-07-20 Thread euromark
if you actually need to save the keys in some models
like "users" (id, name, admin_type, ...)

you could take a look at
http://www.dereuromark.de/2010/06/24/static-enums-or-semihardcoded-attributes/
thats how I do it - application wide available and easy to extend
(if you ever need more types etc)


On 20 Jul., 17:57, "Dr. Loboto"  wrote:
> If you need "global variable", use Configure class designed specially
> for this.
>
> http://book.cakephp.org/view/43/Configure-Methods
>
> On Jul 20, 3:45 pm, xiaopang  wrote:
>
>
>
> > Hello:
>
> > I am a newby to Cakephp,
>
> > I have some simple data which I don't want to store in database but I
> > want them to be application wide accessible. for view, controller as
> > well as model.
>
> > For example:  I have a array  $admin_type, which define 2 types of
> > system administer,
>
> >             $admin_type =  array (1 => 'King',
> >                                   2 => 'Admin');
>
> > Then, where should I define this variable?   I tried to define in
> > bootstrap file, but it doesn't work
>
> > Thanks in advance

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Unicode problem between controller and view

2010-07-20 Thread Kirk
I thought someone here may have some experience with this. I fetch utf-8
data from a mysql db using:

$this->data = find('all',$options);

>From within the controller, if I debug($this->data), I get something like:

[1] => Array
(
[Subdivision] => Array
(
[name] => Aïn Témouchent
)

But if I debug($this->data) in the view, I get something like:

[1] => Array
(
[Subdivision] => Array
(
[name] => A�n T�mouchent
)

The non-ascii characters don't show up correctly. I can't figure out why
this is happening. In my core.php, I have the following option:

Configure::write('App.encoding', 'UTF-8');

I'm not sure what else I need to check. Any help would be greatly
appreciated.

Thanks,
~Kirk

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Email Component

2010-07-20 Thread Ed Propsner
I recently changed names on one of my sites and moved the entire site to a
different dir on the server.

Everything went smooth enough except now I'm unable to send emails.
Mail sends ok using  PHP mail() function but not when using the email
component.
The email is NOT set up for SMTP.

Am I overlooking something here? I'm not sure what the problem is.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 can i realize this in cake? clicking on a DIV field opens a popup

2010-07-20 Thread Tomfox Wiranata
hi.

i'll try to make it quick :) here is what i wanna do:

a user has the opportunity to place information about him on my
website. for that i wanna provide a template. and this i want the user
being able to to.

he has an empty page in front of him, divided by areas, that need to
be filled with information. these areas will be DIV containers. if the
user clicks on such a area a popup opens with a form where he can
enter his information. after cklicking "ok" the information will be
written directly in this div, but NOT saved to the database
already

after filling out all the areas he clicks "save" and the whole form/
page will be store in the database.  what i need to know:

1) is this whole "clicking on a div and open a popup" possible? if so,
how? jquery?

2) where can i temporary save the information before the user finally
stores everything in the database? in hidden fields?

cant wait for feedback :) thx a lot

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


routing issue with languages & language switch links

2010-07-20 Thread dr. Hannibal Lecter
Hi everyone,

I've asked this a few times on IRC, but I guess it's too
complicated(?) to be answered over IRC.

I'm trying to build a multilingual web site, so I've created the
following route:

Router::connect('/:language/:controller/:action/*', array(),
array('language' => '[a-z]{3}'));

Now, if I want to create a few links for switching languages, I do the
following:

foreach ($availableLanguages as $locale => $params)
{
$link = array_merge(array('language' => $locale), $this-
>params['named'], $this->params['pass']);
echo $this->Html->link($image, $link, array('escape' => false));
}

And this actually works, and produces correct results. For example, if
I open an URL:

/hrv/tests/index/drink

The generated links will be in the form of:

/eng/tests/index/drink

HOWEVER...

If the url contains a named param:

/hrv/tests/index/drink/feck:arse

Cake will generate links like this one:

/tests/index/drink/language:eng/feck:arse

So..either I'm missing something, or something is amiss.. I know the
named params are the cause because I can remove $this->params['named']
from the array_merge call and everything works fine.

Any ideas what's wrong here? Is this a router bug?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: Assign Profile When User Registers

2010-07-20 Thread Daniel M.K.
The Schema is simple, user has Username, Password, Email, and the
Group ID that is default for users. Profile just has a user_id, but in
this profile i want to check email, first name and last name when user
registers and assign him his profile. Thanks!

On 19 jul, 01:01, cricket  wrote:
> On Sun, Jul 18, 2010 at 7:26 AM, Daniel M.K.  wrote:
> > I know it seems to be a strange setup but this is what i need to do, i
> > have already got the profiles data already inserted in the database
> > and the users should only make an user account.
>
> > I don't figure where to put that script that you have written cricket.
> > If the user doesn't have the data in the database it should register
> > it and assign him a new profile.
>
> I think you'll need to post the DB schema for both users & profiles tables.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: Ghosts in Auth component register action

2010-07-20 Thread Hugo M
Lol... I was using create() function and there's no automagic there.
Facepalm xD

2010/7/20 Hugo M 

> Hi! I want to add token mail verification but I notice that php is not
> entering in register function when creating user (probably Auth component is
> registering users automagically). The thing is I need to put somewhere my
> code to send a mail to the users email account :S.
>
> I put a die("") in register function but nothing happens x) (when
> registering)
>
> How do you guys do token email verification?
>

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: Form helper: DIVs vs tables

2010-07-20 Thread Hugo M
Good advice, thanks ohcibi.

I was using left and right float behaviors but not with fixed width.

2010/7/20 ohcibi 

> This example is emulating tables with divs which is the same as tables
> in the end... for this kind of layout, you have to give the labels the
> formhelper adds a fixed width which equals your left "column"
>
> On 20 Jul., 17:10, "Mike Karthauser"  wrote:
> > hi hugo
> >
> > heres a form similar the remember the milk which doesnt use tables
> >
> > http://veerle-v2.duoh.com/blog/comments/styling_forms_in_css/
> >
> > should give you some pointers.
> >
> > mikek
> >
> >
> >
> >
> >
> > On Tue, July 20, 2010 4:04 pm, Hugo M wrote:
> > > Yeah I agree! Tables are for tabular data. But that site uses tables
> :O,
> > > but
> > > maybe is not the best option.
> >
> > > Thanks I will se what I can do
> >
> > > 2010/7/20 Mike Karthauser 
> >
> > >> hi hugo
> >
> > >> On Tue, July 20, 2010 3:07 pm, Hugo M wrote:
> > >> > Hi all! I have a question, I'm making forms using form helper.
> >
> > >> > What's better, creating forms with tables or with divs? Divs are the
> > >> only
> > >> > way to create forms with the cakePHP form helper, right?
> >
> > >> > I'm not a css master :P, so maybe I don't understand very well why
> > >> using
> > >> > divs instead of tables in forms (I understand the difference when
> > >> creating
> > >> > nomal page content). The real problem is that I need to do something
> > >> like
> > >> >http://jquery.bassistance.de/validate/demo/milk/but I don't want to
> > >> have
> > >> > an
> > >> > ugly code like:
> >
> > >> > 
> > >> > 
> > >> > input(...) ?>
> > >> > 
> > >> > 
> >
> > >> > etc.
> >
> > >> > I want:
> >
> > >> >  > >> > echo $form->create(...);
> > >> > echo $form->input(...);
> > >> > ?>
> >
> > >> > etc. :P
> >
> > >> > Is that possible with tables? Can I make something like the link
> > >> example
> > >> > without tables?
> >
> > >> it is indeed possible without tables. the example you sited doesnt use
> > >> them either.
> >
> > >> you'll be able to use output from form helper to achieve this although
> > >> can
> > >> be a bit tricky to support old browsers.
> >
> > >> tables are for display of tabular data not for styling.
> >
> > >> the styles already defined in cake.generic.css will get you most of
> the
> > >> way there although you'll need to study the style sheet in
> > >>http://jquery.bassistance.de/validate/demo/milk/ to tighten it all up.
> >
> > >> mikek
> >
> > >> --
> > >> Mike Karthauser
> > >> Managing Director - Brightstorm Ltd
> >
> > >> Email: mi...@brightstorm.co.uk
> > >> Web:http://www.brightstorm.co.uk
> > >> Tel:  07939 252144 (mobile)
> > >> Fax: 0870 1320560
> >
> > >> Address: 1 Brewery Court, North Street, Bristol, BS3 1JS
> >
> > >> Check out the new CakePHP Questions sitehttp://cakeqs.organd help
> > >> others
> > >> with their CakePHP related questions.
> >
> > >> 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
> >
> > > Check out the new CakePHP Questions sitehttp://cakeqs.organd help
> others
> > > with their CakePHP related questions.
> >
> > > 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.comFor
> > >  more options, visit this group
> > > athttp://groups.google.com/group/cake-php?hl=en
> >
> > --
> > Mike Karthauser
> > Managing Director - Brightstorm Ltd
> >
> > Email: mi...@brightstorm.co.uk
> > Web:http://www.brightstorm.co.uk
> > Tel:  07939 252144 (mobile)
> > Fax: 0870 1320560
> >
> > Address: 1 Brewery Court, North Street, Bristol, BS3 1JS
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> 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.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Ghosts in Auth component register action

2010-07-20 Thread Hugo M
Hi! I want to add token mail verification but I notice that php is not
entering in register function when creating user (probably Auth component is
registering users automagically). The thing is I need to put somewhere my
code to send a mail to the users email account :S.

I put a die("") in register function but nothing happens x) (when
registering)

How do you guys do token email verification?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: Problems with AppHelper

2010-07-20 Thread grigri
The problem here is that FormHelper does not load SessionHelper.

Sub-helpers do not merge automatically (unlike controllers), you have
to do it manually... like so

class AppHelper extends Helper {
  var $helpers = array('Session');

  function __construct() {
if (is_subclass_of($this, 'AppHelper')) {
  $parentVars = get_class_vars('AppHelper');
  $this->helpers = array_merge($parenttVars['helpers'], $this-
>helpers);
}
parent::__construct();
  }
}

Please note: this is a very simplified example. It won't handle
plugins properly, or helpers with configuration arrays. But I'm sure
you get the gist.

hth
grigri

On Jul 20, 4:05 am, Galymzhan  wrote:
> Hi, group. I did a blog application in tutorial. I've 2 views like in
> tutorial:
> edit.ctp:
> Edit Post
>          echo $form->create('Post', array('action' => 'edit'));
>         echo $form->input('title');
>         echo $form->input('body', array('rows' => '3'));
>         echo $form->input('id', array('type'=>'hidden'));
>         echo $form->end('Save Post');
> ?>
>
> and view.ctp:
> 
> Created: 
> 
>
> Now I want to override default functionality of url(). I've created
> app_helper.php in /app/ folder.
>
> class AppHelper extends Helper {
>   var $helpers = array('Session'); // I want to use Session helper
>   function url($url = NULL, $full = FALSE) {
>     if ($this->Session->check('lang')) {
>       // here is my custom logic
>     }
>   }
>
> }
>
> The problem is that when I'm trying to edit a post (edit.ctp), I get a
> fatal php error saying FormHelper::$session is undefined. I think that
> session helper isn't loaded.
> But when I view a post (view.ctp) everything works OK and my custom
> url() method works as expected. Help, please. I'm using CakePHP 1.3
> and php 5.2

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: checking posted data

2010-07-20 Thread cricket
On Tue, Jul 20, 2010 at 9:20 AM, rakeshyadav rakeshyadav
 wrote:
> hi all,
>
>   I am trying to execute query with some posted value the query is
> like this
>
>  $sql = "SELECT DISTINCT `csd`.`store_id` ,`csd`.`campaign_id`, `csd`.`date`
> , `c`.`campaign_id` ,    `c`.`supplier_id` , `cm`.`sub_category_id`
> FROM `campaign_store_dates` AS `csd`
> LEFT JOIN `campaigns` AS `c` ON `csd`.`campaign_id` = `c`.`campaign_id`
> LEFT JOIN `campaign_media` AS `cm` ON `c`.`campaign_id` = `cm`.`campaign_id`
> WHERE `c`.`status` NOT
> IN (
> 'request', 'cancelled'
> ) AND `csd`.`store_id` != '0'
> ";
>     if (!empty($strDate) and !empty($endDate)){
>                 $sql .= " AND `csd`.`date` BETWEEN '$strDate' AND
> '$endDate'";
>             }
>     if (isset($sub_category_id)){
>                 $sql .= " AND `cm`.`sub_category_id` = {$sub_category_id}";
>             }
> in if condition i am checking wether the value is there r not the query is
> working fine when value is set.

Which value?

> if value is not set at that time the query
> is not working and giving error like
>
> SQL Error: 1054: Unknown column 'empty' in 'where clause'
> please give me sugitions

debug($sql);

It's a somewhat complicated query but, at a glance, it looks like you
could do this same thing using find() and ContainableBehavior.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: Form helper: DIVs vs tables

2010-07-20 Thread ohcibi
This example is emulating tables with divs which is the same as tables
in the end... for this kind of layout, you have to give the labels the
formhelper adds a fixed width which equals your left "column"

On 20 Jul., 17:10, "Mike Karthauser"  wrote:
> hi hugo
>
> heres a form similar the remember the milk which doesnt use tables
>
> http://veerle-v2.duoh.com/blog/comments/styling_forms_in_css/
>
> should give you some pointers.
>
> mikek
>
>
>
>
>
> On Tue, July 20, 2010 4:04 pm, Hugo M wrote:
> > Yeah I agree! Tables are for tabular data. But that site uses tables :O,
> > but
> > maybe is not the best option.
>
> > Thanks I will se what I can do
>
> > 2010/7/20 Mike Karthauser 
>
> >> hi hugo
>
> >> On Tue, July 20, 2010 3:07 pm, Hugo M wrote:
> >> > Hi all! I have a question, I'm making forms using form helper.
>
> >> > What's better, creating forms with tables or with divs? Divs are the
> >> only
> >> > way to create forms with the cakePHP form helper, right?
>
> >> > I'm not a css master :P, so maybe I don't understand very well why
> >> using
> >> > divs instead of tables in forms (I understand the difference when
> >> creating
> >> > nomal page content). The real problem is that I need to do something
> >> like
> >> >http://jquery.bassistance.de/validate/demo/milk/but I don't want to
> >> have
> >> > an
> >> > ugly code like:
>
> >> > 
> >> > 
> >> > input(...) ?>
> >> > 
> >> > 
>
> >> > etc.
>
> >> > I want:
>
> >> >  >> > echo $form->create(...);
> >> > echo $form->input(...);
> >> > ?>
>
> >> > etc. :P
>
> >> > Is that possible with tables? Can I make something like the link
> >> example
> >> > without tables?
>
> >> it is indeed possible without tables. the example you sited doesnt use
> >> them either.
>
> >> you'll be able to use output from form helper to achieve this although
> >> can
> >> be a bit tricky to support old browsers.
>
> >> tables are for display of tabular data not for styling.
>
> >> the styles already defined in cake.generic.css will get you most of the
> >> way there although you'll need to study the style sheet in
> >>http://jquery.bassistance.de/validate/demo/milk/ to tighten it all up.
>
> >> mikek
>
> >> --
> >> Mike Karthauser
> >> Managing Director - Brightstorm Ltd
>
> >> Email: mi...@brightstorm.co.uk
> >> Web:http://www.brightstorm.co.uk
> >> Tel:  07939 252144 (mobile)
> >> Fax: 0870 1320560
>
> >> Address: 1 Brewery Court, North Street, Bristol, BS3 1JS
>
> >> Check out the new CakePHP Questions sitehttp://cakeqs.organd help
> >> others
> >> with their CakePHP related questions.
>
> >> 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.comFor
> >> more options, visit this group at
> >>http://groups.google.com/group/cake-php?hl=en
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd help others
> > with their CakePHP related questions.
>
> > 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
> > athttp://groups.google.com/group/cake-php?hl=en
>
> --
> Mike Karthauser
> Managing Director - Brightstorm Ltd
>
> Email: mi...@brightstorm.co.uk
> Web:http://www.brightstorm.co.uk
> Tel:  07939 252144 (mobile)
> Fax: 0870 1320560
>
> Address: 1 Brewery Court, North Street, Bristol, BS3 1JS

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: HABTM - can't get model back

2010-07-20 Thread cricket
On Tue, Jul 20, 2010 at 4:33 AM, Andrew  wrote:
> Hi all,
>
> I am having a problem getting data from a model connected to a HABTM
>
> If I have two models, the first being hasMany to the second, then if I
> do a find on the second, I can normally access the first models
> fields, because a LEFT join is done? However, if the model is
> HasAndBelongsToMany then this is not the case??
>
> So, my problem now ---> I have four tables, one called Categories, one
> called Cities and the bridging table Categories_Cities
> And the fourth table is called Items  where Categories HasMany
> Items.
> But when I do a find on Categories_Cities, it is not finding my Items
> table, like it would if it was a HasMany relationship.

You should run the find() on either Category or City, not the join model.


> Cities > Categories_City <- Categories <--- Items
>
> Is that clear?
>
> The last part of my email contains my models:
>
> class Item extends AppModel
> {
>    var $name = 'item';
>
>
>                var $hasOne = array(
>        'Vote' => array(
>                'className' => 'Vote',
>                'foreignKey' => 'item_id'
>        )
>    );


You need to associate Item with Category.


> class City extends AppModel
> {
>    var $name = 'city';
>
>   var $hasMany = array(
>        'Item' => array(
>                'className' => 'Item',
>                'foreignKey' => 'city_id'
>        )
>    );


You showed, above, that Item should be associated with Category, not City.


>    var $hasAndBelongsToMany = array(
>        'Category' => array(
>                'className' => 'Category',
>                'foreignKey' => 'city_id'
>        )
>    );
>
>
>
>
> class Category extends AppModel
> {
>    var $name = 'category';
>
>    var $hasMany = array(
>        'Item' => array(
>                'className' => 'Item',
>                'foreignKey' => 'category_id'
>        )
>    );





>                var $hasAndBelongsToMany = array(
>        'City' => array(
>                'className' => 'City',
>                'foreignKey' => 'category_id'
>        )
>    );
>
>
>
>
> class CategoryCity extends AppModel
> {
>        var $name = 'CategoryCity';
>        var $useTable = 'categories_cities';
>
>        var $belongsTo = array
>        (
>                        'Category' => array
>                        (
>                                 'className'  => 'Category',
>                                 'foreignKey' => 'id'
>                        ),
>                        'City' => array
>                        (
>                                 'className'  => 'City',
>                                 'foreignKey' => 'id'
>                        )
>        );
>
> }

If the rest of your associations are correctly set up there shouldn't
be a need to explicitly create this model as Cake will do it
"virtually". There are cases where doing this is necessarry (or simply
helps) but I don't think you need it in this case.

Another thing you could look into (AFTER you have the associations
corrected) is ContainableBehavior, which makes selecting associated
data very easy.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: Problems with AppHelper

2010-07-20 Thread Dr. Loboto
Try attach Session helper explicitly:

class AppHelper extends Helper {
public $helpers = array('Session');
}

On Jul 20, 10:05 am, Galymzhan  wrote:
> Hi, group. I did a blog application in tutorial. I've 2 views like in
> tutorial:
> edit.ctp:
> Edit Post
>          echo $form->create('Post', array('action' => 'edit'));
>         echo $form->input('title');
>         echo $form->input('body', array('rows' => '3'));
>         echo $form->input('id', array('type'=>'hidden'));
>         echo $form->end('Save Post');
> ?>
>
> and view.ctp:
> 
> Created: 
> 
>
> Now I want to override default functionality of url(). I've created
> app_helper.php in /app/ folder.
>
> class AppHelper extends Helper {
>   var $helpers = array('Session'); // I want to use Session helper
>   function url($url = NULL, $full = FALSE) {
>     if ($this->Session->check('lang')) {
>       // here is my custom logic
>     }
>   }
>
> }
>
> The problem is that when I'm trying to edit a post (edit.ctp), I get a
> fatal php error saying FormHelper::$session is undefined. I think that
> session helper isn't loaded.
> But when I view a post (view.ctp) everything works OK and my custom
> url() method works as expected. Help, please. I'm using CakePHP 1.3
> and php 5.2

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 add global variable

2010-07-20 Thread Dr. Loboto
If you need "global variable", use Configure class designed specially
for this.

http://book.cakephp.org/view/43/Configure-Methods

On Jul 20, 3:45 pm, xiaopang  wrote:
> Hello:
>
> I am a newby to Cakephp,
>
> I have some simple data which I don't want to store in database but I
> want them to be application wide accessible. for view, controller as
> well as model.
>
> For example:  I have a array  $admin_type, which define 2 types of
> system administer,
>
>             $admin_type =  array (1 => 'King',
>                                   2 => 'Admin');
>
> Then, where should I define this variable?   I tried to define in
> bootstrap file, but it doesn't work
>
> Thanks in advance

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: Url in cake

2010-07-20 Thread cricket
On Tue, Jul 20, 2010 at 2:18 AM, nicky  wrote:
> hii i m developing a project in cake where i want some words to come
> before controllers name like as http://www.abc.com/teama/users
>    http://www.abc.com/teamb/users
>
> Can it is possible i have nothing to do with this word team a and team
> b just for displaying .

Router::connect(
'/:team/users/:action',
array('controller' => 'users'),
array('team' => 'team[a-z]')
);

function index()
{
die(debug($this->params));
}

You should see that there's a value for $this->params['team'] that is
passed. In your code, you should do:

if (isset($this->params['team']) && !empty($this->params['team']))
{
$team = $this->params['team'];

...
}


You can also 'pass' the value:

Router::connect(
'/:team/users/:action',
array('controller' => 'users'),
array('team' => 'team[a-z]', 'pass' => array('team'))
);


function index($team = null)
{
debug($team);
die(debug($this->params));
}


Passing the value allows you to do:

if (!isnull($team))
{
...

}

However, you'd need to add "$team = null" to all your methods. If you
only need to pass the team for the index method:

Router::connect(
'/:team/users',
array('controller' => 'users', 'action' => 'index'),
array('team' => 'team[a-z]', 'pass' => array('team'))
);

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 same functions in several views

2010-07-20 Thread mattmoy...@gmail.com
Your life would be soo much easier if you were using cake's ACL in
your application.  It handles all of the stuff you are trying to do
automagically.  It can be a little intimidating for new users but once
you figure it out you will never use anything else again.  Here is a
great 2 part tutorial from one of Cake PHP's developers
http://mark-story.com/posts/view/auth-and-acl-an-end-to-end-tutorial-pt-1

On Jul 20, 6:29 am, "Mike Karthauser"  wrote:
> hi Petter;
>
> On Tue, July 20, 2010 9:12 am, Petter Andreas Str m wrote:
> > Well, I have to explain the topic for the discussion too;
>
> > I'm looking for a solution where I can make a function to check if
> > user have this capability like if(userHasCap('user_edit')). How can i
> > make a function like this and include it into every view i need it?
> > Component?
>
> you could do this in a view helper if you are expecting logic to go into a
> view page (.ctp).
>
> ideally the logic should go in the action for the view in which case you
> could either use a component or more simply just a function in
> app_controller which will make it available to each controller.
>
> --
> Mike Karthauser
> Managing Director - Brightstorm Ltd
>
> Email: mi...@brightstorm.co.uk
> Web:http://www.brightstorm.co.uk
> Tel:  07939 252144 (mobile)
> Fax: 0870 1320560
>
> Address: 1 Brewery Court, North Street, Bristol, BS3 1JS

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: let users 'edit' database

2010-07-20 Thread mattmoy...@gmail.com
Drupal does something like this called revisions.  You could implement
a much simpler version of this in your application by adding 2 columns
to your database called revision and display.  Revision would just be
a revision number and you could use a timestamp as the field so it
would be unique and also keep track of creation time.  The display
column would just be a boolean showing which revision to show.  Then
you would implement some revision control actions in your controller
to manage the revisions.

This would actually be awesome if generalized and written as a
behavior.  Unfortunately, I just don't have the time right now. :(

On Jul 19, 6:01 pm, Jay  wrote:
> ok guys, so here is the situation:
>
> - we have built up a website using cakephp and it contains several
> models.
> - we want some users to be able to "make changes" to the database via
> webpage
> - but we want to audit the changes before they are actual made to the
> database
>
> Our problem is, how do we know what the user changed if those changes
> are not "saved" the first time around. We are thinking of displaying a
> mock database and have the admin merge it with the real db. Is there
> any other way to tackle this?
> Thanks for all your inputs.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: Site issues after moving host

2010-07-20 Thread mattmoy...@gmail.com
Well on a hunch, did you make sure you cleared your tmp and cache
directories?  In the past this has fixed most of these weird issues
that pop up in migration for me.

On Jul 20, 4:32 am, AzzBrands  wrote:
> Hi All,
> I recently moved hosts for my site and now it doesn't function. I get
> the following errors.
>
> Notice: Undefined index: action in /home/baristaa/public_html/cake/
> dispatcher.php  on line 142
>
> Notice: Undefined index: controller in /home/baristaa/public_html/cake/
> dispatcher.php on line 149
>
> Warning: session_start() [function.session-start]: Cannot send session
> cache limiter - headers already sent (output started at /home/baristaa/
> public_html/cake/dispatcher.php:142) in /home/baristaa/public_html/
> cake/libs/session.php on line 145
>
> Warning: Cannot modify header information - headers already sent by
> (output started at /home/baristaa/public_html/cake/dispatcher.php:142)
> in /home/baristaa/public_html/cake/libs/session.php on line 148
>
> I have had 3 Cake experienced developers try and help with no luck. Im
> hoping anyone has any luck or know where i could look?
>
> Thanks in advance.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 include new actions in ACL?

2010-07-20 Thread mattmoy...@gmail.com
As a follow up to my former post here is some code to assist you:

/**
 * Rebuild the Acl based on the current controllers in the application
 *
 * @return void
 */
function buildAcl() {
$log = array();

$aco =& $this->Acl->Aco;
$root = $aco->node('controllers');
if (!$root) {
$aco->create(array('parent_id' => null, 'model' => null,
'alias' => 'controllers'));
$root = $aco->save();
$root['Aco']['id'] = $aco->id;
$log[] = 'Created Aco node for controllers';
} else {
$root = $root[0];
}

App::import('Core', 'File');
$Controllers = Configure::listObjects('controller');
$appIndex = array_search('App', $Controllers);
if ($appIndex !== false ) {
unset($Controllers[$appIndex]);
}
$baseMethods = get_class_methods('Controller');
$baseMethods[] = 'buildAcl';

// look at each controller in app/controllers
foreach ($Controllers as $ctrlName) {
App::import('Controller', $ctrlName);
$ctrlclass = $ctrlName . 'Controller';
$methods = get_class_methods($ctrlclass);

// find / make controller node
$controllerNode = $aco->node('controllers/'.$ctrlName);
if (!$controllerNode) {
$aco->create(array('parent_id' => $root['Aco']['id'],
'model' => null, 'alias' => $ctrlName));
$controllerNode = $aco->save();
$controllerNode['Aco']['id'] = $aco->id;
$log[] = 'Created Aco node for '.$ctrlName;
} else {
$controllerNode = $controllerNode[0];
}

//clean the methods. to remove those in Controller and
private actions.
foreach ($methods as $k => $method) {
if (strpos($method, '_', 0) === 0) {
unset($methods[$k]);
continue;
}
if (in_array($method, $baseMethods)) {
unset($methods[$k]);
continue;
}
$methodNode = $aco->node('controllers/'.$ctrlName.'/'.
$method);
if (!$methodNode) {
$aco->create(array('parent_id' =>
$controllerNode['Aco']['id'], 'model' => null, 'alias' => $method));
$methodNode = $aco->save();
$log[] = 'Created Aco node for '. $method;
}
}
}
debug($log);
}

function initDB() {
$group =& $this->User->Group;
//Allow admins to everything
$group->id = 1;
$this->Acl->allow($group, 'controllers');

//allow managers to posts and widgets
$group->id = 2;
$this->Acl->deny($group, 'controllers');
$this->Acl->allow($group, 'controllers/Posts');
$this->Acl->allow($group, 'controllers/Widgets');

//allow users to only add and edit on posts and widgets
$group->id = 3;
$this->Acl->deny($group, 'controllers');
$this->Acl->allow($group, 'controllers/Posts/add');
$this->Acl->allow($group, 'controllers/Posts/edit');
$this->Acl->allow($group, 'controllers/Widgets/add');
$this->Acl->allow($group, 'controllers/Widgets/edit');
}

This code was taken from Mark Story's tutorial on ACL @
http://mark-story.com/posts/view/auth-and-acl-an-end-to-end-tutorial-pt-2

On Jul 19, 5:40 am, matsakaw  wrote:
> i struggled with Acl/Auth and i admit i just followed the steps
> without FULLY understanding what i did -- to generate the aros, acos
> and aros_acos tables using the build_Acl and initDB functions
> mentioned in the cake book/tutorial.  i was only too glad then to
> finally make Acl/Auth work -- my users and groups can access (and be
> denied from) selected controllers and their actions as programmed (in
> build_Acl, and in initDB).
>
> but lately, there has been a need to add new actions for some
> controllers.   i am now getting some unauthorized access messages to
> these added actions.
>
> what may i do now to include these new actions in the aros, acos and
> aros_acos tables?
>
> any help will be much appreciated.  leads to any new tutorials on Acl/
> Auth welcome also.
>
> thanks,
> matsakaw

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 add global variable

2010-07-20 Thread mattmoy...@gmail.com
The reason you can't do this easily is because it goes against Cake's
conventions.  Try learning to do things the cake way and it will make
your life way easier in the long run.   Especially if you will be
building multiple cake applications in the future!

What you should do is implement Acl to handle these different user
types.  It's super easy to do once you figure out a little of how it
works.  Mark Story one of the main cakephp developers has an excellent
tutorial on his website. 
http://mark-story.com/posts/view/auth-and-acl-an-end-to-end-tutorial-pt-1

If you really want to define this variable system wide though I think
you can do it in your main layout (default.ctp) for your views and
app_controller.php (you may have to create it) for your controllers.

On Jul 20, 4:45 am, xiaopang  wrote:
> Hello:
>
> I am a newby to Cakephp,
>
> I have some simple data which I don't want to store in database but I
> want them to be application wide accessible. for view, controller as
> well as model.
>
> For example:  I have a array  $admin_type, which define 2 types of
> system administer,
>
>             $admin_type =  array (1 => 'King',
>                                   2 => 'Admin');
>
> Then, where should I define this variable?   I tried to define in
> bootstrap file, but it doesn't work
>
> Thanks in advance

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 include new actions in ACL?

2010-07-20 Thread mattmoy...@gmail.com
matsakaw,
there are a few scripts floating around the automagically update your
acl tables.  This has been working great for me with cakephp 1.3
http://bakery.cakephp.org/articles/view/automatically-load-all-controllers-and-actions-into-aco-tables-for-acl-with-a-cakephp-task
You simply drop the script into the shells folder and you can use the
cake command line tool to update your acl perms.  There is also
another script floating around that I think rez was trying to
reference which adds a buildAcl method to your users controller.  I've
used both and prefer the shell script.

On Jul 20, 2:32 am, "rez...@gmail.com"  wrote:
> run build_Acl again
>
> On Jul 19, 12:40 pm, matsakaw  wrote:
>
> > i struggled with Acl/Auth and i admit i just followed the steps
> > without FULLY understanding what i did -- to generate the aros, acos
> > and aros_acos tables using the build_Acl and initDB functions
> > mentioned in the cake book/tutorial.  i was only too glad then to
> > finally make Acl/Auth work -- my users and groups can access (and be
> > denied from) selected controllers and their actions as programmed (in
> > build_Acl, and in initDB).
>
> > but lately, there has been a need to add new actions for some
> > controllers.   i am now getting some unauthorized access messages to
> > these added actions.
>
> > what may i do now to include these new actions in the aros, acos and
> > aros_acos tables?
>
> > any help will be much appreciated.  leads to any new tutorials on Acl/
> > Auth welcome also.
>
> > thanks,
> > matsakaw

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 same functions in several views

2010-07-20 Thread Petter Andreas Strøm
Thanks people! Worked out great;)

On Jul 20, 12:29 pm, "Mike Karthauser" 
wrote:
> hi Petter;
>
> On Tue, July 20, 2010 9:12 am, Petter Andreas Str m wrote:
> > Well, I have to explain the topic for the discussion too;
>
> > I'm looking for a solution where I can make a function to check if
> > user have this capability like if(userHasCap('user_edit')). How can i
> > make a function like this and include it into every view i need it?
> > Component?
>
> you could do this in a view helper if you are expecting logic to go into a
> view page (.ctp).
>
> ideally the logic should go in the action for the view in which case you
> could either use a component or more simply just a function in
> app_controller which will make it available to each controller.
>
> --
> Mike Karthauser
> Managing Director - Brightstorm Ltd
>
> Email: mi...@brightstorm.co.uk
> Web:http://www.brightstorm.co.uk
> Tel:  07939 252144 (mobile)
> Fax: 0870 1320560
>
> Address: 1 Brewery Court, North Street, Bristol, BS3 1JS

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 same functions in several views

2010-07-20 Thread Petter Andreas Strøm
Thanks people! Worked out great;)

On Jul 20, 12:29 pm, "Mike Karthauser" 
wrote:
> hi Petter;
>
> On Tue, July 20, 2010 9:12 am, Petter Andreas Str m wrote:
> > Well, I have to explain the topic for the discussion too;
>
> > I'm looking for a solution where I can make a function to check if
> > user have this capability like if(userHasCap('user_edit')). How can i
> > make a function like this and include it into every view i need it?
> > Component?
>
> you could do this in a view helper if you are expecting logic to go into a
> view page (.ctp).
>
> ideally the logic should go in the action for the view in which case you
> could either use a component or more simply just a function in
> app_controller which will make it available to each controller.
>
> --
> Mike Karthauser
> Managing Director - Brightstorm Ltd
>
> Email: mi...@brightstorm.co.uk
> Web:http://www.brightstorm.co.uk
> Tel:  07939 252144 (mobile)
> Fax: 0870 1320560
>
> Address: 1 Brewery Court, North Street, Bristol, BS3 1JS

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: Provide read-only interface for our CMS (Drupal)

2010-07-20 Thread geste
Galymzhan,

Thanks for a great, short answer to a long question.  I am a perpetual
newbie when it comes to some of this stuff and I had not looked at
REST yet.  I wasn't thinking of HTTP-type access because this app
requires SSL+authentication, but I could probably set up a localhost-
only Apache vhost to handle REST requests (Drupal and the CakePHP app
are on same host).  Being able to access controller actions directly
is what I want to do, so this looks like the most promising way to
go.  Yes, I will follow up as to how this works.

Thanks!

Jim

On Jul 19, 8:33 pm, Galymzhan  wrote:
> Hi. If I understand you correctly you want to pull data from CakePHP
> app and show it in Drupal. So why don't you consider using REST or
> something similar (web services?). AFAIK cake supports REST. From the
> drupal side, you have to write a module to interact with RESTservices
> provided by your cake application. Anyway, it's just an idea. If you
> solve your problem, share your solution, I think it would be
> interesting.
>
> On 20 июл, 05:01, geste  wrote:
>
>
>
> > All,
>
> > For an intranet application we run Drupal 6 but we also have a CakePHP
> > application for back-office stuff.  A simple example is employee
> > directory.  The CakePHP application is read-write with group-based
> > access control.
>
> > We'd like some of the CakePHP information to show up in Drupal on a
> > read-only basis.  I had written a few cheap scripts placed in nodes
> > that query the Cake-side tables directly, but I don't see this as
> > ideal.  For one, I want to move toward building more formal Drupal
> > modules and avoid simply putting random PHP code in nodes (where I see
> > the code being traversed by the Drupal search indexer!).  It would
> > also be hard to maintain over time.
>
> > I have the notion of writing a very basic Drupal module that does
> > nothing more than provide a single interface to our CakePHP tables,
> > then I could add modules like "Department_Directory" that would use
> > the base module.  Where I'm getting bogged down now is how best to
> > connect to the CakePHP tables.  I think I have seen most of the Drupal
> > and CakePHP docs on connecting to multiple databases (no problem) and
> > I have also looked at modules like Drake (not what I want).
>
> > What I am struggling with is whether there is a way to create a
> > CakePHP component or helper that provides certain basics (like show
> > full name sorted in last name, first name format) but which I could
> > also reference from Drupal to provide the same function.  I find
> > myself starting to add snippets like this to multiple controllers:
>
> > $person_orderby = array('Person.lastname', 'Person.firstname');
> > $people = $this->OfficeOccupancy->Person->find('list', array('order'
> > => $person_orderby ));
>
> > to create pick lists/menus.  This could get very laborious, so I am
> > trying to figure out how best to "component-ize" that kind of stuff.
> > Even better if I could figure out a way to make the same code/routines
> > work for Cake *and* Drupal.
>
> > One thought I had was to have a completely separate controller
> > component that would house all of these basic lookup functions and
> > then write some very simple (unformatted?  HTML-less?) views that
> > Drupal could reference to pull result sets back into my Drupal "data"
> > module.
>
> > Anyhow, sorry for ramble.  Any thoughts appreciated.  I suppose I
> > could write a library of functions that just connect to our CakePHP
> > tables, but I thought it could be worthwhile to think it through a bit
> > more.
>
> > Jim

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: Form helper: DIVs vs tables

2010-07-20 Thread Mike Karthauser
hi hugo

heres a form similar the remember the milk which doesnt use tables

http://veerle-v2.duoh.com/blog/comments/styling_forms_in_css/

should give you some pointers.

mikek

On Tue, July 20, 2010 4:04 pm, Hugo M wrote:
> Yeah I agree! Tables are for tabular data. But that site uses tables :O,
> but
> maybe is not the best option.
>
> Thanks I will se what I can do
>
> 2010/7/20 Mike Karthauser 
>
>> hi hugo
>>
>> On Tue, July 20, 2010 3:07 pm, Hugo M wrote:
>> > Hi all! I have a question, I'm making forms using form helper.
>> >
>> > What's better, creating forms with tables or with divs? Divs are the
>> only
>> > way to create forms with the cakePHP form helper, right?
>> >
>> > I'm not a css master :P, so maybe I don't understand very well why
>> using
>> > divs instead of tables in forms (I understand the difference when
>> creating
>> > nomal page content). The real problem is that I need to do something
>> like
>> > http://jquery.bassistance.de/validate/demo/milk/ but I don't want to
>> have
>> > an
>> > ugly code like:
>> >
>> > 
>> > 
>> > input(...) ?>
>> > 
>> > 
>> >
>> > etc.
>> >
>> > I want:
>> >
>> > > > echo $form->create(...);
>> > echo $form->input(...);
>> > ?>
>> >
>> > etc. :P
>> >
>> > Is that possible with tables? Can I make something like the link
>> example
>> > without tables?
>>
>> it is indeed possible without tables. the example you sited doesnt use
>> them either.
>>
>> you'll be able to use output from form helper to achieve this although
>> can
>> be a bit tricky to support old browsers.
>>
>> tables are for display of tabular data not for styling.
>>
>> the styles already defined in cake.generic.css will get you most of the
>> way there although you'll need to study the style sheet in
>> http://jquery.bassistance.de/validate/demo/milk/  to tighten it all up.
>>
>> mikek
>>
>> --
>> Mike Karthauser
>> Managing Director - Brightstorm Ltd
>>
>> Email: mi...@brightstorm.co.uk
>> Web: http://www.brightstorm.co.uk
>> Tel:  07939 252144 (mobile)
>> Fax: 0870 1320560
>>
>> Address: 1 Brewery Court, North Street, Bristol, BS3 1JS
>>
>> Check out the new CakePHP Questions site http://cakeqs.org and help
>> others
>> with their CakePHP related questions.
>>
>> 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.comFor
>> more options, visit this group at
>> http://groups.google.com/group/cake-php?hl=en
>>
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> 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
>


-- 
Mike Karthauser
Managing Director - Brightstorm Ltd

Email: mi...@brightstorm.co.uk
Web: http://www.brightstorm.co.uk
Tel:  07939 252144 (mobile)
Fax: 0870 1320560

Address: 1 Brewery Court, North Street, Bristol, BS3 1JS

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: Form helper: DIVs vs tables

2010-07-20 Thread Hugo M
Yeah I agree! Tables are for tabular data. But that site uses tables :O, but
maybe is not the best option.

Thanks I will se what I can do

2010/7/20 Mike Karthauser 

> hi hugo
>
> On Tue, July 20, 2010 3:07 pm, Hugo M wrote:
> > Hi all! I have a question, I'm making forms using form helper.
> >
> > What's better, creating forms with tables or with divs? Divs are the only
> > way to create forms with the cakePHP form helper, right?
> >
> > I'm not a css master :P, so maybe I don't understand very well why using
> > divs instead of tables in forms (I understand the difference when
> creating
> > nomal page content). The real problem is that I need to do something like
> > http://jquery.bassistance.de/validate/demo/milk/ but I don't want to
> have
> > an
> > ugly code like:
> >
> > 
> > 
> > input(...) ?>
> > 
> > 
> >
> > etc.
> >
> > I want:
> >
> >  > echo $form->create(...);
> > echo $form->input(...);
> > ?>
> >
> > etc. :P
> >
> > Is that possible with tables? Can I make something like the link example
> > without tables?
>
> it is indeed possible without tables. the example you sited doesnt use
> them either.
>
> you'll be able to use output from form helper to achieve this although can
> be a bit tricky to support old browsers.
>
> tables are for display of tabular data not for styling.
>
> the styles already defined in cake.generic.css will get you most of the
> way there although you'll need to study the style sheet in
> http://jquery.bassistance.de/validate/demo/milk/  to tighten it all up.
>
> mikek
>
> --
> Mike Karthauser
> Managing Director - Brightstorm Ltd
>
> Email: mi...@brightstorm.co.uk
> Web: http://www.brightstorm.co.uk
> Tel:  07939 252144 (mobile)
> Fax: 0870 1320560
>
> Address: 1 Brewery Court, North Street, Bristol, BS3 1JS
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> 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.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: Form helper: DIVs vs tables

2010-07-20 Thread Mike Karthauser
hi hugo

On Tue, July 20, 2010 3:07 pm, Hugo M wrote:
> Hi all! I have a question, I'm making forms using form helper.
>
> What's better, creating forms with tables or with divs? Divs are the only
> way to create forms with the cakePHP form helper, right?
>
> I'm not a css master :P, so maybe I don't understand very well why using
> divs instead of tables in forms (I understand the difference when creating
> nomal page content). The real problem is that I need to do something like
> http://jquery.bassistance.de/validate/demo/milk/ but I don't want to have
> an
> ugly code like:
>
> 
> 
> input(...) ?>
> 
> 
>
> etc.
>
> I want:
>
>  echo $form->create(...);
> echo $form->input(...);
> ?>
>
> etc. :P
>
> Is that possible with tables? Can I make something like the link example
> without tables?

it is indeed possible without tables. the example you sited doesnt use
them either.

you'll be able to use output from form helper to achieve this although can
be a bit tricky to support old browsers.

tables are for display of tabular data not for styling.

the styles already defined in cake.generic.css will get you most of the
way there although you'll need to study the style sheet in
http://jquery.bassistance.de/validate/demo/milk/  to tighten it all up.

mikek

-- 
Mike Karthauser
Managing Director - Brightstorm Ltd

Email: mi...@brightstorm.co.uk
Web: http://www.brightstorm.co.uk
Tel:  07939 252144 (mobile)
Fax: 0870 1320560

Address: 1 Brewery Court, North Street, Bristol, BS3 1JS

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Form helper: DIVs vs tables

2010-07-20 Thread Hugo M
Hi all! I have a question, I'm making forms using form helper.

What's better, creating forms with tables or with divs? Divs are the only
way to create forms with the cakePHP form helper, right?

I'm not a css master :P, so maybe I don't understand very well why using
divs instead of tables in forms (I understand the difference when creating
nomal page content). The real problem is that I need to do something like
http://jquery.bassistance.de/validate/demo/milk/ but I don't want to have an
ugly code like:



input(...) ?>



etc.

I want:

create(...);
echo $form->input(...);
?>

etc. :P

Is that possible with tables? Can I make something like the link example
without tables?

Thanks for your attention x)

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 add global variable

2010-07-20 Thread xiaopang
Hello:

I am a newby to Cakephp,

I have some simple data which I don't want to store in database but I
want them to be application wide accessible. for view, controller as
well as model.

For example:  I have a array  $admin_type, which define 2 types of
system administer,

$admin_type =  array (1 => 'King',
  2 => 'Admin');

Then, where should I define this variable?   I tried to define in
bootstrap file, but it doesn't work


Thanks in advance

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Site issues after moving host

2010-07-20 Thread AzzBrands
Hi All,
I recently moved hosts for my site and now it doesn't function. I get
the following errors.

Notice: Undefined index: action in /home/baristaa/public_html/cake/
dispatcher.php  on line 142

Notice: Undefined index: controller in /home/baristaa/public_html/cake/
dispatcher.php on line 149

Warning: session_start() [function.session-start]: Cannot send session
cache limiter - headers already sent (output started at /home/baristaa/
public_html/cake/dispatcher.php:142) in /home/baristaa/public_html/
cake/libs/session.php on line 145

Warning: Cannot modify header information - headers already sent by
(output started at /home/baristaa/public_html/cake/dispatcher.php:142)
in /home/baristaa/public_html/cake/libs/session.php on line 148

I have had 3 Cake experienced developers try and help with no luck. Im
hoping anyone has any luck or know where i could look?

Thanks in advance.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 include new actions in ACL?

2010-07-20 Thread rez...@gmail.com
run build_Acl again

On Jul 19, 12:40 pm, matsakaw  wrote:
> i struggled with Acl/Auth and i admit i just followed the steps
> without FULLY understanding what i did -- to generate the aros, acos
> and aros_acos tables using the build_Acl and initDB functions
> mentioned in the cake book/tutorial.  i was only too glad then to
> finally make Acl/Auth work -- my users and groups can access (and be
> denied from) selected controllers and their actions as programmed (in
> build_Acl, and in initDB).
>
> but lately, there has been a need to add new actions for some
> controllers.   i am now getting some unauthorized access messages to
> these added actions.
>
> what may i do now to include these new actions in the aros, acos and
> aros_acos tables?
>
> any help will be much appreciated.  leads to any new tutorials on Acl/
> Auth welcome also.
>
> thanks,
> matsakaw

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Url in cake

2010-07-20 Thread nicky
hii i m developing a project in cake where i want some words to come
before controllers name like as http://www.abc.com/teama/users
http://www.abc.com/teamb/users

Can it is possible i have nothing to do with this word team a and team
b just for displaying .

Can it be possible in cake please tell how ?>

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: Provide read-only interface for our CMS (Drupal)

2010-07-20 Thread Galymzhan
Hi. If I understand you correctly you want to pull data from CakePHP
app and show it in Drupal. So why don't you consider using REST or
something similar (web services?). AFAIK cake supports REST. From the
drupal side, you have to write a module to interact with RESTservices
provided by your cake application. Anyway, it's just an idea. If you
solve your problem, share your solution, I think it would be
interesting.

On 20 июл, 05:01, geste  wrote:
> All,
>
> For an intranet application we run Drupal 6 but we also have a CakePHP
> application for back-office stuff.  A simple example is employee
> directory.  The CakePHP application is read-write with group-based
> access control.
>
> We'd like some of the CakePHP information to show up in Drupal on a
> read-only basis.  I had written a few cheap scripts placed in nodes
> that query the Cake-side tables directly, but I don't see this as
> ideal.  For one, I want to move toward building more formal Drupal
> modules and avoid simply putting random PHP code in nodes (where I see
> the code being traversed by the Drupal search indexer!).  It would
> also be hard to maintain over time.
>
> I have the notion of writing a very basic Drupal module that does
> nothing more than provide a single interface to our CakePHP tables,
> then I could add modules like "Department_Directory" that would use
> the base module.  Where I'm getting bogged down now is how best to
> connect to the CakePHP tables.  I think I have seen most of the Drupal
> and CakePHP docs on connecting to multiple databases (no problem) and
> I have also looked at modules like Drake (not what I want).
>
> What I am struggling with is whether there is a way to create a
> CakePHP component or helper that provides certain basics (like show
> full name sorted in last name, first name format) but which I could
> also reference from Drupal to provide the same function.  I find
> myself starting to add snippets like this to multiple controllers:
>
> $person_orderby = array('Person.lastname', 'Person.firstname');
> $people = $this->OfficeOccupancy->Person->find('list', array('order'
> => $person_orderby ));
>
> to create pick lists/menus.  This could get very laborious, so I am
> trying to figure out how best to "component-ize" that kind of stuff.
> Even better if I could figure out a way to make the same code/routines
> work for Cake *and* Drupal.
>
> One thought I had was to have a completely separate controller
> component that would house all of these basic lookup functions and
> then write some very simple (unformatted?  HTML-less?) views that
> Drupal could reference to pull result sets back into my Drupal "data"
> module.
>
> Anyhow, sorry for ramble.  Any thoughts appreciated.  I suppose I
> could write a library of functions that just connect to our CakePHP
> tables, but I thought it could be worthwhile to think it through a bit
> more.
>
> Jim

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Problems with AppHelper

2010-07-20 Thread Galymzhan
Hi, group. I did a blog application in tutorial. I've 2 views like in
tutorial:
edit.ctp:
Edit Post
create('Post', array('action' => 'edit'));
echo $form->input('title');
echo $form->input('body', array('rows' => '3'));
echo $form->input('id', array('type'=>'hidden'));
echo $form->end('Save Post');
?>

and view.ctp:

Created: 


Now I want to override default functionality of url(). I've created
app_helper.php in /app/ folder.

class AppHelper extends Helper {
  var $helpers = array('Session'); // I want to use Session helper
  function url($url = NULL, $full = FALSE) {
if ($this->Session->check('lang')) {
  // here is my custom logic
}
  }
}

The problem is that when I'm trying to edit a post (edit.ctp), I get a
fatal php error saying FormHelper::$session is undefined. I think that
session helper isn't loaded.
But when I view a post (view.ctp) everything works OK and my custom
url() method works as expected. Help, please. I'm using CakePHP 1.3
and php 5.2

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


checking posted data

2010-07-20 Thread rakeshyadav rakeshyadav
hi all,

  I am trying to execute query with some posted value the query is
like this

 $sql = "SELECT DISTINCT `csd`.`store_id` ,`csd`.`campaign_id`, `csd`.`date`
, `c`.`campaign_id` ,`c`.`supplier_id` , `cm`.`sub_category_id`
FROM `campaign_store_dates` AS `csd`
LEFT JOIN `campaigns` AS `c` ON `csd`.`campaign_id` = `c`.`campaign_id`
LEFT JOIN `campaign_media` AS `cm` ON `c`.`campaign_id` = `cm`.`campaign_id`
WHERE `c`.`status` NOT
IN (
'request', 'cancelled'
) AND `csd`.`store_id` != '0'
";
if (!empty($strDate) and !empty($endDate)){
$sql .= " AND `csd`.`date` BETWEEN '$strDate' AND
'$endDate'";
}
if (isset($sub_category_id)){
$sql .= " AND `cm`.`sub_category_id` = {$sub_category_id}";
}
in if condition i am checking wether the value is there r not the query is
working fine when value is set. if value is not set at that time the query
is not working and giving error like

*SQL Error:* 1054: Unknown column 'empty' in 'where clause'
please give me sugitions

Thanks in advance
A.RAKESH

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 same functions in several views

2010-07-20 Thread Mike Karthauser
hi Petter;

On Tue, July 20, 2010 9:12 am, Petter Andreas Strøm wrote:
> Well, I have to explain the topic for the discussion too;
>
> I'm looking for a solution where I can make a function to check if
> user have this capability like if(userHasCap('user_edit')). How can i
> make a function like this and include it into every view i need it?
> Component?

you could do this in a view helper if you are expecting logic to go into a
view page (.ctp).

ideally the logic should go in the action for the view in which case you
could either use a component or more simply just a function in
app_controller which will make it available to each controller.

-- 
Mike Karthauser
Managing Director - Brightstorm Ltd

Email: mi...@brightstorm.co.uk
Web: http://www.brightstorm.co.uk
Tel:  07939 252144 (mobile)
Fax: 0870 1320560

Address: 1 Brewery Court, North Street, Bristol, BS3 1JS

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: alt tag for text box

2010-07-20 Thread grigri
Nope, not without using javascript. Tooltips are generated by the
browser and can't be customised.

There are some custom tooltip javascript solutions around, though - do
a search and I'm sure you could find one.

There's a mootools one here: 
http://davidwalsh.name/mootools-12-tooltips-customize

I'm sure there are countless other ones for mootools, jquery,
prototype and any other framework.

hth
grigri

On Jul 19, 8:58 am, Master Ram  wrote:
> it is possible to change the color  for this displaying name when i am
> using alt attribute
>   "array('title' => 'Contact Name')"
>
> in my existing system they are used color.
>
> when i am taking mouse on over the text box.
>
> the displaying information should be the the blue color.
>
> it is possible to change. to blue.
>
> regards:
> Ram
>
> On Jul 15, 4:46 pm, grigri  wrote:
>
> > `alt` is not a tag, it's an attribute.
>
> > Also, although some browsers show an ``'s alt attribute as a
> > tooltip, this is nonstandard. The `title` attribute is what should be
> > used for a tooltip, and it works on all elements.
>
> > In short,
>
> > text('contact_name', array('title' => 'Contact Name',
> >                                         'value' => '',
> >                                         'style' => 'width: 80%')));
> >         ?>
>
> > This will make "Contact Name" appear in the tooltip when the text box
> > is hovered.
>
> > hth
> > grigri
>
> > On Jul 15, 11:50 am, Jeremy Burns | Class Outfit
>
> >  wrote:
> > > I'm happy to be corrected, but I think the 'alt' tag only exists for 
> > > images (that's HTML, not Cake).
>
> > > Also interested to see you using inline styles - are you not using CSS?
>
> > > Jeremy Burns
> > > Class Outfit
>
> > > jeremybu...@classoutfit.comhttp://www.classoutfit.com
>
> > > On 15 Jul 2010, at 11:42, Master Ram wrote:
>
> > > > Hi,
>
> > > > how to set "alt" tag for text box, in cakePHP.
>
> > > > i used like this.
> > > > text('contact_name', array('alt' => 'Contact Name',
> > > >                                        'value' => '',
> > > >                                        'style' => 'width: 80%')));
> > > >        ?>
>
> > > > its not working .
>
> > > > where i missed out.
>
> > > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelpothers 
> > > > with their CakePHP related questions.
>
> > > > 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 athttp://groups.google.com/group/cake-php?hl=en
>
>

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


translate behavior: no join for default language?

2010-07-20 Thread M
for example, i have posts table and i18n table. posts table already
have data in english so i created data of the other language in i18n.

i was wondering if there's a way to retrieve data from posts table
when language is english. or do i have to create english data in i18n
table?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 same functions in several views

2010-07-20 Thread Zaky Katalan-Ezra
Inherit from Helper class and put it in /views/helpers.
class LegendHelper extends Helper
 {
var $helpers = Array("Html");

function legendColor($arg1, $arg2)
{ terun true;}
}

in view use it
$legend-> legendColor(1, 5);

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 - can't get model back

2010-07-20 Thread Andrew
Hi all,

I am having a problem getting data from a model connected to a HABTM

If I have two models, the first being hasMany to the second, then if I
do a find on the second, I can normally access the first models
fields, because a LEFT join is done? However, if the model is
HasAndBelongsToMany then this is not the case??

So, my problem now ---> I have four tables, one called Categories, one
called Cities and the bridging table Categories_Cities
And the fourth table is called Items  where Categories HasMany
Items.
But when I do a find on Categories_Cities, it is not finding my Items
table, like it would if it was a HasMany relationship.

Cities > Categories_City <- Categories <--- Items

Is that clear?

The last part of my email contains my models:

class Item extends AppModel
{
var $name = 'item';


var $hasOne = array(
'Vote' => array(
'className' => 'Vote',
'foreignKey' => 'item_id'
)
);






class City extends AppModel
{
var $name = 'city';

   var $hasMany = array(
'Item' => array(
'className' => 'Item',
'foreignKey' => 'city_id'
)
);

var $hasAndBelongsToMany = array(
'Category' => array(
'className' => 'Category',
'foreignKey' => 'city_id'
)
);




class Category extends AppModel
{
var $name = 'category';

var $hasMany = array(
'Item' => array(
'className' => 'Item',
'foreignKey' => 'category_id'
)
);

var $hasAndBelongsToMany = array(
'City' => array(
'className' => 'City',
'foreignKey' => 'category_id'
)
);




class CategoryCity extends AppModel
{
var $name = 'CategoryCity';
var $useTable = 'categories_cities';

var $belongsTo = array
(
'Category' => array
(
 'className'  => 'Category',
 'foreignKey' => 'id'
),
'City' => array
(
 'className'  => 'City',
 'foreignKey' => 'id'
)
);

}


Andrew

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 same functions in several views

2010-07-20 Thread Petter Andreas Strøm
Well, I have to explain the topic for the discussion too;

I'm looking for a solution where I can make a function to check if
user have this capability like if(userHasCap('user_edit')). How can i
make a function like this and include it into every view i need it?
Component?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Using same functions in several views

2010-07-20 Thread Petter Andreas Strøm
Hi,

I'm trying to implement some functionality for hiding buttons(and
info) from a page depending on parameters sat for the specific user
(in the model). Off course to create some restrictions for the
different users.

But im kind of confused how to do this. The way i do it now is like:

1. Cache the user capabilities on login (now i have implemented this
in the App_model, which is bad, so i made another post about this)

2. In each function view read the cached user capabilities and iterate
that list and check if that function should be rendered. Code:

foreach(Cache::read('userCapList') as $userCap){
if($userCap['tag']=="user_edit"){
// echo function
}
}

I think this solution is bad, and wonder if any of you have a better
solution?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: Login using Auth component

2010-07-20 Thread designv...@gmail.com
Put the caching logic in the login action in your controller, and use
the autoRedirect variable, as described here:

http://book.cakephp.org/view/395/autoRedirect

d.


On Jul 19, 4:13 pm, Petter Andreas Strøm  wrote:
> Hi,
>
> Im modifying an existing login function which uses the Auth component.
> My modifications is that i want to cache some user-details during the
> login-sequence. Im kind of looking for a  way to implement this, but
> no luck yet. I kind of found a solution where i did the caching in the
> App_model  but this solution runs the code everytime a model is run,
> and the cacheing becomes useless.
>
> Anybody?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 create forms

2010-07-20 Thread gabriel
Here a good tutorial for a contact form!

http://snook.ca/archives/cakephp/contact_form_cakephp

On Jul 19, 4:14 pm, amr_AJ  wrote:
> how to create forms

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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