Re: validation in model

2008-11-30 Thread David C. Zentgraf

What you're looking for is this:
http://book.cakephp.org/view/131/on

On 1 Dec 2008, at 16:06, AngeloZanetti wrote:

>
>
> Hi all,
>
> Is it possible to have model validation only be called when there is  
> an add
> action and not edit for example ?
>
> I have added unique name validation but now with the edit of a  
> record it
> still gives a validation error as that name of that record already  
> exists.
>
> My code as follows:
>
>   var $validate = array(
>   'question' => array(
>  'Question already exists, please enter a  
> unique
> question' => array(
>   'rule' => array(
>
> 'isUnique',
> 'question'
>   )
> ),
>  'This field cannot be left blank' =>
> VALID_NOT_EMPTY
>  ),
>
> function isUnique($field, $value) {
>
>$fields[$this->name.'.'.$value] = $field[$value];
>$this->recursive = -1;
>
>if ($this->hasAny($fields)) {
>  $this->invalidate('unique_'.$field);
>  return false;
>} else {
>
>  return true;
>}
>  }
>
> thanks in advance.
>
> -- 
> View this message in context: 
> http://www.nabble.com/validation-in-model-tp20767005p20767005.html
> Sent from the CakePHP mailing list archive at Nabble.com.
>
>
> >


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



Re: jquery && prototype

2008-11-27 Thread David C. Zentgraf

http://docs.jquery.com/Using_jQuery_with_Other_Libraries

On 28 Nov 2008, at 12:10, Diego Villar wrote:

> boys,
>
> I am with a problem
>
> In one of my pages I use jQuery to launch windows thickbox, now I am  
> on the
> need to send a form via ajax on that same page, I wanted to use  
> prototype
> and $ ajax-> form (), with the surprising finding that it gives of  
> errors I
> read it there or by using jQuery or prototype, can not be loaded  
> together.
> Is this so?
>
> How can I send the form by ajax?
>
> thanks!
>
>
>
> --
> Diego
>
> >


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



Re: RSS Feed ... what method is called by index.rss

2008-11-25 Thread David C. Zentgraf

I guess the idea is that the index page and the index RSS feed should  
very much contain the same data, only in a different output format  
(layout/view). You can use a paginate() call even for the RSS feed, as  
you usually only want the last x entries in the feed, not the whole  
database. You can ask the RequestHandler component whether the page is  
supposed to be RSS or regular, and increase the limit for the paginate  
call for example, or set other differentiating options.

If the RSS version is supposed to be completely different from the  
regular page, just name it something else like feed.rss and have a  
dedicated feed() action in your controller for it.

On 26 Nov 2008, at 14:28, aranworld wrote:

>
> Well, I realize it is a pretty dumb question.  Obviously, the index()
> method is called when index.rss is accessed.
>
> I guess my real question is ... what if the logic behind index.rss is
> different from the logic behind index ... as I'm sure it usually is on
> websites.
>
> For example, what if my posts/index uses paginate?  How could I make a
> controller action called index, that handled both an rss request and a
> regular request, using different logic for each one?
>
> -Aran
>
> On Nov 25, 2:07 pm, aranworld <[EMAIL PROTECTED]> wrote:
>> I am finding the manual entry on generating RSS Feeds really helpful
>> except for one minor detail.
>>
>> http://book.cakephp.org/view/483/Creating-an-RSS-feed-with-the-RssHelper
>>
>> When someone requests posts/index.rss , what controller method is
>> actually called?  Is Posts::index() called?
>>
>> Where should I put the Controller Code that appears?  If I put it in
>> Posts::index(), then how do I integrate it with other code for
>> generating a non-rss feed from Posts::index()?
>>
>> Thanks,
>> Aran
> >


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



Re: how to check the path of your cache view in the source code?

2008-11-25 Thread David C. Zentgraf

Have you set the correct permission levels on the tmp directories (web  
server needs write access)?

On 25 Nov 2008, at 17:53, robert123 wrote:

>
> hi
>
> I have enabled caching, in my testing environment, the cache is
> working well, and generate the views at tmp/cache/views
>
> so i deploy the code in the production server, using the same code,
> but this time no views are generated at tmp/cache/views
>
> I am not sure the reason, anyone can tell me the reason, or anyone can
> tell me where to find the code, where i can check the path of the
> generated view files, so that i can debug it, thanks
> >


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



Re: Modrewrite for folder containing wusage

2008-11-24 Thread David C. Zentgraf

You can place the folder in Cake's webroot folder.
Alternatively, see here:
http://stackoverflow.com/questions/3157/htaccess-directives-to-not-redirect-certain-urls

On 25 Nov 2008, at 08:14, Kut Jegan wrote:

>
> Hello,
>
> on my webserver in /wusage a tool to analyze statistics and requestes
> to my website is installed.
> I use cake php 1.2 and .htaccess-file.
> I tried to change the .htaccess-file to the following that the link
> www.example.com/wusage points to the directory /wusage and is not
> handeled by cake:
>
> 
>   RewriteEngine on
>   RewriteRule^wusage(.*) wusage/$1 [L]
>   RewriteRule^$ app/webroot/[L]
>   RewriteRule(.*) app/webroot/$1 [L]
> 
>
> I tried various strings but I could not find the right one.
>
> Can anyone help me, please?
>
> Kut.
>
> >


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



Re: calling exit() after redirect STILL redirects

2008-11-24 Thread David C. Zentgraf

On 25 Nov 2008, at 06:34, _Z wrote:

> However when the form is submitted to login, they are instead
> redirected back to the register view.


That means your register form AND login action both work fine? Only  
after logging in the user goes back to the register view?

By default the Auth component (if that is what you're using) redirects  
to the last page the user was on after a successful login. And since  
the user just came from the register form, he's being redirected back  
to it, only logged in this time. Might that explain it?

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



Re: String conversion

2008-11-19 Thread David C. Zentgraf

Somewhere in the data you're trying to save there's an array where  
there should be a string.

E.g.

array(
'Model' => array(
'field1' => array( ... )
)
)

instead of

array(
'Model' => array(
'field1' => 'This should be a simple string'
)
)

Do a debug($data) on whatever you're trying to save to see where the  
problem is, and/or post that data here.

On 20 Nov 2008, at 13:31, sun wrote:

>
> I am not able to  understand exactly what do u said.. so once again
>
> can u explain in detail... please
>
> >


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



Re: Ways to display data from another controller without resorting to requestAction?

2008-11-18 Thread David C. Zentgraf

http://book.cakephp.org/view/63/Introduction

On 18 Nov 2008, at 16:55, Pizgin wrote:

>
> David tell me please more detail. Thanks.
>
> On 18 нояб, 10:31, "David C. Zentgraf" <[EMAIL PROTECTED]> wrote:
>> How about making a reusable component?
>>
>> On 18 Nov 2008, at 16:22, Pizgin wrote:
>>
>>
>>
>>
>>
>>> Hi! What else there are ways to display data from another controller
>>> instead of using requestAction? Thanks.
> >


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



Re: Ways to display data from another controller without resorting to requestAction?

2008-11-17 Thread David C. Zentgraf

How about making a reusable component?

On 18 Nov 2008, at 16:22, Pizgin wrote:

>
> Hi! What else there are ways to display data from another controller
> instead of using requestAction? Thanks.
> >


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



Re: difference in model and controller name

2008-11-17 Thread David C. Zentgraf

> var $name = 'Category ';
  ^

Get rid of the extra space, then your model name should inflect  
properly (and eliminate a million other possible headaches).

On 18 Nov 2008, at 07:43, introvert wrote:

>
> I'm using the latest cakephp (downloaded it a moment ago).
>
> I have created the 'categories' table and database connection works
> just fine.
>
> If I add in the model class the $useTable variable, the error
> "Database table category s for model Category was not found." goes
> away:
>
> Heres the model code:
>  class Category extends AppModel {
>   var $name = 'Category ';
>
>   var $useTable = 'categories';
> }
> ?>
>
> Any idea what is going on?
>
> Many thanks in advance!
>
> On Nov 17, 11:31 pm, teknoid <[EMAIL PROTECTED]> wrote:
>> Either you are using some really really old release of cake,
>> or you did something incorrectly.
>>
>> Cake will look for 'categories' table for a Category model by  
>> default.
>>
>> On Nov 17, 4:35 pm, introvert <[EMAIL PROTECTED]> wrote:
>>
>>> Hey,
>>
>>> Its CategorIES instead of CategorYS.
>>
>>> The error I get:
>>
>>> Error:  Database table category s for model Category was not found.
>>
>>> Or should this work for sure?
>>> In my case it doesnt.
>>
>>>  If not, how to associate the database categories with the model/
>>> controller (since it think the name is categorys)
>>
>>> On Nov 17, 10:26 pm, "Dardo Sordi Bogado" <[EMAIL PROTECTED]>
>>> wrote:
>>
 On Mon, Nov 17, 2008 at 7:22 PM, introvert  
 <[EMAIL PROTECTED]> wrote:
>>
> Hello,
>>
> I have recently came acrros cakephp and I'm not very familiar  
> with it
> yet.
>>
> I made a model:
> category.php (Category)
>>
> which I want to associate with controller:
> categories_controller.php (CategoriesController)
>>
 That is exactly how cake works.
>>
> but this wont happen due to differences in names Category ->
> Categories (plural form).
>>
 No, exactly the inverse.
>>
> What should I do in such case to make it work?
>>
 Nothing, just read the docs: book.cakephp.org
>>
 HTH,
 - Dardo Sordi.
>>
> Many thanks in advance!
> >


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



Re: How to apply permission to XML folder in webroot

2008-11-16 Thread David C. Zentgraf

You'd do this on the server side by setting file system permissions or  
with .htaccess directives (hardly a Cake question).
The better thing to do though would be to not put it in the webroot to  
begin with, if it's not supposed to ever be accessed.

On 17 Nov 2008, at 16:33, bookme wrote:

>
> Hi,
>
> I am working on a flash application using XML. Flash file and XML is
> inside webroot folder. I want to apply permission   on XML file so
> that no body can access XML files because these XML files contains
> some secrete data.
>
> Please tell me how can I apply permissions on webroot/flash/xml folder
> so that no body can access or view xml files.
>
>
> >


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



Re: Can't use internationalization on input label

2008-11-15 Thread David C. Zentgraf

echo $form->input('names', array( 'label' => __('Names', true)));

On 16 Nov 2008, at 13:15, Mateo San Román wrote:

>
> Hello
>
> When I try to use the __() function on
>
> echo $form->input('names', array( 'label' => __('Names')));
>
> on a view, the output shows both default table field name AND its
> internationalization.
>
>
> Thanks in advance.
>
> >


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



Re: How change url from paginator

2008-11-13 Thread David C. Zentgraf

Ignore the Camel Case Guy...

What you're looking for was discussed here recently:
http://groups.google.com/group/cake-php/browse_thread/thread/3f6a92d35769f7c3/

On 14 Nov 2008, at 10:10, Xavier Mathews wrote:

> Those Links Dont Work But The Did Come With An Erorr MSG That I Can  
> Run For You!
>
> On 11/13/2008, Petr Vytlačil <[EMAIL PROTECTED]> wrote:
>>
>> Hi is any way how i can chage url for paging?
>>
>> Router:
>>  Router::connect('/:seourl/list/',array('controller' => 'entries',
>> 'action' => 'categories'),array('pass' => array('seourl')));
>>
>> this generate:
>> http://localhost/seourl-category/list
>> Its ok, but url for paging are:
>> http://localhost/entries/categories/seourl-category/page:2
>>
>> It isnt good I need:
>> http://localhost/seourl-category/list/page:2
>>
>> or link without page:
>> http://localhost/seourl-category/list/2
>>
>> Please can you help me how i will write router or setting paginator
>> helper.
>> THX
>>>
>>
>
>
> -- 
> Xavier A. Mathews
> Student/Developer/Web-Master
> GG Client Based Tech Support Specialist
> Hazel Crest Illinois
> [EMAIL PROTECTED]@hotmail.com 
> [EMAIL PROTECTED]
> "Fear of a name, only increases fear of the thing itself."
>
> >


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



Re: Finding the page that a specific record appears

2008-11-12 Thread David C. Zentgraf

Shouldn't be too hard. Get the ids of all records with the same  
conditions as used by paginate, find out at which position your id is,  
divide by number of records per page. There's probably a way to do it  
all in SQL, without parsing everything in PHP.

The problem is, depending on your dataset and how often it changes,  
that that position will change between pageloads, or at least that the  
URL won't work for very long (hence not bookmarkable etc).

On 13 Nov 2008, at 00:25, Walther wrote:

>
> I don't know if this has been answered yet (And so far my searching
> has been fruitless, so either it hasn't or I'm using the wrong terms).
>
> Anyways, I'm using 1.2RC3 and managed to get the paginate feature
> working wonderfully (was very easy as well).
>
> Now I wish to add the ability for a user to jump to a page that
> contains a specific record, the id (or some other unique identifier)
> for the record is known, how would I go about finding which page the
> particular record appears on? I assume that I'd need to write my own
> paginate methods?
>
> Regards
> Walther.
>
> >


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



Re: how to validate the empty fileds in cakephp

2008-11-12 Thread David C. Zentgraf

> "the missing all fields will shown error message..but no one  
> displayed."


I don't understand, can you express that differently?

On 12 Nov 2008, at 16:24, sun wrote:

>
> Thanks for consider my request.
>
> I am  asking abt how to validate the  empty  form fields and upload
> file filed. ? consider three text fields and one upload file field  if
> i submit the submit button directly,  with out any values entered, the
> missing all fields will shown error message..but no one displayed.
> please  tell how to solve this...
>
> with regards
> sundar.
>
> >


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



Re: how to validate the empty fileds in cakephp

2008-11-11 Thread David C. Zentgraf

Hi Sun,

Please send your replies to the list.

I think you need to read through the book again to understand how to  
properly use validation rules.
http://book.cakephp.org/view/127/One-Rule-Per-Field

Chrs,
Dav

On 12 Nov 2008, at 16:42, sun wrote:

> Thanks for consider my request,
>   I am asking abt how to validate the empty fields ? consider three
> input text fields and one file upload field. if i click the submit
> button directly with out give any values to the appropriate fields,,
> the error message will be shown  but  no one displayed  so tell how to
> solve this?
>
> Test module:
>   class Test extends Appmodel{
>   var $name = 'Test';
>   var $validate = array(
> 'name'=>array(
>   VALID_NOT_EMPTY,
>   ),
>  'mark1'=>array(
>   VALID_NOT_EMPTY,
>   array(
>   'rule'=>'numeric',
>   'required'=>'true',
>   )
>   ),
>   'mark2'=>array(
>   VALID_NOT_EMPTY,
>   array(
>   'rule'=>'numeric',
>   'required'=>'true',
>   )
>   ),
> 'photo' => array(
>VALID_NOT_EMPTY,
>array(
>   'required'=>'true',
>   )
>   )
>   );
>   function validate($ary_test_info){
>   $ary_error = array();
>   for($i=0; $i<1; $i++){
>   if( 
> $this->isEmpty($ary_test_info['Test']['photo'][$i]['name'])||
>   
> $this->isEmpty($ary_test_info['Test']['name'][$i])||
>   
> $this->isEmpty($ary_test_info['Test']['mark1'][$i])||
>   
> $this->isEmpty($ary_test_info['Test']['mark2'][$i])){
>
>   if 
> ($this->isEmpty($ary_test_info['Test']['name'][$i])){
>   $ary_error['name'][$i] = 
> 'Please enter  name';
>   }
>   if 
> ($this->isEmpty($ary_test_info['Test']['mark1'][$i])){
>   $ary_error['mark1'][$i] = 
> 'Please enter mark1';
>   }
>   if 
> ($this->isEmpty($ary_test_info['Test']['mark2'][$i])){
>   $ary_error['mark2'][$i] = 
> 'Please enter mark2';
>   } elseif 
> (strlen($ary_test_info['Test']['photo'][$i]['name'])>4){
>   if ( 
> $this->isEmpty($ary_test_info['Test']['photo'][$i] 
> ['name']))
> {
>   $ary_error[$i]['photo'] 
> = 'Please select an jpg file';
>   }
>   }
>
>   } else{
>
>   }
>   return $ary_error;
>   }
>   }
>   function isEmpty($str_data){
>   if (trim($str_data) == ""){
>   return true;
>}else{
> return false;
>   }
>   }
> }
> ?>
>
> with regards
> sundar


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



Re: how to validate the empty fileds in cakephp

2008-11-11 Thread David C. Zentgraf

I don't understand what exactly you mean, but you may wanna look into  
allowEmpty or notEmpty:
http://book.cakephp.org/view/130/allowEmpty
http://book.cakephp.org/view/740/notEmpty

On 12 Nov 2008, at 14:58, sun wrote:

>
> How to validate the empty fileds in cakephp ? when i dont give any
> values to any fields in the form
>
> If I click the submit button.. error message will be displayed  under
> the missing all fields..
>
> Tell some idea to do that
>
> by
> sun
>
> >


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



Re: Queries based on

2008-11-11 Thread David C. Zentgraf

This should certainly work:
$this->set('events', $this->Event->find('all', array('conditions' =>  
array('Event.associate_id' => $curr_user["Associate"]["0"]["id"];

Good flight! WEe~

On 12 Nov 2008, at 08:59, lirc201 wrote:

>
> Hello All,
>
> I need a little push off the cliff here.  I want this query to return
> all entries where the associate_id = some value ( WHERE associate_id =
> '??').
>
> $this->set('events', $this->Event->find('all', array('associate_id' =>
> '$curr_user["Associate"]["0"]["id"]')));
>
> $curr_user will be defined with some INT(11) value.
>
> I'm using 1.2 RC3.
>
> Thanks,
> Brian
> >


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



Re: Pagination and Reverse Routing

2008-11-10 Thread David C. Zentgraf

Try:
Router::connect('/dashboard/watching/*', array('controller' =>  
'watching', 'action' => 'index'));

Notice the final /*. For pagination links several args have to be  
appended to the URL, so it doesn't match "/dashboard/watching" anymore.

Chrs,
Dav

On 11 Nov 2008, at 15:26, benko wrote:

>
> Firstly, the reverse routing feature of CakePHP is fantastic!
>
> Has anyone noticed that reverse routing doesnt seem to work for
> pagination links, or perhaps I am doing something wrong?
>
> I have the following route set up:
>
> Router::connect('/dashboard/watching', array('controller' =>
> 'watching', 'action' => 'index'));
>
> The links work fine
>
> echo $html->link('test', array('controller' => 'watching', 'action' =>
> 'index')); // displays /dashboard/watching
>
> But id like to have the same effect for the pagination links
>
> echo $paginator->next(' Next >', array('url' => array('controller' =>
> 'watching', 'action' => 'index')), null, array('class' =>
> 'disabled'));
>
> Although this doesn't seem to work...
>
> Thanks in advance :)
> >


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



Re: Alt text?

2008-11-09 Thread David C. Zentgraf

image('icon.gif', array('alt' => $text . $phone['Phone'] 
['phonenumber'], 'title'=> $text . $phone['Phone']['phonenumber'])));
?>

Does that help?

On 10 Nov 2008, at 10:21, thankyou wrote:

>
> Any help on this is greatly appreciated :)
>
> I want to add additional text to the alt and title code for the icon,
> how can I hard code this in. For example, how do I add the text "HELLO
> THERE" to the alt tag so it says both "Hello There" and what it pulls
> up from the $phone?
>
> image('icon.gif', array('alt'=>$phone['Phone']
> ['phonenumber'], 'title'=>$phone['Phone']['phonenumber'])));?>
>
> >


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



Re: Difference between read and find

2008-11-06 Thread David C. Zentgraf

read() sets the data in the model, find() does not.
http://api.cakephp.org/class_model.html#da9914325847e7a03320eafb691208da

I.e.
$Model->find();
echo $Model->data; // empty

$Model->read();
echo $Model->data; // not empty

Personally I never use read() either.

On 6 Nov 2008, at 17:54, Liebermann, Anja Carolin wrote:

>
> Hello everybody,
>
> I wonder what the difference is between
>
> $this->Hotel->read(null, $id);
> and
> $this->Hotel->findById($id);
>
> Hotel being my model with HABTM relations to a lot of other models.
>
> The returned arrays look the same. Is read just a shortcut for  
> findById?
> Bake put me a lot of "read"s in my code, I personally never use it  
> on my
> own. Am I missing something?
>
> Greetings
>
> Anja
>
> >


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



Re: Creating DatabaseTables (cakephp way)

2008-11-05 Thread David C. Zentgraf

In this case you'll have to tell Cake what the primary key is:
http://book.cakephp.org/view/437/primaryKey

Why would you want to name it this way though? An "id" column in the  
Category table is obviously going to be the "Category.id".  
"Category.category_id" seems pretty redundant to me, and in Cake  
conventions it looks like a belongsTo association field at first glance.

On 6 Nov 2008, at 08:44, Rey Philip wrote:

>
> hi guys,
>
>   I just would like to ask about creating tables. I have read a book
> "Apress Beginning CakePHP" in chapter 2 it says there that
>
> "Giving each record a unique id value is essential for Cake to
> function without trouble.
> This application is simple, so you may be able to get by without
> creating an id field set to
> auto_increment. However, it’s good practice to make sure that all your
> records in the database
> can be identified by a unique value and that it’s named id, because
> then Cake can generate
> scaffolding around your table without any code on your part. Once you
> begin creating associated
> tables, then it will be mandatory to include an id field."
>
> My question is, I want to change the id field into another name, let's
> say category_id. Example I have a category table like this.
>
> category_table
> fields: category_id, name, description
>
> Will this work in the scaffolding feature?
>
> Here's my entire problemSample I have  a not real world example
> haha...
>
> products has one to one relationship with category.
>
> product has one category
> category has one product
>
> product
> fields: id, name, description
>
> category
> fields category_id, name, description, product_id
>
> can this be possible using cake's scaffolding feature?
> if possible how?
>
> Good day.
>
> >


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



Re: Returning a model variable

2008-11-04 Thread David C. Zentgraf

On 4 Nov 2008, at 23:47, Mathew wrote:

> class Document extens AppModel
> {
>  var $foo;
>
>  function afterSave()
>  {
>.
>$foo = "something";

$this->foo = "something";

>  }
> }
>
> in your controller
>
> $this->Document->save($data);
> echo $this->Document->foo;

FTFY.


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



Re: Using $this->ModelA->ModelB->find('list') with belongsTo conditions on ModelA.

2008-11-04 Thread David C. Zentgraf

Doing ModelA->ModelB->find() is the same thing as ModelB->find().
It doesn't matter "through" which or how many models you go, it  
doesn't change the result.
Which means, the conditions and associations you have defined in  
ModelB are being used here, so check those.

On 4 Nov 2008, at 20:07, Ian M. Jones wrote:

>
> Hi all,
>
> I'm a little confused about something I'm seeing with belongsTo
> conditions, and from searching the docs and this list I haven't been
> able to find an answer. Maybe some kind soul can help clear my
> confusion?
>
> In my Crop model I have:
>
>   var $belongsTo = array(
>   'EntryClassification' => array('className' => 'Classification',
>   'foreignKey' => 
> 'entry_classification_id',
>   'conditions' => 
> array('EntryClassification.entry' => 1),
>   'fields' => '',
>   'order' => ''
>   )
>   );
>
> When I do an find operation on a Crop and let it pick up associated
> models I see that the condition is used, a fragment from the where
> clause displayed in the debugger would be like:
>
> LEFT JOIN `classifications` AS `EntryClassification` ON
> (`Crop`.`entry_classification_id` = `EntryClassification`.`id` AND
> `EntryClassification`.`entry` = 1)
>
> However, in my crops_controller I do for a select box:
>
> $entryClassifications = $this->Crop->EntryClassification-
>> find('list');
>
> and it brings back all classifications, not just those that meet the
> "EntryClassification = 1" condition.
>
> This is confirmed in the debugger, I see:
>
> SELECT `EntryClassification`.`id`, `EntryClassification`.`name` FROM
> `classifications` AS `EntryClassification` WHERE 1 = 1
>
> Why is that? Shouldn't a find through the Crop->EntryClassification
> association use the condition?
>
> Thanks for any help in clearing my confusion!
>
> Ian
>
> >


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



Re: Pagination with HasMany and SQL Aggregation

2008-11-03 Thread David C. Zentgraf

I needed to that a little while ago and got it to work with some  
slightly ugly hacking that probably doesn't scale too well, but it  
might work for you too. :)

This belongs in the controller:
http://bin.cakephp.org/view/1990384829

On 4 Nov 2008, at 13:20, mwcbrent wrote:

>
> I'm not sure that this is possible but if it is, it would put Cake
> into a special place in my heart.  I have 2 related models Articles
> and Ratings.
>
> Articles hasMany Ratings
>
> A Rating has a User ID an Article ID and a Rating #.  In order to get
> an articles rating I need to query all ratings by the Article ID and
> average them out.
>
> How would I paginate all Articles ordered by Rating?
> >


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



Re: AW: Turn off inflections

2008-10-30 Thread David C. Zentgraf

Works for me. In /app/config/inflections.php:
$uninflectedPlural = array('.*ive');

Then:
debug(Inflector::pluralize('Uebsmwinklusive'));
> Uebsmwinklusive

Do not enter RegEx slashes '/.*/', that screws it up.

BTW, looking at your original problem again, you might rather want to  
use the irregular plurals array, since you do need it pluralized for  
the table name...

On 30 Oct 2008, at 17:46, Liebermann, Anja Carolin wrote:

>
> Hi David,
>
> I tried out several variations of
> $uninflectedPlural = array('.*ive');
>
> But I either get error messages or nothing happens
>
> Nothing happens: '.*ive'
>
> Errors with:
> '/.*ive/i'  gives preg_match() [function.preg-match]: Unknown  
> modifier '.'
> '/.*ive/  gives preg_match() [function.preg-match]: Unknown modifier  
> '.'
> '/^.*ive$/'   gives preg_match() [function.preg-match]: Unknown  
> modifier '^' [CORE\cake\libs\inflector.php, line 258]
>
> Any idea what the correct syntax could be?
>
> Thank you in advance!
>
> Anja
>
> -Ursprüngliche Nachricht-
> Von: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] Im  
> Auftrag von David C. Zentgraf
> Gesendet: Donnerstag, 30. Oktober 2008 00:25
> An: cake-php@googlegroups.com
> Betreff: Re: Turn off inflections
>
>
> Try putting the words you do not want inflected in the  
> $uninflectedPlural array.
>
> Gruß,
> Dav
>
> On 30 Oct 2008, at 01:33, Liebermann, Anja Carolin wrote:
>
>>
>> Hi all,
>>
>> I just encountered an error in my program due to inflections.
>>
>> My model is called "Uebsmwinklusive", it uses the table
>> "uebsmwinklusives". What happened, when I tried to use the index.ctp,
>> which uses arrays like: $uebsmwinklusive['Uebsmwinklusive']['id'], I
>> get an error "Undefined index:  Uebsmwinklusive".
>> After some poking around I got me the array which arrives in the
>> index.ctp and - aha - see there an irregular plural:
>> Array
>> (
>>   [0] => Array
>>   (
>>   [Uebsmwinklusife] => Array
>>   (
>>   [id] => 10
>>   [mwinklusive_id] => 1
>>   [sprache_id] => 1 
>>
>> Please note the [Uebsmwinklusife] instead of [Uebsmwinklusive]
>>
>> In my inflections.php all my arrays are already empty:
>>  $pluralRules = array();
>>  $uninflectedPlural = array();
>>  $irregularPlural = array();
>>  $singularRules = array();
>>  $uninflectedSingular = $uninflectedPlural;
>>  $irregularSingular = array_flip($irregularPlural);
>>
>> What can I do to get my normal rules? I remember when I baked the
>> application the plural rules really gave me a hard time and we  
>> decided
>> to have no language specific plural rules just the mold "Name" in the
>> model becomes "names" in the controller and database table.
>>
>> Any idea where I can check to get rid of the unwanted "ife"?
>>
>> By the way: My model starts like this:
>>
>> class Uebsmwinklusive extends AppModel {
>>  var $name = 'Uebsmwinklusive';
>>  var $useTable = 'uebsmwinklusives';
>>
>> Thanks a lot in advance!
>>
>> Anja
>>
>>>
>
>
>
>
> >


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



Re: Search Engine Bots Generating Strange Queries

2008-10-30 Thread David C. Zentgraf

I'm totally no expert on this, but I'd guess that the bots are simply  
trying to walk the tree.
If "http://mysite.com/directory/subdirectory/subsubdirectory"; is  
valid, then "http://mysite.com/directory/subdirectory";, 
"http://mysite.com/directory 
" and "http://mysite.com"; are probably also valid. The GOOG doesn't  
know that those directories don't actually exist. In "classic" web  
development patterns there should be an index.htm file in each of  
these directories, so it can't hurt to look for them.

BTW: Safari (and possibly other browsers as well) allow you to right- 
click on the title bar and offer the same kind of "URL shortening  
shortcuts" in a popup menu.

On 30 Oct 2008, at 15:02, MikeK wrote:

>
> In a general CMS app written in CakePHP I am noticing in my logs
> invalid queries being generated by various search engine bots
> including Google, Inktomi, and Yahoo.
>
> What I'm wondering is WHY?
>
> For example they are requesting
>
> http://mysite.com/controller/view instead of the correct
>
> http://mysite.com/controller/view/34 (ex: id 34)
>
> Nowhere on my site do I publish any links to /controllers/view without
> an id parm
>
> This is driving me slightly nuts. Why would a bot request a URI it has
> never seen?
>
> My validation code that checks for valid requests logs these
> occurences and every day I puzzle over my logs and examine the emitted
> web page source wondering where or why they are requesting these
> invalid URIs. I've been dumping $_SERVER and no clues there either.
> The referer is always '/'.
>
>
> >


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



Re: CakePHP conference in Tokyo 2008 - report

2008-10-29 Thread David C. Zentgraf

Thanks! See if I can catch the next one... :)

Chrs,
Dav

On 30 Oct 2008, at 09:38, sdozono wrote:

>
> Hi, David
>
> Sorry for that...
> The announcements was in Japanese only.
> (There was an information at http://events.php.gr.jp/events/show/55
> though.)
> Next time, let us post the news at this google group.
>
> Still, you can watch Garrett's talk at
>
> CakePHP and Beyond / Garrett J Woodworth (Cake Software Foundation),
> phpstudy Ustream.TV:
> http://www.ustream.tv/recorded/811617
>
> Whole program:
> http://www.ustream.tv/channel/cakephpcon-tokyo
>
> Regards,
> Shun
>
> David C. Zentgraf のメッセージ:
>> I wish you would've posted this to the list before the conference, I
>> live just three stations from where it took place. Or did I miss the
>> announcement...? ^_^;;
>>
>> Chrs,
>> Dav
>>
>> On 27 Oct 2008, at 09:45, sdozono wrote:
>>
>>>
>>> Hello, CakePHP users.
>>>
>>> Last Satureday, we had a CakePHP conference in Tokyo, Japan. (In
>>> Japan.)
>>>
>>> This was a fourth CakePHP study meeting (in Japanese language). More
>>> than 140  + (at ustream 70) people attended.
>>>
>>> Conference page:
>>> http://conference.cakephp.jp
>>>
>>> Photos:
>>> http://www.flickr.com/photos/tsukimiya/sets/72157608356377914/
>>>
>>> Blog articles:
>>> http://b.hatena.ne.jp/t/cakecon?sort=eid
>>>
>>> Google trends (in Japan)
>>> http://www.google.com/trends?q=CakePHP%2CSymfony%2CZend+Framework%2CRuby+on+Rails%2CCode+Igniter&ctab=0&geo=JP&date=ytd&sort=0
>>>
>>> Shun(sdozono)
>>>>
> >


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



Re: Array truncates after first letter

2008-10-29 Thread David C. Zentgraf

Double check what you're actually doing:

> foreach ($popular[2]['Project'] as $project)
means you're going over the fields inside $popular[2]['Project'].
The first time $project will be "Gallery" (the first field inside  
['Project']).
The next time it'll be "This is for testing" and so on.
Then you're trying to echo $project['name'],
i.e. the ['name'] part of the string "Gallery".
Surely that'll have unintended consequences...

On 30 Oct 2008, at 03:48, Josey wrote:

>
> Thanks for your reply.
> When I run that bit of code I get the following error.
>
> Fatal error: Cannot use string offset as an array in /var/www/
> mortfolio/www.mortfolio.com/html/app/views/users/view.ctp on line 108
>
> Note that if I just print the name by passing $popular[2]['Project']
> ['name'] all is well, the problem comes when I insert it into a loop
> and have it increment through the records.
>
> On Oct 29, 1:02 pm, AD7six <[EMAIL PROTECTED]> wrote:
>> On Oct 29, 6:47 pm, Josey <[EMAIL PROTECTED]> wrote:
>>
>>
>>
>>> Here's an interesting problem I've run into today:
>>
>>> I've created a query in my controller that will go out and grab  
>>> the 3
>>> most viewed projects each user has.
>>> Here is my find as well my variable for the view:
>>
>>> $popular = $this->Project->find('all',
>>> array(
>>>  
>>> 'conditions'=>array('Project.portfolio_id' =>$user['Portfolio']
>>> ['id']),
>>> 'order'=>'Project.visits DESC',
>>> 'fields'=> array('Project.name',  
>>> 'Project.description',
>>> 'Project.visits', 'Project.slug', 'Project.cover'),
>>> 'recursive'=>0,
>>> 'limit' => 3
>>> )
>>> );
>>
>>> // add name to option
>>> $popular= array('User'=>'This Users 3 most  
>>> viewed Projects') +
>>> $popular;
>>> $this->set('popular', $popular);
>>
>>> As you can see I find all projects that have a Portfolio ID set to  
>>> the
>>> same Portfolio ID of the user.
>>> It will display the records by how often they've been viewed  
>>> (visits)
>>> in descending order.
>>> I chose which fields to display as well as limiting it to just the  
>>> top
>>> 3.
>>
>>> This works fine. If I print  the variable is set (popular) to the  
>>> view
>>> my array looks perfect.
>>
>>> The problem I'm having is that when I create a loop to loop through
>>> the three records it only prints the 1st character of each field.
>>
>>> Here's my loop (Just a small one for debugging).
>>
>>> >> //$i = 0;
>>> foreach ($popular[2]['Project'] as  
>>> $project) { ?>
>>> 
>>> 
>>> 
>>> 
>>
>>> The incrementer that I created isn't being used for this example.  
>>> I'm
>>> just pulling the data for the 3rd record in the array.
>>
>>> I suppose I should also provide you with the 3rd item in my array so
>>> here it is.
>>
>>> [2] => Array
>>> (
>>> [Project] => Array
>>> (
>>> [name] => Gallery
>>> [description] => This is for testing purposes,
>>> this project will be removed after I have fine-tuned the image  
>>> display
>>> scripts.
>>> [visits] => 16
>>> [slug] => gallery
>>> [cover] => Sexy-Party.jpg
>>> [id] => 41
>>> )
>>
>>> )
>>
>>> So when I view the page after running the loop this is what is
>>> displayed.
>>> G
>>> T
>>> 1
>>> g
>>> S
>>> 4
>>
>> You are treating a string as an array. compare
>> debug ($popular);
>> debug($popular[2]['Project']);
>> foreach ($popular as $project) { <- note the difference.
>>  debug ($project['Project']['name']); die;
>>
>> }
>>
>>
> >


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



Re: Turn off inflections

2008-10-29 Thread David C. Zentgraf

Try putting the words you do not want inflected in the  
$uninflectedPlural array.

Gruß,
Dav

On 30 Oct 2008, at 01:33, Liebermann, Anja Carolin wrote:

>
> Hi all,
>
> I just encountered an error in my program due to inflections.
>
> My model is called "Uebsmwinklusive", it uses the table
> "uebsmwinklusives". What happened, when I tried to use the index.ctp,
> which uses arrays like: $uebsmwinklusive['Uebsmwinklusive']['id'], I  
> get
> an error "Undefined index:  Uebsmwinklusive".
> After some poking around I got me the array which arrives in the
> index.ctp and - aha - see there an irregular plural:
> Array
> (
>[0] => Array
>(
>[Uebsmwinklusife] => Array
>(
>[id] => 10
>[mwinklusive_id] => 1
>[sprache_id] => 1 
>
> Please note the [Uebsmwinklusife] instead of [Uebsmwinklusive]
>
> In my inflections.php all my arrays are already empty:
>   $pluralRules = array();
>   $uninflectedPlural = array();
>   $irregularPlural = array();
>   $singularRules = array();
>   $uninflectedSingular = $uninflectedPlural;
>   $irregularSingular = array_flip($irregularPlural);
>
> What can I do to get my normal rules? I remember when I baked the
> application the plural rules really gave me a hard time and we decided
> to have no language specific plural rules just the mold "Name" in the
> model becomes "names" in the controller and database table.
>
> Any idea where I can check to get rid of the unwanted "ife"?
>
> By the way: My model starts like this:
>
> class Uebsmwinklusive extends AppModel {
>   var $name = 'Uebsmwinklusive';
>   var $useTable = 'uebsmwinklusives';
>
> Thanks a lot in advance!
>
> Anja
>
> >


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



Re: Fetching ACO

2008-10-29 Thread David C. Zentgraf

Off the top of my head I have used this quite a while ago:
$this->Acl->Aco->findAll();
$this->Acl->Aco->generatetreelist();

I'd venture the guess that $this->Acl->Aco->find('threaded') should  
work too.

On 29 Oct 2008, at 16:18, jst4fun wrote:

>
> Hello all,
> I am trying to fetch the list of all ACO as a tree from the acos
> table. I hope there will be some function in acl to fetch all the aco
> list as an array. Already there is a console method "acl view aco". So
> what is the php function to do the same so that I can use it in my
> controllers. Thanks.
> >


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



Re: Using the Tree behavior

2008-10-27 Thread David C. Zentgraf

See this article to understand what the lft/rght values are for:
http://dev.mysql.com/tech-resources/articles/hierarchical-data.html

You can use the TreeBehavior::recover method to generate these values  
for an already existing tree.

On 28 Oct 2008, at 07:36, [EMAIL PROTECTED] wrote:

>
> I'm having trouble using the Tree behavior. Exactly from where do I
> get the 'lft' right 'rght' values? I can't figure out what these
> values could be.
>
> For example:
>
> (Parent 1) Category 1
> (Child of Parent 1) Category 1.1
> (Child of Parent 1) Category 1.2
> (Parent 2) Category 2
> (Child of Parent 2) Category 2.1
> (Child of Category 2.1) Category 2.1.1
>
> How would I get along doing something like that? I'm trying to create
> a simple CMS for my website, and there has to be an automated way of
> finding these 'lft' and 'rght' values.
>
>
> >


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



Re: CakePHP conference in Tokyo 2008 - report

2008-10-27 Thread David C. Zentgraf

I wish you would've posted this to the list before the conference, I  
live just three stations from where it took place. Or did I miss the  
announcement...? ^_^;;

Chrs,
Dav

On 27 Oct 2008, at 09:45, sdozono wrote:

>
> Hello, CakePHP users.
>
> Last Satureday, we had a CakePHP conference in Tokyo, Japan. (In
> Japan.)
>
> This was a fourth CakePHP study meeting (in Japanese language). More
> than 140  + (at ustream 70) people attended.
>
> Conference page:
> http://conference.cakephp.jp
>
> Photos:
> http://www.flickr.com/photos/tsukimiya/sets/72157608356377914/
>
> Blog articles:
> http://b.hatena.ne.jp/t/cakecon?sort=eid
>
> Google trends (in Japan)
> http://www.google.com/trends?q=CakePHP%2CSymfony%2CZend+Framework%2CRuby+on+Rails%2CCode+Igniter&ctab=0&geo=JP&date=ytd&sort=0
>
> Shun(sdozono)
> >


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



Re: user name on default.ctp

2008-10-26 Thread David C. Zentgraf

You can use $session->read('Auth.User') and/or $session- 
 >read('Auth.User.username') in the view.
Also, do NOT echo any HTML from the controller. It violates the MVC  
pattern and the echo'd HTML will always come before anything else,  
i.e. even before , which is even wronger.

Chrs,
Dav

On 27 Oct 2008, at 03:54, carlos ferrandis wrote:

>
> btw, I've done that on my appcontroller
>
> echo "";
>   echo $this->Auth->user('name');
>   echo "";
>
> and it works. But, I don't know why I don't think is the correct
> approach.
>
> thanks for any help
>
> carlos
> >


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



Re: Habtm fetching data

2008-10-23 Thread David C. Zentgraf

If you search for an Auction, Cake will automatically get you all the  
linked Categories with it, and vice versa.
So if you want to find all Auctions in Category X, do
$this->Category->find( /* appropriate conditions here */ );
and you'll get the correct Category and all Auctions linked with it.

Note that if your controller does not use Category as its primary  
model, you'll have to go through $this->Auctions->Category..., which  
in the end is the same (search the group on this topic, has been  
explained before).

Play around with debug($this->Category->find()) for a while and you'll  
get the hang of it.

On 23 Oct 2008, at 08:34, cem wrote:

>
> Hi I have auctions which can have more than one category . I want to
> get the categories which belongs to a specified auction .
>
> So the Category HABTM Auction . Thats Right because I can store data
> in the join table . My problem is :
>
>   While fetching data what will I do ?
>
>$this->Auction->Category->find('all' ,array('conditions'...))
>
>   was an advice from the chat which does not work any other ideas ?
>
> >


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



Re: Recursion

2008-10-22 Thread David C. Zentgraf

Is your table set up correctly (includes parent_id, lft, rght)?
Post the error you're getting here, stabbing in the dark doesn't work  
too well. ;o)

Chrs,
Dav

On 22 Oct 2008, at 14:16, mirfan wrote:

>
> Hello david,
> The link you provide me nearly solved my problem thanks, but there is
> a problem when i was trying it in a separate project it works as i
> need but when i integrate it in my project it gives me an sql error i
> don't know why is that problem coming please help me
>
> On Oct 20, 7:31 am, "David C. Zentgraf" <[EMAIL PROTECTED]> wrote:
>> http://book.cakephp.org/view/91/Tree
>>
>> On 19 Oct 2008, at 20:10,mirfanwrote:
>>
>>
>>
>>> Hi,
>>> I have a problem with recursion. I have a table for keeping the
>>> account information of all members in which each member has a parent
>>> now i have to find out all of the members in the downline of a
>>> specific one look at the following example.
>>> Member1
>>> |
>>>
>>>   |   |
>>>   Member2   Member3
>>> | |
>>>   Member4---
>>>|  |
>>> Member5 Member6
>>> from member2 to member6 all are the downline of Member1 and member5
>>> and 6 are downline of member3
>>> please give a solution for this i am really tired and boared.
>>> Regards,
> >


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



Re: I'm having a problem with containable

2008-10-21 Thread David C. Zentgraf

Please refrain from spamming this list until you are less confussed,  
thanks.

Chrs,
Dav

On 22 Oct 2008, at 11:53, Xavier Mathews wrote:

> Nope I am so confussed but i will look into it deeper.

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



Re: I'm having a problem with containable

2008-10-21 Thread David C. Zentgraf

> 'contain' => array('ListLink', array(


Try:
'contain' => array('ListLink' => array(...

Make a connection between 'LinkList' => and => it's => array().
The way you wrote it it's two separate parameters...

On 22 Oct 2008, at 06:43, Stinkbug wrote:

>
> I think my code looks almost exactly like what's in the docs with the
> exception of the extra condition.  I'm not getting my desired results
> and I'm not sure what I'm doing wrong.  Here is what my data looks
> like that's getting returned.
>
> Array
> (
>[ListTitle] => Array
>(
>[id] => 3
>[title] => Featured Story
>)
>
>[ListLink] => Array
>(
>[0] => Array
>(
>[id] => 1
>[title] => It's the great and mighty Stinkbug!
>[link] => http://blog.stinkbug.net
>[list_title_id] => 3
>[created] => 2008-10-20 15:05:01
>[modified] => 2008-10-20 15:41:49
>[deleted] => 1
>[deleted_date] => 2008-10-20 15:41:49
>)
>
>[1] => Array
>(
>[id] => 2
>[title] => It's Google!
>[link] => http://www.google.com
>[list_title_id] => 3
>[created] => 2008-10-20 16:35:54
>[modified] => 2008-10-20 16:35:54
>[deleted] => 0
>[deleted_date] =>
>)
>
>[2] => Array
>(
>[id] => 3
>[title] => Stinkbug The Man
>[link] => http://www.stinkbug.net
>[list_title_id] => 3
>[created] => 2008-10-21 09:38:14
>[modified] => 2008-10-21 09:38:14
>[deleted] => 1
>[deleted_date] => 2008-10-21 09:49:12
>)
>
>[3] => Array
>(
>[id] => 4
>[title] => A Test URL
>[link] => http://www.google.com
>[list_title_id] => 3
>[created] => 2008-10-21 09:43:41
>[modified] => 2008-10-21 09:43:41
>[deleted] => 1
>[deleted_date] => 2008-10-21 09:46:57
>)
>
>[4] => Array
>(
>[id] => 5
>[title] => Oops, Stinkbugs did it again!
>[link] => http://www.stinkbug.net
>[list_title_id] => 3
>[created] => 2008-10-21 11:17:15
>[modified] => 2008-10-21 11:17:15
>[deleted] => 0
>[deleted_date] =>
>)
>
>)
>
> )
>
> And here is my code that returns that data:
>
> //Grab the Features Stories data.
> $this->ListTitle->Behaviors->attach('Containable');
>
> $featuredStories = $this->ListTitle->find('first', array(
>   'conditions' => array('ListTitle.id' => 3),
>   'contain' => array('ListLink', array(
>   'conditions' => array('ListLink.deleted' => 0),
>   'order' => 'ListLink.created DESC',
>   'limit' => 3
>   )
> )));
>
> By looking at the code I think you can see what I would like
> returned.  All of ListLink where deleted = 0.  As you can see from my
> data above, it's returning everything.  I am getting some errors.
>
> Warning (2): preg_match() expects parameter 2 to be string, array
> given [CORE\cake\libs\model\behaviors\containable.php, line 280]
> Notice (8): Array to string conversion [CORE\cake\libs\model\behaviors
> \containable.php, line 283]
> Notice (8): Array to string conversion [CORE\cake\libs\model\behaviors
> \containable.php, line 340]
> Warning (512): Model "ListTitle" is not associated with model
> "Array" [CORE\cake\libs\model\behaviors\containable.php, line 342]
>
> Not sure what they mean though.  Here are the queries getting spit
> out.
>
> SELECT `ListTitle`.`id`, `ListTitle`.`title` FROM `list_titles` AS
> `ListTitle` WHERE `ListTitle`.`id` = 3 LIMIT 1
>
> SELECT `ListLink`.`id`, `ListLink`.`title`, `ListLink`.`link`,
> `ListLink`.`list_title_id`, `ListLink`.`created`,
> `ListLink`.`modified`, `ListLink`.`deleted`, `ListLink`.`deleted_date`
> FROM `list_links` AS `ListLink` WHERE `ListLink`.`list_title_id` = (3)
>
> As you can see, the conditions for the ListLink model is totally being
> ignored.  Can anyone suggest what I might be doing wrong?
>
> >


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

Re: PHP Editor

2008-10-20 Thread David C. Zentgraf

+1 for TextMate with ProjectPlus (http://ciaranwal.sh/category/ 
textmate) plugin.

On 20 Oct 2008, at 15:46, Matthieu wrote:

>
> Hello, I'd like to know which project editor you would recommend. I'm
> planning to make a web application using the CakePHP framework.
>
> >


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



Re: what does this do exactly? examples?

2008-10-19 Thread David C. Zentgraf

Maybe you should look into what a framework is.
http://en.wikipedia.org/wiki/Web_application_framework

"A web application framework [...] aims to alleviate the overhead  
associated with common activities used in Web development. For  
example, many frameworks provide libraries for database access,  
templating frameworks and session management, and often promote code  
reuse."

I.e. it takes the nitty gritty detail work you usually have to do over  
and over again away from you (to a certain degree), provides a basic  
structure for your app from the get-go, and cures cancer.

On 20 Oct 2008, at 13:56, duxxx wrote:

>
> hi,
>
> I am quite still a noob for php, but i have worked on php stuff awhile
> back but i never dealth with OO. After reading the intro to cakePHP, I
> still do not know what this does? can someone give me some examples of
> what this is used for? Im mainly a front end developer, but i would
> like to learn more about back end stuff.
>
> >


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



Re: i need http://site.com/2/page:3 instead of http://site.com/controller/action/2/page:3

2008-10-19 Thread David C. Zentgraf

If you create appropriate Routes, the PaginationHelper will pick the  
first one that matches.
Maybe what you're overlooking is that the route needs to have a  
trailing asterisk for the page parameter.
/:id/* will match /2/page:3, only /:id/ won't.

On 19 Oct 2008, at 22:56, mclight wrote:

>
> Hi, guys. I need a help.
> How I can make my pagination links' urls into next view:
> http://site.com/2/page:3 instead of http://site.com/controller/action/2/page:3
>
>
> >


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



Re: Recursion

2008-10-19 Thread David C. Zentgraf

http://book.cakephp.org/view/91/Tree

On 19 Oct 2008, at 20:10, mirfan wrote:

>
> Hi,
> I have a problem with recursion. I have a table for keeping the
> account information of all members in which each member has a parent
> now i have to find out all of the members in the downline of a
> specific one look at the following example.
>  Member1
>  |
> 
>|   |
>Member2   Member3
>  | |
>Member4---
> |  |
>  Member5 Member6
> from member2 to member6 all are the downline of Member1 and member5
> and 6 are downline of member3
> please give a solution for this i am really tired and boared.
> Regards,
>
> >


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



Re: error message on select box validation

2008-10-19 Thread David C. Zentgraf

If you use $form->input(), it will create everything for an input  
field, including label and error messages.
If you use the more specialized select() you'll have to create labels  
and error messages yourself. See FormHelper::error().

http://api.cakephp.org/class_form_helper.html


On 20 Oct 2008, at 07:49, clrockwell wrote:

>
> I'm using 1.2 and this is driving me crazy.  I have a form with
> several fields that use validation.  When I submit an empty form for
> testing all fields *except* the select have the appropriate html
> generated and the error message is displayed.
>
> The html for the select box begins with:
>
> Occupation*
>
> On submitting without selecting anything, the html is this (class
> ="form-error" now present):
>
> Occupation*
>
> But there is no html generated below it.  Dumping Model-
>> invalidFields() shows:
> [occupation_id] => Please select the most appropriate occupation
>
> So it is definitely there.  This happens on all select boxes.  The
> code using to generate this one:
> Occupation*> select('Vip.occupation_id', $this->requestAction('/occupations/
> occSelect', array('cache' => '1 week', 'label' => false, 'div' =>
> false))); ?>
>
> Thanks for any thoughts, I'm thinking this may be a bug.
>
>
> >


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



Re: Problem with hasMany and belongsTo

2008-10-19 Thread David C. Zentgraf

Don't you mean that each Immobilie hasMany Anhänge,
and every Anhang belongsTo an Immobilie?
I.e. your Anhänge model is correct, but the Immobilie model is wrong.

On 19 Oct 2008, at 03:35, havanna wrote:

>
> Hi together,
> I started with cakePHP and I'm a bit confussed about the relations
> hasMany and belongsTo.
>
> Because it's a old application which I want to change onto MVC with
> Cake, the table names are given.
>
> I have a table named "immobilien" (real esteat) and anhaenge
> (attachements). I can have n anhaenge for one entry in immobilie. The
> primary key in both is (also historical) objektnummer.
>
> In the model immobilien I tried this:
>var $hasMany = array('Immobilien' => array(
>  'className' => 'Immobilien',
>  'foreignKey' => 'objektnummer')
>);
>
> In the model anhaenge I tried this:
>var $belongsTo = array(
>  'Immobilien'=>array(
>  'className' => 'Immobilien',
>  'foreignKey' => 'objektnummer'
>  )
>);
> In both models I give the parameter for $useTable and $primaryKey.
>
> If I call find all from the controller Immobilien I got a error that
> show me that the relationship between the table immobilien and
> anhaenge wasn't build by Cake.
> If I use $hasOne in both models instead, every things works fine.
>
> If I try to use a custom query in immobilien model like this:
>
>var $hasMany = array(
>'Anhaenge' => array('className' => 'Anhaenge',
>'foreignKey' => 'objektnummer',
>'finderQuery' => "SELECT
> `Immobilien`.`objektnummer`,
> `Immobilien`.`anbieternr`,
> `Immobilien`.`plz`,
> `Immobilien`.`ort`,
> `Immobilien`.`gesamtpreis`,
> `Immobilien`.`iso_waehrung`,
> `Anhaenge`.`objektnummer`,
> `Anhaenge`.`pfad`,
> `Anhaenge`.`anhangtitel`,
>  FROM `immobilien` AS
> `Immobilien`
>  LEFT JOIN `anhaenge` AS
> `Anhaenge`
> ON
> (`Immobilien`.`objektnummer` = `Anhaenge`.`objektnummer`)",
>'counterQuery' => ''
>)
>  );
>
> I got the same error as using $hasMany in the easy way - Cake always
> ignore my $hasMany.
>
> Is this normal?
>
> I'm using Cake 1.2.0.7692 RC3
>
> Regards Thomas
>
> >


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



Re: Newbie: What is the "proper" way of rendering views within views?

2008-10-16 Thread David C. Zentgraf

I don't see the problem with using elements, that's exactly what they  
were made for.

Layouts: outer wrapper, same for all pages (or very few different  
variations)
Views: the actual "page", usually one per action
Elements: re-usable pieces of a view that are the same on many pages

You can put the elements in sub-directories if you don't want them to  
clutter up one directory. A renderAction() is overkill here.

On 17 Oct 2008, at 12:05, Stan wrote:

>
> From what I could gather in other posts, it seem like the right way to
> do this is through requestAction, although there are a few things
> which don't seem right. Let me very briefly explain my setup which
> should be fairly common.
>
> I have 2 tables, customers, and inquiries. Customers hasMany
> inquiries. I baked a project/models/views for these, and customers/
> view will show me my customer info, along with all inquiries belonging
> to the customer.
>
> In customers/view.ctp, there is some code to render an inquiry. Also,
> inquiries/view.ctp has the same code to render an inquiry. My first
> thought was -- I don't want the same code in two places... I want to
> define how an inquiry should be rendered in inquiry/view.ctp, and then
> use that in customers/view.ctp. Also, I might want to have a couple of
> different views of an inquiry -- maybe a view_full.ctp,
> view_summary.ctp, view_oneline.ctp...
>
> There are a couple of options that I could find:
>
> I can use renderAction ("/inquiries/view_expanded/$id",
> array('return')) and get what I want... but, that causes a whole new
> page request, and the inquiry data which was already available to the
> customer view has to be retrieved again.
>
> I can use an element, and pass the inquiry data to it. Sounds great,
> except now I have to create a different element for each inquiry view
> I want to include in various pages -- inquiry_expanded.ctp,
> inquiry_summary.ctp, inquiry_online.ctp, etc. Soon, I'm going to have
> a few elements for each model and that's not what elements are
> supposed to be for -- that's exactly why there are views.
>
> What is the proper "cake-way" of doing this?
>
> >


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



Re: How to use helpers??

2008-10-16 Thread David C. Zentgraf

If you read carefully:

"Problems with $html->input()..."
"In 1.2, all form/input related stuff has been moved to FormHelper"

Ergo, a lot of stuff that is in $form in 1.2 used to be in $html in 1.1.
You may want to check the documentation that pertains to the version  
you're using:
http://api.cakephp.org/1.1/classes.html

On 17 Oct 2008, at 14:22, xelios wrote:

> Your links refer to v1.2
>
> But m working on v1.1
>
> On Oct 17, 9:34 am, "David C. Zentgraf" <[EMAIL PROTECTED]> wrote:
>> http://groups.google.com/group/cake-php/browse_thread/thread/560bceab...http://groups.google.com/group/cake-php/browse_thread/thread/e88b06c5
>>  
>> ...
>>
>> On 17 Oct 2008, at 12:56, xelios wrote:
>>
>>
>>
>>> m using v1.1.x
>>
>>> Following is the error:
>>
>>> Fatal error: Call to undefined method FormHelper::create() in C: 
>>> \xampp
>>> \htdocs\cake\app\views\tasks\add.ctp on line 1


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



Re: How to use helpers??

2008-10-16 Thread David C. Zentgraf

http://groups.google.com/group/cake-php/browse_thread/thread/560bceab6131f7ca
http://groups.google.com/group/cake-php/browse_thread/thread/e88b06c5ce6e91a8

On 17 Oct 2008, at 12:56, xelios wrote:

>
> m using v1.1.x
>
>
> Following is the error:
>
> Fatal error: Call to undefined method FormHelper::create() in C:\xampp
> \htdocs\cake\app\views\tasks\add.ctp on line 1
> >


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



Re: Data validation from URL

2008-10-16 Thread David C. Zentgraf

Think twice about what's actually going on in that code...

If no $id or $secretid were supplied, you redirect somewhere else.
If $this->data is not empty... doesn't matter.
Then, last case that always gets triggered if there's ANY $id or  
$secretid, you fetch the data from the DB and present it to the user.

There's no validation of the $secretid going on whatsoever, how do you  
expect it to work?

On 16 Oct 2008, at 14:36, Cody Sortore wrote:

>
> Okay, with the particular site I'm building a log in system isn't
> necessary, and people don't want it.  The problem is that I want to
> allow the creator editing access still. People make mistakes, or may
> need to delete spam comments occasionally.
>
> What I was thinking was to have a place when creating their page they
> put in a "secret id" that then goes into the database and what I want
> to do is so that the only way to access the edit page is to have that
> secret id in the url for example:
>
> http://www.testsite.com/inventory/edit/secretid/1/
>
> I've actually got that working with this code:
>
> http://bin.cakephp.org/view/1344979601
>
> and a view that has a hidden field for the secret id.  Problem is with
> what I have anything in place of the secret id allows you to edit.
> Examples:
>
> http://www.testsite.com/inventory/edit/12345/1/
> http://www.testsite.com/inventory/edit/iamahaxor/1/
> http://www.testsite.com/inventory/edit/1/1/
>
> will all allow you to edit inventory item number 1.
>
> Another annoyance I've noticed is that if you have an inventory number
> higher than what the table goes up to.  Say with this one in test runs
> I've only got 3 inventory items to work with right now.  If I put:
>
> http://www.testsite.com/inventory/edit/secretid/1337/
>
> it simply adds another inventory item to the list... this like I said
> is only a minor nuisance and can be ignored, the important part is the
> data validation (which may be fix this trouble too).
> >


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



Re: Data validation from URL

2008-10-16 Thread David C. Zentgraf

Dabble around with the debug() method, like

$this->data = $this->Model->find( /* conditions */ );
debug($this->data);

You'll find the answer eventually...

On 16 Oct 2008, at 16:41, Cody Sortore wrote:

> Okay, I added this:
>
> if ($secretid != /* What Goes Here? */ ) {
>
>   $this->flash(__('Invalid Secret Identification Code', true),
> array('action'=>'index'));
>
> }
>
> Tried several different things, but I'm a noob, which is why I
> couldn't get it to work in the first place, I was just messing around
> with some of the code that was baked up for me but it's not working.
> How do you call a single item from the database?
>
>
> On Oct 16, 1:28 am, "David C. Zentgraf" <[EMAIL PROTECTED]> wrote:
>> Think twice about what's actually going on in that code...
>>
>> If no $id or $secretid were supplied, you redirect somewhere else.
>> If $this->data is not empty... doesn't matter.
>> Then, last case that always gets triggered if there's ANY $id or
>> $secretid, you fetch the data from the DB and present it to the user.
>>
>> There's no validation of the $secretid going on whatsoever, how do  
>> you
>> expect it to work?
>>
>> On 16 Oct 2008, at 14:36, Cody Sortore wrote:
>>
>>
>>
>>> Okay, with the particular site I'm building a log in system isn't
>>> necessary, and people don't want it.  The problem is that I want to
>>> allow the creator editing access still. People make mistakes, or may
>>> need to delete spam comments occasionally.
>>
>>> What I was thinking was to have a place when creating their page  
>>> they
>>> put in a "secret id" that then goes into the database and what I  
>>> want
>>> to do is so that the only way to access the edit page is to have  
>>> that
>>> secret id in the url for example:
>>
>>> http://www.testsite.com/inventory/edit/secretid/1/
>>
>>> I've actually got that working with this code:
>>
>>> http://bin.cakephp.org/view/1344979601
>>
>>> and a view that has a hidden field for the secret id.  Problem is  
>>> with
>>> what I have anything in place of the secret id allows you to edit.
>>> Examples:
>>
>>> http://www.testsite.com/inventory/edit/12345/1/
>>> http://www.testsite.com/inventory/edit/iamahaxor/1/
>>> http://www.testsite.com/inventory/edit/1/1/
>>
>>> will all allow you to edit inventory item number 1.
>>
>>> Another annoyance I've noticed is that if you have an inventory  
>>> number
>>> higher than what the table goes up to.  Say with this one in test  
>>> runs
>>> I've only got 3 inventory items to work with right now.  If I put:
>>
>>> http://www.testsite.com/inventory/edit/secretid/1337/
>>
>>> it simply adds another inventory item to the list... this like I  
>>> said
>>> is only a minor nuisance and can be ignored, the important part is  
>>> the
>>> data validation (which may be fix this trouble too).


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



Re: How to Handle Special Fields on $this->query() statements - Forking from "MySQL Having Clausule "

2008-10-15 Thread David C. Zentgraf

Very helpful piece-o-code, thanks grigri. :)

On 15 Oct 2008, at 19:07, grigri wrote:

>
> Heh, looks like that one was mine [copied from 
> http://i-love-cake.pastebin.com/f78d0639a 
> ]
>
>
> On Oct 15, 4:13 am, "David C. Zentgraf" <[EMAIL PROTECTED]> wrote:
>> I can't find the author anymore, but this extended MySQL driver was
>> pasted in the bin a while back (I think). Pasting it again.
>>
>> http://bin.cakephp.org/view/443659159
>>
>> // Extended 'resultSet' to allow alias processing
>> // Fields should contain '((something)) AS Model__field'
>>
>> Hope this helps.
>>
>> On 15 Oct 2008, at 02:59, Dérico Filho wrote:
>>
>>
>>
>>> Hello guys,
>>
>>> So I asked a question about having clauses using $this->Model- 
>>> >find()
>>> method, and the answer was daunting, in my opinion: use in Model  
>>> Class
>>> $this->query() method within a custom method... OK. I shall do it  
>>> this
>>> way.
>>
>>> One of the problems I face using $this->query() is:
>>
>>> Whenever I have a special field, the result parser puts it in a
>>> different key.
>>
>>> For instance:
>>
>>> $qry = $this->query("SELECT `Table`.*, `Table`.field * 1000 as
>>> specialfield FROM ");
>>
>>> it would return $qry as
>>> Array( 0 =>
>>> Array("Table" => Array("field" => "1", "field2" => "value"), 0 =>
>>> Array("specialfield" => "1000"), ...
>>> );
>>
>>> What do I do?
>>
>>> I array_walk the result, array_mergin Table with 0... eventually it
>>> turns into:
>>> Array( 0 =>
>>> Array("Table" => Array("field" => "1", "field2" => "value",
>>> "specialfield" => "1000"), ...
>>> );
>>
>>> Is there any more practical way doing it?
>>
>>> thanks you guys!
>>
>>> []s
>>> Dérico Filho
> >


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



Re: Move existing app to Subversion

2008-10-15 Thread David C. Zentgraf

http://svnbook.red-bean.com/nightly/en/svn.ref.svn.c.export.html
http://subversion.tigris.org/mailing-lists.html

Chrs,
Dav

On 15 Oct 2008, at 18:04, oleonav wrote:

>
> Hi there,
>
> I am also using subversion to mamage development of apps.
>
> My setup is:
> - Central subversion server; Manages all project under development
> - Multiple development clients; Check in/out updated files to the
> central server.
>
> This setup works just fine. Question;
> I want to be able to get the latest working copy of the central server
> for specific projects on live productions webservers without all
> hidden subversion files etc... Call it a 'clean' copy. How can I do
> this?
>
> Thanks,
>
> Olav
>
>
>
> On Oct 14, 7:53 pm, Mathew <[EMAIL PROTECTED]> wrote:
>> I've been using SVN with CakePHP for 2 years now, and it works great
>> together.
>>
>> I run Eclipse as my IDE on Windows, and use TortoiseSVN as my desktop
>> client. I also have the SVN plugin for Eclipse.
>>
>> My repository setup is simple.
>>
>> /svn/trunk/website_name/...
>> /svn/branch/branch_version/website_name/...
>>
>> I do all my work off the trunk, and then move files to branches as I
>> reach milestones. Some people do it the reverse, working off a branch
>> and then merging with the trunk as they reach milestones. It's up to
>> you to figure out which is best.
>>
>> I found that TortoiseSVN allows me to quickly add files to the ignore
>> list of SVN. Things like the cake temp folder for example.
> >


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



Re: Mysql Error when trying to execute a function in the model

2008-10-14 Thread David C. Zentgraf

So, did it fix it? It just seems like a typo somewhere.
Point being, if you mistype model names and/or methods, Cake makes  
them up as it goes along (automagic guesswork). An inexistent method  
name will be attempted to be interpreted as an SQL call (e.g. - 
 >findByUserName(), even though you don't have a method of that name).

On 15 Oct 2008, at 12:22, Earl0983 wrote:

>
> Thanks, but that was actually a typo on my part it should have said:
>
> $this->User->validateUserLogin($this->data['User']) )
>
> I was playing around with it to try to get it to work and that is when
> i changed it to Users.  Sorry for the confusion.
>
> On Oct 14, 11:18 pm, "David C. Zentgraf" <[EMAIL PROTECTED]> wrote:
>> On 15 Oct 2008, at 12:08, Earl0983 wrote:
>>
>>> $this->Users->validateUserLogin($this->data['User']) )
>>
>>  ^^
>> Model names are usually singular.
>>
>> Chrs,
>> Dav
> >


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



Re: Mysql Error when trying to execute a function in the model

2008-10-14 Thread David C. Zentgraf

On 15 Oct 2008, at 12:08, Earl0983 wrote:

> $this->Users->validateUserLogin($this->data['User']) )

 ^^
Model names are usually singular.

Chrs,
Dav

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



Re: How to Handle Special Fields on $this->query() statements - Forking from "MySQL Having Clausule "

2008-10-14 Thread David C. Zentgraf

I can't find the author anymore, but this extended MySQL driver was  
pasted in the bin a while back (I think). Pasting it again.

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

// Extended 'resultSet' to allow alias processing
// Fields should contain '((something)) AS Model__field'

Hope this helps.

On 15 Oct 2008, at 02:59, Dérico Filho wrote:

>
> Hello guys,
>
>
> So I asked a question about having clauses using $this->Model->find()
> method, and the answer was daunting, in my opinion: use in Model Class
> $this->query() method within a custom method... OK. I shall do it this
> way.
>
> One of the problems I face using $this->query() is:
>
> Whenever I have a special field, the result parser puts it in a
> different key.
>
> For instance:
>
> $qry = $this->query("SELECT `Table`.*, `Table`.field * 1000 as
> specialfield FROM ");
>
> it would return $qry as
> Array( 0 =>
> Array("Table" => Array("field" => "1", "field2" => "value"), 0 =>
> Array("specialfield" => "1000"), ...
> );
>
> What do I do?
>
> I array_walk the result, array_mergin Table with 0... eventually it
> turns into:
> Array( 0 =>
> Array("Table" => Array("field" => "1", "field2" => "value",
> "specialfield" => "1000"), ...
> );
>
> Is there any more practical way doing it?
>
> thanks you guys!
>
> []s
> Dérico Filho
> >


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



Re: Filtering controller

2008-10-14 Thread David C. Zentgraf

http://book.cakephp.org/view/542/Defining-Routes

Your route would look something like:

Router::connect('/countries/:country_id/cities/*', array('controller'  
=> 'cities', 'action' => 'someCityAction'));

The 'country_id' will be available in $this->params in the controller.

On 15 Oct 2008, at 08:31, machuidel wrote:

>
> Hello,
>
> How can I map a controller to an URL like "/countries/12/cities/" such
> that the index of cities will be filtered by the specified country? I
> would like that URL to dispatch the "city" controller (not the
> "country" controller) with the specified country as its argument.
> Something like:
>
> class CityController extends AppController {
>
>  ...
>
>  function index_country ($country_id) {
> // Index of cities filtered by specified country
>  }
>
>  ...
>
> }
>
> Could not find any example of someone doing this in Cakephp.
>
> Cheers,
> Mike
>
> >


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



Re: Associations for multiple tables/models

2008-10-12 Thread David C. Zentgraf

I stand corrected, didn't think of that workaround (not sure I'd call  
it a feature).
Would be great if Cake would recognize these potentials for  
optimization automagically...

On 12 Oct 2008, at 23:00, AD7six wrote:

> On Oct 12, 3:04 pm, "David C. Zentgraf" <[EMAIL PROTECTED]> wrote:
>> Unfortunately there's no makeQueriesSuckLess flag in Cake. Yet. It
>> gets you the results you ask for, just don't ask how. If you care
>> about the how, do it yourself. ;-)
>
> FUD. What's the point of using a framework if you are going to ignore
> one if it's most powerful features.
>
> Define or bind B -> belongsTo C
> Define or bind B -> hasOne A
>
> $result = $this->A->B->read/find();
>
> $result will contain a, b and c
> >


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



Re: Associations for multiple tables/models

2008-10-12 Thread David C. Zentgraf

Unfortunately there's no makeQueriesSuckLess flag in Cake. Yet. It  
gets you the results you ask for, just don't ask how. If you care  
about the how, do it yourself. ;-)

On 12 Oct 2008, at 21:52, jkritikos wrote:

>
> I m cool with that but are you suggesting this because there is no way
> for cake to handle this automatically or are you now aware of how to
> do it ?:)
>
> On Oct 12, 3:49 pm, "David C. Zentgraf" <[EMAIL PROTECTED]> wrote:
>> On 12 Oct 2008, at 21:39, jkritikos wrote:
>>
>>> What should i do so that i get the data for A+B+C in one query?
>>
>> Write your own query.
>>
>> Chrs,
>> Dav
> >


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



Re: Associations for multiple tables/models

2008-10-12 Thread David C. Zentgraf

On 12 Oct 2008, at 21:39, jkritikos wrote:

> What should i do so that i get the data for A+B+C in one query?

Write your own query.

Chrs,
Dav

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



Re: In controller using too many models hit the performance?

2008-10-11 Thread David C. Zentgraf

Yes, the more models you use, the more overhead there is. Not only in  
terms of database hits, but simply the fact that an additional class  
needs to be included and loaded. So design your database and models  
wisely from the start.

Having said that, this overhead is often negligible, except for truly  
performance hungry apps. If you have such a performance hungry app,  
think about conditionally loading models with App::import.
Also, as soon as you go to debug mode 0, the models will be cached and  
not DESCRIBED every single time. (What Larry said.)

On 12 Oct 2008, at 11:42, [EMAIL PROTECTED] wrote:

>
> Hi there,
>
> My controller includes eight models as follows,
> var $uses = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H');
>
> When loading a view for the controller, it always DESCRIBE the above
> eight TABLES (models) even the action (view) has nothing to do with
> these tables. From the cakephp log on view, it is a big performance
> hit for me.
>
> Q:
> 1. is this by design?
> 2. how to reduce these queries?
>
> I didn't get much helpful info from internet and cakephp official
> site. I'd appreciate it if any help (or article link).
>
> Thanks,
> Bo
> >


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



Re: HABTM & Belongs_To Together?

2008-10-11 Thread David C. Zentgraf

A HABTM relationship will fetch data differently then a belongsTo  
relationship.
HABTM will get you an array with multiple results, belongsTo just a  
"flat" array.
$habtm = array(
[0] => array(['id'] =>, ...),
[1] => array(['id'] =>, ...)
)
$belongsTo = array(['id'] =>, ...)

When you specify multiple associations, you'll have to specify unique  
names for them.
var $belongsTo = array(
'Owner' => array(...)
);
var $hasAndBelongsToMany = array(
'Users' => array(...)
);

You shouldn't/can't mix different associations under the same name.  
Your output is screwed up because you're mixing the "flat" array with  
the "multi" array. You can either fix that manually (also see Set  
Class) or just keep it simple and name your associations properly.
BTW, your debug output is virtually impossible to read, use  
debug($array) or pr($array) to spot these kinda things a lot easier.

On 11 Oct 2008, at 23:58, Keith wrote:

>
> Hi Villas,
>
> I tried clearing out the cache and that didn't fix it unfortunately.
>
> I have the max debug level set.  The code appears to be operating as
> programmed.
>
> I tried a simple habtm with belongs_to in a scenario where I only had
> those two models and still got the same results.
>
> I think it's a problem with how CakePHP is creating the array.  The
> first element in the array has no numeric identifier.  If you look
> back at the screenshot in the initial post you'll see that the first
> entry in the array is not [0] but rather is called [id] as it would be
> when there is a belongs_to and not a HABTM as well.
>
> Unless I can figure something out I'm going to go ahead and just
> report it to cakePHP as a bug because there are legit reasons, like
> the one I'm building, where you'd want a habtm with a belongs_to in
> the same model.
>
> - Keith
>
> On Oct 11, 8:14 am, villas <[EMAIL PROTECTED]> wrote:
>> Hi Keith
>>
>> Thanks for the extra info although it still isn't very clear to me
>> from that what's going on.  However,  I would mention:
>> 1. Are you clearing your cache?  You might have old data hanging
>> around.
>> 2. Did you try to set a higher debug level to get more info?
>> 3. Did you try to experiment with Bake?  You can try different
>> scenarios which you should be able to get working without too much
>> sweat.
>>
>> Best regards.
>>
>> On Oct 11, 6:31 am, Keith <[EMAIL PROTECTED]> wrote:
>>
>>> Just as a clarification on why I have it set up this way...
>>
>>> The belongs_to is there because the users that creates the project
>>> becomes the owner.
>>> The has_and_belongs_to_many is there so that if a user wants someone
>>> outside their department to access it they can manually add them.
>>
>>> The problem looks like it's stemming from how cakePHP is handling  
>>> the
>>> array...
>>
>>> for the belongs_to the array keys are based on field names like  
>>> [id] &
>>> [first_name], etc.
>>> for the HABTM array the array keys are sequential as the "related
>>> users" foreach loop expects.
>>
>>> - Keith
>>
>>> On Oct 11, 1:18 am, Keith <[EMAIL PROTECTED]> wrote:
>>
 It looks to me like this is what is happening, but it's very
 strange...
>>
 Even when no users are associated I'm getting 8 blank associated  
 users
 which is exactly how many elements are in the array...
>>
 So...
>>
 It looks like it's taking the first character from each part of the
 first entry in the array and putting it there...
 K = Keith = First Name
 M = Medlin = Last Name
 etc. for each of the fields.
>>
 So...I'm totally confused why the following code would produce  
 that:
>>
 SQL Query:
 SELECT `User`.`id`, `User`.`first_name`, `User`.`last_name`,
 `User`.`email`, `User`.`date_created`, `User`.`last_login`,
 `User`.`username`, `User`.`password`, `ProjectsUser`.`user_id`,
 `ProjectsUser`.`project_id` FROM `users` AS `User` JOIN
 `projects_users` AS `ProjectsUser` ON  
 (`ProjectsUser`.`project_id` = 1
 AND `ProjectsUser`.`user_id` = `User`.`id`) WHERE 1 = 1
>>
 Which returns a normal looking data set in SQL...
>>
 Relevant View Code:
 >>> $i = 0;
 foreach ($project['User'] as $user):
 $class = null;
 if ($i++ % 2 == 0) {
 $class = ' class="altrow"';
 }
 ?>
 >
 
 
 
 
 >>> td>
 
 
 
>>
 project['User'] is what you see dumped above the related users  
 table
 so you can see that the array doesn't look strange in any way.  Is
 this possibly a bug that needs reporting to the CakePHP trac?
>>
 - Keith
>>
 On Oct 10, 11:58 pm, Keit

Re: Controller/Model Question

2008-10-10 Thread David C. Zentgraf

All you need to do is insert the post_type into the data array before  
saving it to the database.
Either insert a hidden field into the form that you use to create the  
post, or insert it in the controller.

$this->data['Post']['post_type'] = 'news';
$this->Post->save($this->data);

On 11 Oct 2008, at 10:50, jfgreco wrote:

>
> I am designing a CMS system and am new to CakePHP. I am porting
> everything to Cake from a legacy system, so I have a defined database
> already.
>
> I have a table of posts and in that table I have a column called
> post_type which I populate with News, Page, Event or Admin. I don't
> want the user to have to choose the type when posting. I want them to
> click a link like Post News or Post A New Page. Is there a good way to
> use a single base controller to build off of? I created the
> PostController and it works for a good base, but what is the best way
> to build out from there? Any ideas will be helpful.
>
> I consolidated into one table to reduce duplicate table structures for
> essentially the same type of item.
>
> >


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



Re: Querying Unrelated Models from a Controller

2008-10-10 Thread David C. Zentgraf

What you're looking for is $uses.
http://book.cakephp.org/view/53/components-helpers-and-uses

Or alternatively:
App::import('Model', 'OtherModel');
$othermodel = new OtherModel();

On 11 Oct 2008, at 09:56, Wayne wrote:

>
> This might be a simple question, but everything I'm trying is not
> working and it's frustrating the hell out of me.
>
> I need to do a find() on a model that is not related to the model
> whose controller I'm currently accessing. I know how to make this work
> if there's a hasMany or belongsTo sort of relationship between the two
> models, but in this case, there's not. I've tried creating new
> instances of the other controller to query, and I've tried to use the
> static find() method, but neither is working because the model I'm
> working with doesn't have any knowledge of the existence of the other
> model. It seems to me there should be some simple way to do this, but
> I can't find any example of this sort of query in the documentation. I
> realize that I can use query() to hit the database directly, but I was
> trying to avoid that, and it seems like CakePHP should be able to find
> the other model if I could just ask it in the right way.
>
> Is there some way normal "CakePHP" to do this?
>
> Thanks for any help you can provide,
> Wayne Eaker.
>
> >


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



Re: Instance methods in Models

2008-10-09 Thread David C. Zentgraf

Yeah you're right, Cakes models are DAOs. That is due to objects  
carrying a certain overhead in PHP (4), whereas they're virtually free  
in Ruby. There have been discussions about this before on the list.  
IIRC, Cake is slated to become OO by 2.0.


I'd still say your question was aimed at (instance)  
methods accessing data stored in the model instance, rather than how  
to use instance methods.
Sorry, feeling nitpicky today. ;-)

Chrs,
Dav

On 10 Oct 2008, at 10:41, cbankier wrote:

>
> Thanks for the reply.
>
> Actually "instance method" is exactly what I mean, as per
> http://en.wikipedia.org/wiki/Instance_method
>
> I think my confusion is with the fact that cake Models can only return
> arrays of data, not objects as I am used to from rails/Java.
>
> I guess the Model is really a DAO, not a domain object as I expected.
>> It's more  Cake-like to expect your data to be in an array that you
> feed into functions
> This seems more of a procedural approach rather than proper OO, but
> I'll deal with that for now.
>
>
> Still this helps me at understand how I need to structure my app to
> fit in with cakes ways.
>
> Thanks,
> Colin.
> >


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



Re: AppController being ignored

2008-10-09 Thread David C. Zentgraf

Paste your EventsController too...


On 10 Oct 2008, at 00:06, Fibra wrote:

>
> Hello Everyone, how are you?
>
> I've read this issue in other posts but most of the solutions are
> becouse they've updated to a newer version.
>
> Since I just downloaded the latest stable version on cake,
> cake_1.2.0.7692-rc3.tar.bz2 I must ask for help.
>
> Here's the thing:
>
> I have my routing.admin turned on, and placed my app_controller.php
> under /app
>
> here's the code:
>
>class AppController extends Controller {
>   function __construct(){
>   die('wtf');
>   }
>
>   function beforeFilter(){
>   echo 'ok';
>   if (isset($this->params['admin'])) {
>   $this->layout = 'admin';
>   }
>   }
>
>   }
> ?>
>
> Neither 'ok' or 'wtf' get printed once I access /admin/events, however
> they DO get printed when I access /admin, but that's becouse I forced
> to have the admin_layout like this:
>
> Router::connect('/admin', array('controller' => 'pages','layout' =>
> 'admin', 'action' => 'display', 'admin_home'));
>
> So, any ideas? Do I have to post more info for this issue?
>
> Thanks in advance!
>
> >


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



Re: Instance methods in Models

2008-10-09 Thread David C. Zentgraf

Not quite sure if "instance methods" is the right term for what you're  
asking for, but anyway.

Look into Model::read() and Model::set();
A Model::find() will only return the data, it will not persist it in  
the model instance. set() is used to, well, set data inside the model,  
i.e. it will be persisted in Model::$data. In a model function you can  
then access $this->data.
Model::read() will find a record by id and automatically set() it.

Actually though, Cake is less object oriented than Rails. It's more  
Cake-like to expect your data to be in an array that you feed into  
functions, rather than data being persisted in the model instance.


On 9 Oct 2008, at 16:29, cbankier wrote:

>
> Hi,
> I'm new to Cake, but have used rails quite a bit as well as Java
> frameworks etc.
>
> Is it possible for a model to have instance methods? eg have behaviour
> that depends on the objects state - the fundamental concept of
> objects.
>
> Here is an example of something I might do in rails/Java. The syntax
> is almost certainly wrong for cake, but hopefully you can see what I'm
> trying do to and hopefully explain the cake way of achieving this.
>
> Secondly in this example the model is aware if it's associations. Is
> that possible/recommended in Cake?
>
> class Order extends AppModel {
> var $hasMany = 'Product';
>
> function getTotal(){
>$total = 0;
>foreach($this->Product->find('all') as $product):
>$total += $product->price;
>endforeach;
>
> return $total;
> }
>
> }
>
> and then a controller might do:
>
> $order = $this->Order->findById(5);
> $orderTotal = $order->getTotal();
>
> Any help appreciated.
> Cheers,
> Colin.
>
>
>
> >


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



Re: Getting route-URL for internal controller/action-URL

2008-10-09 Thread David C. Zentgraf

I believe what you're looking for is $html->url() or, more direct,  
Router::url().
http://api.cakephp.org/class_router.html#a34cdc409ebe46302682fb8c242c4838

Also, you should lookup URLs with an array like
array('controller' => 'groups', 'action' => 'something')
instead of /groups/something. Seems more reliable for reverse lookups  
in my experience.

On 9 Oct 2008, at 17:23, Andreas Hofmann wrote:

>
> Hi all,
>
> i discovered the whole Router-class-definition, but I found no method,
> that matches my needs :)
> Is there any way to get the URL of a defined route for an internal
> cake-controller/action-URL.
>
> For example I have this route defined:
>
> Router::connect('/gruppen', array('controller' => 'groups', 'action'
> => 'index'));
>
> Is there now a way to get this defined URL ('/gruppen') by calling a
> function with the params controller/action, like this:
>
> Router::theMagicMethodThatMustExist(
>  array(
>'controller' => 'groups'
>'action' => 'index'
>  )
> ); // Should now return '/gruppen'
>
> With this I can undock the URLs from the templates/views! Currently
> I'm doing stuff like this in a view:
>
> $html->link('A Link', '/groups/index');
>
> But this sucks, because when I define a route for '/groups/index', I
> don't want to change the URL in 1000 view-files and replace '/groups/
> index' with '/gruppen' :S Would be nice if there is a method I'm
> looking for, to always get a defined route-URL, if there is one! :)
>
> Is there such a method out there??
>
> Thanks and greetings,
>
> Andreas!
> >


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



Re: Non alphanumeric chars breaks $validate error messages

2008-10-08 Thread David C. Zentgraf

Just tested with some UTF-8 Japanese and it works, so it's not a  
problem in general.
I'd investigate along the same lines as this recent thread:
http://groups.google.com/group/cake-php/browse_thread/thread/0ea507c127fd2ab9

Try a simple echo "Descripción"; from anywhere.
Does that display correctly on the page?

On 9 Oct 2008, at 10:20, [EMAIL PROTECTED] wrote:

>
> Actually it happens everywhere and I hadn't noticed it.
> For example:
>
> sort('Descripción');?>
>
> The cell comes out empty when the page is rendered.
>
>
>
> On Oct 8, 9:15 pm, "R. Davila" <[EMAIL PROTECTED]> wrote:
>> Hi,
>>
>> I'm using the $validate array to setup validation and error  
>> messages in
>> the model.
>>
>> Given a field called "description", the following works perfectly:
>>
>> $validate = array(
>>  'description' => array(
>>   'rule' => array('minLength', 20),
>>   'message' => 'Description must be at least 20 characters'));
>>
>> If I translate the error message to spanish it would be:
>>   'message' => 'La descripción tiene que ser al menos 20  
>> caracteres'));
>>
>> Notice the ó in the translated word "description" == "descripción".
>>
>> The result is that no message is shown. The error is still  
>> triggered though.
>>
>> I tested it with all accentuated vocals á é í ó ú and ñ, all of which
>> are heavily used in spanish.
>>
>> How can I overcome this?
>>
>> Thanks
> >


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



Re: Install cake on leopard, but not the docroot

2008-10-08 Thread David C. Zentgraf

Yes you can, but you'll have to tell Apache that it should care about  
~/cakeSites as well.
You'll have to create a new Directory or VirtualHost directive in a  
config file in /etc/apache2/users.

Is there a particular reason you want to go through this trouble? :-)

On 9 Oct 2008, at 03:43, dotty wrote:

>
> Hay all, i have PHP5 installed (w/ mysql). This works fine, i navigate
> to ~/Sites and all my php get parsed correctly.
>
> Now, how would i go about installing cake without mucking up my ~/
> Sites directory? Could i make a new dir called ~/cakeSites and run
> cake in there?
>
> Any help would be great!
>
> Thanks
>
> >


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



Re: Encryption/Decryption of data

2008-10-08 Thread David C. Zentgraf
scribed above. In this manner, all the
> 'child' users and the 'parent' have access to the data using their own
> passphrases, and the actual data in the database is protected from
> anyone, even if you have root access, since you need the private key
> to decrypt the data, and all private keys of the users are encrypted
> with a symmetric algorithm which requires a passphrase.
>
> 4) When you need to add new data or modify existing data, it can be
> encrypted by anyone using the public key, which was stored somewhere
> on the database & associated to that data. As a result, any of the
> users who can view the decrypted data may add/edit data, and the
> result will then be encrypted with the public key. The data is then
> only viewable to users who have a copy of that private key, which is a
> feature of the scheme described above.
>
> Limitations:
>
> - New users need to be created by pre-existing users who already have
> access to the data. You can limit this to the 'parent' by providing an
> appropriate flag.
>
> - Since a private key is associated to the public key that is used to
> encrypt the relevant data, for each 'data group' that a user has
> access to, you will need to store an encrypted private key. E.g. if
> User1 has access to data1, and User2 has access to data1 and data2,
> and User3 has access to data2, then User2 will have two encrypted
> private keys, one for each data group he is able to view.
>
> Sorry for the length of the post. If google groups allowed LaTex
> typesetting and Venn diagrams, I could have been much more brief ;-).
>
> -J.
>
> On Oct 8, 1:38 am, "Bernhard J. M. Grün"
> <[EMAIL PROTECTED]> wrote:
>> Hi!
>>
>> Here are some of my ideas for that problem:
>>  - public key encryption (Algorithms: RSA, ElGamal, ...)
>>read:http://en.wikipedia.org/wiki/Public-key_cryptography
>>You should combine those algorithms with traditional  
>> cryptography (i.e.
>> AES) - called hybrid cryptography
>>  - secret sharing (Algorithm: Shamir, ...)
>>
>> read:http://en.wikipedia.org/wiki/Secret_sharing,http://en.wikipedia.org/wiki/Shamir's_Secret_Sharing
>>
>> Idea:
>> Just save your data more than once for every user but with its own  
>> (public)
>> key.
>>
>> This mail is short because I am short in time at the moment. Anyway  
>> I hope
>> this helps.
>>
>> -- Bernhard J. M. Grün
>>
>> 2008/10/8 David C. Zentgraf <[EMAIL PROTECTED]>
>>
>>
>>
>>> I'm very interested in this topic.
>>
>>> I have an application that by it's nature shares "objects" between
>>> multiple participants, each object having different participants.
>>> Since those objects contain sensitive data, I was looking into  
>>> ways to
>>> encrypt those, so that not even the database admin could see the
>>> content.
>>
>>> With "traditional" encryption schemes this is very difficult to
>>> realize though, as there's always only one key that can decrypt the
>>> data (would be pointless otherwise). That means for every object a
>>> user is participating in you'd need to store an additional key with
>>> the user's data, which is pointless.
>>
>>> I haven't yet, in my limited research, found a meaningful way to
>>> encrypt data in a way that allows it to be decrypted with any one of
>>> multiple keys (i.e. the user's password). But I'm no cryptographer  
>>> by
>>> any means. Are public/private keys a way to do this?
>>
>>> Chrs,
>>> Dav
>>
>>> On 8 Oct 2008, at 12:37, titang wrote:
>>
>>>> It sounds good, but what about if the data must be accessible by  
>>>> many
>>>> users.
>>>> For example I want to let 2 users to access the same datas with  
>>>> their
>>>> own passphrase...
>>
>>>> Is there a simple way to do that ?
>>
>>>> Titang
>>
>>>> On Oct 8, 11:03 am, Joel Perras <[EMAIL PROTECTED]> wrote:
>>>>> Simple solution: Generate a pseudo-random string of characters (or
>>>>> let
>>>>> him choose his own passphrase), and use this as a salt to encrypt
>>>>> your
>>>>> data before saving to your database. The passphrase must then be  
>>>>> used
>>>>> to retrieve any information from the database.
>>
>>>>> Of course, all of this is completely useless if you

Re: Tutorial - How make associations between models on different database

2008-10-08 Thread David C. Zentgraf

I have this case working in an app of mine, no problem whatsoever.
Cake just gets the data in two steps and combines it.
(I'd rather it does a cross-database JOIN, but it works anyway.)

Chrs,
Dav

On 8 Oct 2008, at 22:07, [EMAIL PROTECTED] wrote:

>
> David:
> I can see how that would work for hasMany. But for hasOne, belongsTo
> and (I think) HABTM Cake joins the tables to get the data in a single
> query. Does Cake honor useDbConfig in these cases?
>
> /Martin
>
>
> On Oct 8, 1:08 pm, "David C. Zentgraf" <[EMAIL PROTECTED]> wrote:
>> Set up multiple database connections in 
>> database.php.http://book.cakephp.org/view/40/Database-Configuration
>>
>> Configure your models to use the appropriate 
>> connection.http://book.cakephp.org/view/435/useDbConfig
>>
>> The associations between models work exactly the same, no extra work
>> needed.
>>
>> On 8 Oct 2008, at 17:06, [EMAIL PROTECTED] wrote:
>>
>>
>>
>>> Hi
>>> I have read many posts about "How make associations between models  
>>> on
>>> different database"
>>> but I have not yet understood how can I do this.
>>> Can someone explain how I can do this for all type of associations  
>>> (in
>>> particular for HABTM)?
>>> Many thanks
> >


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



Re: Tutorial - How make associations between models on different database

2008-10-08 Thread David C. Zentgraf

Set up multiple database connections in database.php.
http://book.cakephp.org/view/40/Database-Configuration

Configure your models to use the appropriate connection.
http://book.cakephp.org/view/435/useDbConfig

The associations between models work exactly the same, no extra work  
needed.

On 8 Oct 2008, at 17:06, [EMAIL PROTECTED] wrote:

>
> Hi
> I have read many posts about "How make associations between models on
> different database"
> but I have not yet understood how can I do this.
> Can someone explain how I can do this for all type of associations (in
> particular for HABTM)?
> Many thanks
> >


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



Re: Is there ANY way to insert page-specific code in to $scripts_for_layout??

2008-10-08 Thread David C. Zentgraf

I'll play around with that, thanks.

A new undocumented goodie every day... ;-)

On 8 Oct 2008, at 16:54, grigri wrote:

>
> What about $this->addScript() ?
>
> From the view:
>
> $this->addScript("");
>
> Adds it internally to the $scripts_for_layout variable; it's called
> from HtmlHelper::css() and whatnot.
>
> hth
> grigri
>
> On Oct 8, 3:19 am, "David C. Zentgraf" <[EMAIL PROTECTED]> wrote:
>> I'm using the HeadHelper to do exactly what you want to 
>> do.http://rossoft.wordpress.com/2006/03/28/register-head-tags-from-helpe 
>> ...
>>
>> On 8 Oct 2008, at 11:16, BrendonKoz wrote:
>>
>>
>>
>>> Ah, teknoid...  I've seen that solution before, albeit with  
>>> different
>>> variable names, but that would be the exact solution I was looking
>>> for.  Thanks.
>>
>>> The reason I don't want to create separate CSS files (usually the  
>>> best
>>> solution) is two-fold.
>>> 1. I can't think of a way to apply IE conditional styling with  
>>> Cake's
>>> built in $html->css() method unless I create a layout specifically  
>>> for
>>> this purpose - but without the additional variable in the layout  
>>> that
>>> you suggested, I probably wouldn't have figured out how to do that
>>> properly anyway.
>>> 2. I'd rather not have multiple stylesheets specific to a single web
>>> address on the server - that can add up rather quickly.  I foresee
>>> administration wanting other forms recreated on the web, and with  
>>> just
>>> 30 forms, that approximately 90 CSS files unrelated to core CSS  
>>> styles
>>> for regular layout.
>>
>>> I've used the default.ctp layout supplied by Cake's core so often to
>>> recreate functionality, I completely forgot I could add my own
>>> variables to it, and that they would be accessible from my views.
>>> Thanks again.
>>
>>> On Oct 7, 7:02 pm, teknoid <[EMAIL PROTECTED]> wrote:
>>>> To me it seems that you've shut down the best option (creating a
>>>> separate CSS file)... why not create one?
>>
>>>> On the other hand you could try something like that in the layout:
>>>> if(isset($additional_css)) { echo $additional_css; }
>>
>>>> in the view:
>>>> $this->set('additional_css', ' //your css code ');
>>
>>>> On Oct 7, 5:48 pm, BrendonKoz <[EMAIL PROTECTED]> wrote:
>>
>>>>> I have some page-specific code (CSS in this case) that I would
>>>>> like to
>>>>> use on a form.  This code will *not* be used anywhere else in my
>>>>> application, and if replicated, only portions of it will be.  I'd
>>>>> rather not have to create separate CSS files to use this.  I
>>>>> looked at
>>>>> $html->css() and $html->style() without success.  Is there another
>>>>> method to input *whatever* code I'd like directly in to
>>>>> $scripts_for_layout?
>>
>>>>> The specific code I need to insert can be found at the following
>>>>> pastebin address:http://pastebin.com/m28c87fd2
>>
>>>>> I do plan on reusing the layout I created for this, for other  
>>>>> forms,
>>>>> but the CSS is specific to this individual form (a recreation of a
>>>>> paper form, and must retain the same look for legal reasons).
>>
>>>>> Although I could use $html->css for two of the three CSS sections
>>>>> (I'd
>>>>> prefer not to however), that specific class method is not made to
>>>>> handle IE conditional CSS statements for insertion.  Has anyone  
>>>>> come
>>>>> up with any solutions to this in their own projects, or have any
>>>>> ideas
>>>>> on a possible solution?
>>
>>>>> Note: The linked CSS file has not yet been converted for use  
>>>>> within
>>>>> Cake, but that's not the issue here.- Hide quoted text -
>>
>>>> - Show quoted text -
> >


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



Re: executing shell scripts

2008-10-08 Thread David C. Zentgraf

http://images.google.com/images?q=facepalm
;-)

On 8 Oct 2008, at 16:00, Ryan McKillen wrote:

> Martin, thanks for the continued help.
>
> David, wow. That was it. Think I subconsciously omitted them since  
> it's not
> going to run through the web server. Thank you.
>
>
>
> On Wed, Oct 8, 2008 at 2:54 AM, David C. Zentgraf <[EMAIL PROTECTED]>  
> wrote:
>
>>
>> Just to make sure:
>> Your code is inside  tags, is it?
>>
>> On 7 Oct 2008, at 21:53, Ryan McKillen wrote:
>>
>>> I am using cloud.php as the filename. And just to be safe, I changed
>>> to var
>>> $uses = array(); in case there was a problem with my model. Am I
>>> executing
>>> the shell properly?
>>>
>>> cd ~/cake/console
>>> ./cake cloud
>>>
>>> class CloudShell extends Shell {
>>>   var $uses = array();
>>>   function main() {
>>> $this->out("test\n");
>>>   }
>>> }Error: Class CloudShell could not be loaded
>>>
>>>
>>>
>>>
>>> On Tue, Oct 7, 2008 at 2:16 AM, [EMAIL PROTECTED] <
>>> [EMAIL PROTECTED]> wrote:
>>>
>>>>
>>>> Another basic thing to double-check is the filename. It should be
>>>> cloud.php in your case.
>>>>
>>>> /Martin
>>>>
>>>> On Oct 7, 2:54 am, Ryan <[EMAIL PROTECTED]> wrote:
>>>>> Sorry, it is in ~/vendors/shells
>>>>>
>>>>> On Oct 6, 1:41 pm, "dr. Hannibal Lecter" <[EMAIL PROTECTED]>
>>>>> wrote:
>>>>>
>>>>>> Is it in ~/vendors or ~/vendors/shells ?
>>>>>
>>>>>> On Oct 6, 7:30 pm, Ryan <[EMAIL PROTECTED]> wrote:
>>>>>
>>>>>>> I am trying to create my first shell script. The shell script is
>>>>>>> in /
>>>>>>> vendors and when I run, I get this:
>>>>>
>>>>>>> class CloudShell extends Shell {
>>>>>>>  var $uses = array('Item');
>>>>>>>  function main() {
>>>>>>>$this->out("test\n");
>>>>>>>  }
>>>>>
>>>>>>> }Error: Class CloudShell could not be loaded
>>>>>
>>>>>>> What am I missing? Thanks!
>>>>>
>>>>
>>>
>>>>
>>
>>
>>>
>>
>
> >


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



Re: executing shell scripts

2008-10-07 Thread David C. Zentgraf

Just to make sure:
Your code is inside  tags, is it?

On 7 Oct 2008, at 21:53, Ryan McKillen wrote:

> I am using cloud.php as the filename. And just to be safe, I changed  
> to var
> $uses = array(); in case there was a problem with my model. Am I  
> executing
> the shell properly?
>
> cd ~/cake/console
> ./cake cloud
>
> class CloudShell extends Shell {
>var $uses = array();
>function main() {
>  $this->out("test\n");
>}
> }Error: Class CloudShell could not be loaded
>
>
>
>
> On Tue, Oct 7, 2008 at 2:16 AM, [EMAIL PROTECTED] <
> [EMAIL PROTECTED]> wrote:
>
>>
>> Another basic thing to double-check is the filename. It should be
>> cloud.php in your case.
>>
>> /Martin
>>
>> On Oct 7, 2:54 am, Ryan <[EMAIL PROTECTED]> wrote:
>>> Sorry, it is in ~/vendors/shells
>>>
>>> On Oct 6, 1:41 pm, "dr. Hannibal Lecter" <[EMAIL PROTECTED]>  
>>> wrote:
>>>
 Is it in ~/vendors or ~/vendors/shells ?
>>>
 On Oct 6, 7:30 pm, Ryan <[EMAIL PROTECTED]> wrote:
>>>
> I am trying to create my first shell script. The shell script is  
> in /
> vendors and when I run, I get this:
>>>
> class CloudShell extends Shell {
>   var $uses = array('Item');
>   function main() {
> $this->out("test\n");
>   }
>>>
> }Error: Class CloudShell could not be loaded
>>>
> What am I missing? Thanks!
>>>
>>
>
> >


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



Re: Encryption/Decryption of data

2008-10-07 Thread David C. Zentgraf

I'm very interested in this topic.

I have an application that by it's nature shares "objects" between  
multiple participants, each object having different participants.  
Since those objects contain sensitive data, I was looking into ways to  
encrypt those, so that not even the database admin could see the  
content.

With "traditional" encryption schemes this is very difficult to  
realize though, as there's always only one key that can decrypt the  
data (would be pointless otherwise). That means for every object a  
user is participating in you'd need to store an additional key with  
the user's data, which is pointless.

I haven't yet, in my limited research, found a meaningful way to  
encrypt data in a way that allows it to be decrypted with any one of  
multiple keys (i.e. the user's password). But I'm no cryptographer by  
any means. Are public/private keys a way to do this?

Chrs,
Dav

On 8 Oct 2008, at 12:37, titang wrote:

>
> It sounds good, but what about if the data must be accessible by many
> users.
> For example I want to let 2 users to access the same datas with their
> own passphrase...
>
> Is there a simple way to do that ?
>
> Titang
>
> On Oct 8, 11:03 am, Joel Perras <[EMAIL PROTECTED]> wrote:
>> Simple solution: Generate a pseudo-random string of characters (or  
>> let
>> him choose his own passphrase), and use this as a salt to encrypt  
>> your
>> data before saving to your database. The passphrase must then be used
>> to retrieve any information from the database.
>>
>> Of course, all of this is completely useless if you don't use SSL for
>> the entire request/response process.
>>
>> -J.
>>
>> On Oct 7, 3:50 am, titang <[EMAIL PROTECTED]> wrote:
>>
>>> Hi,
>>> I would like to encrypt/decrypt data in my application regarding the
>>> following requirements:
>>> - The data will be decrypted by many users.
>>> - I dont want to keep the secret password for decrypting the data of
>>> each users in my application.
>>
>>> Does someone have any idea about how can I do this ? And if there is
>>> something already implemented for the cakephp framework?
>>
>>> There is something pretty good, it is the gnupg 
>>> project.http://www.gnupg.org/
>>> I did my first test by command line on Linux, and it seems really
>>> good.
>>> 1. First i have to generate one public key per users (from an uid  
>>> and
>>> a passphrase).
>>> 2. Then i encrypt  the data and specify which users can access the
>>> data (by specifying the uid).
>>> 3. And the authorized users can decrypt the data with their own
>>> passphrase
>>
>>> An extension gnupg is available for php.
>>> What about a cakephp behavior using this extension? I think it could
>>> be very useful.
>>
>>> Any suggestions or helps are welcome !
>>
>>> Thanks
> >


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



Re: Is there ANY way to insert page-specific code in to $scripts_for_layout??

2008-10-07 Thread David C. Zentgraf

I'm using the HeadHelper to do exactly what you want to do.
http://rossoft.wordpress.com/2006/03/28/register-head-tags-from-helpers-2/

On 8 Oct 2008, at 11:16, BrendonKoz wrote:

>
> Ah, teknoid...  I've seen that solution before, albeit with different
> variable names, but that would be the exact solution I was looking
> for.  Thanks.
>
> The reason I don't want to create separate CSS files (usually the best
> solution) is two-fold.
> 1. I can't think of a way to apply IE conditional styling with Cake's
> built in $html->css() method unless I create a layout specifically for
> this purpose - but without the additional variable in the layout that
> you suggested, I probably wouldn't have figured out how to do that
> properly anyway.
> 2. I'd rather not have multiple stylesheets specific to a single web
> address on the server - that can add up rather quickly.  I foresee
> administration wanting other forms recreated on the web, and with just
> 30 forms, that approximately 90 CSS files unrelated to core CSS styles
> for regular layout.
>
> I've used the default.ctp layout supplied by Cake's core so often to
> recreate functionality, I completely forgot I could add my own
> variables to it, and that they would be accessible from my views.
> Thanks again.
>
>
> On Oct 7, 7:02 pm, teknoid <[EMAIL PROTECTED]> wrote:
>> To me it seems that you've shut down the best option (creating a
>> separate CSS file)... why not create one?
>>
>> On the other hand you could try something like that in the layout:
>> if(isset($additional_css)) { echo $additional_css; }
>>
>> in the view:
>> $this->set('additional_css', ' //your css code ');
>>
>> On Oct 7, 5:48 pm, BrendonKoz <[EMAIL PROTECTED]> wrote:
>>
>>
>>
>>> I have some page-specific code (CSS in this case) that I would  
>>> like to
>>> use on a form.  This code will *not* be used anywhere else in my
>>> application, and if replicated, only portions of it will be.  I'd
>>> rather not have to create separate CSS files to use this.  I  
>>> looked at
>>> $html->css() and $html->style() without success.  Is there another
>>> method to input *whatever* code I'd like directly in to
>>> $scripts_for_layout?
>>
>>> The specific code I need to insert can be found at the following
>>> pastebin address:http://pastebin.com/m28c87fd2
>>
>>> I do plan on reusing the layout I created for this, for other forms,
>>> but the CSS is specific to this individual form (a recreation of a
>>> paper form, and must retain the same look for legal reasons).
>>
>>> Although I could use $html->css for two of the three CSS sections  
>>> (I'd
>>> prefer not to however), that specific class method is not made to
>>> handle IE conditional CSS statements for insertion.  Has anyone come
>>> up with any solutions to this in their own projects, or have any  
>>> ideas
>>> on a possible solution?
>>
>>> Note: The linked CSS file has not yet been converted for use within
>>> Cake, but that's not the issue here.- Hide quoted text -
>>
>> - Show quoted text -
> >


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



Re: Cake php Controller Structure

2008-10-07 Thread David C. Zentgraf

Think of the controllers/actions as pages on your website.
If it makes sense to do everything on one page (i.e. in one action)  
than do that.
Just because models and controllers of the same name are automatically  
linked doesn't mean you shouldn't or can't use other models as well.

On 8 Oct 2008, at 05:53, Ahmed wrote:

>
> I am trying to make an action that involves using several models for
> example:
>
> There is a ticket and an order.
> I want to create a controller that creates a ticket then it creates an
> order for that ticket.
>
> Should i create a new controller for this action or should the action
> be included in the tickets_controller.php file  or the
> orders_controller.php
>
> What is the conventional way to creating custom controller actions
> that do tasks that involve several models.
>
> >


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



Re: How do you make line breaks appear in views?

2008-10-07 Thread David C. Zentgraf

http://jp2.php.net/nl2br

Or use  or CSS white-space: pre.

On 8 Oct 2008, at 08:33, Cody Sortore wrote:

>
> Okay, I know I sound like a complete n00b right now, and that's fine
> because I am.  I've really only made applications for myself so far so
> putting in  tags is no problem... but now that I'm trying to
> make something for other people to use how to I make it so that when
> they hit "enter" it will automatically put in a  tag for me?
> >


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



Re: $this->pageTitle not showing Japanese characters

2008-10-06 Thread David C. Zentgraf

On 6 Oct 2008, at 17:47, grigri wrote:

> Make sure that your charset meta-tag is BEFORE the title tag. In an
> older version of cake, the default layout had the reverse (title
> first) which meant that it wasn't parsed as UTF-8.

This shouldn't be the case.
An HTML document is not evaluated by the browser line-by-line in the  
same way PHP is. At least no modern browser should do that (do I need  
to look in your direction IE?). A quick test on OS X Safari confirms  
that it makes no difference where the UTF8 tag is, only that it needs  
to be somewhere in the header.

If it does make a difference in other browsers, please let me know  
(honest request).

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



Re: $this->pageTitle not showing Japanese characters

2008-10-06 Thread David C. Zentgraf

$this->pageTitle isn't any different in my experience.
Have you checked that the .php file (your controller) is certainly  
saved as UTF8? That depends on your text editor...

On 6 Oct 2008, at 16:03, exo_duz wrote:

>
> Sorry forgot to add:
>
> All other information is also set to UTF-8 such as the App.Encoding in
> core.php and also the database is set to UTF-8 in database.php.
>
> I am using i18n and all text from the .po files are correct, it is
> only when I try to pass the $this->pageTitle that the encoding do not
> seem to work.
>
> On Oct 6, 4:00 pm, exo_duz <[EMAIL PROTECTED]> wrote:
>> Hi David,
>>
>> All pages contain:
>>
>> charset('UTF-8'); ?>
>>
>>
>> in the default layour (default.ctp).
>>
>> On Oct 6, 3:22 pm, "David C. Zentgraf" <[EMAIL PROTECTED]> wrote:
>>
>>> That's simply an encoding problem.
>>> Is your .php file saved in UTF8?
>>> Are there UTF8 meta tags in the page header?
>>
>>> Also see very recent 
>>> discussion:http://groups.google.com/group/cake-php/msg/8f40e1bd40182e11?hl=en
>>
>>> On 6 Oct 2008, at 15:15, exo_duz wrote:
>>
>>>> Hi all,
>>
>>>> Is there a different way to do page titles when using multiple
>>>> languages?
>>
>>>> I have done in the controller:
>>
>>>> CODE
>>>> //read the language and redirect as needed
>>>> $lang = Configure::read('Config.langCode');
>>
>>>> //en or jp
>>>> if ($lang == 'en')
>>>> {
>>>> $this->pageTitle = "Welcome";
>>>> }
>>>> else
>>>> {
>>>> $this->pageTitle = "ようこそ";
>>>> }
>>
>>>> English is fine but when I try to do Japanese characters the only
>>>> things that come up is 悤
>>
>>>> Anyone know why this is happening?
>>
>>>> Is there a better way to do this?
>>
>>>> As the pages changes with each page and further down the line I  
>>>> want
>>>> to add the database output to the title as well, what would be the
>>>> best way to achieve this?
>>
>>>> Thanks in advance.
> >


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



Re: $this->pageTitle not showing Japanese characters

2008-10-05 Thread David C. Zentgraf

That's simply an encoding problem.
Is your .php file saved in UTF8?
Are there UTF8 meta tags in the page header?

Also see very recent discussion:
http://groups.google.com/group/cake-php/msg/8f40e1bd40182e11?hl=en

On 6 Oct 2008, at 15:15, exo_duz wrote:

>
> Hi all,
>
> Is there a different way to do page titles when using multiple
> languages?
>
> I have done in the controller:
>
> CODE
> //read the language and redirect as needed
> $lang = Configure::read('Config.langCode');
>
> //en or jp
> if ($lang == 'en')
> {
>  $this->pageTitle = "Welcome";
> }
> else
> {
>  $this->pageTitle = "ようこそ";
> }
>
>
> English is fine but when I try to do Japanese characters the only
> things that come up is �悤
>
> Anyone know why this is happening?
>
> Is there a better way to do this?
>
> As the pages changes with each page and further down the line I want
> to add the database output to the title as well, what would be the
> best way to achieve this?
>
> Thanks in advance.
> >


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



Re: css parsing stripping background-image tags from css

2008-10-05 Thread David C. Zentgraf

Are you using CSS compression? If so, if the CSS syntax is invalid  
Cake might strip it out accidentally when removing comments etc.

And the usual:

Check caching. Maybe Cake or your webserver is just serving an old copy.

Make sure you are looking at the same two files (editing A while  
actually B is included).


On 6 Oct 2008, at 00:33, paulinthought wrote:

>
> Hi,
>
> I've been playing with cakephp for a litle bit and its taken me a
> while to figure this out.  cake seems to be stripping out tags from my
> css files. My mod_rewrite is working and my paths are correct.  I'm
> running on winxp and assumed it was some kind of permissions problem.
> I've been stumped with this for 2 days and I've just thought to look
> at cakes output in firebug which is showing my css file without
> (*some) of the background-image tags.  Thats the strange thing because
> the last couple are still in there.  My css styles have been
> reshuffled into alphabetic order and some removed.  Is there some kind
> of css parser in cake I can check or alter.
> I'm relatively new to cake but not a complete.  Any help or advice
> would be appreciated.
>
> Thanks,
>
> P
>
> >


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



Re: $this->

2008-10-05 Thread David C. Zentgraf

The very basics in simple language:

An object is grouping variables and functions together.

class MyObject {
var $myObjectVariable = 12;

function myObjectFunction() {
// does something
}
}

You can move a bunch of functions and variables around in one package  
without worrying about naming conflicts with other variables or  
function names, and can reliably access those variables inside the  
object since they're guaranteed to be packaged together.

$obj = new MyObject();

Now $obj has all the stuff I declared above in "class MyObject". To  
access all that stuff, you use ->.

$obj->myObjectVariable; // = 12
$obj->myObjectFunction();   // does something

The question that remains is, how do you access $obj->myObjectVariable  
from within the object itself (i.e. from the line "// does something"  
above)? The answer: $this.

class MyObject {
var $myObjectVariable = 12;

function myObjectFunction() {
$this->myObjectVariable;// refers to 12 above
}
}

Just felt like posting that here... ;)


On 6 Oct 2008, at 12:19, mattocrocop wrote:

>
> Cool.  Thanks guys!  My problem with searching for the answers was
> really that I didn't know what I was looking for.  I wasn't sure
> whether it was a feature of basic PHP, OOP, or CakePHP.  I guess that
> the last time I looked at PHP in any detail was probably prior to PHP
> 5.
>
> Once again, thanks to everyone for your support.
>
> On Oct 5, 11:06 pm, Dave Porter <[EMAIL PROTECTED]> wrote:
>> I too have battled with this, so went hunting
>>
>> I found this explanation that I think is fairly clear!
>>
  $this explanation
>>
>> The $this pseudo-variable provides a mechanism for objects to refer  
>> to
>> their own properties and methods. Outside of an object, there is a
>> handle you can use to access its elements.
>> Inside an object, there is no such handle, so you must fall back on
>> $this. If you find $this confusing, try replacing it in your mind  
>> with
>> the current instance when you encounter it in code.
>>   End
>>
  -> explanation
>>
>> You can access public object properties using the object operator '- 
>> >'. So $en->type means the $type property of the Dictionary object
>>
>> referenced by $en. If you can access a property, it means that you  
>> can
>> set and get its value.
>> < End
>>
>> HTH - Dave Porter
>>
>> On Oct 6, 9:29 am, "Gonzalo Servat" <[EMAIL PROTECTED]> wrote:
>>
>>> On Sun, Oct 5, 2008 at 10:38 PM, mattocrocop  
>>> <[EMAIL PROTECTED]> wrote:
>>
 Thanks to all the guys who offered help.  I found this great video
 series for beginners to OOP.
>>
 http://www.killerphp.com/tutorials/object-oriented-php/index.php
>>
 The last minute or so of Build Objects in PHP - Part I and the  
 bulk of
 Part II offer a decent enough description of the meaning of  
 "$this",
 and the of "->".
>>
>>> Thanks Matt for writing back. I'm sure beginners to OOP will  
>>> appreciate the
>>> link.
>>
>>> - Gonzalo
> >


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



Re: dealing with curly quotes

2008-10-05 Thread David C. Zentgraf

class DATABASE_CONFIG {
var $default = array(
'driver' => 'mysql',
...
'encoding' => 'utf8'
);
}

I forget to put that in on a regular basis and it always costs my a  
few minutes of debugging. ;-)
Not sure why it's not in the default template.

On 6 Oct 2008, at 10:24, Ryan wrote:

>
> Hey Adam, thanks. Here's how I'm setup:
>
> core.php
> Configure::write('App.encoding', 'UTF-8')
>
> database.php
> (I don't see a place to specify UTF-8)
>
> MySQL
> utf8_general_ci
>
> default.ctp (head section)
> charset('UTF-8') ?>
>
> Am I missing anything?
>
> When you say to make sure all of my code is utf8 compliant (eg string
> conversions), what do you mean? Can you be more specific?
>
> I think users of my site are entering curly quotes, which are saved to
> the db, then come out as garbage when displayed in HTML.
>
> -Ryan
>
>
> On Sep 30, 9:05 pm, Adam Royle <[EMAIL PROTECTED]> wrote:
>> If your database is correctly setup as utf8, cakephp db settings as
>> utf8 and your html is output as utf8, and make sure all of your code
>> is utf8 compliant (eg string conversion, etc) then you shouldn't have
>> any issues. Unless you just don't like the look of curly quotes?
>>
>> Cheers,
>> Adam
>>
>> On Oct 1, 8:39 am, Ryan <[EMAIL PROTECTED]> wrote:
>>
>>> I'm using a UTF-8 character set and the curly single and double  
>>> quotes
>>> are causing some problems with my app. I have a couple of questions
>>> regarding the best way to deal with (eliminate) them:
>>
>>> Allow the curly quotes to go into the database, but convert them to
>>> straight quotes before display? Or convert them into straight quotes
>>> before going into the database?
>>
>>> And beyond that fundamental issue, what is the best way to convert
>>> from curly to straight? I've dealt with similar issues in some of my
>>> non-Cake PHP applications and am wondering if Cake has any built-in
>>> functionality for dealing.
>>
>>> Thanks!
> >


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



Re: how to display a different field name from the database in the model

2008-10-04 Thread David C. Zentgraf

You should really look into changing the variable name in the code.  
With search&replace this may be the best option.

Otherwise, you could do that in the model with the afterFind callback.
Just copy the field:
$model['name'] = $model['name_en_gb'];

But you're setting yourself up for all kinds of problems with this, as  
you'll have to convert back and forth between the database and  
application.

On 5 Oct 2008, at 15:36, robert123 wrote:

>
> hi,
>
> Thank you, I have a cakephp application, the product model has the
> 'name' field, and all the codes, that is the controller, view, call
> that field as 'name'.
>
> but right now the product table in the database which has the field
> 'name' has been changed to 'name_en_gb', I am wondering, is there any
> small change in the model I can do such that it will read the
> 'name_en_gb' field in the product table in the database, but at the
> code level, the view, controller, etc can access it using the 'name'
> field.
>
> Thank you
>
> On Oct 5, 2:21 pm, "David C. Zentgraf" <[EMAIL PROTECTED]> wrote:
>> If you mean "display to the user" I don't see where the problem is.
>> If you're talking about scaffolding, just make a proper view.
>> If you mean "change internally" it's more hassle than it's worth  
>> IMHO.
>>
>> Can you clarify a bit what you want to do and where you're stuck?
>>
>> On 5 Oct 2008, at 10:32, robert123 wrote:
>>
>>
>>
>>> hi
>>
>>> in my database there is a field
>>
>>> which is name_en_gb
>>
>>> in my model
>>
>>> i wanted it to read the field, but display it as the field
>>
>>> name
>>
>>> can anyone let me know how to do it, thank you
> >


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



Re: how to display a different field name from the database in the model

2008-10-04 Thread David C. Zentgraf

If you mean "display to the user" I don't see where the problem is.
If you're talking about scaffolding, just make a proper view.
If you mean "change internally" it's more hassle than it's worth IMHO.

Can you clarify a bit what you want to do and where you're stuck?

On 5 Oct 2008, at 10:32, robert123 wrote:

>
> hi
>
> in my database there is a field
>
> which is name_en_gb
>
> in my model
>
> i wanted it to read the field, but display it as the field
>
> name
>
>
> can anyone let me know how to do it, thank you
>
>
>
> >


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



Re: How to recode MySQL Boolean field to yes/no in a view

2008-10-03 Thread David C. Zentgraf

Over-engineer much? ;-)

echo $model['boolField'] ? 'Yes' : 'No';

On 3 Oct 2008, at 17:08, Kanten wrote:

>
> Hi,
>
> I have a MySQL table with lots of boolean fields (BOOL) and when
> viewing these in my view I would like to output "Yes" or "No" instead
> of "1" or "0".
>
> I have experimented a bit with doing stuff like this in my controller:
>
>   foreach (array_keys($data['BrugadaProfile']) as $key):
>   if ($data['BrugadaProfile'][$key] == 1 && ! 
> strpbrk($key, 'id'))
> { //Avoid recoding foreign key fields
>   $data['BrugadaProfile'][$key] = 'Yes';
>   } elseif ($data['BrugadaProfile'][$key] == 0 && ! 
> strpbrk($key,
> 'id')) {
>   $data['BrugadaProfile'][$key] = 'No';
>   }
>   endforeach;
>
> But this approach is obviously very error prone and I think the best
> way to go about it, is to somehow access the field type to check if
> its a boolean field and then recode it.
> How can this be done?
>
> /Anders
> >


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



Re: AJAX: is it possible to update the src parameter of an image directly?

2008-10-02 Thread David C. Zentgraf

Sorry, try request.responseText.
And put it in the Book if it worked. :-)

On 3 Oct 2008, at 02:44, qwanta wrote:

>
>
>
> On Oct 1, 11:59 pm, "David C. Zentgraf" <[EMAIL PROTECTED]> wrote:
>> 'callback' doesn't exist, the only names of callbacks you can use are
>> listed on the page in my last message. :-)
> Oooops, it was getting late
>
>> Other than that, you pretty much got it. I always forget what the
>> variable name is called, but I think in your callback function you'll
>> have access to whatever the controller returns in the variable
>> 'response.responseText'.
>>
> Well, I'm halfway there. I can set the image src from the javascript,
> but I can't seem to figure out how to get access to the text returned
> from the controller - "response.responseText" doesn't seem to be it.
> Is it documented anywhere? I'm drawing a blank with google.
> In my original non-cakephp javascript, I was getting the text response
> from the XMLHttpRequest object (ie. xmlHttp.responseXML; ). This
> object doesn't seem available in the callback either (unless it's
> called something else).
>
> mikeg - thanks for the tip, but I think it's close to working with the
> "official" cakephp prototype solution. I don't want to delve into
> jquery if I don't have to.
> >


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



Re: AJAX: is it possible to update the src parameter of an image directly?

2008-10-01 Thread David C. Zentgraf

'callback' doesn't exist, the only names of callbacks you can use are  
listed on the page in my last message. :-)
Other than that, you pretty much got it. I always forget what the  
variable name is called, but I think in your callback function you'll  
have access to whatever the controller returns in the variable  
'response.responseText'.

On 2 Oct 2008, at 12:52, qwanta wrote:

>
> OK, thanks. That's exactly what I am looking for. I already have the
> javascript I need from my php/javascript code. If I understand this
> correctly, I just have to send the generated image name back using
> echo statements in the controller (maybe wrapping it in xml format),
> then trigger my 3 js statements to read the name and update the src
> parameter with it.
>
> I'll be investigating this in more detail, but one quick thing I have
> run into right away:
> I added some alert statements to my ajax link:
> ===
> array('callback'=>'alert("callback")',
>   'complete' => 'alert( "Executed OK" )',
>   'loading'=> 'alert("Loading")',
>   'loaded'=> 'alert("Loaded")')
> ===
> Loading, loaded & complete all fire the alert window OK. But I don't
> get the callback one. Is there anything special to be set up? Thanks.
>
>
> On Oct 1, 10:23 pm, "David C. Zentgraf" <[EMAIL PROTECTED]> wrote:
>> I guess the AJAX helper doesn't have this ability built-in, but you
>> could simply write your own JS for the 'complete' 
>> callback.http://book.cakephp.org/view/211/Callback-Options
>>
>> On 2 Oct 2008, at 12:12, qwanta wrote:
>>
>>
>>
>>> Using pure php/javascript without cakephp, I am able to use the
>>> javascript function
>>> ===
>>> document.getElementById("pic").src = imageName;
>>> ===
>>> to update an image (when a button on the web page is clicked). this
>>> results in very smooth image updates.
>>
>>> In CakePHP, I have been able to update the image from an ajax link  
>>> by
>>> updating the  containing the image. ie. by generating the full
>>>  tag in the controller to replace the text in the .
>>> Something like this:
>>> ===
>>> echo "";
>>> ===
>>
>>> Both methods work OK, but the cakephp  update results in a
>>> flicker as the div size briefly goes to zero, before it displays the
>>> image (anything below the image moves up briefly to cover the area
>>> where the image was, then moves back down again when the image is
>>> loaded and displayed). I would like to get the smooth image  
>>> updates of
>>> the javascript function in CakePHP by directly injecting the new  
>>> image
>>> name into the src parameter of the  tag. Is this possible?
>>
>>> Just to give some more background, I am using jpgraph to generate  
>>> line
>>> plots based on changing data, with time on the x-axis. Each new  
>>> graph
>>> is an image with a randomly generated filename that I pass back to  
>>> the
>>> client.
> >


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



Re: AJAX: is it possible to update the src parameter of an image directly?

2008-10-01 Thread David C. Zentgraf

I guess the AJAX helper doesn't have this ability built-in, but you  
could simply write your own JS for the 'complete' callback.
http://book.cakephp.org/view/211/Callback-Options

On 2 Oct 2008, at 12:12, qwanta wrote:

>
> Using pure php/javascript without cakephp, I am able to use the
> javascript function
> ===
> document.getElementById("pic").src = imageName;
> ===
> to update an image (when a button on the web page is clicked). this
> results in very smooth image updates.
>
> In CakePHP, I have been able to update the image from an ajax link by
> updating the  containing the image. ie. by generating the full
>  tag in the controller to replace the text in the .
> Something like this:
> ===
> echo "";
> ===
>
> Both methods work OK, but the cakephp  update results in a
> flicker as the div size briefly goes to zero, before it displays the
> image (anything below the image moves up briefly to cover the area
> where the image was, then moves back down again when the image is
> loaded and displayed). I would like to get the smooth image updates of
> the javascript function in CakePHP by directly injecting the new image
> name into the src parameter of the  tag. Is this possible?
>
>
> Just to give some more background, I am using jpgraph to generate line
> plots based on changing data, with time on the x-axis. Each new graph
> is an image with a randomly generated filename that I pass back to the
> client.
>
> >


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



Re: Best way to localize URL

2008-10-01 Thread David C. Zentgraf

You could use Routes to connect URLs to a controller by an alternate  
name:
Router::connect('/マイアップ/外国語/何々', array('controller'  
=> 'actualController', 'action' => ...));
But that can be become quite a hassle if you have many controllers and  
actions.

Any variables in the URL you could store in two languages:
/myapp/controller/view/english-name-of-post
/myapp/controller/view/日本語バーション
Which means you have two fields in your model: 'id_english' and  
'id_otherlang'.

Constructing URLs is more of a hazzle, you may want to write your own  
helper for that.
Ultimately I see little benefit in localizing URLs for most apps. If  
you're working on something like last.fm, localized variables/ids are  
worth it I guess (i.e. http://www.last.fm/music/М. 
+Баярмагнай).

On 2 Oct 2008, at 05:16, lemp wrote:

>
> What would be the best way to localize URL?
>
> I know I can use gettext function on URL, like in:
> $html->link(__('Logout', true), __('/users/logout', true));
>
> But it seems a bit cumbersome.
> >


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



Re: 'schema generate' and different connections (was: help with YAML pls basic syntax...etc)

2008-10-01 Thread David C. Zentgraf

Hi Mark,

Schema seems to want to schemify all models using the same connection,  
the one it automatically defaults to or the one that was specified,  
ignoring the $useDbConfig setting in the model itself. Opened a ticket  
for it: https://trac.cakephp.org/ticket/5502

Chrs,
Dav

On 30 Sep 2008, at 23:22, mark_story wrote:

>
> David,
>
> So you have different models using different connections, and when
> specifying a -connection
> the shell is attempting to schem-ify models not using that connection?
>
> If that is the case please open a ticket, with some examples on how to
> reproduce it.
>
> -Mark
>
> On Sep 30, 1:53 am, "David C. Zentgraf" <[EMAIL PROTECTED]> wrote:
>> Speaking of which...
>>
>> I have multiple connections in my database.conf. Running a 'cake
>> schema generate' always quits with "Error: Missing database table 'x'
>> for model 'y'". Even doing 'schema -connection alt -name Model
>> generate' quits with the same message. Depending on which '-
>> connection' I specify it quits on different models, so it seems it
>> always tries to generate schemas for all models, ignoring my flags.
>>
>> Am I misusing the schema shell or should I open a ticket?
>>
>> Chrs,
>> Dav
>>
>> On 30 Sep 2008, at 05:03, mark_story wrote:
>>
>>> In 1.2 there is a builtin Schema shell (console app) that can manage
>>> things like ALTER statements that need to be run on a db between  
>>> runs.
>>> To my knowledge it doesn't insert records.  From a prompt cd into
>>> cake/
>>> console and try cake schema help.  That will give you a list of
>>> commands supported by the SchemaShell.
>>
>>> -Mark
> >


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



Re: 'Undefined index' problem on production server

2008-09-30 Thread David C. Zentgraf

No, I mean the PHP error reporting in your php.ini.
http://jp2.php.net/manual/en/configuration.php
http://jp2.php.net/manual/en/errorfunc.configuration.php#ini.display-errors

The error is coming from PHP, not Cake.
You should switch error reporting on on your development system and  
off on your production system. If the error reporting is on on your  
development system and it's not giving you any errors (i.e. no  
programming mistakes) it'll be something that's set up differently on  
your production machine.

On 30 Sep 2008, at 18:48, Pieter Van Leuven wrote:

>
> Hello David,
>
> thanks for the tips. Both are currently running in debuglevel 2 mode.
> That's why I think it's so strange.
>
> Can someone give me some tips about what could be wrong with the
> database? The application can reach the database, because some data is
> fetched correctly...
>
> Thanks in advance,
> Pieter Van Leuven
>
> On 30 sep, 07:37, "David C. Zentgraf" <[EMAIL PROTECTED]> wrote:
>> Stabs into the dark:
>>
>> a) your local PHP has a lower debug level than your production  
>> server,
>> i.e. your local system doesn't complain about missing indexes but  
>> your
>> server does
>> b) the associated model can't be fetched because your database setup
>> is different/misconfigured
>>
>> Hope that helps,
>> Dav
>>
>> On 30 Sep 2008, at 06:26, Pieter Van Leuven wrote:
>>
>>
>>
>>> Hello people,
>>
>>> I have a strange problem i ran into with CakePHP. On my local  
>>> machine
>>> all works fine. When I upload the complete project to my webhost,  
>>> the
>>> problems begin.
>>
>>> For example: when I query posts from the database. All fields of  
>>> this
>>> posts are shown fine (for example $post['Post']['title'], but all
>>> relative data like for example the username ($post['User']
>>> ['username']) gives an error similar to 'Notice (8): Undefined
>>> index:'. Someone an idea what the problem could be?
>>
>>> Could this be a know problem? I tried to search, but it is difficult
>>> with that less information.
>>
>>> Some things I already thought of:
>>> - Version difference of apache/mysql from my local machine/webhost
>>> server
>>> - windows newlines on my local machine versus webhost server (not
>>> tested yet)
>>
>>> Local server:
>>> - Apache/2.2.9 (Win32)
>>> - mysql/5.0.51b with phpMyAdmin/5.0.51b
>>> - vista
>>
>>> Webhost server:
>>> - Apache/2.2.3
>>> - mysql/5.0.32-Debian_7etch6-log with phpMyAdmin/5.0.32
>>> - debian
>>
>>> Already thanks for reading this folks!
>>
>>> Kind regards,
>>> Pieter Van Leuven
> >


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



Re: 'schema generate' and different connections (was: help with YAML pls basic syntax...etc)

2008-09-29 Thread David C. Zentgraf

Speaking of which...

I have multiple connections in my database.conf. Running a 'cake  
schema generate' always quits with "Error: Missing database table 'x'  
for model 'y'". Even doing 'schema -connection alt -name Model  
generate' quits with the same message. Depending on which '- 
connection' I specify it quits on different models, so it seems it  
always tries to generate schemas for all models, ignoring my flags.

Am I misusing the schema shell or should I open a ticket?

Chrs,
Dav


On 30 Sep 2008, at 05:03, mark_story wrote:

> In 1.2 there is a builtin Schema shell (console app) that can manage
> things like ALTER statements that need to be run on a db between runs.
> To my knowledge it doesn't insert records.  From a prompt cd into  
> cake/
> console and try cake schema help.  That will give you a list of
> commands supported by the SchemaShell.
>
> -Mark


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



Re: 'Undefined index' problem on production server

2008-09-29 Thread David C. Zentgraf

Stabs into the dark:

a) your local PHP has a lower debug level than your production server,  
i.e. your local system doesn't complain about missing indexes but your  
server does
b) the associated model can't be fetched because your database setup  
is different/misconfigured

Hope that helps,
Dav

On 30 Sep 2008, at 06:26, Pieter Van Leuven wrote:

>
> Hello people,
>
> I have a strange problem i ran into with CakePHP. On my local machine
> all works fine. When I upload the complete project to my webhost, the
> problems begin.
>
> For example: when I query posts from the database. All fields of this
> posts are shown fine (for example $post['Post']['title'], but all
> relative data like for example the username ($post['User']
> ['username']) gives an error similar to 'Notice (8): Undefined
> index:'. Someone an idea what the problem could be?
>
> Could this be a know problem? I tried to search, but it is difficult
> with that less information.
>
> Some things I already thought of:
> - Version difference of apache/mysql from my local machine/webhost
> server
> - windows newlines on my local machine versus webhost server (not
> tested yet)
>
> Local server:
> - Apache/2.2.9 (Win32)
> - mysql/5.0.51b with phpMyAdmin/5.0.51b
> - vista
>
> Webhost server:
> - Apache/2.2.3
> - mysql/5.0.32-Debian_7etch6-log with phpMyAdmin/5.0.32
> - debian
>
> Already thanks for reading this folks!
>
> Kind regards,
> Pieter Van Leuven
>
> >


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



Re: Does anyone know why naming your controller actions 'new' or 'list' causes an error?

2008-09-22 Thread David C. Zentgraf

It's not a Cake issue, it's a PHP thing. "new" is a reserved word for  
PHP and list() happens to be a language construct that looks like a  
function, hence it's out too.

http://jp.php.net/manual/en/reserved.php
http://jp.php.net/list

On 22 Sep 2008, at 16:59, trustfundbaby wrote:

>
> I'm using cakephp 1.2 and naming any of my controller actions 'new' or
> 'list'
> throws  this error
>
> Parse error: parse error, expecting `T_STRING' in {file_path} on line
> {line_number}
>
> I'm just curious why that is?
> >


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



Re: Generate List with SQL calculated Fields

2008-09-21 Thread David C. Zentgraf

Play around with the Set::combine() or Set::extract() methods to get  
the array into the right shape.
http://api.cakephp.org/class_set.html#80506e373d04c93eb4dc1582d8e5c09c

On 22 Sep 2008, at 06:26, ORCC wrote:

>
> Usually I create lists for using with $form->select(), vía
> find('list') method. For instance, in the controller method
>
> $l = $this->ProductCategory->find('list');
>
> Another way to create the list is by using a plain query:
>
> $l = $this->ProductCategory->query('SELECT `id`, `name` FROM
> product_categories ORDER by `name` ASC');
>
>
> The problem is that select is not correctly rendered when I need a SQL
> calculated field. My trouble is the following:
>
> The table "product_categories" has a field called "sex" with type
> VARCHAR(1) and whose values are 'M' or 'F'.  I need that in my select,
> the list items apear of the following manner:
>
> Pants(WOMEN)
> Shirts (WOMEN)
> Pants (MEN)
> Shirts (MEN)
> ...
>
> I try to create the list with the following query:
>
> $query = "SELECT `id`, CONCAT(`name`,IF(`sex`= 'M','(MEN)','(WOMEN)'))
> AS `description` from `product_categories` ORDER BY `name` ASC, `sex`
> ASC;";
> $l = ProductCategory->query($query);
>
> But the calculated field appears wrapped into an array and the select
> list wouldn't create correctly.
>
> How to make a "raw query" in order to add SQL calculated fields?
>
>
>
>
>
>
> >


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



Re: correct syntax for an OR

2008-09-21 Thread David C. Zentgraf

http://book.cakephp.org/view/74/Complex-Find-Conditions

On 22 Sep 2008, at 09:32, . wrote:

> Hi
>
> How would I do an OR in the conditions, such as the following?  
> What's the
> correct syntax? Thanks
>
> $messages = $this->Message->find('all',
>   array('conditions'=>array('Email.email'=>$email1 OR
> 'Email.email'=>$email2)));
>
> >


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



Re: How to count associated records in a model?

2008-09-21 Thread David C. Zentgraf

You can skip the App::import step completely. Your models are already  
associated, so $this->Product is already accessible. In fact,  
App::import doesn't do anything, it works like require_once(), you  
would still have to manually instantiate the imported model class  
yourself (i.e. App::import will not create $this->Product for you,  
you'd have to do $this->Product = new Product() yourself).

Hence your solution is already not bad, isn't it? You could even do it  
from the controller anytime:
$this->Manufacturer->Product->find('count', ...);

On 22 Sep 2008, at 01:41, ORCC wrote:

>
> I have a Manufacturer model having many Products. In order to return
> the number of Products of a Manufacturer I wrote the following method
> in Manufacturer:
>
> function countProducts() {
>App::import('Model','Product');
>   $condition = Array('manufacturer_id' => $this->id)
>   return $this->Product->find('count',Array('conditions' =>
> $condition));
> }
>
> I would like to know if there is some way of getting the count of
> associated records without importing the associated model, but
> performing a recursive count.
>
>
> >


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



Re: HABTM find all

2008-09-20 Thread David C. Zentgraf

You can not search on conditions of a related model (generally, some  
tricking with bind() might do the trick).
But, you can search for a group ($this->MyGroup->find()), which will  
automatically get you all the related Users as well. You can further  
filter these users with the Containable behaviour.

On 21 Sep 2008, at 07:44, Mojo wrote:

>
> Hi,
> I have 2 classes MyUser and MyGroup.
> Both of them are tied by HABTM relationship.
>
> I want to make a find all query that will find all Users belonging to
> a certain group I don't know how to make this query. All I got are
> examples with queries on the same table.
>
> class MyUser extends AppModel {
> var $name = 'MyUser';
> var $hasAndBelongsToMany = array('MyGroup');
> }
>
> class MyGroup extends AppModel {
> var $name = 'MyGroup';
> var $hasAndBelongsToMany = array('MyUser');
> }
>
> MyGroup has a field called 'name' and I'd like to make a query about
> that.
> Something like :
>
> SELECT *.u, *.g from MyUsers u, MyGroups g, MyGroup_MyUser m WHERE
> g.name = 'TheNameImLookingFor' and g.id = m.MyGroup_id and m.MyUser_id
> = u.id
>
> I tried :
>
> $this->MyUser->recursive = 2;
>
> $this->MyUser->find('all', array('conditions' =>
>array( 'MyUser.MyGroup.name'=>
> 'TheNameImLookingFor'
> )));
>
> How can I do it better ?
> >


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



  1   2   >