Re: Cake 1.2 and JW FLV Media Player

2008-11-06 Thread Fran Iglesias

HI,

El 07/11/2008, a las 7:39, nightcrawler13 escribió:

> but after I followed then I got this error message "Fatal error: Class
> 'AppHelper' not found in C:\xampp\htdocs\stream\app\views\helpers
> \media_player.php on line 106"

You could add the file app_helper.php in

C:\xampp\htdocs\stream\app\

with this code



or simply change the snippet code fromm extends AppHelper to extends  
Helper...

I guess some builds of Cake 1.2 haven't cake/libs/view/helpers/ 
app_helper.php
--
Fran Iglesias
[EMAIL PROTECTED]





--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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
-~--~~~~--~~--~--~---



Cake 1.2 and JW FLV Media Player

2008-11-06 Thread nightcrawler13

Hello baker..

I just found this code
http://bin.cakephp.org/saved/38536

but after I followed then I got this error message "Fatal error: Class
'AppHelper' not found in C:\xampp\htdocs\stream\app\views\helpers
\media_player.php on line 106"

Model : video.php


Controller : videos_controller.php


View : index.ctp
show($media, $options = array());
echo $mediaPlayer->show('filename.mov');
echo $mediaPlayer->show('http://www.youtube.com/watch?
v=DvdfO0lq4rQ', array('options' => array('ratio' => '4: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
-~--~~~~--~~--~--~---



Custom Validation Method in Behaviour

2008-11-06 Thread si-mon

Hi all,

In my application, I have used the custom validation rule as:

'rule'=>array('checkRelatedItem','office_id','Office','Employee')

and I have defined the function checkRelatedItem in a behaviour:

function checkRelatedItem($data, $foreign_key=null,
$related_model=null, $model_name=null) {
echo $foreign_key;
echo $related_model;
echo $model_name;
}

But, the parameters of the function are not passing correctly.

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



access variable in controller

2008-11-06 Thread [EMAIL PROTECTED]

I have set variables in App Controller & I want to access that
variable in controller?
i do like that:
$this->set('feach',$this->products->read());
 pr($this->feach);
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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 get code coverage analysis working?

2008-11-06 Thread Dr. Tarique Sani

On Fri, Nov 7, 2008 at 11:43 AM, Daniel Hofstetter <[EMAIL PROTECTED]> wrote:
>
> Hi Brett,
>
>> Anyone get any further with this ? I'm running a LAMP ubuntu install
>> and get the same result either a blank screen or empty test.php.
>>
>> Phpinfo says the xdebug is installas far as I can tell.
>
> No, I had no luck so far...

Blank page usually means crashed process - any clue in the server
error logs or any core dumps?

BTW what is the memory allowed for PHP? Upping the memory had helped me...

Cheers
Tarique

-- 
=
Cheesecake-Photoblog: http://cheesecake-photoblog.org
PHP for E-Biz: http://sanisoft.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: How to get code coverage analysis working?

2008-11-06 Thread Daniel Hofstetter

Hi Brett,

> Anyone get any further with this ? I'm running a LAMP ubuntu install
> and get the same result either a blank screen or empty test.php.
>
> Phpinfo says the xdebug is installas far as I can tell.

No, I had no luck so far...

--
Daniel Hofstetter
http://cakebaker.42dh.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: How to get code coverage analysis working?

2008-11-06 Thread Brett Wilton

Anyone get any further with this ? I'm running a LAMP ubuntu install
and get the same result either a blank screen or empty test.php.

Phpinfo says the xdebug is installas far as I can tell.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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
-~--~~~~--~~--~--~---



i want lean authentication core components

2008-11-06 Thread Elavavazhagan Chidambaram
please,
 i don't no about  authentication core components so you help me with any
examples

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: Finds: Contain vs. Unbind-on-the-fly

2008-11-06 Thread Xavier Mathews

I am so confused. Run the query and check the arrays etc the code looks good.

On 11/06/2008, teknoid <[EMAIL PROTECTED]> wrote:
>
> That's very strange... why is it trying to select models with id=2?
> Doesn't seem like you pass any conditions to your find()...
> Are you sure there is nothing else going (maybe in model associations)
> or any other attached behaviors?
>
> On Nov 6, 6:34 pm, Brenton B <[EMAIL PROTECTED]> wrote:
>> Where there is only 1 level in the 'contain':
>>
>> SELECT `Photographer`.`id`, `Photographer`.`first_name`,
>> `Photographer`.`last_name`, `Photographer`.`company_name`,
>> `Photographer`.`email`, `Photographer`.`telephone`,
>> `Photographer`.`address_1`, `Photographer`.`address_2`,
>> `Photographer`.`country_id`, `Photographer`.`state_id`,
>> `Photographer`.`city`, `Photographer`.`zip_code`,  [[[... plus a bunch
>> of other fields ... ]]]  `Country`.`id`, `Country`.`name`,
>> `Country`.`created`, `Country`.`created_by`, `Country`.`modified`,
>> `Country`.`modified_by`, `State`.`id`, `State`.`name`,
>> `State`.`country_id`, `State`.`created`, `State`.`created_by`,
>> `State`.`modified`, `State`.`modified_by` FROM `photographers` AS
>> `Photographer` LEFT JOIN `countries` AS `Country` ON
>> (`Photographer`.`country_id` = `Country`.`id`) LEFT JOIN `states` AS
>> `State` ON (`Photographer`.`state_id` = `State`.`id`) WHERE
>> `Photographer`.`id` = 1 LIMIT 1
>>
>> SELECT `PrintSize`.`id`, `PrintSize`.`name`, `PrintSize`.`created`,
>> `PrintSize`.`created_by`, `PrintSize`.`modified`,
>> `PrintSize`.`modified_by`, `PhotographersPrintSize`.`id`,
>> `PhotographersPrintSize`.`photographer_id`,
>> `PhotographersPrintSize`.`print_size_id`,
>> `PhotographersPrintSize`.`price`, `PhotographersPrintSize`.`comment`,
>> `PhotographersPrintSize`.`created`,
>> `PhotographersPrintSize`.`created_by`,
>> `PhotographersPrintSize`.`modified`,
>> `PhotographersPrintSize`.`modified_by` FROM `print_sizes` AS
>> `PrintSize` JOIN `photographers_print_sizes` AS
>> `PhotographersPrintSize` ON
>> (`PhotographersPrintSize`.`photographer_id` = 1 AND
>> `PhotographersPrintSize`.`print_size_id` = `PrintSize`.`id`) WHERE 1 =
>> 1
>>
>> Then as soon as I add in the extra level in 'contain' I get the above,
>> plus these extras:
>>
>> SELECT `Country`.`id`, `Country`.`name`, `Country`.`created`,
>> `Country`.`created_by`, `Country`.`modified`, `Country`.`modified_by`
>> FROM `countries` AS `Country` WHERE `Country`.`id` = 2
>>
>> SELECT `State`.`id`, `State`.`name`, `State`.`country_id`,
>> `State`.`created`, `State`.`created_by`, `State`.`modified`,
>> `State`.`modified_by` FROM `states` AS `State` WHERE `State`.`id` = 2
>>
>> I'm hoping to have some time tonight to really dig through the
>> Containable behaviour code.
>>
>> On Nov 6, 3:03 pm, teknoid <[EMAIL PROTECTED]> wrote:
>>
>> > What are the "extra" queries, which get generated for Country and
>> > State, when you add other models?
>> > Could you provide an example?
>>
>> > On Nov 6, 5:41 pm, Brenton B <[EMAIL PROTECTED]> wrote:
>>
>> > > Photographer:
>> > > Photographer belongsTo Country
>> > > Photographer belongsTo State
>> > > Photographer HABTM PrintSize: with PhotographersPrintSize
>> > > (join table
>> > > has extra data)
>>
>> > > PrintSize:
>> > > PrintSize HABTM Photographer: with PhotographersPrintSize
>> > > (again,
>> > > join table with data)
>>
>> > > PhotographersPrintSize:
>> > > PhotographersPrintSize hasMany Photographer
>> > > PhotographersPrintSize hasMany PrintSize
>>
>> > > yes, all in same db.
>>
>> > > Also, forgot to mention, if I take off to recursive level (as below),
>> > > it does it fine without all the extra queries.
>>
>> > > $this->set('photographer',
>> > > $this->Photographer->find('first',
>> > >
>> > > array('contain' => array(
>> > >
>> > > 'Country',
>> > >
>> > > 'State',
>> > >
>> > > 'PrintSize';
>>
>> > > On Nov 6, 2:18 pm, teknoid <[EMAIL PROTECTED]> wrote:
>>
>> > > > what's the relation between all those models?
>> > > > and are they all in the same db?
>>
>> > > > On Nov 6, 5:12 pm, Brenton B <[EMAIL PROTECTED]> wrote:
>>
>> > > > > Aha!!!
>> > > > > I think I've come up with the reason ...
>>
>> > > > > As I was trying to produce a nice a short example I realized that
>> > > > > when
>> > > > > there's only 1 level it doesn't produce the extra queries ... as
>> > > > > soon
>> > > > > as there's more than 1 level it has the extra queries.
>>
>> > > > > So if I have:
>>
>> > > > > $this->set('photographer',
>> > > > > $this->Photographer->find('first',
>> > > > >
>> > > > > array('contain' => array(
>> > > > >
>> > > > > 'Country',
>> > > > >
>> > > > > 'State';
>>
>> > > > > Then there's no problem, but if I have
>>
>> > > > > $this->set('photographer',
>> > > > > $this->Photographer->find('first',
>> > > > >
>> > > > > array('contain' => array(

Re: Finds: Contain vs. Unbind-on-the-fly

2008-11-06 Thread teknoid

That's very strange... why is it trying to select models with id=2?
Doesn't seem like you pass any conditions to your find()...
Are you sure there is nothing else going (maybe in model associations)
or any other attached behaviors?

On Nov 6, 6:34 pm, Brenton B <[EMAIL PROTECTED]> wrote:
> Where there is only 1 level in the 'contain':
>
> SELECT `Photographer`.`id`, `Photographer`.`first_name`,
> `Photographer`.`last_name`, `Photographer`.`company_name`,
> `Photographer`.`email`, `Photographer`.`telephone`,
> `Photographer`.`address_1`, `Photographer`.`address_2`,
> `Photographer`.`country_id`, `Photographer`.`state_id`,
> `Photographer`.`city`, `Photographer`.`zip_code`,  [[[... plus a bunch
> of other fields ... ]]]  `Country`.`id`, `Country`.`name`,
> `Country`.`created`, `Country`.`created_by`, `Country`.`modified`,
> `Country`.`modified_by`, `State`.`id`, `State`.`name`,
> `State`.`country_id`, `State`.`created`, `State`.`created_by`,
> `State`.`modified`, `State`.`modified_by` FROM `photographers` AS
> `Photographer` LEFT JOIN `countries` AS `Country` ON
> (`Photographer`.`country_id` = `Country`.`id`) LEFT JOIN `states` AS
> `State` ON (`Photographer`.`state_id` = `State`.`id`) WHERE
> `Photographer`.`id` = 1 LIMIT 1
>
> SELECT `PrintSize`.`id`, `PrintSize`.`name`, `PrintSize`.`created`,
> `PrintSize`.`created_by`, `PrintSize`.`modified`,
> `PrintSize`.`modified_by`, `PhotographersPrintSize`.`id`,
> `PhotographersPrintSize`.`photographer_id`,
> `PhotographersPrintSize`.`print_size_id`,
> `PhotographersPrintSize`.`price`, `PhotographersPrintSize`.`comment`,
> `PhotographersPrintSize`.`created`,
> `PhotographersPrintSize`.`created_by`,
> `PhotographersPrintSize`.`modified`,
> `PhotographersPrintSize`.`modified_by` FROM `print_sizes` AS
> `PrintSize` JOIN `photographers_print_sizes` AS
> `PhotographersPrintSize` ON
> (`PhotographersPrintSize`.`photographer_id` = 1 AND
> `PhotographersPrintSize`.`print_size_id` = `PrintSize`.`id`) WHERE 1 =
> 1
>
> Then as soon as I add in the extra level in 'contain' I get the above,
> plus these extras:
>
> SELECT `Country`.`id`, `Country`.`name`, `Country`.`created`,
> `Country`.`created_by`, `Country`.`modified`, `Country`.`modified_by`
> FROM `countries` AS `Country` WHERE `Country`.`id` = 2
>
> SELECT `State`.`id`, `State`.`name`, `State`.`country_id`,
> `State`.`created`, `State`.`created_by`, `State`.`modified`,
> `State`.`modified_by` FROM `states` AS `State` WHERE `State`.`id` = 2
>
> I'm hoping to have some time tonight to really dig through the
> Containable behaviour code.
>
> On Nov 6, 3:03 pm, teknoid <[EMAIL PROTECTED]> wrote:
>
> > What are the "extra" queries, which get generated for Country and
> > State, when you add other models?
> > Could you provide an example?
>
> > On Nov 6, 5:41 pm, Brenton B <[EMAIL PROTECTED]> wrote:
>
> > > Photographer:
> > >         Photographer belongsTo Country
> > >         Photographer belongsTo State
> > >         Photographer HABTM PrintSize: with PhotographersPrintSize (join 
> > > table
> > > has extra data)
>
> > > PrintSize:
> > >         PrintSize HABTM Photographer: with PhotographersPrintSize (again,
> > > join table with data)
>
> > > PhotographersPrintSize:
> > >         PhotographersPrintSize hasMany Photographer
> > >         PhotographersPrintSize hasMany PrintSize
>
> > > yes, all in same db.
>
> > > Also, forgot to mention, if I take off to recursive level (as below),
> > > it does it fine without all the extra queries.
>
> > >         $this->set('photographer',
> > >                         $this->Photographer->find('first',
> > >                                                         array('contain' 
> > > => array(
> > >                                                                   
> > > 'Country',
> > >                                                                   'State',
> > >                                                                   
> > > 'PrintSize';
>
> > > On Nov 6, 2:18 pm, teknoid <[EMAIL PROTECTED]> wrote:
>
> > > > what's the relation between all those models?
> > > > and are they all in the same db?
>
> > > > On Nov 6, 5:12 pm, Brenton B <[EMAIL PROTECTED]> wrote:
>
> > > > > Aha!!!
> > > > > I think I've come up with the reason ...
>
> > > > > As I was trying to produce a nice a short example I realized that when
> > > > > there's only 1 level it doesn't produce the extra queries ... as soon
> > > > > as there's more than 1 level it has the extra queries.
>
> > > > > So if I have:
>
> > > > >         $this->set('photographer',
> > > > >                         $this->Photographer->find('first',
> > > > >                                                                 
> > > > > array('contain' => array(
> > > > >                                                                       
> > > > >     'Country',
> > > > >                                                                       
> > > > >     'State';
>
> > > > > Then there's no problem, but if I have

Re: Inconsistency between displaying validation errors and validating with model.saveAll()

2008-11-06 Thread teknoid

There is nothing stopping you from naming your fields as:
$form->input('Model.1.fieldname');

As a matter of fact, if you read about saveAll() in the manual, you'll
see an example that uses that exact format.

Regarding the 'fieldname.1' notation as in the form helper example, it
clearly states that is only useful for looping through the fields, it
doesn't say anything about saveAll(). That being said, it probably
should be updated, but again form helper works just fine either way.

On Nov 6, 1:23 am, Joel <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I've run into a frustrating problem, I'm trying to validate an array
> of the same type of model, but the
>
> I have used the name convention as suggested 
> here:http://manual.cakephp.org/complete/181/Core-Helpers#Field-naming-conv...
>
> eg:
>
>     echo $form->input('fieldname.1');
>    echo $form->input('fieldname.2');
> ?>
> 
> 
>
> The problem is when I do model.saveAll() it screws up because it
> expects the data in this format:
> data[1][Modelname][fieldname]
> data[2][Modelname][fieldname]
>
> I know that is the expected model because of the comment above the
> saveAll function:
> @param array $data Record data to save.  This can be either a
> numerically-indexed array (for saving multiple records of the same
> type), or an array indexed by association name.
>
> But validation errors won't display in the saveAll format.
>
> Because validationErrors array ends up looking like:
> [ModelName][1][field] = "error message"
> [ModelName][2][field] = "error message"
>
> But for the FormHelper to display the errors it needs to look like
> this:
> [ModelName][field][1] = "error message"
> [ModelName][field][2] = "error message"
>
> So I have managed to work around it by using this in the view:
>    echo $form->input('Model.fieldname.1');
>    echo $form->input('Model.fieldname.2');
>
> And then I have a function that converts the $this->data for saveAll:
>
>    function _prepareDataForValidation($data) {
>       $fixedData = array();
>
>       foreach ($data as $model => $fields) {
>          foreach ($fields as $field => $values) {
>             foreach ($values as $id => $value) {
>                $fixedData[$id][$model][$field] = $value;
>             }
>          }
>       }
>
>       return $fixedData;
>    }
>
> And another function that puts the validationErrors in the right
> format:
>
>    function _fixValidationErrorsArray($validationErrors) {
>       $newValidationErrors = array();
>
>       foreach($validationErrors as $key => $fields) {
>          foreach ($fields as $field => $value) {
>                 $newValidationErrors[$field][$key] = $value;
>          }
>       }
>
>       return $newValidationErrors;
>    }
>
> Should I log this as a bug in trac?
>
> I really think FormHelper should be changed to be in this format:
>
>     echo $form->input('Model.1.fieldname');
>    echo $form->input('Model.2.fieldname');
> ?>
>
> instead of
>
>     echo $form->input('Model.fieldname.1');
>    echo $form->input('Model.fieldname.2');
> ?>
>
> https://trac.cakephp.org/ticket/4981is similar to this, except I
> don't have the belongs to association.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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
-~--~~~~--~~--~--~---



Failed test case: libs/view/helpers/cache.test.php

2008-11-06 Thread bwilt

Hi All,

I was just trying to investigate my trouble with caching outlined in
this thread :-

http://groups.google.com/group/cake-php/browse_thread/thread/3ad96f4680bf0211/0832f1e2ac262345#0832f1e2ac262345

This is my first try with the test suite so forgive me if I'm doing
things wrong, I haven't started writing a test yet but struck failed
error for the test mentioned in the subject line .is this
correct ?  All other tests I have run seem to work, the failed errors
are as follows :-

* Failed
  Pattern [/cake:nocache/] detected at character [1661] in
[String: plugin = $this->plugin = ''; $controller->helpers = $t...] as
[cake:nocache] in region [...php $x = 1; ?>  View
Content  cache...] at [/var/
www/dev/src-devlin/web/wiltonsoftware/cake/tests/cases/libs/view/
helpers/cache.test.php line 224]
  /var/www/dev/src-devlin/web/wiltonsoftware/cake/tests/cases/libs/
view/helpers/cache.test.php -> CacheHelperTest ->
testCacheEmptySections
* Failed
  Pattern [@\s*Posts\s*<\?php $x = 1; \?>\s*\s*\s*<\?php $x\+\+; \?>\s*<\?php $x\+\+; \?>\s*View Content
\s*<\?php $y = 1; \?>\s*<\?php echo 'cached count is:' . $x; \?>[EMAIL 
PROTECTED]
not detected in [String: plugin = $this->plugin = '';
$controller->helpers = $t...] at [/var/www/dev/src-devlin/web/
wiltonsoftware/cake/tests/cases/libs/view/helpers/cache.test.php line
235]
  /var/www/dev/src-devlin/web/wiltonsoftware/cake/tests/cases/libs/
view/helpers/cache.test.php -> CacheHelperTest ->
testCacheEmptySections

I'm running RC3 latest 7835...

Thanks for any help,
Brett
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: Loosing passed arguments after validation and redirection to show errors

2008-11-06 Thread Home Boy Howy

Ok, I am a complete dork. The reason this wasn't working is because
the AJAX submit wasn't going to the ACTUAL action of the form. So
getting rid of that parameter of jQuery AJAX form submit it went to
the correct form action which allowed the validation process to return
to the correct URL and action.

Martins tip above was a great help:
You could change your forma little:
$form->create('Contact', array('url' => $this->here, 'id' =>
'sendpage-
form'))

Thanks Martin!!

-Brian

On Nov 6, 4:47 pm, Home Boy Howy <[EMAIL PROTECTED]> wrote:
> Wow. I did what you recommends and still no "love". Thank you for the
> tip on "$this-here" syntax. It is still clearing the params on
> validation. I guess I don't understand what happens during the
> validation process. I assumed that it would just return the user to
> the previous URL with all params still in the URL which would then
> just reset that data variable.
> What I am trying to do is a similiar thing as a basic old CakePHP
> generated admin edit form, but instead of passing the controller
> function the Id I am trying to pass the function a URL string. Just
> like the edit link passes the edit form the id and sets a hidden form
> value, I want to do this with a url string. On edit and submit of the
> form, instead of saving the data I want to shoot of an email to the
> email addresses added in the form. What is throwing me is the darn
> validation of this form.
>
> -Brian
>
> On Nov 6, 1:45 pm, "[EMAIL PROTECTED]"
>
> <[EMAIL PROTECTED]> wrote:
> > Hi Howy,
>
> > You are loosing the agruments since you are submitting the form to "/
> > contacts/send_page" and not "/contacts/send_page/params/here".
> > But you still try to pull "sendUrl" from the passed params if the
> > validation fails.
>
> > You could change your forma little:
> > $form->create('Contact', array('url' => $this->here, 'id' => 'sendpage-
> > form'))
>
> > or not replace the value of $this->data['Contact']['sendUrl'] if the
> > validation fails. I prefer the first alternative.
>
> > Either way, you need to "validate" the url passed and handle that in a
> > different way since displaying the form again will not solve that
> > problem. This data should first be validated before even displaying
> > the form and if the url does not pass validation the form should
> > probably not be displayed at all.
>
> > /Martin
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Changing views depending on ARO

2008-11-06 Thread rm

I couldn't initially get it to work

But then I cleared out the redirect session to stop it from confusing
me (as it would automatically redirect to the previously redirected
page first).

To do that I put this in my users_controller : login function
$this->Session->del('Auth.redirect');

I then changed the cake/libs/controller/components/auth.php to have

var $autoRedirect = false;

This is working now, but I have to find a way to turn off
$autoredirect without changing auth.php itself.

So thanks for the code - it helped heaps!

On Oct 16, 1:29 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> oh and I forgot, also added this in the user model
>
>         function admin(){
>
>                 if ($this->id) {
>                         $node = $this->node();
>                         $type = $node['1']['Aro']['alias'];
>                         if($type=='Admin'){ return true; }
>                 }
>
>                 return false;
>
>         }

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: Inconsistency between displaying validation errors and validating with model.saveAll()

2008-11-06 Thread Joel

For reference I have created a ticket in trac here:
https://trac.cakephp.org/ticket/5715

On Nov 6, 5:23 pm, Joel <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I've run into a frustrating problem, I'm trying to validate an array
> of the same type of model, but the
>
> I have used the name convention as suggested 
> here:http://manual.cakephp.org/complete/181/Core-Helpers#Field-naming-conv...
>
> eg:
>
> echo $form->input('fieldname.1');
>echo $form->input('fieldname.2');
> ?>
> 
> 
>
> The problem is when I do model.saveAll() it screws up because it
> expects the data in this format:
> data[1][Modelname][fieldname]
> data[2][Modelname][fieldname]
>
> I know that is the expected model because of the comment above the
> saveAll function:
> @param array $data Record data to save.  This can be either a
> numerically-indexed array (for saving multiple records of the same
> type), or an array indexed by association name.
>
> But validation errors won't display in the saveAll format.
>
> Because validationErrors array ends up looking like:
> [ModelName][1][field] = "error message"
> [ModelName][2][field] = "error message"
>
> But for the FormHelper to display the errors it needs to look like
> this:
> [ModelName][field][1] = "error message"
> [ModelName][field][2] = "error message"
>
> So I have managed to work around it by using this in the view:
>echo $form->input('Model.fieldname.1');
>echo $form->input('Model.fieldname.2');
>
> And then I have a function that converts the $this->data for saveAll:
>
>function _prepareDataForValidation($data) {
>   $fixedData = array();
>
>   foreach ($data as $model => $fields) {
>  foreach ($fields as $field => $values) {
> foreach ($values as $id => $value) {
>$fixedData[$id][$model][$field] = $value;
> }
>  }
>   }
>
>   return $fixedData;
>}
>
> And another function that puts the validationErrors in the right
> format:
>
>function _fixValidationErrorsArray($validationErrors) {
>   $newValidationErrors = array();
>
>   foreach($validationErrors as $key => $fields) {
>  foreach ($fields as $field => $value) {
> $newValidationErrors[$field][$key] = $value;
>  }
>   }
>
>   return $newValidationErrors;
>}
>
> Should I log this as a bug in trac?
>
> I really think FormHelper should be changed to be in this format:
>
> echo $form->input('Model.1.fieldname');
>echo $form->input('Model.2.fieldname');
> ?>
>
> instead of
>
> echo $form->input('Model.fieldname.1');
>echo $form->input('Model.fieldname.2');
> ?>
>
> https://trac.cakephp.org/ticket/4981is similar to this, except I
> don't have the belongs to association.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: Loosing passed arguments after validation and redirection to show errors

2008-11-06 Thread Home Boy Howy

Wow. I did what you recommends and still no "love". Thank you for the
tip on "$this-here" syntax. It is still clearing the params on
validation. I guess I don't understand what happens during the
validation process. I assumed that it would just return the user to
the previous URL with all params still in the URL which would then
just reset that data variable.
What I am trying to do is a similiar thing as a basic old CakePHP
generated admin edit form, but instead of passing the controller
function the Id I am trying to pass the function a URL string. Just
like the edit link passes the edit form the id and sets a hidden form
value, I want to do this with a url string. On edit and submit of the
form, instead of saving the data I want to shoot of an email to the
email addresses added in the form. What is throwing me is the darn
validation of this form.

-Brian



On Nov 6, 1:45 pm, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:
> Hi Howy,
>
> You are loosing the agruments since you are submitting the form to "/
> contacts/send_page" and not "/contacts/send_page/params/here".
> But you still try to pull "sendUrl" from the passed params if the
> validation fails.
>
> You could change your forma little:
> $form->create('Contact', array('url' => $this->here, 'id' => 'sendpage-
> form'))
>
> or not replace the value of $this->data['Contact']['sendUrl'] if the
> validation fails. I prefer the first alternative.
>
> Either way, you need to "validate" the url passed and handle that in a
> different way since displaying the form again will not solve that
> problem. This data should first be validated before even displaying
> the form and if the url does not pass validation the form should
> probably not be displayed at all.
>
> /Martin

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



Re: Changing views depending on ARO

2008-11-06 Thread rm

Silly me, it should have been a change in app_controller

function beforeFilter()
{
$this->Auth->autoRedirect = false;

instead of changing auth.php


On Oct 16, 1:29 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> oh and I forgot, also added this in the user model
>
>         function admin(){
>
>                 if ($this->id) {
>                         $node = $this->node();
>                         $type = $node['1']['Aro']['alias'];
>                         if($type=='Admin'){ return true; }
>                 }
>
>                 return false;
>
>         }

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: Seperate Public/Admin Apps with Shared Models & Webroot?

2008-11-06 Thread Adam Royle

If you're sharing the same webroot and models, controllers,
components, etc, what is the purpose of have two separate apps?

You can just use admin routes for this.

Cheers,
Adam

On Nov 7, 5:55 am, WildFoxMedia <[EMAIL PROTECTED]> wrote:
> I saw an article on the bakery that described a method for creating 2
> seperate applications that could share Models, Controllers, COmponents, etc.
> I followed that tutorial and had everything setup how I wanted, except for
> the webroot. Is it possible to share the webroots across these 2 apps?
>
> I thought about removing everything from the webroot for each app except for
> the index.php for that sake of bootstrapping and actually dispatching the
> request - but moving the rest of the files to a shared webroot in a similar
> fashion to the models, etc. My question is this
>
> Is it easy, or even possible to change system paths for Forms, JS, CSS, etc.
> to reference a new shared webroot, or at worst, make the public app have all
> webroot files and the manager leach its files?
> --
> View this message in 
> context:http://www.nabble.com/Seperate-Public-Admin-Apps-with-Shared-Models--...
> 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: Finds: Contain vs. Unbind-on-the-fly

2008-11-06 Thread Brenton B

Where there is only 1 level in the 'contain':

SELECT `Photographer`.`id`, `Photographer`.`first_name`,
`Photographer`.`last_name`, `Photographer`.`company_name`,
`Photographer`.`email`, `Photographer`.`telephone`,
`Photographer`.`address_1`, `Photographer`.`address_2`,
`Photographer`.`country_id`, `Photographer`.`state_id`,
`Photographer`.`city`, `Photographer`.`zip_code`,  [[[... plus a bunch
of other fields ... ]]]  `Country`.`id`, `Country`.`name`,
`Country`.`created`, `Country`.`created_by`, `Country`.`modified`,
`Country`.`modified_by`, `State`.`id`, `State`.`name`,
`State`.`country_id`, `State`.`created`, `State`.`created_by`,
`State`.`modified`, `State`.`modified_by` FROM `photographers` AS
`Photographer` LEFT JOIN `countries` AS `Country` ON
(`Photographer`.`country_id` = `Country`.`id`) LEFT JOIN `states` AS
`State` ON (`Photographer`.`state_id` = `State`.`id`) WHERE
`Photographer`.`id` = 1 LIMIT 1

SELECT `PrintSize`.`id`, `PrintSize`.`name`, `PrintSize`.`created`,
`PrintSize`.`created_by`, `PrintSize`.`modified`,
`PrintSize`.`modified_by`, `PhotographersPrintSize`.`id`,
`PhotographersPrintSize`.`photographer_id`,
`PhotographersPrintSize`.`print_size_id`,
`PhotographersPrintSize`.`price`, `PhotographersPrintSize`.`comment`,
`PhotographersPrintSize`.`created`,
`PhotographersPrintSize`.`created_by`,
`PhotographersPrintSize`.`modified`,
`PhotographersPrintSize`.`modified_by` FROM `print_sizes` AS
`PrintSize` JOIN `photographers_print_sizes` AS
`PhotographersPrintSize` ON
(`PhotographersPrintSize`.`photographer_id` = 1 AND
`PhotographersPrintSize`.`print_size_id` = `PrintSize`.`id`) WHERE 1 =
1


Then as soon as I add in the extra level in 'contain' I get the above,
plus these extras:

SELECT `Country`.`id`, `Country`.`name`, `Country`.`created`,
`Country`.`created_by`, `Country`.`modified`, `Country`.`modified_by`
FROM `countries` AS `Country` WHERE `Country`.`id` = 2

SELECT `State`.`id`, `State`.`name`, `State`.`country_id`,
`State`.`created`, `State`.`created_by`, `State`.`modified`,
`State`.`modified_by` FROM `states` AS `State` WHERE `State`.`id` = 2


I'm hoping to have some time tonight to really dig through the
Containable behaviour code.


On Nov 6, 3:03 pm, teknoid <[EMAIL PROTECTED]> wrote:
> What are the "extra" queries, which get generated for Country and
> State, when you add other models?
> Could you provide an example?
>
> On Nov 6, 5:41 pm, Brenton B <[EMAIL PROTECTED]> wrote:
>
> > Photographer:
> > Photographer belongsTo Country
> > Photographer belongsTo State
> > Photographer HABTM PrintSize: with PhotographersPrintSize (join 
> > table
> > has extra data)
>
> > PrintSize:
> > PrintSize HABTM Photographer: with PhotographersPrintSize (again,
> > join table with data)
>
> > PhotographersPrintSize:
> > PhotographersPrintSize hasMany Photographer
> > PhotographersPrintSize hasMany PrintSize
>
> > yes, all in same db.
>
> > Also, forgot to mention, if I take off to recursive level (as below),
> > it does it fine without all the extra queries.
>
> > $this->set('photographer',
> > $this->Photographer->find('first',
> > array('contain' => 
> > array(
> >   'Country',
> >   'State',
> >   
> > 'PrintSize';
>
> > On Nov 6, 2:18 pm, teknoid <[EMAIL PROTECTED]> wrote:
>
> > > what's the relation between all those models?
> > > and are they all in the same db?
>
> > > On Nov 6, 5:12 pm, Brenton B <[EMAIL PROTECTED]> wrote:
>
> > > > Aha!!!
> > > > I think I've come up with the reason ...
>
> > > > As I was trying to produce a nice a short example I realized that when
> > > > there's only 1 level it doesn't produce the extra queries ... as soon
> > > > as there's more than 1 level it has the extra queries.
>
> > > > So if I have:
>
> > > > $this->set('photographer',
> > > > $this->Photographer->find('first',
> > > > 
> > > > array('contain' => array(
> > > > 
> > > >   'Country',
> > > > 
> > > >   'State';
>
> > > > Then there's no problem, but if I have
>
> > > > $this->set('photographer',
> > > > $this->Photographer->find('first',
> > > > 
> > > > array('contain' => array(
> > > > 
> > > >   'Country',
> > > > 
> > > >   'State',
> > > >  

Re: Finds: Contain vs. Unbind-on-the-fly

2008-11-06 Thread teknoid

What are the "extra" queries, which get generated for Country and
State, when you add other models?
Could you provide an example?

On Nov 6, 5:41 pm, Brenton B <[EMAIL PROTECTED]> wrote:
> Photographer:
>         Photographer belongsTo Country
>         Photographer belongsTo State
>         Photographer HABTM PrintSize: with PhotographersPrintSize (join table
> has extra data)
>
> PrintSize:
>         PrintSize HABTM Photographer: with PhotographersPrintSize (again,
> join table with data)
>
> PhotographersPrintSize:
>         PhotographersPrintSize hasMany Photographer
>         PhotographersPrintSize hasMany PrintSize
>
> yes, all in same db.
>
> Also, forgot to mention, if I take off to recursive level (as below),
> it does it fine without all the extra queries.
>
>         $this->set('photographer',
>                         $this->Photographer->find('first',
>                                                         array('contain' => 
> array(
>                                                                   'Country',
>                                                                   'State',
>                                                                   
> 'PrintSize';
>
> On Nov 6, 2:18 pm, teknoid <[EMAIL PROTECTED]> wrote:
>
> > what's the relation between all those models?
> > and are they all in the same db?
>
> > On Nov 6, 5:12 pm, Brenton B <[EMAIL PROTECTED]> wrote:
>
> > > Aha!!!
> > > I think I've come up with the reason ...
>
> > > As I was trying to produce a nice a short example I realized that when
> > > there's only 1 level it doesn't produce the extra queries ... as soon
> > > as there's more than 1 level it has the extra queries.
>
> > > So if I have:
>
> > >         $this->set('photographer',
> > >                         $this->Photographer->find('first',
> > >                                                                 
> > > array('contain' => array(
> > >                                                                           
> > > 'Country',
> > >                                                                           
> > > 'State';
>
> > > Then there's no problem, but if I have
>
> > >         $this->set('photographer',
> > >                         $this->Photographer->find('first',
> > >                                                                 
> > > array('contain' => array(
> > >                                                                           
> > > 'Country',
> > >                                                                           
> > > 'State',
> > >                                                                           
> > > 'PrintSize.PhotographersPrintSize';
>
> > > Then it'll do extra queries on Country and State, in addition to
> > > PrintSize and PhotographersPrintSize.
>
> > > Even if I change it to
>
> > >         $this->set('photographer',
> > >                         $this->Photographer->find('first',
> > >                                                                 
> > > array('contain' => array(
> > >                                                                           
> > > 'Country',
> > >                                                                           
> > > 'State',
> > >                                                                           
> > > 'PrintSize' => array('PhotographersPrintSize');
>
> > > I still run into the issue.
>
> > > BTW:
>
> > > class AppModel extends Model {
>
> > >         var $actsAs = array('Containable');
>
> > > }
>
> > > I suspect it's something to do with recursive, but will keep digging.
>
> > > On Nov 6, 8:33 am, teknoid <[EMAIL PROTECTED]> wrote:
>
> > > > Can you show your use of containable?
> > > > I think something might be amiss...
>
> > > > On Nov 5, 6:21 pm, Brenton B <[EMAIL PROTECTED]> wrote:
>
> > > > > After a bit of digging setting the 'recursive' property in the model
> > > > > _partially_ solves this:
> > > > > var $actsAs = array('Containable' => array('recursive' => false));
>
> > > > > However, obviously won't help where some items need a 2nd or 3rd
> > > > > level.
>
> > > > > So I guess it comes back to: is there any way to be model-specific for
> > > > > recursion?
>
> > > > > On Nov 5, 2:54 pm, Brenton B <[EMAIL PROTECTED]> wrote:
>
> > > > > > That's the problem with 'contain' though ... even if I do use a 
> > > > > > hasOne
> > > > > > bind, 'contain' will still do extra queries.
> > > > > > In the example I mentioned, it will retrieve everything properly in 
> > > > > > 1
> > > > > > big query, but then it'll go back again and find the models listed 
> > > > > > in
> > > > > > 'contain'.
> > > > > > On a default page of 20 records (since I'm doing pagination), where
> > > > > > each record has 4 extra models to find you're looking at 80 extra
> > > > > > unnecessary db hits ... multiply that by X users view the page and
> > > > > > you're looking at a lot of unnecessary queries. Sure it's just
> > > > > > mi

Re: Finds: Contain vs. Unbind-on-the-fly

2008-11-06 Thread Brenton B

Photographer:
Photographer belongsTo Country
Photographer belongsTo State
Photographer HABTM PrintSize: with PhotographersPrintSize (join table
has extra data)

PrintSize:
PrintSize HABTM Photographer: with PhotographersPrintSize (again,
join table with data)

PhotographersPrintSize:
PhotographersPrintSize hasMany Photographer
PhotographersPrintSize hasMany PrintSize


yes, all in same db.

Also, forgot to mention, if I take off to recursive level (as below),
it does it fine without all the extra queries.

$this->set('photographer',
$this->Photographer->find('first',
array('contain' => 
array(
  'Country',
  'State',
  
'PrintSize';


On Nov 6, 2:18 pm, teknoid <[EMAIL PROTECTED]> wrote:
> what's the relation between all those models?
> and are they all in the same db?
>
> On Nov 6, 5:12 pm, Brenton B <[EMAIL PROTECTED]> wrote:
>
> > Aha!!!
> > I think I've come up with the reason ...
>
> > As I was trying to produce a nice a short example I realized that when
> > there's only 1 level it doesn't produce the extra queries ... as soon
> > as there's more than 1 level it has the extra queries.
>
> > So if I have:
>
> > $this->set('photographer',
> > $this->Photographer->find('first',
> > 
> > array('contain' => array(
> >   
> > 'Country',
> >   
> > 'State';
>
> > Then there's no problem, but if I have
>
> > $this->set('photographer',
> > $this->Photographer->find('first',
> > 
> > array('contain' => array(
> >   
> > 'Country',
> >   
> > 'State',
> >   
> > 'PrintSize.PhotographersPrintSize';
>
> > Then it'll do extra queries on Country and State, in addition to
> > PrintSize and PhotographersPrintSize.
>
> > Even if I change it to
>
> > $this->set('photographer',
> > $this->Photographer->find('first',
> > 
> > array('contain' => array(
> >   
> > 'Country',
> >   
> > 'State',
> >   
> > 'PrintSize' => array('PhotographersPrintSize');
>
> > I still run into the issue.
>
> > BTW:
>
> > class AppModel extends Model {
>
> > var $actsAs = array('Containable');
>
> > }
>
> > I suspect it's something to do with recursive, but will keep digging.
>
> > On Nov 6, 8:33 am, teknoid <[EMAIL PROTECTED]> wrote:
>
> > > Can you show your use of containable?
> > > I think something might be amiss...
>
> > > On Nov 5, 6:21 pm, Brenton B <[EMAIL PROTECTED]> wrote:
>
> > > > After a bit of digging setting the 'recursive' property in the model
> > > > _partially_ solves this:
> > > > var $actsAs = array('Containable' => array('recursive' => false));
>
> > > > However, obviously won't help where some items need a 2nd or 3rd
> > > > level.
>
> > > > So I guess it comes back to: is there any way to be model-specific for
> > > > recursion?
>
> > > > On Nov 5, 2:54 pm, Brenton B <[EMAIL PROTECTED]> wrote:
>
> > > > > That's the problem with 'contain' though ... even if I do use a hasOne
> > > > > bind, 'contain' will still do extra queries.
> > > > > In the example I mentioned, it will retrieve everything properly in 1
> > > > > big query, but then it'll go back again and find the models listed in
> > > > > 'contain'.
> > > > > On a default page of 20 records (since I'm doing pagination), where
> > > > > each record has 4 extra models to find you're looking at 80 extra
> > > > > unnecessary db hits ... multiply that by X users view the page and
> > > > > you're looking at a lot of unnecessary queries. Sure it's just
> > > > > milliseconds, but still quite concerning.
>
> > > > > On Nov 5, 2:48 pm, teknoid <[EMAIL PROTECTED]> wrote:
>
> > > > > > JOINS are only built for hasOne and belongsTo relationships.
> > > > > > A bunch of little selects will not harm your DB (how many 
> > > > > > milliseconds
> > > > > > do those queries take?)
>
> > > > > > Are you displaying some list on the page? Maybe paginate is in order
> > > > > > for this

Re: Finds: Contain vs. Unbind-on-the-fly

2008-11-06 Thread teknoid

what's the relation between all those models?
and are they all in the same db?

On Nov 6, 5:12 pm, Brenton B <[EMAIL PROTECTED]> wrote:
> Aha!!!
> I think I've come up with the reason ...
>
> As I was trying to produce a nice a short example I realized that when
> there's only 1 level it doesn't produce the extra queries ... as soon
> as there's more than 1 level it has the extra queries.
>
> So if I have:
>
>         $this->set('photographer',
>                         $this->Photographer->find('first',
>                                                                 
> array('contain' => array(
>                                                                           
> 'Country',
>                                                                           
> 'State';
>
> Then there's no problem, but if I have
>
>         $this->set('photographer',
>                         $this->Photographer->find('first',
>                                                                 
> array('contain' => array(
>                                                                           
> 'Country',
>                                                                           
> 'State',
>                                                                           
> 'PrintSize.PhotographersPrintSize';
>
> Then it'll do extra queries on Country and State, in addition to
> PrintSize and PhotographersPrintSize.
>
> Even if I change it to
>
>         $this->set('photographer',
>                         $this->Photographer->find('first',
>                                                                 
> array('contain' => array(
>                                                                           
> 'Country',
>                                                                           
> 'State',
>                                                                           
> 'PrintSize' => array('PhotographersPrintSize');
>
> I still run into the issue.
>
> BTW:
>
> class AppModel extends Model {
>
>         var $actsAs = array('Containable');
>
> }
>
> I suspect it's something to do with recursive, but will keep digging.
>
> On Nov 6, 8:33 am, teknoid <[EMAIL PROTECTED]> wrote:
>
> > Can you show your use of containable?
> > I think something might be amiss...
>
> > On Nov 5, 6:21 pm, Brenton B <[EMAIL PROTECTED]> wrote:
>
> > > After a bit of digging setting the 'recursive' property in the model
> > > _partially_ solves this:
> > > var $actsAs = array('Containable' => array('recursive' => false));
>
> > > However, obviously won't help where some items need a 2nd or 3rd
> > > level.
>
> > > So I guess it comes back to: is there any way to be model-specific for
> > > recursion?
>
> > > On Nov 5, 2:54 pm, Brenton B <[EMAIL PROTECTED]> wrote:
>
> > > > That's the problem with 'contain' though ... even if I do use a hasOne
> > > > bind, 'contain' will still do extra queries.
> > > > In the example I mentioned, it will retrieve everything properly in 1
> > > > big query, but then it'll go back again and find the models listed in
> > > > 'contain'.
> > > > On a default page of 20 records (since I'm doing pagination), where
> > > > each record has 4 extra models to find you're looking at 80 extra
> > > > unnecessary db hits ... multiply that by X users view the page and
> > > > you're looking at a lot of unnecessary queries. Sure it's just
> > > > milliseconds, but still quite concerning.
>
> > > > On Nov 5, 2:48 pm, teknoid <[EMAIL PROTECTED]> wrote:
>
> > > > > JOINS are only built for hasOne and belongsTo relationships.
> > > > > A bunch of little selects will not harm your DB (how many milliseconds
> > > > > do those queries take?)
>
> > > > > Are you displaying some list on the page? Maybe paginate is in order
> > > > > for this case?
>
> > > > > All that being said, if you are not happy with that and prefer a long
> > > > > JOIN query, you can always "trick" cake into building one, by using a
> > > > > temporary hasOne bind.
>
> > > > > On Nov 5, 5:08 pm, Brenton B <[EMAIL PROTECTED]> wrote:
>
> > > > > > What might also help is a way to include recursion on only certain
> > > > > > associations - which can be done with 'contain', but again, 
> > > > > > 'contain'
> > > > > > is doing more db queries than it needs to.
>
> > > > > > On Nov 5, 11:38 am, Brenton B <[EMAIL PROTECTED]> wrote:
>
> > > > > > > This is getting quite confusing/frustrating ...
>
> > > > > > > If I use 'contain' it's the equivalent of using 'unbind' (on the 
> > > > > > > fly)
> > > > > > > on everything not listed in 'contain' (as described in the 
> > > > > > > Cookbook);
> > > > > > > however, if I use 'contain', it seems to actually execute an extra
> > > > > > > query to get that corresponding information, regardless of 
> > > > > > > association
> > > > > > > type.
>
> > > > > > > For example, list of members with countries (belongsTo), provinces
> > > > > > > (belongsTo), plus a whole bunch of other stuff: webpages, 
> 

Re: Finds: Contain vs. Unbind-on-the-fly

2008-11-06 Thread Brenton B

Aha!!!
I think I've come up with the reason ...

As I was trying to produce a nice a short example I realized that when
there's only 1 level it doesn't produce the extra queries ... as soon
as there's more than 1 level it has the extra queries.

So if I have:

$this->set('photographer',
$this->Photographer->find('first',
array('contain' 
=> array(
  
'Country',
  
'State';

Then there's no problem, but if I have

$this->set('photographer',
$this->Photographer->find('first',
array('contain' 
=> array(
  
'Country',
  
'State',
  
'PrintSize.PhotographersPrintSize';

Then it'll do extra queries on Country and State, in addition to
PrintSize and PhotographersPrintSize.

Even if I change it to

$this->set('photographer',
$this->Photographer->find('first',
array('contain' 
=> array(
  
'Country',
  
'State',
  
'PrintSize' => array('PhotographersPrintSize');

I still run into the issue.


BTW:

class AppModel extends Model {

var $actsAs = array('Containable');
}


I suspect it's something to do with recursive, but will keep digging.

On Nov 6, 8:33 am, teknoid <[EMAIL PROTECTED]> wrote:
> Can you show your use of containable?
> I think something might be amiss...
>
> On Nov 5, 6:21 pm, Brenton B <[EMAIL PROTECTED]> wrote:
>
> > After a bit of digging setting the 'recursive' property in the model
> > _partially_ solves this:
> > var $actsAs = array('Containable' => array('recursive' => false));
>
> > However, obviously won't help where some items need a 2nd or 3rd
> > level.
>
> > So I guess it comes back to: is there any way to be model-specific for
> > recursion?
>
> > On Nov 5, 2:54 pm, Brenton B <[EMAIL PROTECTED]> wrote:
>
> > > That's the problem with 'contain' though ... even if I do use a hasOne
> > > bind, 'contain' will still do extra queries.
> > > In the example I mentioned, it will retrieve everything properly in 1
> > > big query, but then it'll go back again and find the models listed in
> > > 'contain'.
> > > On a default page of 20 records (since I'm doing pagination), where
> > > each record has 4 extra models to find you're looking at 80 extra
> > > unnecessary db hits ... multiply that by X users view the page and
> > > you're looking at a lot of unnecessary queries. Sure it's just
> > > milliseconds, but still quite concerning.
>
> > > On Nov 5, 2:48 pm, teknoid <[EMAIL PROTECTED]> wrote:
>
> > > > JOINS are only built for hasOne and belongsTo relationships.
> > > > A bunch of little selects will not harm your DB (how many milliseconds
> > > > do those queries take?)
>
> > > > Are you displaying some list on the page? Maybe paginate is in order
> > > > for this case?
>
> > > > All that being said, if you are not happy with that and prefer a long
> > > > JOIN query, you can always "trick" cake into building one, by using a
> > > > temporary hasOne bind.
>
> > > > On Nov 5, 5:08 pm, Brenton B <[EMAIL PROTECTED]> wrote:
>
> > > > > What might also help is a way to include recursion on only certain
> > > > > associations - which can be done with 'contain', but again, 'contain'
> > > > > is doing more db queries than it needs to.
>
> > > > > On Nov 5, 11:38 am, Brenton B <[EMAIL PROTECTED]> wrote:
>
> > > > > > This is getting quite confusing/frustrating ...
>
> > > > > > If I use 'contain' it's the equivalent of using 'unbind' (on the 
> > > > > > fly)
> > > > > > on everything not listed in 'contain' (as described in the 
> > > > > > Cookbook);
> > > > > > however, if I use 'contain', it seems to actually execute an extra
> > > > > > query to get that corresponding information, regardless of 
> > > > > > association
> > > > > > type.
>
> > > > > > For example, list of members with countries (belongsTo), provinces
> > > > > > (belongsTo), plus a whole bunch of other stuff: webpages, interests,
> > > > > > etc.
>
> > > > > > If I'm doing a listing, I just want name, country, and province, so 
> > > > > > I
> > > > > > can either do unbind on everything I don't need, or use 'contain' on
> > > > > > the things I do need  'contain' is the logical choice.
> > > > > > The resulting query does a LEFT JOIN on countries and provinc

Re: Loosing passed arguments after validation and redirection to show errors

2008-11-06 Thread [EMAIL PROTECTED]

Hi Howy,

You are loosing the agruments since you are submitting the form to "/
contacts/send_page" and not "/contacts/send_page/params/here".
But you still try to pull "sendUrl" from the passed params if the
validation fails.

You could change your forma little:
$form->create('Contact', array('url' => $this->here, 'id' => 'sendpage-
form'))

or not replace the value of $this->data['Contact']['sendUrl'] if the
validation fails. I prefer the first alternative.

Either way, you need to "validate" the url passed and handle that in a
different way since displaying the form again will not solve that
problem. This data should first be validated before even displaying
the form and if the url does not pass validation the form should
probably not be displayed at all.

/Martin


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



Re: RC3 file cache trouble

2008-11-06 Thread Brett Wilton

Have been trying to figure out this for a while now, anyone used the
file engine caching under 1.2 with  around a form ?

In the controller I'm using var $cacheAction = array('index' => '1
day', 'view' => '1 day'); the view page has a few elements which are
cached as well but I only get the errors in the nocache section. If I
remove this form and nocache section it all works correctly.

Any idea would be much appreciated.

Brett.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: basic site concept

2008-11-06 Thread justclint

Man you guys are Awesome!  Thanks so much for the support. And dr.
Hannibal, I just saw the info on the CMS your working on, NeutrinoCMS.
Once I finish up this site I would like to add a CMS to it so you'll
probably hear more from me.

Thanks again everyone!

Clint

On Nov 6, 8:37 am, "dr. Hannibal Lecter" <[EMAIL PROTECTED]> wrote:
> Hi Clint,
>
> Of course you can have as many controllers as you need. Since you're
> not familiar with Cake yet, maybe the best thing to do is to learn by
> reading some code, just go through some of these applications:
>
> http://book.cakephp.org/view/511/Applicationshttp://cakeforge.org/top/mostactive.php
>
> and try to figure out how they work (with the assumption that you're
> already familiar with regular PHP).
>
> Welcome to cake family! ;)
>
> On Nov 6, 4:30 pm, justclint <[EMAIL PROTECTED]> wrote:
>
> > Thank you so much Anja and dr. Hannibal. This helps me very much. As
> > you described dr. Hannibal your not sure why I would want many apps
> > for what Im doing and nor do I. So having you confirm that I can do
> > all this in a single cake folder is a relief.
>
> > So I guess than its true to say that I can have one app folder and I
> > can just keep adding as many controllers, models and views as I
> > please.
>
> > I really do appreciate your help here.
>
> > Thanks again!
>
> > Clint
>
> > On Nov 6, 2:02 am, "dr. Hannibal Lecter" <[EMAIL PROTECTED]> wrote:
>
> > > I'm not sure why would you want many apps for what you've described.
> > > Your "products section" would actually be ProductsController and
> > > Product model, your "search" and "download" functionality are just
> > > SearchController and DownloadsController and their respective models
> > > and views etc..
>
> > > Normally, a single app is enough for all your needs. Even if it isn't,
> > > you can still use cake plugins..
>
> > > Hope that helps!
>
> > > On Nov 6, 8:40 am, justclint <[EMAIL PROTECTED]> wrote:
>
> > > > Hello all, thanks for having this group available for newbies like
> > > > myself. I have a pretty basic question that Im having a very difficult
> > > > time finding an answer on. I've done google searches, read the cakephp
> > > > manual and I am also reading the book "Beginning CakePHP" by David
> > > > Golding which is a great book by the way.
>
> > > > Any way I've never used a framework before and Im totally new to the
> > > > MVC concept. Ive done a couple tutorials such as the blog and also a
> > > > to-do list. I have a site I will be converting over to cakephp and
> > > > want to make sure I am using best practices and that I understand the
> > > > basic concept.
>
> > > > So my question is; if Im building a whole website, is the whole
> > > > website a "cakephp app" or does my whole website have many "cakephp
> > > > apps"?
>
> > > > Through my reading it seems every tutorial is based on just a piece of
> > > > a website (ie: blog) and every tutorial required a new cake folder
> > > > with the usual contents (app, controllers, views, webroot etc.).
>
> > > > I need to make a single typical website with the usual stuff like
> > > > products section, support section with search/download functionality
> > > > and contact/request forms.
>
> > > > Im not sure if each one of these things are supposed to be different
> > > > apps or if the whole site is in one app. It seems a bit cumbersome to
> > > > keep adding cake folders over and over on a single site but nothing
> > > > Ive read says otherwise. Also, If you are supposed to keep adding cake
> > > > folder after cake folder you would endup with multiple webroot folders
> > > > which also kinda of boggles my mind.
>
> > > > Your help is greatly appreciated and I do apologize for having such a
> > > > primitive question but I have no where else to go but here.
>
> > > > Thanks again!
>
> > > > Cheers,
>
> > > > Clint
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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 can I do to speed up bootstrap > beforeFilter ?

2008-11-06 Thread teknoid

Also, you shouldn't get DESCRIBE queries, which can slow things down a
little, depending on the models used per given page.

On Nov 6, 3:00 pm, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:
> It does not make much difference to the time either way actually.
> debug 0 results are more often down around 0.06 and debug 1 is more
> often around 0.08 or maybe up to 0.1 at times.
>
> On Nov 6, 8:42 pm, teknoid <[EMAIL PROTECTED]> wrote:
>
> > You have debug at 0, I presume?
>
> > On Nov 6, 2:35 pm, "[EMAIL PROTECTED]"
>
> > <[EMAIL PROTECTED]> wrote:
> > > Hi,
> > > I have been migrating an application to 1.2 and partly because of some
> > > threads about performance and benchmarking I have done my own
> > > comparisons. Loading up a simple login form for my app (just Auth no
> > > ACL) 1.1 is 8-10 times faster. 1.2 quickly catches up on more complete
> > > requests with a running session and more data.
>
> > > I was wondering of there was something I could do to my application to
> > > speed up Cake's initial overhead? I thought it might be some of my
> > > code but the time seem to be lost between bootstrap.php and the
> > > beforeFilter. Dropping all components does very little so I am
> > > guessing that if any time can be saved it has to be in routing or by
> > > some opcode caching.
>
> > > My server has eAccelerator running. Is there any experience of
> > > problems using eAccelerator (or APC) with 1.2 or anything like that
> > > which could explain the difference? Or , maybe I should say is there
> > > anything I may have forgotten to do that would make opcode caching
> > > work more efficiently on 1.2?
>
> > > I want to be clear about a few things.
> > > 1. I am talking about pretty small numbers here. Hundreds of seconds,
> > > not minutes. The total overhead on my server is about 0.06-0.08 sec
> > > depending on the mood of the server. 1.1 is usually another 0 down at
> > > about 0.008 sec. 1.2 is fast but 1.1 is damn fast, which is slightly
> > > annoying :)
>
> > > 2. This is not a big problem for this application on this server but I
> > > do have another project where the hardware is being pushed a lot more.
> > > This is me learning more about optimization. I am not looking to trim
> > > away anything in the core to gain speed but if there is something I
> > > can do to help the core "boot" faster I'd like give it a try.
>
> > > As always, any insights shared are greatly appreciated.
>
> > > /Martin
>
>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: what can I do to speed up bootstrap > beforeFilter ?

2008-11-06 Thread teknoid

Well, that really depends on the way the app is setup.
With debug 0 you are completely bypassing the Debugger, so it should
definitely improve some things.

On Nov 6, 3:00 pm, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:
> It does not make much difference to the time either way actually.
> debug 0 results are more often down around 0.06 and debug 1 is more
> often around 0.08 or maybe up to 0.1 at times.
>
> On Nov 6, 8:42 pm, teknoid <[EMAIL PROTECTED]> wrote:
>
> > You have debug at 0, I presume?
>
> > On Nov 6, 2:35 pm, "[EMAIL PROTECTED]"
>
> > <[EMAIL PROTECTED]> wrote:
> > > Hi,
> > > I have been migrating an application to 1.2 and partly because of some
> > > threads about performance and benchmarking I have done my own
> > > comparisons. Loading up a simple login form for my app (just Auth no
> > > ACL) 1.1 is 8-10 times faster. 1.2 quickly catches up on more complete
> > > requests with a running session and more data.
>
> > > I was wondering of there was something I could do to my application to
> > > speed up Cake's initial overhead? I thought it might be some of my
> > > code but the time seem to be lost between bootstrap.php and the
> > > beforeFilter. Dropping all components does very little so I am
> > > guessing that if any time can be saved it has to be in routing or by
> > > some opcode caching.
>
> > > My server has eAccelerator running. Is there any experience of
> > > problems using eAccelerator (or APC) with 1.2 or anything like that
> > > which could explain the difference? Or , maybe I should say is there
> > > anything I may have forgotten to do that would make opcode caching
> > > work more efficiently on 1.2?
>
> > > I want to be clear about a few things.
> > > 1. I am talking about pretty small numbers here. Hundreds of seconds,
> > > not minutes. The total overhead on my server is about 0.06-0.08 sec
> > > depending on the mood of the server. 1.1 is usually another 0 down at
> > > about 0.008 sec. 1.2 is fast but 1.1 is damn fast, which is slightly
> > > annoying :)
>
> > > 2. This is not a big problem for this application on this server but I
> > > do have another project where the hardware is being pushed a lot more.
> > > This is me learning more about optimization. I am not looking to trim
> > > away anything in the core to gain speed but if there is something I
> > > can do to help the core "boot" faster I'd like give it a try.
>
> > > As always, any insights shared are greatly appreciated.
>
> > > /Martin
>
>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: what can I do to speed up bootstrap > beforeFilter ?

2008-11-06 Thread [EMAIL PROTECTED]

It does not make much difference to the time either way actually.
debug 0 results are more often down around 0.06 and debug 1 is more
often around 0.08 or maybe up to 0.1 at times.


On Nov 6, 8:42 pm, teknoid <[EMAIL PROTECTED]> wrote:
> You have debug at 0, I presume?
>
> On Nov 6, 2:35 pm, "[EMAIL PROTECTED]"
>
> <[EMAIL PROTECTED]> wrote:
> > Hi,
> > I have been migrating an application to 1.2 and partly because of some
> > threads about performance and benchmarking I have done my own
> > comparisons. Loading up a simple login form for my app (just Auth no
> > ACL) 1.1 is 8-10 times faster. 1.2 quickly catches up on more complete
> > requests with a running session and more data.
>
> > I was wondering of there was something I could do to my application to
> > speed up Cake's initial overhead? I thought it might be some of my
> > code but the time seem to be lost between bootstrap.php and the
> > beforeFilter. Dropping all components does very little so I am
> > guessing that if any time can be saved it has to be in routing or by
> > some opcode caching.
>
> > My server has eAccelerator running. Is there any experience of
> > problems using eAccelerator (or APC) with 1.2 or anything like that
> > which could explain the difference? Or , maybe I should say is there
> > anything I may have forgotten to do that would make opcode caching
> > work more efficiently on 1.2?
>
> > I want to be clear about a few things.
> > 1. I am talking about pretty small numbers here. Hundreds of seconds,
> > not minutes. The total overhead on my server is about 0.06-0.08 sec
> > depending on the mood of the server. 1.1 is usually another 0 down at
> > about 0.008 sec. 1.2 is fast but 1.1 is damn fast, which is slightly
> > annoying :)
>
> > 2. This is not a big problem for this application on this server but I
> > do have another project where the hardware is being pushed a lot more.
> > This is me learning more about optimization. I am not looking to trim
> > away anything in the core to gain speed but if there is something I
> > can do to help the core "boot" faster I'd like give it a try.
>
> > As always, any insights shared are greatly appreciated.
>
> > /Martin
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Seperate Public/Admin Apps with Shared Models & Webroot?

2008-11-06 Thread WildFoxMedia


I saw an article on the bakery that described a method for creating 2
seperate applications that could share Models, Controllers, COmponents, etc.
I followed that tutorial and had everything setup how I wanted, except for
the webroot. Is it possible to share the webroots across these 2 apps?

I thought about removing everything from the webroot for each app except for
the index.php for that sake of bootstrapping and actually dispatching the
request - but moving the rest of the files to a shared webroot in a similar
fashion to the models, etc. My question is this 

Is it easy, or even possible to change system paths for Forms, JS, CSS, etc.
to reference a new shared webroot, or at worst, make the public app have all
webroot files and the manager leach its files?
-- 
View this message in context: 
http://www.nabble.com/Seperate-Public-Admin-Apps-with-Shared-Models---Webroot--tp20368520p20368520.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: SELECT DISTINCT using find('list')

2008-11-06 Thread [EMAIL PROTECTED]

I see, I'll try that and post the results, thanks!

On Nov 6, 10:36 am, teknoid <[EMAIL PROTECTED]> wrote:
> find('list') requires to fields, because it is used to build a select
> drop down (with value being the id, and option the name usually).
> You probably need find('all') + Set::extract() ... depending on what
> you need really.
>
> On Nov 6, 10:44 am, "[EMAIL PROTECTED]"
>
> <[EMAIL PROTECTED]> wrote:
> > Hello guys,
>
> > I need a "distinct" list of items, so that I tried to set this up
> > using the following code, but it's not working:
>
> > $list = $this->Model->find('list',array('fields' => 'DISTINCT
> > `Model`.`field`', 'conditions' => array("Model.field2 !=
> > '-1'"),'order' => 'Model.order ASC'));
>
> > Unfortunately the result query is this:
>
> > SELECT `Model`.`field`, DISTINCT `Model`.`field` FROM `models` AS
> > `Model` WHERE `Model`.`field2` != '-1' ORDER BY `Model`.`order` ASC
>
> > Which is not what I need, there's an extra `Model`.`field`, that
> > breaks the query. Do you have an idea of how to get the results I'm
> > looking for?
>
> > 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: what can I do to speed up bootstrap > beforeFilter ?

2008-11-06 Thread teknoid

You have debug at 0, I presume?

On Nov 6, 2:35 pm, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:
> Hi,
> I have been migrating an application to 1.2 and partly because of some
> threads about performance and benchmarking I have done my own
> comparisons. Loading up a simple login form for my app (just Auth no
> ACL) 1.1 is 8-10 times faster. 1.2 quickly catches up on more complete
> requests with a running session and more data.
>
> I was wondering of there was something I could do to my application to
> speed up Cake's initial overhead? I thought it might be some of my
> code but the time seem to be lost between bootstrap.php and the
> beforeFilter. Dropping all components does very little so I am
> guessing that if any time can be saved it has to be in routing or by
> some opcode caching.
>
> My server has eAccelerator running. Is there any experience of
> problems using eAccelerator (or APC) with 1.2 or anything like that
> which could explain the difference? Or , maybe I should say is there
> anything I may have forgotten to do that would make opcode caching
> work more efficiently on 1.2?
>
> I want to be clear about a few things.
> 1. I am talking about pretty small numbers here. Hundreds of seconds,
> not minutes. The total overhead on my server is about 0.06-0.08 sec
> depending on the mood of the server. 1.1 is usually another 0 down at
> about 0.008 sec. 1.2 is fast but 1.1 is damn fast, which is slightly
> annoying :)
>
> 2. This is not a big problem for this application on this server but I
> do have another project where the hardware is being pushed a lot more.
> This is me learning more about optimization. I am not looking to trim
> away anything in the core to gain speed but if there is something I
> can do to help the core "boot" faster I'd like give it a try.
>
> As always, any insights shared are greatly appreciated.
>
> /Martin
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Cake 1.2 is slow (4s...)

2008-11-06 Thread teknoid

Just did a simple look up on a random page of my app (1.2 RC3, recent
nightly build)
There are three models paginated on the page limit=15 rows.
Total of 18 queries required to get all data, 2 for pagination of the
main Model (with some conditions), 16 for related models...
yes they are little selects on hasMany.
There are a couple of CSS includes from the view and a few jquery
scripts as well.
Debug = 2.

Total render time:  0.4857s

Simple windows XP PC: 2.33GHz Core Duo, ~ 2GB RAM


On Nov 6, 1:50 pm, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:
> Ziobe:
> It sounds like you are having some odd problem with that computer. I
> am sorry to say I have no idea of what could be the cause. If 1.2
> works fine on another computer, then the oldest support answer in the
> world might be the only way: reinstall.
>
> On Nov 6, 12:12 pm, Ziobe <[EMAIL PROTECTED]> wrote:
>
> > Just to say that my cakephp project is blank.
> > And even if i try to change the debug, the problem is still here
>
> Remigijus:
> CakePHP 1.2 IS a bit slower than 1.1 in the "real-app" tests I have
> done on my own (roughly 10-30%). But since the difference is more
> pronounced in more complex requests, a lot of that may be that my code
> is not optimised enough for 1.2 yet. I have one benchmark that
> disturbs me but that is best left to it's own thread.
>
> But I am not experiencing anything like what you describe. A simple
> blog-like app I built by taking a chainsaw to the code for the bakery
> is online (http://pensive.eimermusic.com/) with debug @ 1 and it is
> usually rendering in less than 0.05 sec. And that is still on RC2 (=
> the reportedly slow version) and not RC3.
>
> FYI: It is on a single server (core duo2 2.33GHz, 2GB RAM sata
> raid10... nothing special) running mysql5, apache2 and php5 from
> Ubuntu's standard packages. eAccelerator is active but I have not done
> much else to optimize apache/php.
>
> I am only detailing this to give you something to compare to. That
> server is a home-built garage-server that should be comparable to any
> normal computer.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: Add-on Domain w/ Cakephp

2008-11-06 Thread Kyle Decot

Thanks worked perfectly

On Nov 4, 10:09 am, cjsharp1 <[EMAIL PROTECTED]> wrote:
> I had a similiar issue when setting up a subdomain. What Adam is
> saying is the correct code, but just remember to add the rewrite rule.
>
> Here is what I had to do in my primary .htaccess file:
>
> 
>         RewriteEngine on
>         RewriteCond %{HTTP_HOST} subdomain.second-domain.com
>         RewriteRule subdomain/ - [L]
>
>         RewriteEngine on
>         RewriteRule    ^$ app/webroot/    [L]
>         RewriteRule    (.*) app/webroot/$1 [L]
> 
>
> On Nov 4, 7:34 am, Adam Royle <[EMAIL PROTECTED]> wrote:
>
> > Haven't tried this, but I'm guessing something like this... ignoring
> > your second-domain.com in the primary site's .htaccess
>
> > rewritecond %{http_host} !^(www)?\.second-domain\.com
>
> > On Nov 4, 4:37 pm, Kyle Decot <[EMAIL PROTECTED]> wrote:
>
> > > I have a CakePHP app installed on my primarydomain/hosting account. I
> > > want to have anadd-ondomainon the same hosting plan. I have my
> > > folders set up as follows:
>
> > > /
> > > -- .htaccess
> > > -- app
> > > -- cake
> > > -- (seconddomainfolder)
>
> > > The problem is that is when I go towww.second-domain.comigetan
> > > internal server error. I assume that this is due the the rewrite rules
> > > in the .htaccess file. What Do I need to add to this file in order to
> > > make cake not rewrite my seconddomainfolder? 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
-~--~~~~--~~--~--~---



what can I do to speed up bootstrap > beforeFilter ?

2008-11-06 Thread [EMAIL PROTECTED]

Hi,
I have been migrating an application to 1.2 and partly because of some
threads about performance and benchmarking I have done my own
comparisons. Loading up a simple login form for my app (just Auth no
ACL) 1.1 is 8-10 times faster. 1.2 quickly catches up on more complete
requests with a running session and more data.

I was wondering of there was something I could do to my application to
speed up Cake's initial overhead? I thought it might be some of my
code but the time seem to be lost between bootstrap.php and the
beforeFilter. Dropping all components does very little so I am
guessing that if any time can be saved it has to be in routing or by
some opcode caching.

My server has eAccelerator running. Is there any experience of
problems using eAccelerator (or APC) with 1.2 or anything like that
which could explain the difference? Or , maybe I should say is there
anything I may have forgotten to do that would make opcode caching
work more efficiently on 1.2?


I want to be clear about a few things.
1. I am talking about pretty small numbers here. Hundreds of seconds,
not minutes. The total overhead on my server is about 0.06-0.08 sec
depending on the mood of the server. 1.1 is usually another 0 down at
about 0.008 sec. 1.2 is fast but 1.1 is damn fast, which is slightly
annoying :)

2. This is not a big problem for this application on this server but I
do have another project where the hardware is being pushed a lot more.
This is me learning more about optimization. I am not looking to trim
away anything in the core to gain speed but if there is something I
can do to help the core "boot" faster I'd like give it a try.

As always, any insights shared are greatly appreciated.

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



Re: Tree Helper - is it fully operational?

2008-11-06 Thread adriaanb

I have the same problem. It looks like the $tree->addItemAttribute and
$tree->addTypeAttribute doesn't work in the element. If I put this in
the view where the tree gets generated it 'highlights' the first item.

I need classes on the items to decide when to expand it's children. I
got a treepath so in combination with those methods it should work.

Is the helper still working in 1.2.0.7692 RC3?

I get the children through: $this->MenuItem->children($id,
$onlyDirectChildren);

Thanks in advanced!

Adriaan

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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 presentation

2008-11-06 Thread soosa
of course!!, thats for sure :-)

On Thu, Nov 6, 2008 at 7:34 PM, teknoid <[EMAIL PROTECTED]> wrote:

>
> Btw, If it's going to be a power-point or some screen cast (or even
> write-up)... and you wouldn't mind shareing with the community, it
> might be a nice addition to cake resources...
> just a thought.
>
> On Nov 6, 10:46 am, soosa <[EMAIL PROTECTED]> wrote:
> > Awesome!
> > Thanks guys :-)
> >
> > On Thu, Nov 6, 2008 at 11:08 AM, mark_story <[EMAIL PROTECTED]>
> wrote:
> >
> > > Also recently on the documentation side of things, John has been busy
> > > adding cookbook links into the doc blocks. So when you look things up
> > > on the API you can get to the related cookbook page very easily.
> >
> > > -Mark
> >
> > > On Nov 6, 5:22 am, soosa <[EMAIL PROTECTED]> wrote:
> > > > Thanks a lot guys, i will take all your suggestions in mind, teknoid,
> i
> > > will
> > > > be using your tutorials to explain Auth in cake, by the way, thanks a
> lot
> > > > for those greate once!, Daniel Hofstetter, i finally got the PDF's to
> be
> > > > read correctly, thank you :), 703designs, indeed, bake is one of my
> > > favurite
> > > > subjects to talk about, BrendonKoz, true, the documentation in cake
> was a
> > > > problem but now its REALLY getting much better and i will be passing
> > > through
> > > > it in my presentation.
> >
> > > > Thanks again guys.
> >
> > > > On Wed, Nov 5, 2008 at 1:28 PM, BrendonKoz <[EMAIL PROTECTED]>
> > > wrote:
> >
> > > > > I also think it's worth mentioning something about documentation.
>  The
> > > > > Cake Cookbook is now an absolutely excellent resource for material,
> > > > > and I know that in some businesses people are frightened by open
> > > > > source because of lack of documentation.  Zend's manuals are
> > > > > excrutiatingly in-depth (just reading about Lucene...owch),
> > > > > CodeIgniter I've heard has good docs, etc...  Some frameworks even
> > > > > have IRC and mailing lists (Cake's Google Groups) as alternative
> ways
> > > > > to find answers.
> >
> > > > > Just a thought.  :)
> >
> > > > > On Nov 5, 12:22 pm, teknoid <[EMAIL PROTECTED]> wrote:
> > > > > > Oh, and I do second 703designs' suggestion regarding bake +
> > > > > > scaffolding. Those two alone are brilliant tools.
> >
> > > > > > On Nov 5, 11:05 am, soosa <[EMAIL PROTECTED]> wrote:
> >
> > > > > > > unfortunately the PDF files are broken, or at least this is how
> i
> > > see
> > > > > them,
> > > > > > > and actually thats what i was really looking for in terms of
> > > subjects,
> > > > > would
> > > > > > > you please try them out to assert my claims.
> >
> > > > > > > Thank you!
> >
> > > > > > > On Wed, Nov 5, 2008 at 11:42 AM, Daniel Hofstetter <
> > > [EMAIL PROTECTED]
> > > > > >wrote:
> >
> > > > > > > > Hi,
> >
> > > > > > > > > Any ideas of other subjects that might be useful to be
> > > mentioned
> > > > > over the
> > > > > > > > > above?, and may be if there is any one who did something
> like
> > > that
> > > > > in the
> > > > > > > > > past, it would be nice to share the docs or the slides of
> > > his/her
> > > > > > > > > presentation.
> >
> > > > > > > > Have a look at the slides onhttp://cakephp.org/files/, maybe
> > > they
> > > > > are
> > > > > > > > helpful for you.
> >
> > > > > > > > --
> > > > > > > > Daniel Hofstetter
> > > > > > > >http://cakebaker.42dh.com-Hidequoted 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 1.2 is slow (4s...)

2008-11-06 Thread [EMAIL PROTECTED]

Ziobe:
It sounds like you are having some odd problem with that computer. I
am sorry to say I have no idea of what could be the cause. If 1.2
works fine on another computer, then the oldest support answer in the
world might be the only way: reinstall.


On Nov 6, 12:12 pm, Ziobe <[EMAIL PROTECTED]> wrote:
> Just to say that my cakephp project is blank.
> And even if i try to change the debug, the problem is still here


Remigijus:
CakePHP 1.2 IS a bit slower than 1.1 in the "real-app" tests I have
done on my own (roughly 10-30%). But since the difference is more
pronounced in more complex requests, a lot of that may be that my code
is not optimised enough for 1.2 yet. I have one benchmark that
disturbs me but that is best left to it's own thread.

But I am not experiencing anything like what you describe. A simple
blog-like app I built by taking a chainsaw to the code for the bakery
is online (http://pensive.eimermusic.com/) with debug @ 1 and it is
usually rendering in less than 0.05 sec. And that is still on RC2 (=
the reportedly slow version) and not RC3.

FYI: It is on a single server (core duo2 2.33GHz, 2GB RAM sata
raid10... nothing special) running mysql5, apache2 and php5 from
Ubuntu's standard packages. eAccelerator is active but I have not done
much else to optimize apache/php.

I am only detailing this to give you something to compare to. That
server is a home-built garage-server that should be comparable to any
normal computer.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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-11-06 Thread Mathew

Another reason not to use redirects for missing URIs is that you could
mistakenly create what is called a "crawler trap".

A crawler trap are URLs that keep changing but keep producing the same
content. The crawler gets stuck wasting its time download the same
page, because it can't tell by the URL that the content is the same.

While good crawlers have logic to prevent this problem from happening.
Your site could be flagged as poorly structured, and commercial
crawlers will avoid indexing your content.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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-11-06 Thread Mathew

Most web crawlers won't check a 404, because of the way servers send
Http responses.

When a crawler requests a page that is missing, it first receives the
header response from the request, and it can read the response code,
content-type, and other information. The web crawler can then stop the
download of the content after it has checked the response code,
reducing the bandwidth placed on the server, and reducing time the web
crawler is spending on missing content. If a redirect response is
sent, then the crawler must make another request to the server and
will download the entire content of a page that does not reflect the
source url. The web crawler will see a 200 response code on the new
URI, download all the content, and increase the time and bandwidth
spent crawling that domain.

But I understand what your saying Brendon about it being a design
choice. I'm just not sure traversing the URL path improves the
visitors usability of the website their visiting. Once they step up to
an invalid URI they will be redirected somewhere else, which would
stop the traversal of the URL.

Here's CNN as an example.

http://edition.cnn.com/2008/POLITICS/11/06/middle.east.peace.deal/index.html
http://edition.cnn.com/2008/POLITICS/11/06/middle.east.peace.deal
http://edition.cnn.com/2008/POLITICS/11/06
http://edition.cnn.com/2008/POLITICS/11
http://edition.cnn.com/2008/POLITICS
http://edition.cnn.com/2008

While these links will produce a 404 response and display Html. A web
crawler will not download the content after it has rejected the
response code in the header of the Http response. So the most
bandwidth load placed on the server is a few bytes per bad URI.

This makes your domain crawler friendly, but a friendly crawler would
not request phantom URIs.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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-11-06 Thread BrendonKoz

It may not index a 404, but it still checks the 404.  For usability's
sake I'd still prefer to redirect than to send a 404.  Although we
were discussing bots, we have to keep the user in mind as well.  I
have personally traversed the URL path to see what may be found on
some sites, and if Safari has the feature included out of the box,
well...I'd rather present the user with something than nothing at all,
and a 404 isn't my idea of proper degredation within the path.  Either
way, it's simply a matter of personal preference.

Google was not the first search engine to incorporate robots.txt by
the way...they were the first to incorporate the rel="nofollow" and
also I think the SiteMap.xml idea.

On Nov 6, 12:05 pm, Mathew <[EMAIL PROTECTED]> wrote:
> > I'd actually say using a permanent redirect (301, I believe) to your
> > root (or that controller's index), rather than to the 404 page might
> > be a better solution.  If your users/visitors won't see it since
> > you're not linking to it, it isn't really a bad solution, and I doubt
> > you'd want any search engines indexing 404 errors in association with
> > your site/domain.  If it was a hacker, I don't think I'd send them a
> > 404 message either, I'd just redirect them...if it was a Safari user,
>
> You should not redirect unless the content has been moved. Sending the
> wrong response codes to incorrect URIs makes it difficult for web
> crawl operators to correctly crawl your site. Should a web crawl
> operator come to the conclusion that your site provides incorrect
> response codes, then they might choose to crawl it aggressively since
> the server's responses can not be trusted.
>
> Indexing bots will not index a 404 response code from the Http header.
> That response code tells the bots the URI points to no content. Bots
> will only index pages when the 404 error message is sent with a Http
> 200 response code and a text/html content-type in the header, which is
> incorrect and more of an error on the server side then a problem with
> the bot.
>
> If you send a 301/302 response code you are telling the bot, this URI
> is valid, it has been moved, now the source URI and the redirected URI
> will continue to be processed by the bot. Where as if you tell the bot
> 404, then the bot knows this URI is invalid, the source page that URI
> comes from is generating invalid URIs, and it can drop other URIs from
> that source.
>
> Sending a hacker a 301, 302 does nothing to change their behavior, and
> provides them no extra information then a 404.
>
> Blocking a remote computer from making to many invalid requests from
> your server does change the behavior of that remote computer. It stops
> it. Which is about all you can do at this point. A hacker will return
> with a different IP address, and attack. So, hackers are a completely
> different topic :)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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 presentation

2008-11-06 Thread teknoid

Btw, If it's going to be a power-point or some screen cast (or even
write-up)... and you wouldn't mind shareing with the community, it
might be a nice addition to cake resources...
just a thought.

On Nov 6, 10:46 am, soosa <[EMAIL PROTECTED]> wrote:
> Awesome!
> Thanks guys :-)
>
> On Thu, Nov 6, 2008 at 11:08 AM, mark_story <[EMAIL PROTECTED]> wrote:
>
> > Also recently on the documentation side of things, John has been busy
> > adding cookbook links into the doc blocks. So when you look things up
> > on the API you can get to the related cookbook page very easily.
>
> > -Mark
>
> > On Nov 6, 5:22 am, soosa <[EMAIL PROTECTED]> wrote:
> > > Thanks a lot guys, i will take all your suggestions in mind, teknoid, i
> > will
> > > be using your tutorials to explain Auth in cake, by the way, thanks a lot
> > > for those greate once!, Daniel Hofstetter, i finally got the PDF's to be
> > > read correctly, thank you :), 703designs, indeed, bake is one of my
> > favurite
> > > subjects to talk about, BrendonKoz, true, the documentation in cake was a
> > > problem but now its REALLY getting much better and i will be passing
> > through
> > > it in my presentation.
>
> > > Thanks again guys.
>
> > > On Wed, Nov 5, 2008 at 1:28 PM, BrendonKoz <[EMAIL PROTECTED]>
> > wrote:
>
> > > > I also think it's worth mentioning something about documentation.  The
> > > > Cake Cookbook is now an absolutely excellent resource for material,
> > > > and I know that in some businesses people are frightened by open
> > > > source because of lack of documentation.  Zend's manuals are
> > > > excrutiatingly in-depth (just reading about Lucene...owch),
> > > > CodeIgniter I've heard has good docs, etc...  Some frameworks even
> > > > have IRC and mailing lists (Cake's Google Groups) as alternative ways
> > > > to find answers.
>
> > > > Just a thought.  :)
>
> > > > On Nov 5, 12:22 pm, teknoid <[EMAIL PROTECTED]> wrote:
> > > > > Oh, and I do second 703designs' suggestion regarding bake +
> > > > > scaffolding. Those two alone are brilliant tools.
>
> > > > > On Nov 5, 11:05 am, soosa <[EMAIL PROTECTED]> wrote:
>
> > > > > > unfortunately the PDF files are broken, or at least this is how i
> > see
> > > > them,
> > > > > > and actually thats what i was really looking for in terms of
> > subjects,
> > > > would
> > > > > > you please try them out to assert my claims.
>
> > > > > > Thank you!
>
> > > > > > On Wed, Nov 5, 2008 at 11:42 AM, Daniel Hofstetter <
> > [EMAIL PROTECTED]
> > > > >wrote:
>
> > > > > > > Hi,
>
> > > > > > > > Any ideas of other subjects that might be useful to be
> > mentioned
> > > > over the
> > > > > > > > above?, and may be if there is any one who did something like
> > that
> > > > in the
> > > > > > > > past, it would be nice to share the docs or the slides of
> > his/her
> > > > > > > > presentation.
>
> > > > > > > Have a look at the slides onhttp://cakephp.org/files/, maybe
> > they
> > > > are
> > > > > > > helpful for you.
>
> > > > > > > --
> > > > > > > Daniel Hofstetter
> > > > > > >http://cakebaker.42dh.com-Hidequoted 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
-~--~~~~--~~--~--~---



including CSS through PHP

2008-11-06 Thread Josey

Here's an interesting problem I've run into that I hope somebody may
have seen before.

I'm wanting to include a php file that acts as a CSS file so that I
can create variables inside of it for more flexibility in my
stylesheet.

I've done this several times before, but not with CakePHP.

The problem comes when I include my main stylesheet in the PHP. The
spacing changes without cause.

If I link to main.css via the cakephp method ( echo $this-
>css(array('main')) ) it works just fine.
If I create a manual xhtml link () and disable the cake call again
it works fine.

But when I link to container.css.php through 
and inside container.css.php I have:



Everything displays so I know it's finding the file but the flow
breaks.
I haven't been able to tell if its all or just some of the properties
(margin, line-height, padding) but it just doesn't display correctly.

Has anybody else run into this problem?

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: Enhancements to cakephp testing and code coverage

2008-11-06 Thread Daniel Hofstetter

Hi,

> I have been using cakephp for a while, and I have made some updates to
> the cakephp testing and code coverage framework which I would like to
> submit for review. If there is a better way to achieve this, or this
> already exists in cakephp, I would be grateful if someone can send me
> pointers.

It's probably best to open an enhancement ticket for it on
https://trac.cakephp.org/timeline

Hope that helps!

--
Daniel Hofstetter
http://cakebaker.42dh.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
-~--~~~~--~~--~--~---



Loosing passed arguments after validation and redirection to show errors

2008-11-06 Thread Home Boy Howy

Hi there all,
I have a conundrum in CakePHP. Not hard to do for a newbie like me.
I am trying to do a simple "Send the page to a Friend" form so I can
use it anywhere on the site. The form is loaded via AJAX in a "pop-up"
layer. I thought I could achieve this by just grabbing the URL for the
current page and pass it to a view with a form and have the URL get
set as a hidden input. This hidden input would then get sent with the
email addresses and message, etc. It seemed the easiest way would be
to create a table-less Model and Controller that handled this type of
contact whose sole function was to send of an email. Well, I found out
that passing full URLS to a controller function wasn't so easy, but I
did figure out how to grab all the passed arguments and use them in
the controller to form the URL. This is working fine when the "send"
form first loads, but these passed arguments get lost if validation
fails and form reloads. I just can't think of how to solve this.
Here is my code

Model:
class Contact extends AppModel {
var $name = 'Contact';
var $useTable = false;

var $_schema = array(
'sendUrl' => 
array('type'=>'string', 'length'=>200),
'to' => array('type'=>'string', 'length'=>150),
'from' => array('type'=>'string', 'length'=>150),
'from_name' => array('type'=>'string', 'length'=>100),
'message'   =>array('type'=>'text')
);

var $validate = array(
//'sendUrl' => VALID_NOT_EMPTY,
'to' => array('rule' => array('email', 
true), 'message' =>
'Please enter a valid email address.'),
'from' => array('rule' => 
array('email', true), 'message' =>
'Please enter a valid email address.'),
'from_name' => 
array('rule'=>array('minLength', 1),
'message'=>'Your name is required' )
);

}


Controller:
function send_page() {
$this->layout = "contacts";
if (!empty($this->data)) {
$this->data['Contact']['sendUrl'] = 
urlencode("http://
www.pacificfoods.com/".join($this->passedArgs, '/'));
$this->Contact->set($this->data);
if ($this->Contact->validates()) {
if( 
$this->_sendPageMail($this->data) ) {

$this->Session->setFlash('The page url was sent successfully.
Thanks for spreading the word.', true);
} else {

$this->Session->setFlash('Sorry, there was an error trying to
send the email. Please try again later.', true);
}
} else {

$this->data['Contact']['sendUrl'] = urlencode("http://
www.mydomain.com/".join($this->passedArgs, '/'));
$this->render('send_page', 
'ajax');
}
} else {
$this->data['Contact']['sendUrl'] = 
urlencode("http://
www.mydomain.com/".join($this->passedArgs, '/'));
$this->render('send_page', 'ajax');
}
}

View:
flash() ?>
create('Contact', array('url' => '/contacts/
send_page', 'id' => 'sendpage-form')) ?>
hidden('sendUrl'),
$form->input('to', array('label' => 
"Friend’s
Email",'between' => '', 'tabindex' => '2')),
$form->input('from', array('label' => 
'Your Email', 'between' =>
'', 'tabindex' => '3')),
$form->input('from_name', array('label' 
=> 'Your Name', 'between'
=> '', 'tabindex' => '4')),
$form->input('message', array(
'type' => 'textarea',
'between' => '',
'tabindex' => '5',
'label' => 'Message'));
echo $html->link('close', 'javascript:void(0)', array('id' =>
'formclose','class' => "jqmClose"));
echo $form->submit('SEND');
echo $form->end();
?>

Link calling the view:
link('Send this Page',

'/contacts/send_page/'.$pgurl,

array('

Re: Undesired Recursion in Models

2008-11-06 Thread Renesistemic

Adam,

Thanks for the reply. I've read up on containable and had actually
already begun implementing that behavior in certain locations
throughout the application. While I can definitely see the performance
gains in properly applying that behavior before calling Find(), I'm
still a little weary about the actual setup I have in place for
models.

On a different CakePHP framework that I'm running, if I dump the $this
variable in the app_controller file, I might get something like
this...

[User] = array {
  [uses]
  [behaviors]
  [Posts] = array {
[Replies]
  }
  [Comments]
}

On the site that I'm currently troubleshooting, the output of the same
controller might display something like this...

[User] = array {
  [uses]
  [behaviors]
  [Posts] = array {
* RECURSIVE
[Replies] = array {
** RECURSIVE
  [Posts] = array {
  }
}
  }
  [Comments]
}

That doesn't raise any flags or suggest there might be errors in the
relationships I've built for my models?

Thanks again for the prior advice.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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-11-06 Thread Mathew

> I'd actually say using a permanent redirect (301, I believe) to your
> root (or that controller's index), rather than to the 404 page might
> be a better solution.  If your users/visitors won't see it since
> you're not linking to it, it isn't really a bad solution, and I doubt
> you'd want any search engines indexing 404 errors in association with
> your site/domain.  If it was a hacker, I don't think I'd send them a
> 404 message either, I'd just redirect them...if it was a Safari user,

You should not redirect unless the content has been moved. Sending the
wrong response codes to incorrect URIs makes it difficult for web
crawl operators to correctly crawl your site. Should a web crawl
operator come to the conclusion that your site provides incorrect
response codes, then they might choose to crawl it aggressively since
the server's responses can not be trusted.

Indexing bots will not index a 404 response code from the Http header.
That response code tells the bots the URI points to no content. Bots
will only index pages when the 404 error message is sent with a Http
200 response code and a text/html content-type in the header, which is
incorrect and more of an error on the server side then a problem with
the bot.

If you send a 301/302 response code you are telling the bot, this URI
is valid, it has been moved, now the source URI and the redirected URI
will continue to be processed by the bot. Where as if you tell the bot
404, then the bot knows this URI is invalid, the source page that URI
comes from is generating invalid URIs, and it can drop other URIs from
that source.

Sending a hacker a 301, 302 does nothing to change their behavior, and
provides them no extra information then a 404.

Blocking a remote computer from making to many invalid requests from
your server does change the behavior of that remote computer. It stops
it. Which is about all you can do at this point. A hacker will return
with a different IP address, and attack. So, hackers are a completely
different topic :)

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: Multiple HABTM levels produces duplicate entries.

2008-11-06 Thread Finster

Have not tried latest svn, but I am running RC3 now.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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 Cakephp 1.2 faster than Code Igniter ?

2008-11-06 Thread teknoid

There are a few other issues to consider...

For example the learning curve. To get to know CakePHP on an intimate
level you'll probably need 3-6 months of solid development, depending
on ones ability to learn and previous experience with PHP and OO, of
course. After spending more than 1.5 years of developing with CakePHP
almost daily, (I'd like to think :))  it's possible for most to build
an app with the features I've described above in a matter of a 1-2
weeks (5-8 hrs a day).

Secondly, how well does a framework protect you from doing things the
wrong way?
CodeIgniter is more "open" and many people claim it has a much easier
learning curve, which may very well be true... but is learning curve
lower, because some poor, old habits and can be implemented faster?
(i.e. take some old/bad code and quickly port it to CI).

There's a lot to consider in a fair presentation of a framework's
environment, but considering you're doing a science masters thesis, I
do hope you come with the mindset on how to approach it.

Certainly wish you the best in this endeavor.

On Nov 6, 10:01 am, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:
> On 5 marras, 19:34, BrendonKoz <[EMAIL PROTECTED]> wrote:
>
> > Another issue with benchmarking is that when dealing with OOP, or any
> > code in PHP, TMTOWTDI (There's More Than One Way To Do It)...  So, to
> > properly benchmark any framework, one would have to know each
> > framework inside and out to take advantage of all the tricks to
> > increase performance when necessary, and increase development time
> > when not necessary.
>
> > This is one of the major issues that many framework performance
> > testers have found...they don't know their frameworks as best as
> > possible, or may know one to a varying degree more than another and
> > not make as many "allowable mistakes" in one over another.  It's hard
> > to get a true non-bias performance test, even if you're trying really
> > hard.  ;)
>
> That is true. However I'm going to use each frameworks helpers and
> components when available. That way I'll find how significant the
> trade-off between shorter development time and system performance is?
>
> -Kalle
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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 maven for deployment

2008-11-06 Thread Smelly_Eddie

Bob:

Have you made nay progress on this.  Thinking about it got me very
excited.

I am very new to Maven itself, but I have begun looking into creating
pom files for CakePHP.

I don't want to reinvent the wheel though if your already moving
forward.

Eddie

On Oct 10, 10:12 am, Bob Mattax <[EMAIL PROTECTED]> wrote:
> Has anyone experimented with usingmavento bundle their website, and
> accumulate dependencies?
>
> I'm being asked to do so for our website, as all our other projects
> are integrated into this deployment strategy.
>
> 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 Cakephp 1.2 faster than Code Igniter ?

2008-11-06 Thread teknoid

Sure, administrative interface might be extra... but again it comes
down to the way you plan to measure performance.
I believe that admin interface, is an integral post of a vast majority
of mature web apps.

With CakePHP's admin routing and Auth, such can build fairly painless
and quickly.
How long would it take you to build one if such facility is not
provided?
Does that matter in the way performance is measured? IMO, it is... but
again, that depends on your criteria.


On Nov 6, 9:54 am, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:
> > How are you going to measure the performance?
>
> > The time it takes to process a request?
> > The time it takes to develop?
> > Are you going to implement caching?
> > Are you going to try multiple datasources (of various types)?
>
> I realize that performance is a complicated issue. I'm currently
> finding out about different performance testing methods. I'm also
> going to compare features of frameworks and I'm going to measure
> development time and other factors while coding test application with
> each of the frameworks.
>
> I'll propably run performance tests both with and without caching.
> Propably only datasource will be MySQL-database.
>
>
>
> > IMO, a real-world app should have the following features:
> > - User registration
> > - Authentication
> > - Database interaction
> > - At least 5 models, which cover various types of associations
> > - Data validation
> > - Security
> > - Session management
> > - Web service API (at least provisioning)
> > - Administrative interface
>
> I'm thinking along the same lines, except I'm not sure if
> administrative interface is essential when comparing performance.
>
> -Kalle
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: basic site concept

2008-11-06 Thread dr. Hannibal Lecter

Hi Clint,

Of course you can have as many controllers as you need. Since you're
not familiar with Cake yet, maybe the best thing to do is to learn by
reading some code, just go through some of these applications:

http://book.cakephp.org/view/511/Applications
http://cakeforge.org/top/mostactive.php

and try to figure out how they work (with the assumption that you're
already familiar with regular PHP).

Welcome to cake family! ;)

On Nov 6, 4:30 pm, justclint <[EMAIL PROTECTED]> wrote:
> Thank you so much Anja and dr. Hannibal. This helps me very much. As
> you described dr. Hannibal your not sure why I would want many apps
> for what Im doing and nor do I. So having you confirm that I can do
> all this in a single cake folder is a relief.
>
> So I guess than its true to say that I can have one app folder and I
> can just keep adding as many controllers, models and views as I
> please.
>
> I really do appreciate your help here.
>
> Thanks again!
>
> Clint
>
> On Nov 6, 2:02 am, "dr. Hannibal Lecter" <[EMAIL PROTECTED]> wrote:
>
> > I'm not sure why would you want many apps for what you've described.
> > Your "products section" would actually be ProductsController and
> > Product model, your "search" and "download" functionality are just
> > SearchController and DownloadsController and their respective models
> > and views etc..
>
> > Normally, a single app is enough for all your needs. Even if it isn't,
> > you can still use cake plugins..
>
> > Hope that helps!
>
> > On Nov 6, 8:40 am, justclint <[EMAIL PROTECTED]> wrote:
>
> > > Hello all, thanks for having this group available for newbies like
> > > myself. I have a pretty basic question that Im having a very difficult
> > > time finding an answer on. I've done google searches, read the cakephp
> > > manual and I am also reading the book "Beginning CakePHP" by David
> > > Golding which is a great book by the way.
>
> > > Any way I've never used a framework before and Im totally new to the
> > > MVC concept. Ive done a couple tutorials such as the blog and also a
> > > to-do list. I have a site I will be converting over to cakephp and
> > > want to make sure I am using best practices and that I understand the
> > > basic concept.
>
> > > So my question is; if Im building a whole website, is the whole
> > > website a "cakephp app" or does my whole website have many "cakephp
> > > apps"?
>
> > > Through my reading it seems every tutorial is based on just a piece of
> > > a website (ie: blog) and every tutorial required a new cake folder
> > > with the usual contents (app, controllers, views, webroot etc.).
>
> > > I need to make a single typical website with the usual stuff like
> > > products section, support section with search/download functionality
> > > and contact/request forms.
>
> > > Im not sure if each one of these things are supposed to be different
> > > apps or if the whole site is in one app. It seems a bit cumbersome to
> > > keep adding cake folders over and over on a single site but nothing
> > > Ive read says otherwise. Also, If you are supposed to keep adding cake
> > > folder after cake folder you would endup with multiple webroot folders
> > > which also kinda of boggles my mind.
>
> > > Your help is greatly appreciated and I do apologize for having such a
> > > primitive question but I have no where else to go but here.
>
> > > Thanks again!
>
> > > Cheers,
>
> > > Clint
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: SELECT DISTINCT using find('list')

2008-11-06 Thread teknoid

find('list') requires to fields, because it is used to build a select
drop down (with value being the id, and option the name usually).
You probably need find('all') + Set::extract() ... depending on what
you need really.

On Nov 6, 10:44 am, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:
> Hello guys,
>
> I need a "distinct" list of items, so that I tried to set this up
> using the following code, but it's not working:
>
> $list = $this->Model->find('list',array('fields' => 'DISTINCT
> `Model`.`field`', 'conditions' => array("Model.field2 !=
> '-1'"),'order' => 'Model.order ASC'));
>
> Unfortunately the result query is this:
>
> SELECT `Model`.`field`, DISTINCT `Model`.`field` FROM `models` AS
> `Model` WHERE `Model`.`field2` != '-1' ORDER BY `Model`.`order` ASC
>
> Which is not what I need, there's an extra `Model`.`field`, that
> breaks the query. Do you have an idea of how to get the results I'm
> looking for?
>
> 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: Finds: Contain vs. Unbind-on-the-fly

2008-11-06 Thread teknoid

Can you show your use of containable?
I think something might be amiss...

On Nov 5, 6:21 pm, Brenton B <[EMAIL PROTECTED]> wrote:
> After a bit of digging setting the 'recursive' property in the model
> _partially_ solves this:
> var $actsAs = array('Containable' => array('recursive' => false));
>
> However, obviously won't help where some items need a 2nd or 3rd
> level.
>
> So I guess it comes back to: is there any way to be model-specific for
> recursion?
>
> On Nov 5, 2:54 pm, Brenton B <[EMAIL PROTECTED]> wrote:
>
> > That's the problem with 'contain' though ... even if I do use a hasOne
> > bind, 'contain' will still do extra queries.
> > In the example I mentioned, it will retrieve everything properly in 1
> > big query, but then it'll go back again and find the models listed in
> > 'contain'.
> > On a default page of 20 records (since I'm doing pagination), where
> > each record has 4 extra models to find you're looking at 80 extra
> > unnecessary db hits ... multiply that by X users view the page and
> > you're looking at a lot of unnecessary queries. Sure it's just
> > milliseconds, but still quite concerning.
>
> > On Nov 5, 2:48 pm, teknoid <[EMAIL PROTECTED]> wrote:
>
> > > JOINS are only built for hasOne and belongsTo relationships.
> > > A bunch of little selects will not harm your DB (how many milliseconds
> > > do those queries take?)
>
> > > Are you displaying some list on the page? Maybe paginate is in order
> > > for this case?
>
> > > All that being said, if you are not happy with that and prefer a long
> > > JOIN query, you can always "trick" cake into building one, by using a
> > > temporary hasOne bind.
>
> > > On Nov 5, 5:08 pm, Brenton B <[EMAIL PROTECTED]> wrote:
>
> > > > What might also help is a way to include recursion on only certain
> > > > associations - which can be done with 'contain', but again, 'contain'
> > > > is doing more db queries than it needs to.
>
> > > > On Nov 5, 11:38 am, Brenton B <[EMAIL PROTECTED]> wrote:
>
> > > > > This is getting quite confusing/frustrating ...
>
> > > > > If I use 'contain' it's the equivalent of using 'unbind' (on the fly)
> > > > > on everything not listed in 'contain' (as described in the Cookbook);
> > > > > however, if I use 'contain', it seems to actually execute an extra
> > > > > query to get that corresponding information, regardless of association
> > > > > type.
>
> > > > > For example, list of members with countries (belongsTo), provinces
> > > > > (belongsTo), plus a whole bunch of other stuff: webpages, interests,
> > > > > etc.
>
> > > > > If I'm doing a listing, I just want name, country, and province, so I
> > > > > can either do unbind on everything I don't need, or use 'contain' on
> > > > > the things I do need  'contain' is the logical choice.
> > > > > The resulting query does a LEFT JOIN on countries and provinces just
> > > > > fine, but it ALSO does an extra query for every single country_id and
> > > > > province_id to get the name. So on a big long list I'm getting quite a
> > > > > few extra database hits.
>
> > > > > Is this supposed to do this? Because it goes against the Cookbook's
> > > > > comment of "Using Containable will help you cut down on needless wear
> > > > > and tear on your database".
>
> > > > > (This gets slightly worse once I go a level 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: Search Engine Bots Generating Strange Queries

2008-11-06 Thread BrendonKoz

I'd actually say using a permanent redirect (301, I believe) to your
root (or that controller's index), rather than to the 404 page might
be a better solution.  If your users/visitors won't see it since
you're not linking to it, it isn't really a bad solution, and I doubt
you'd want any search engines indexing 404 errors in association with
your site/domain.  If it was a hacker, I don't think I'd send them a
404 message either, I'd just redirect them...if it was a Safari user,
I'd rather give them a graceful degredation than a 404 just as well.
That's just me though.

Standard incorrect addresses should still receive a 404.  A 404 does
serve a very important purpose.

On Nov 6, 9:00 am, Mathew <[EMAIL PROTECTED]> wrote:
> Hi Mike,
>
> If your using Apache it has some features in the htaccess file that
> will allow you to disable access to your server for bots causing you
> trouble.
>
> In your Cake 404 display page keep track of the number of times a 404
> is generated per IP address, and if it exceeds a threshold log that IP
> address to a text file.
>
> Humans browsing a website will not generate many 404 messages, even if
> they have bad bookmarks, or follow old links from search engines. So
> an IP address requesting more then one hundred 404 errors is likely a
> problem bot. Each time a 404 page is display log the IP to a database
> with a counter. When the counter reaches your limit add that IP
> address to a text file.
>
> In your .htaccess you can load this text file of IP addresses and
> apply rules to those addresses. It's up to you if you wish to display
> a static access denied Html page, or simply throw a connection
> refused.
>
> Sorry I don't remember the commands for the htaccess file.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: Linking back to the CakePHP site ...

2008-11-06 Thread BrendonKoz

Two things: If you want to keep the site in debug mode, I'd at least
suggest hiding the SQL queries with CSS.  (.cake-sql-log
{ display:none; } )...also, you're already linking back to www.cakephp.org
with the "CakePHP | Power" badge that comes with the default template
files.  I'm no official, but I don't see why that would be a problem
for you to use that image and link.  It's included by default in the
package itself and I'm sure the developers know that many people
simply use CakePHP as a simple scaffolding application with little to
no tweaking of the original code (whether it's good to do or not).
Just my $0.02.  :)

On Nov 5, 10:33 pm, Rob <[EMAIL PROTECTED]> wrote:
> I'd like to place a link back to the CakePHP site on my project pages,
> and I can't seem to locate anything that tells me whether it is OK to
> use any of the images on the site, or what the link back would look
> like.
>
> I posed this on the IRC channel and they suggested I post here so that
> perhaps gwoo or somebody would have an answer.
>
> I created a project on SourceForge to hold the code I created for
> volunteer signups for the Livermore Community Thanksgiving Dinner.
> SourceForge has a page that gives you HTML snippets to use on the
> pages you host there, which they require you to use.
>
> Some sites have branding requirements to meet, and others simply don't
> want you to use certain images.
>
> I'd love to be able to add a nice image back to the CakePHP home page
> and/or contributions page, but I want to follow any rules y'all might
> have around doing so.
>
> My site is athttp://volunteercake.sf.net
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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
-~--~~~~--~~--~--~---



SELECT DISTINCT using find('list')

2008-11-06 Thread [EMAIL PROTECTED]

Hello guys,

I need a "distinct" list of items, so that I tried to set this up
using the following code, but it's not working:

$list = $this->Model->find('list',array('fields' => 'DISTINCT
`Model`.`field`', 'conditions' => array("Model.field2 !=
'-1'"),'order' => 'Model.order ASC'));

Unfortunately the result query is this:

SELECT `Model`.`field`, DISTINCT `Model`.`field` FROM `models` AS
`Model` WHERE `Model`.`field2` != '-1' ORDER BY `Model`.`order` ASC

Which is not what I need, there's an extra `Model`.`field`, that
breaks the query. Do you have an idea of how to get the results I'm
looking for?

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: Getting DB entries based on an array of id's...

2008-11-06 Thread Anupom
This should work,
$this->set('bookmarkdata',   $this->Image->find('all', 'conditions' =>
array('id'  => $bookmarklist) ) );

On Thu, Nov 6, 2008 at 9:02 PM, wallerdm <[EMAIL PROTECTED]> wrote:

>
> Dear All,
>
> Just a quick question really (hopefully).
>
> I have a load of images stored in a table, each with an ID. Users can
> choose to bookmark images and this is also stored in a table:
>
> --Users
> id - INT
> username - VARCHAR
>
> --Images
> id - INT
> title - VARCHAR
> url - VARCHAR
>
> --Bookmarks
> id - INT
> user_id - INT
> image_id - INT
>
> I now have all of my models set up, including all of the
> relationships, and have all of the data reading correctly. What I'm
> trying to do now is list (as part of the Users controller) all of the
> image titles that they have bookmarked.
>
> My users controller now has an array that contains the id's of all the
> bookmarked images and I now want to get the data for the images that
> have been bookmarked but the "find" request has stumped me.
>
> class UsersController extends AppController {
>var $name = 'Users';
>var $uses = array('User','Image');
>var $helpers = array('Html', 'Form');
>
>function view($id=null){
>$this->set('userdata', $this->User->findById($id));
>$temp = $this->User->findById($id);
>$bookmarklist = array();
>foreach($temp['Bookmark'] as $bookmark){
>$bookmarklist[] = $bookmark['image_id'];
>}
>$this->set('bookmarkdata', $this->Image->find(ARGHHH, WHAT
> GOES HERE));
>}
> }
>
> I hope I've explained myself okay. Any help is greatly appreciated.
>
> Thanks,
>
> Dave.
> >
>


-- 
Anupom Syam
http://syamantics.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: CakePHP presentation

2008-11-06 Thread soosa
Awesome!
Thanks guys :-)

On Thu, Nov 6, 2008 at 11:08 AM, mark_story <[EMAIL PROTECTED]> wrote:

>
> Also recently on the documentation side of things, John has been busy
> adding cookbook links into the doc blocks. So when you look things up
> on the API you can get to the related cookbook page very easily.
>
> -Mark
>
> On Nov 6, 5:22 am, soosa <[EMAIL PROTECTED]> wrote:
> > Thanks a lot guys, i will take all your suggestions in mind, teknoid, i
> will
> > be using your tutorials to explain Auth in cake, by the way, thanks a lot
> > for those greate once!, Daniel Hofstetter, i finally got the PDF's to be
> > read correctly, thank you :), 703designs, indeed, bake is one of my
> favurite
> > subjects to talk about, BrendonKoz, true, the documentation in cake was a
> > problem but now its REALLY getting much better and i will be passing
> through
> > it in my presentation.
> >
> > Thanks again guys.
> >
> > On Wed, Nov 5, 2008 at 1:28 PM, BrendonKoz <[EMAIL PROTECTED]>
> wrote:
> >
> > > I also think it's worth mentioning something about documentation.  The
> > > Cake Cookbook is now an absolutely excellent resource for material,
> > > and I know that in some businesses people are frightened by open
> > > source because of lack of documentation.  Zend's manuals are
> > > excrutiatingly in-depth (just reading about Lucene...owch),
> > > CodeIgniter I've heard has good docs, etc...  Some frameworks even
> > > have IRC and mailing lists (Cake's Google Groups) as alternative ways
> > > to find answers.
> >
> > > Just a thought.  :)
> >
> > > On Nov 5, 12:22 pm, teknoid <[EMAIL PROTECTED]> wrote:
> > > > Oh, and I do second 703designs' suggestion regarding bake +
> > > > scaffolding. Those two alone are brilliant tools.
> >
> > > > On Nov 5, 11:05 am, soosa <[EMAIL PROTECTED]> wrote:
> >
> > > > > unfortunately the PDF files are broken, or at least this is how i
> see
> > > them,
> > > > > and actually thats what i was really looking for in terms of
> subjects,
> > > would
> > > > > you please try them out to assert my claims.
> >
> > > > > Thank you!
> >
> > > > > On Wed, Nov 5, 2008 at 11:42 AM, Daniel Hofstetter <
> [EMAIL PROTECTED]
> > > >wrote:
> >
> > > > > > Hi,
> >
> > > > > > > Any ideas of other subjects that might be useful to be
> mentioned
> > > over the
> > > > > > > above?, and may be if there is any one who did something like
> that
> > > in the
> > > > > > > past, it would be nice to share the docs or the slides of
> his/her
> > > > > > > presentation.
> >
> > > > > > Have a look at the slides onhttp://cakephp.org/files/, maybe
> they
> > > are
> > > > > > helpful for you.
> >
> > > > > > --
> > > > > > Daniel Hofstetter
> > > > > >http://cakebaker.42dh.com-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
-~--~~~~--~~--~--~---



AW: basic site concept

2008-11-06 Thread Liebermann, Anja Carolin

Hi Clint,

You are right. If you don't want to reuse applications you can do that way. 
Even if you do want to reuse them it might work, dependihg on relations between 
them.

Anja

-Ursprüngliche Nachricht-
Von: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] Im Auftrag von 
justclint
Gesendet: Donnerstag, 6. November 2008 16:31
An: CakePHP
Betreff: Re: basic site concept


Thank you so much Anja and dr. Hannibal. This helps me very much. As you 
described dr. Hannibal your not sure why I would want many apps for what Im 
doing and nor do I. So having you confirm that I can do all this in a single 
cake folder is a relief.

So I guess than its true to say that I can have one app folder and I can just 
keep adding as many controllers, models and views as I please.

I really do appreciate your help here.

Thanks again!

Clint

On Nov 6, 2:02 am, "dr. Hannibal Lecter" <[EMAIL PROTECTED]> wrote:
> I'm not sure why would you want many apps for what you've described.
> Your "products section" would actually be ProductsController and 
> Product model, your "search" and "download" functionality are just 
> SearchController and DownloadsController and their respective models 
> and views etc..
>
> Normally, a single app is enough for all your needs. Even if it isn't, 
> you can still use cake plugins..
>
> Hope that helps!
>
> On Nov 6, 8:40 am, justclint <[EMAIL PROTECTED]> wrote:
>
> > Hello all, thanks for having this group available for newbies like 
> > myself. I have a pretty basic question that Im having a very 
> > difficult time finding an answer on. I've done google searches, read 
> > the cakephp manual and I am also reading the book "Beginning 
> > CakePHP" by David Golding which is a great book by the way.
>
> > Any way I've never used a framework before and Im totally new to the 
> > MVC concept. Ive done a couple tutorials such as the blog and also a 
> > to-do list. I have a site I will be converting over to cakephp and 
> > want to make sure I am using best practices and that I understand 
> > the basic concept.
>
> > So my question is; if Im building a whole website, is the whole 
> > website a "cakephp app" or does my whole website have many "cakephp 
> > apps"?
>
> > Through my reading it seems every tutorial is based on just a piece 
> > of a website (ie: blog) and every tutorial required a new cake 
> > folder with the usual contents (app, controllers, views, webroot etc.).
>
> > I need to make a single typical website with the usual stuff like 
> > products section, support section with search/download functionality 
> > and contact/request forms.
>
> > Im not sure if each one of these things are supposed to be different 
> > apps or if the whole site is in one app. It seems a bit cumbersome 
> > to keep adding cake folders over and over on a single site but 
> > nothing Ive read says otherwise. Also, If you are supposed to keep 
> > adding cake folder after cake folder you would endup with multiple 
> > webroot folders which also kinda of boggles my mind.
>
> > Your help is greatly appreciated and I do apologize for having such 
> > a primitive question but I have no where else to go but here.
>
> > Thanks again!
>
> > Cheers,
>
> > Clint


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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
-~--~~~~--~~--~--~---



[no subject]

2008-11-06 Thread Scott McLaughlin

unsubscribe


  

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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:

2008-11-06 Thread Gonzalo Servat
On Thu, Nov 6, 2008 at 1:03 PM, Scott McLaughlin <[EMAIL PROTECTED]>wrote:

>
> unsubscribe
>

As you can see on every single post that hits the list, the way to
unsubscribe is:

To unsubscribe from this group, send email to
> [EMAIL PROTECTED]<[EMAIL PROTECTED]>
> For more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

- 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: basic site concept

2008-11-06 Thread justclint

Thank you so much Anja and dr. Hannibal. This helps me very much. As
you described dr. Hannibal your not sure why I would want many apps
for what Im doing and nor do I. So having you confirm that I can do
all this in a single cake folder is a relief.

So I guess than its true to say that I can have one app folder and I
can just keep adding as many controllers, models and views as I
please.

I really do appreciate your help here.

Thanks again!

Clint

On Nov 6, 2:02 am, "dr. Hannibal Lecter" <[EMAIL PROTECTED]> wrote:
> I'm not sure why would you want many apps for what you've described.
> Your "products section" would actually be ProductsController and
> Product model, your "search" and "download" functionality are just
> SearchController and DownloadsController and their respective models
> and views etc..
>
> Normally, a single app is enough for all your needs. Even if it isn't,
> you can still use cake plugins..
>
> Hope that helps!
>
> On Nov 6, 8:40 am, justclint <[EMAIL PROTECTED]> wrote:
>
> > Hello all, thanks for having this group available for newbies like
> > myself. I have a pretty basic question that Im having a very difficult
> > time finding an answer on. I've done google searches, read the cakephp
> > manual and I am also reading the book "Beginning CakePHP" by David
> > Golding which is a great book by the way.
>
> > Any way I've never used a framework before and Im totally new to the
> > MVC concept. Ive done a couple tutorials such as the blog and also a
> > to-do list. I have a site I will be converting over to cakephp and
> > want to make sure I am using best practices and that I understand the
> > basic concept.
>
> > So my question is; if Im building a whole website, is the whole
> > website a "cakephp app" or does my whole website have many "cakephp
> > apps"?
>
> > Through my reading it seems every tutorial is based on just a piece of
> > a website (ie: blog) and every tutorial required a new cake folder
> > with the usual contents (app, controllers, views, webroot etc.).
>
> > I need to make a single typical website with the usual stuff like
> > products section, support section with search/download functionality
> > and contact/request forms.
>
> > Im not sure if each one of these things are supposed to be different
> > apps or if the whole site is in one app. It seems a bit cumbersome to
> > keep adding cake folders over and over on a single site but nothing
> > Ive read says otherwise. Also, If you are supposed to keep adding cake
> > folder after cake folder you would endup with multiple webroot folders
> > which also kinda of boggles my mind.
>
> > Your help is greatly appreciated and I do apologize for having such a
> > primitive question but I have no where else to go but here.
>
> > Thanks again!
>
> > Cheers,
>
> > Clint
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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
-~--~~~~--~~--~--~---



Enhancements to cakephp testing and code coverage

2008-11-06 Thread Catch22

Hello,

I have been using cakephp for a while, and I have made some updates to
the cakephp testing and code coverage framework which I would like to
submit for review. If there is a better way to achieve this, or this
already exists in cakephp, I would be grateful if someone can send me
pointers.

Changes included in the patch
- Add test hook functions to email sending, Session flash display and
page redirection to enable asserting these operations in the test
suite.

- Remove caching of DB schema during test suite execution. Without
this test suite fails when there are many models & controllers that
use different fixtures

- Enhancements to allow code coverage when executing group test cases,
specifically ALL
   test cases, and provide a clickable file list for code coverage
summary.

- Enable code coverage tracking only while running the actual test
cases, instead of all code.
   Reason: Much quicker execution test suite execution with coverage.

Also is there a good way of checking is the test suite is running as
opposed to real code? I have noticed in different places where they
check the url for the pattern 'test.php', which might fail if this
pattern is part of the url.
I am using a define called 'TEST_SUITE' which I am setting at the
start of the test suite execution, but there should be a better way of
doing this.

The patch follows below.

Cheers,
/Chandan


diff -r 16c58dcbc810 cake/libs/controller/components/email.php
--- a/cake/libs/controller/components/email.php Fri Nov 07 00:17:46
2008 +1100
+++ b/cake/libs/controller/components/email.php Fri Nov 07 01:06:33
2008 +1100
@@ -665,6 +665,18 @@
}
return @mail($this->to, $this->__encode($this->subject), $this-
>__message, $this->__header, $this->additionalParams);
}
+
+/**
+ * Wrapper for Test Suite email testing.
+ * Expects a function called testmail() to handle mail delivery.
+ *
+ * @return bool Success
+ * @access private
+ */
+   function __test() {
+ return @testmail($this->to, $this->__encode($this->subject), $this-
>__message, $this->__header, $this->additionalParams);
+   }
+
 /**
  * Sends out email via SMTP
  *
diff -r 16c58dcbc810 cake/libs/controller/components/session.php
--- a/cake/libs/controller/components/session.php   Fri Nov 07 00:17:46
2008 +1100
+++ b/cake/libs/controller/components/session.php   Fri Nov 07 01:06:33
2008 +1100
@@ -229,10 +229,14 @@
  * @access public
  */
function setFlash($message, $layout = 'default', $params = array(),
$key = 'flash') {
-   if ($this->__active === true) {
-   $this->__start();
-   $this->write('Message.' . $key, compact('message', 
'layout',
'params'));
-   }
+ if(defined('TEST_SUITE')) {
+   testFlashCallback($message, $params);
+ }
+
+ if ($this->__active === true) {
+   $this->__start();
+   $this->write('Message.' . $key, compact('message', 'layout',
'params'));
+ }
}
 /**
  * Used to renew a session id
diff -r 16c58dcbc810 cake/libs/controller/controller.php
--- a/cake/libs/controller/controller.php   Fri Nov 07 00:17:46 2008
+1100
+++ b/cake/libs/controller/controller.php   Fri Nov 07 01:06:33 2008
+1100
@@ -472,6 +472,11 @@
  * @access public
  */
function redirect($url, $status = null, $exit = true) {
+   if (defined('TEST_SUITE')) {
+   setRedirectURL($url);
+   return;
+   }
+
$this->autoRender = false;

if (is_array($status)) {
@@ -1077,4 +1082,4 @@
return false;
}
 }
-?>
\ No newline at end of file
+?>
diff -r 16c58dcbc810 cake/libs/model/datasources/dbo/dbo_mysql.php
--- a/cake/libs/model/datasources/dbo/dbo_mysql.php Fri Nov 07
00:17:46 2008 +1100
+++ b/cake/libs/model/datasources/dbo/dbo_mysql.php Fri Nov 07
01:06:33 2008 +1100
@@ -158,6 +158,12 @@
  */
function listSources() {
$cache = parent::listSources();
+   if (defined('TEST_SUITE')) {
+ /* During testing we keep adding and dropping tables.
+  * Relying on cache can cause tests to fail
+  */
+ $cache = null;
+   }
if ($cache != null) {
return $cache;
}
@@ -589,4 +595,4 @@
return $out;
}
 }
-?>
\ No newline at end of file
+?>
diff -r 16c58dcbc810 cake/tests/lib/code_coverage_manager.php
--- a/cake/tests/lib/code_coverage_manager.php  Fri Nov 07 00:17:46
2008 +1100
+++ b/cake/tests/lib/code_coverage_manager.php  Fri Nov 07 01:06:33
2008 +1100
@@ -116,6 +116,65 @@
$manager->testCaseFile = $testCaseFile;
xdebug_start_code_coverage(XDEBUG_CC_UNUSED | 
XDEBUG_CC_DEAD_CODE);
}
+
+   /* Added by CK for group coverage testing */
+   var $groupCoverageData =

Re: Pause $ajax->remoteTimer();

2008-11-06 Thread Galdan

Wow great, it works exactly how i mentioned it! Thank you very, very
much!

On 5 Nov., 18:45, schneimi <[EMAIL PROTECTED]> wrote:
> Hi Galdan,
>
> ok here is a little help:
>
>   function remoteTimer($options = null) {
>     $frequency = (isset($options['frequency'])) ?
> $options['frequency'] : 10;
>     $timervar = (isset($options['timervar'])) ? $options['timervar'] .
> '=' : '';
>     $code = $timervar . "new PeriodicalExecuter(function() {" . 
> $this->remoteFunction($options) . "}, $frequency)";
>
>     return $this->Javascript->codeBlock($code);
>   }
>
>    echo $ajax->remoteTimer(array('url' => array('controller' =>
> 'posts', 'action' => 'view'),
>                                                 'update' => 'mydiv',
>                                                 'frequency' => 5,
>                                                 'timervar' =>
> 'mytimer'));
>   echo $form->checkbox('pause', array('onclick' => 'if (this.checked)
> {mytimer.stop();}'));
> ?>
>
> But this is only good if you want to stop the timer once and restart
> it with a page reload.
>
> Now in your case you said you want to enable and disable it, so you
> also have to start a new timer when the checkbox is unchecked again,
> so in your case I advise to not change the ajax-helper (which is not
> the best idea anyway) but to write it all in javascript.
>
> Just include the following javascript code into your app:
>
> var mytimer = null;
>
> function startTimer(url, update, frequency) {
>   mytimer = new PeriodicalExecuter(function() {new
> Ajax.Updater(update, url , {asynchronous:true, evalScripts:true,
> requestHeaders:['X-Update', update]})}, frequency);
>
> }
>
> function stopTimer() {
>   mytimer.stop();
>
> }
>
> And this is how your view could look like:
>
> echo $javascript->codeBlock("startTimer('/yourapp/posts/view',
> 'mydiv', 5)");
> echo $form->checkbox('pause', array('onclick' => 'if (this.checked)
> {startTimer('/yourapp/posts/view', 'mydiv', 5);} else
> {stopTimer();}'));
>
> I hope this works for you,
>
> Michael
>
> On 5 Nov., 09:33, Galdan <[EMAIL PROTECTED]> wrote:
>
> > Hi Michaeal,
>
> > thank you for your response. I've taken a look to the ajax helper, and
> > basically i understand what you mean.
>
> > But I'am not experienced enough to do this :-(
>
> > On 4 Nov., 23:57, schneimi <[EMAIL PROTECTED]> wrote:
>
> > > Hi,
>
> > > this is not supported by the ajax helper, I think you have to stop and
> > > overwrite the PeriodicalExecuter manually. See 
> > > herehttp://www.prototypejs.org/api/periodicalExecuterandherehttp://www.pr
>
> > > You could try to change the ajax helper remoteTimer() so that the
> > > PeriodicalExecuter is put into a variable which you may then use to
> > > stop it and overwrite it with a new PeriodicalExecuter on click on
> > > your checkbox.
>
> > > Not sure if this works, but I hope this helps anyway,
>
> > > Michael
>
> > > On 4 Nov., 21:51, Galdan <[EMAIL PROTECTED]> wrote:
>
> > > > Hi together,
>
> > > > i use $ajax->remoteTimer(); to refresh a DIV all 30 seconds.
>
> > > > I wan't to enable/disable this by an checkbox, but i have absolutely
> > > > no idea to handle this.
>
> > > > Could you help me?
>
> > > > Thank you very much in advance!
>
> > > > byebye
> > > > Tom
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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 presentation

2008-11-06 Thread mark_story

Also recently on the documentation side of things, John has been busy
adding cookbook links into the doc blocks. So when you look things up
on the API you can get to the related cookbook page very easily.

-Mark

On Nov 6, 5:22 am, soosa <[EMAIL PROTECTED]> wrote:
> Thanks a lot guys, i will take all your suggestions in mind, teknoid, i will
> be using your tutorials to explain Auth in cake, by the way, thanks a lot
> for those greate once!, Daniel Hofstetter, i finally got the PDF's to be
> read correctly, thank you :), 703designs, indeed, bake is one of my favurite
> subjects to talk about, BrendonKoz, true, the documentation in cake was a
> problem but now its REALLY getting much better and i will be passing through
> it in my presentation.
>
> Thanks again guys.
>
> On Wed, Nov 5, 2008 at 1:28 PM, BrendonKoz <[EMAIL PROTECTED]> wrote:
>
> > I also think it's worth mentioning something about documentation.  The
> > Cake Cookbook is now an absolutely excellent resource for material,
> > and I know that in some businesses people are frightened by open
> > source because of lack of documentation.  Zend's manuals are
> > excrutiatingly in-depth (just reading about Lucene...owch),
> > CodeIgniter I've heard has good docs, etc...  Some frameworks even
> > have IRC and mailing lists (Cake's Google Groups) as alternative ways
> > to find answers.
>
> > Just a thought.  :)
>
> > On Nov 5, 12:22 pm, teknoid <[EMAIL PROTECTED]> wrote:
> > > Oh, and I do second 703designs' suggestion regarding bake +
> > > scaffolding. Those two alone are brilliant tools.
>
> > > On Nov 5, 11:05 am, soosa <[EMAIL PROTECTED]> wrote:
>
> > > > unfortunately the PDF files are broken, or at least this is how i see
> > them,
> > > > and actually thats what i was really looking for in terms of subjects,
> > would
> > > > you please try them out to assert my claims.
>
> > > > Thank you!
>
> > > > On Wed, Nov 5, 2008 at 11:42 AM, Daniel Hofstetter <[EMAIL PROTECTED]
> > >wrote:
>
> > > > > Hi,
>
> > > > > > Any ideas of other subjects that might be useful to be mentioned
> > over the
> > > > > > above?, and may be if there is any one who did something like that
> > in the
> > > > > > past, it would be nice to share the docs or the slides of his/her
> > > > > > presentation.
>
> > > > > Have a look at the slides onhttp://cakephp.org/files/, maybe they
> > are
> > > > > helpful for you.
>
> > > > > --
> > > > > Daniel Hofstetter
> > > > >http://cakebaker.42dh.com-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
-~--~~~~--~~--~--~---



Getting DB entries based on an array of id's...

2008-11-06 Thread wallerdm

Dear All,

Just a quick question really (hopefully).

I have a load of images stored in a table, each with an ID. Users can
choose to bookmark images and this is also stored in a table:

--Users
id - INT
username - VARCHAR

--Images
id - INT
title - VARCHAR
url - VARCHAR

--Bookmarks
id - INT
user_id - INT
image_id - INT

I now have all of my models set up, including all of the
relationships, and have all of the data reading correctly. What I'm
trying to do now is list (as part of the Users controller) all of the
image titles that they have bookmarked.

My users controller now has an array that contains the id's of all the
bookmarked images and I now want to get the data for the images that
have been bookmarked but the "find" request has stumped me.

class UsersController extends AppController {
var $name = 'Users';
var $uses = array('User','Image');
var $helpers = array('Html', 'Form');

function view($id=null){
$this->set('userdata', $this->User->findById($id));
$temp = $this->User->findById($id);
$bookmarklist = array();
foreach($temp['Bookmark'] as $bookmark){
$bookmarklist[] = $bookmark['image_id'];
}
$this->set('bookmarkdata', $this->Image->find(ARGHHH, WHAT
GOES HERE));
}
}

I hope I've explained myself okay. Any help is greatly appreciated.

Thanks,

Dave.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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 Cakephp 1.2 faster than Code Igniter ?

2008-11-06 Thread [EMAIL PROTECTED]



On 5 marras, 19:34, BrendonKoz <[EMAIL PROTECTED]> wrote:
> Another issue with benchmarking is that when dealing with OOP, or any
> code in PHP, TMTOWTDI (There's More Than One Way To Do It)...  So, to
> properly benchmark any framework, one would have to know each
> framework inside and out to take advantage of all the tricks to
> increase performance when necessary, and increase development time
> when not necessary.
>
> This is one of the major issues that many framework performance
> testers have found...they don't know their frameworks as best as
> possible, or may know one to a varying degree more than another and
> not make as many "allowable mistakes" in one over another.  It's hard
> to get a true non-bias performance test, even if you're trying really
> hard.  ;)

That is true. However I'm going to use each frameworks helpers and
components when available. That way I'll find how significant the
trade-off between shorter development time and system performance is?

-Kalle

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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 Cakephp 1.2 faster than Code Igniter ?

2008-11-06 Thread [EMAIL PROTECTED]

> How are you going to measure the performance?
>
> The time it takes to process a request?
> The time it takes to develop?
> Are you going to implement caching?
> Are you going to try multiple datasources (of various types)?

I realize that performance is a complicated issue. I'm currently
finding out about different performance testing methods. I'm also
going to compare features of frameworks and I'm going to measure
development time and other factors while coding test application with
each of the frameworks.

I'll propably run performance tests both with and without caching.
Propably only datasource will be MySQL-database.

>
> IMO, a real-world app should have the following features:
> - User registration
> - Authentication
> - Database interaction
> - At least 5 models, which cover various types of associations
> - Data validation
> - Security
> - Session management
> - Web service API (at least provisioning)
> - Administrative interface

I'm thinking along the same lines, except I'm not sure if
administrative interface is essential when comparing performance.

-Kalle
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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-06 Thread Donkeybob

I use this same concept but my userinformation is called profiles.
just what i like but here is how mine our set up:

users_controller.php:
class UsersController extends AppController {

var $name = 'Users';
var $scaffold;
}
user.php:
class User extends AppModel {

 var $name = 'User';
 var $hasOne = array(
'Profiles' => array('className' => 'Profiles',
'foreignKey' => 
'users_id',
'dependent' => 
false
)
);
}

profiles_controller.php:
class ProfilesController extends AppController {

var $name = 'Profiles';
   var $scaffold;
}
profile.php:
class Profile extends AppModel {

var $name = 'Profile';

var $belongsTo = array(
'Users' => array('className' => 'Users',
'foreignKey' => 
'users_id'
)
);

}

going by your table setup - - -
user table:
id integer auto increment primary
firstname varchar(45)
lastname varchar(45)

profile:
id integer auto increment primary
sss_number varchar(45)
birthday datetime
users_id integer primary

this scenario works for me

the id column in the profile table should be relevant to the profile
table only . . . your association would be with the user_id field in
the profile table and how you setup the relationship in your model
(ex.  'foreignKey' => 'users_id' ) will make it work

but this is how i do it . .

rich

On Nov 6, 8:18 am, Rey Philip <[EMAIL PROTECTED]> wrote:
> By the way thnks for the responseActually what I want to do is the
> "HasOne" relationship, the problem is that I can't implement it. The
> problem is like this
>
> I have a users table:
> id integer auto increment primary
> firstname varchar(45)
> lastname varchar(45)
>
> also I have a userinformations table
> id integer auto increment primary
> sss_number varchar(45)
> birthday datetime
> user_id integer
>
> I want this to have a one to one relationship
>
> so what I did in the userinformations_controller.php
>
> class UserinformationsController extends AppController
> {
>     var $name = 'Userinformations';
>     var $scaffold;
>
> }
>
> in the userinformation.php
>
> class Userinformation extends AppModel
> {
>     var $ame = 'Userinformation';
>     var $belongsTo = array('User');
>
> }
>
> in the users_controller.php
>
> class UsersController extends AppController
> {
>     var $name = 'User';
>     var $scaffold;
>
> }
>
> in the user.php
>
> class User extends AppModel
> {
>     var $name = 'User';
>     var $hasOne = array('Userinformation');
>
> }
>
> After doing that, I add new users to my users table and its
> doneThe problem now is when I insert records on the
> userinformations table, I cant insert 2 or more user_id in the
> userinformations table. So I think the problem is on my table cause my
> userinformations table has an auto_increment id  and also the primary
> key. So what I want to do is to delete the id in the userinformations
> table and then make the user_id a primary key so, it will have a one
> to one relationship with the user table.
>
> Am I right? Give me some advice on how to do it correctly.
>
> 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: Search Engine Bots Generating Strange Queries

2008-11-06 Thread Mathew

Hi Mike,

If your using Apache it has some features in the htaccess file that
will allow you to disable access to your server for bots causing you
trouble.

In your Cake 404 display page keep track of the number of times a 404
is generated per IP address, and if it exceeds a threshold log that IP
address to a text file.

Humans browsing a website will not generate many 404 messages, even if
they have bad bookmarks, or follow old links from search engines. So
an IP address requesting more then one hundred 404 errors is likely a
problem bot. Each time a 404 page is display log the IP to a database
with a counter. When the counter reaches your limit add that IP
address to a text file.

In your .htaccess you can load this text file of IP addresses and
apply rules to those addresses. It's up to you if you wish to display
a static access denied Html page, or simply throw a connection
refused.

Sorry I don't remember the commands for the htaccess file.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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
-~--~~~~--~~--~--~---



About CakePHP

2008-11-06 Thread Eric Saboia (Fortes Informatica)

Hello,
I´m looking for some of Cake´s history (why it begun, what inspirated
it, etc)... where can i get information about that?

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: Creating DatabaseTables (cakephp way)

2008-11-06 Thread Rey Philip

By the way thnks for the responseActually what I want to do is the
"HasOne" relationship, the problem is that I can't implement it. The
problem is like this

I have a users table:
id integer auto increment primary
firstname varchar(45)
lastname varchar(45)

also I have a userinformations table
id integer auto increment primary
sss_number varchar(45)
birthday datetime
user_id integer

I want this to have a one to one relationship

so what I did in the userinformations_controller.php

class UserinformationsController extends AppController
{
var $name = 'Userinformations';
var $scaffold;
}

in the userinformation.php

class Userinformation extends AppModel
{
var $ame = 'Userinformation';
var $belongsTo = array('User');
}

in the users_controller.php

class UsersController extends AppController
{
var $name = 'User';
var $scaffold;
}

in the user.php

class User extends AppModel
{
var $name = 'User';
var $hasOne = array('Userinformation');
}

After doing that, I add new users to my users table and its
doneThe problem now is when I insert records on the
userinformations table, I cant insert 2 or more user_id in the
userinformations table. So I think the problem is on my table cause my
userinformations table has an auto_increment id  and also the primary
key. So what I want to do is to delete the id in the userinformations
table and then make the user_id a primary key so, it will have a one
to one relationship with the user table.

Am I right? Give me some advice on how to do it correctly.

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: Cake 1.2 is slow (4s...)

2008-11-06 Thread Remigijus

Dave J:

I have very (very!) small page that using postgresql database with 20
rows at all. In the config file I have found this line:
Cache::config('default', array('engine' => 'File'));

How cache can affect website memory usage and speed?

By the way, is anyone using website made by CakePHP version 1.2? Have
you any problems with speed or memory usage?


On Nov 6, 2:38 pm, Dave J <[EMAIL PROTECTED]> wrote:
> Are you using any op-code caches (APC, eAccelerator or XCache) ?
>
> On Nov 6, 11:53 am, Remigijus <[EMAIL PROTECTED]> wrote:
>
> > I have set debug mode to zero. But still framework uses
>
> > Memory used: 5.42 MB
>
> > And loads about 1 sec. I have done some benchmarks, and without models
> > loaded, site uses 2.6MB memory, with empty model (and set param
> > useTable to null, and recursion to -1) it uses 5.42. Where is the
> > problem, please help me ;(
>
> > On Nov 6, 1:12 pm, Ziobe <[EMAIL PROTECTED]> wrote:
>
> > > Just to say that my cakephp project is blank.
> > > And even if i try to change the debug, the problem is still here
>
>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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 Brenda

I had a problem recently where my validation errors weren't showing up
in a form. Turns out I was using to read() to get some related data to
display, and that wiped out the validation results from the form
submission. Changing it to find() left the validation results in place.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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 1.2 is slow (4s...)

2008-11-06 Thread Dave J

Are you using any op-code caches (APC, eAccelerator or XCache) ?


On Nov 6, 11:53 am, Remigijus <[EMAIL PROTECTED]> wrote:
> I have set debug mode to zero. But still framework uses
>
> Memory used: 5.42 MB
>
> And loads about 1 sec. I have done some benchmarks, and without models
> loaded, site uses 2.6MB memory, with empty model (and set param
> useTable to null, and recursion to -1) it uses 5.42. Where is the
> problem, please help me ;(
>
> On Nov 6, 1:12 pm, Ziobe <[EMAIL PROTECTED]> wrote:
>
> > Just to say that my cakephp project is blank.
> > And even if i try to change the debug, the problem is still here
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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 1.2 is slow (4s...)

2008-11-06 Thread Remigijus

I have set debug mode to zero. But still framework uses

Memory used: 5.42 MB

And loads about 1 sec. I have done some benchmarks, and without models
loaded, site uses 2.6MB memory, with empty model (and set param
useTable to null, and recursion to -1) it uses 5.42. Where is the
problem, please help me ;(


On Nov 6, 1:12 pm, Ziobe <[EMAIL PROTECTED]> wrote:
> Just to say that my cakephp project is blank.
> And even if i try to change the debug, the problem is still here
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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 1.2 is slow (4s...)

2008-11-06 Thread Ziobe

Just to say that my cakephp project is blank.
And even if i try to change the debug, the problem is still here
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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 1.2 is slow (4s...)

2008-11-06 Thread Dardo Sordi Bogado

I don't get it, even in debug mode I always get response times in ms,
even in modest laptops/desktop machines... always in linux ;)

- Dardo Sordi.

On Thu, Nov 6, 2008 at 8:30 AM, AD7six <[EMAIL PROTECTED]> wrote:
>
>
>
> On Nov 6, 11:24 am, Remigijus <[EMAIL PROTECTED]> wrote:
>> Latest CakePHP framework 10x times faster?
>>
>> I have upgraded to latest version, and my empty page before:
>> used 5.5 MB of memory
>> loaded in 1.2s
>>
>> After upgraded:
>> used 5.6 of memory
>> loaded in 2.3s
>>
>> Where is that 'faster'?
>>
>> I have tested in 3 apache servers. Tested with both 1.2 stable and 1.2
>> latest release. So where is the problem?
>
> In you testing load times with any or all of the typical causes
> (search the group) applying - most notable: having debug enabled.
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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: Authentificate against LDAP?

2008-11-06 Thread Sebastian Göttschkes

Thanks for your help. I'll have a look at the bakery.

There is no way not using AD as LDAP, so I need to find a way to get
AD working.

On 4 Nov., 13:11, hydra12 <[EMAIL PROTECTED]> wrote:
> There are some articles in the bakery about using ldap as a model.  I
> haven't used them, so I couldn't say how well they work.  I do know
> that ActiveDirectory is microsoft's version of ldap and doesn't always
> work quite the way you think it should.  Personally, I use adLdap
> (http://adldap.sourceforge.net/).  I drop it in the vendors folder,
> then create an instance of adldap in my users controller and do all my
> authentication there.  I've had good luck with it so far, but it's not
> 'cakey', so it might not be what you are looking for.
>
> I hope that helps.
> hydra12
>
> On Nov 4, 4:11 am, Sebastian Göttschkes <[EMAIL PROTECTED]
>
> e.de> wrote:
> > Hi,
>
> > I started using cakePHP not long ago and it's really nice. It works
> > great for me and my time and effort building web apps has decreased.
> > Thank you for this!
>
> > Right now I got this problem: I need to authentificate not against a
> > database but against a LDAP (Active Directory).
>
> > In the database I got a table employees, containing all employees with
> > their login name (not the password) and other data. When a employee is
> > sending his login name and password, I want to authentificate him
> > against the LDAP. If the password is correct AND his dataset is found
> > in the table (using his login name), the login was correct and he can
> > use the application.
>
> > Is their an easy way to handle this task with cakePHP? I have searched
> > the docs but only found the "normal" authentification against a
> > database. This is not possible as there is no way for me to read the
> > password from the LDAP into the database. I read something about
> > models representing LDAP entries, but didn't found any information on
> > that.
>
> > I hope you guys can help me!
>
> > Regards,
> > Sebastian
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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 jitka (poLK)

David C. Zentgraf is right.

Besides other things, it allows things like

if ($this->ModelName->read(..., $id)) {
$this->ModelName->set(...);

instead of usual

$this->ModelName->id = $id;
if ($this->ModelName->exists(true)) {
$this->ModelName->create(...);
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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 1.2 is slow (4s...)

2008-11-06 Thread AD7six



On Nov 6, 11:24 am, Remigijus <[EMAIL PROTECTED]> wrote:
> Latest CakePHP framework 10x times faster?
>
> I have upgraded to latest version, and my empty page before:
> used 5.5 MB of memory
> loaded in 1.2s
>
> After upgraded:
> used 5.6 of memory
> loaded in 2.3s
>
> Where is that 'faster'?
>
> I have tested in 3 apache servers. Tested with both 1.2 stable and 1.2
> latest release. So where is the problem?

In you testing load times with any or all of the typical causes
(search the group) applying - most notable: having debug enabled.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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 1.2 is slow (4s...)

2008-11-06 Thread Remigijus

Latest CakePHP framework 10x times faster?


I have upgraded to latest version, and my empty page before:
used 5.5 MB of memory
loaded in 1.2s

After upgraded:
used 5.6 of memory
loaded in 2.3s

Where is that 'faster'?

I have tested in 3 apache servers. Tested with both 1.2 stable and 1.2
latest release. So where is the problem?


On Nov 6, 12:04 pm, Ziobe <[EMAIL PROTECTED]> wrote:
> Hello, i want to use Cake 1.2 but for render a page it takes more than
> 4sec
>
> I try Cake 1.1, CodeIgniter, Drupal and all of that things are fully
> working on my computer.
> But cake 1.2 don't want. I Also tried on another computer and it's
> works.
> I don't know what to do can you help me ?
> I'm on windows i use the latest Wamp package (also tried with XAMPP
> same problem)
> (sorry for my bad english)

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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 presentation

2008-11-06 Thread soosa
Thanks a lot guys, i will take all your suggestions in mind, teknoid, i will
be using your tutorials to explain Auth in cake, by the way, thanks a lot
for those greate once!, Daniel Hofstetter, i finally got the PDF's to be
read correctly, thank you :), 703designs, indeed, bake is one of my favurite
subjects to talk about, BrendonKoz, true, the documentation in cake was a
problem but now its REALLY getting much better and i will be passing through
it in my presentation.

Thanks again guys.

On Wed, Nov 5, 2008 at 1:28 PM, BrendonKoz <[EMAIL PROTECTED]> wrote:

>
> I also think it's worth mentioning something about documentation.  The
> Cake Cookbook is now an absolutely excellent resource for material,
> and I know that in some businesses people are frightened by open
> source because of lack of documentation.  Zend's manuals are
> excrutiatingly in-depth (just reading about Lucene...owch),
> CodeIgniter I've heard has good docs, etc...  Some frameworks even
> have IRC and mailing lists (Cake's Google Groups) as alternative ways
> to find answers.
>
> Just a thought.  :)
>
>
> On Nov 5, 12:22 pm, teknoid <[EMAIL PROTECTED]> wrote:
> > Oh, and I do second 703designs' suggestion regarding bake +
> > scaffolding. Those two alone are brilliant tools.
> >
> > On Nov 5, 11:05 am, soosa <[EMAIL PROTECTED]> wrote:
> >
> >
> >
> > > unfortunately the PDF files are broken, or at least this is how i see
> them,
> > > and actually thats what i was really looking for in terms of subjects,
> would
> > > you please try them out to assert my claims.
> >
> > > Thank you!
> >
> > > On Wed, Nov 5, 2008 at 11:42 AM, Daniel Hofstetter <[EMAIL PROTECTED]
> >wrote:
> >
> > > > Hi,
> >
> > > > > Any ideas of other subjects that might be useful to be mentioned
> over the
> > > > > above?, and may be if there is any one who did something like that
> in the
> > > > > past, it would be nice to share the docs or the slides of his/her
> > > > > presentation.
> >
> > > > Have a look at the slides onhttp://cakephp.org/files/, maybe they
> are
> > > > helpful for you.
> >
> > > > --
> > > > Daniel Hofstetter
> > > >http://cakebaker.42dh.com- 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: Custom Validation

2008-11-06 Thread Adam Royle

http://book.cakephp.org/view/150/Custom-Validation-Rules

On Nov 6, 8:07 pm, si-mon <[EMAIL PROTECTED]> wrote:
> Hello...
>
> There is a problem in validating data in my application.
> Let me explain:
>
> I used a model "Employee" belongsTo "Office"
> office_id is the foreignKey
>
> When I'm trying to insert data from the cake-generated form, it
> correctly inserts the office_id (because I set it as Select box).
> But, when I'm trying to insert data directly through $this->data,
>
> Example:  $this->data = Array('office_id' => '1055','name' =>
> 'abc','description'=>'some text');
>
> it doesn't checks whether the office_id is present in the Office
> model. (In my case, there is no office_id = 1055 in offices table)
>
> Is there any method to solve this problem?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: basic site concept

2008-11-06 Thread dr. Hannibal Lecter

I'm not sure why would you want many apps for what you've described.
Your "products section" would actually be ProductsController and
Product model, your "search" and "download" functionality are just
SearchController and DownloadsController and their respective models
and views etc..

Normally, a single app is enough for all your needs. Even if it isn't,
you can still use cake plugins..

Hope that helps!

On Nov 6, 8:40 am, justclint <[EMAIL PROTECTED]> wrote:
> Hello all, thanks for having this group available for newbies like
> myself. I have a pretty basic question that Im having a very difficult
> time finding an answer on. I've done google searches, read the cakephp
> manual and I am also reading the book "Beginning CakePHP" by David
> Golding which is a great book by the way.
>
> Any way I've never used a framework before and Im totally new to the
> MVC concept. Ive done a couple tutorials such as the blog and also a
> to-do list. I have a site I will be converting over to cakephp and
> want to make sure I am using best practices and that I understand the
> basic concept.
>
> So my question is; if Im building a whole website, is the whole
> website a "cakephp app" or does my whole website have many "cakephp
> apps"?
>
> Through my reading it seems every tutorial is based on just a piece of
> a website (ie: blog) and every tutorial required a new cake folder
> with the usual contents (app, controllers, views, webroot etc.).
>
> I need to make a single typical website with the usual stuff like
> products section, support section with search/download functionality
> and contact/request forms.
>
> Im not sure if each one of these things are supposed to be different
> apps or if the whole site is in one app. It seems a bit cumbersome to
> keep adding cake folders over and over on a single site but nothing
> Ive read says otherwise. Also, If you are supposed to keep adding cake
> folder after cake folder you would endup with multiple webroot folders
> which also kinda of boggles my mind.
>
> Your help is greatly appreciated and I do apologize for having such a
> primitive question but I have no where else to go but here.
>
> Thanks again!
>
> Cheers,
>
> Clint
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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
-~--~~~~--~~--~--~---



[Problem] Cake 1.2 is slow (4s...)

2008-11-06 Thread Ziobe

Hello, i want to use Cake 1.2 but for render a page it takes more than
4sec

I try Cake 1.1, CodeIgniter, Drupal and all of that things are fully
working on my computer.
But cake 1.2 don't want. I Also tried on another computer and it's
works.
I don't know what to do can you help me ?
I'm on windows i use the latest Wamp package (also tried with XAMPP
same problem)
(sorry for my bad english)

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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
-~--~~~~--~~--~--~---



Custom Validation

2008-11-06 Thread si-mon

Hello...

There is a problem in validating data in my application.
Let me explain:

I used a model "Employee" belongsTo "Office"
office_id is the foreignKey

When I'm trying to insert data from the cake-generated form, it
correctly inserts the office_id (because I set it as Select box).
But, when I'm trying to insert data directly through $this->data,

Example:  $this->data = Array('office_id' => '1055','name' =>
'abc','description'=>'some text');

it doesn't checks whether the office_id is present in the Office
model. (In my case, there is no office_id = 1055 in offices table)

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



Re: Undesired Recursion in Models

2008-11-06 Thread Adam Royle

Well you kinda hijacked Renesistemic's thread... but anyway...

1. I'm pretty sure it takes both and means the same thing.
2. Town would need to actsAs Containable... however I add it to my
AppModel so all of my models have the ability.
3. I would have thought so... but there is an easy way to test!

Cheers,
Adam

On Nov 6, 7:09 pm, "Liebermann, Anja Carolin"
<[EMAIL PROTECTED]> wrote:
> Thank you for the hint!
>
> Containable seems to offer amazing possibilities.  I read the cookbook 
> article on it (http://manual.cakephp.org/view/474/Containable) and 3 
> Questions arose:
>
> 1st:
> I wonder about the syntax to get more than one associated model back.
>
> Lets say I call $this->Hotel->find
>
> Hotel belongs to a town and a country and has many images.
>
> In my call I would be interested in the information on town and country and 
> want to ignore the images.
> I sths possible and what would be the correct syntax?
> $this->Hotel->contain('Town','Country');
> Or
> $this->Hotel->contain(array('Town','Country'));
>
> Looking 
> athttp://api.cakephp.org/1.2/class_containable_behavior.html#41f468f246...
> The first option seems to be better.
>
> 2nd:
> Let's say I am in my hotels_controller.php and from there I want to call 
> information on my Town
> E.g.
> $this->Hotel->Town->findByFoo($foo);
> Now I would like to limit the associated models for town. Can this be done 
> from the hotel_cotroller? If yes, how?
> E.g.
> $this->Hotel->Town->contain('Quarters');
> Where would I have to place the
>
> var $actsAs = array('Containable');
>
> In the hotels_controller.php or in the town_controller.php or both?
>
> 3rd.
> Does contain work only with find or also with findBy?
>
> Thank you for all enlightening comments!
>
> Anja
>
> -Ursprüngliche Nachricht-
> Von: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] Im Auftrag von Adam 
> Royle
> Gesendet: Donnerstag, 6. November 2008 07:46
> An: CakePHP
> Betreff: Re: Undesired Recursion in Models
>
> Well the recursion is just symbolic. Cake will only create one instance for 
> each of your models and uses references to that one model throughout your 
> app. You can test this out in your controller.
>
> var $uses = array('Site', 'Post');
>
> function test(){
>         if ($this->Site->Post === $this->Post) {
>                 echo 'adam is right!';
>         } else {
>                 echo 'ok adam lied!';
>         }
>         exit;
>
> }
>
> So really the only issue is that you're requesting more data from your models 
> than you actually want. This is where the Containable behavior comes in. It 
> will automatically prune your recursive associations based on what data you 
> want.
>
> But you can read up on that elsewhere. Hope this helps and best of luck with 
> your project!
>
> Cheers,
> Adam
>
> On Nov 6, 2:10 pm, Renesistemic <[EMAIL PROTECTED]> wrote:
>
> > Hi. I've scoured the web to my best extent without wasting away days
> > of time on this, and I'm stuck... I'm running a CakePHP site with RC3,
> > and am having some serious memory overhead issues. As I came into this
> > project picking up the pieces of another programmer, I've recently
> > decided it'd be best to restructure the architecture of the model
> > relationships, as that seemed to be the major problem.
>
> > I have what could be best understood as three models. We'll call them
> > Site, Post, and Datavalues. The problem comes into play when I look at
> > the variable $this in the app_controller function. When I dump that
> > variable using the debug() method, I'm presented with about 3000 lines
> > of data, among which some of the code references indices of an array
> > inside a Model storing a sub-array of a Parent model, this of course
> > being prefixed by a line indicating * RECURSIVE.
>
> > I have a separate CakePHP site running with different models, and on
> > that site everything checks out with my model architecture. I realize
> > that I've left this problem contextually generalized, but there's no
> > sense in writing a novel if no one has any thoughts or interest in
> > this issue. Additionally, I thought that this problem might be known
> > well enough already that, upon reading this article, someone might be
> > able to offer a suggestion.
>
> > As such, is anyone familiar with issues involving recursive model
> > architecture in CakePHP? Thanks for any feedback you may have to
> > offer.
>
> > The Site model is set up with the assignment:
> > var $hasMany = array(
> >                         'Post' =>
> >                                 array('className' => 'Post',
> >                                                 'foreignKey' =>
> > 'site_id',
> >                                 )
> >         );
>
> > The Post model is set up with the assignment:
> > var $hasMany = array(
> >       'Datavalue' =>
> >         array('className' => 'Datavalue',
> >               'foreignKey' => 'post_id',
> >              )
> >       );
>
> > And lastly, the Datavalue model is set up 

AW: basic site concept

2008-11-06 Thread Liebermann, Anja Carolin

Hi Clint,

I guess that depends on what your website should do in generaland if and how 
the differnet functionalities are related.

1. How many static pages do you have
2. How often chengeas teh content of teh static pages and who changes them?

Based on this you have to decide if you do it yourself with basic HTML or if a 
WCMS is needed.

Depending on this you can either have several apps like a download center, 
support database linked to a static webseite or integrated in a WCMS.

Hope that helps.

Anja


-Ursprüngliche Nachricht-
Von: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] Im Auftrag von 
justclint
Gesendet: Donnerstag, 6. November 2008 08:40
An: CakePHP
Betreff: basic site concept


Hello all, thanks for having this group available for newbies like myself. I 
have a pretty basic question that Im having a very difficult time finding an 
answer on. I've done google searches, read the cakephp manual and I am also 
reading the book "Beginning CakePHP" by David Golding which is a great book by 
the way.

Any way I've never used a framework before and Im totally new to the MVC 
concept. Ive done a couple tutorials such as the blog and also a to-do list. I 
have a site I will be converting over to cakephp and want to make sure I am 
using best practices and that I understand the basic concept.

So my question is; if Im building a whole website, is the whole website a 
"cakephp app" or does my whole website have many "cakephp apps"?

Through my reading it seems every tutorial is based on just a piece of a 
website (ie: blog) and every tutorial required a new cake folder with the usual 
contents (app, controllers, views, webroot etc.).

I need to make a single typical website with the usual stuff like products 
section, support section with search/download functionality and contact/request 
forms.

Im not sure if each one of these things are supposed to be different apps or if 
the whole site is in one app. It seems a bit cumbersome to keep adding cake 
folders over and over on a single site but nothing Ive read says otherwise. 
Also, If you are supposed to keep adding cake folder after cake folder you 
would endup with multiple webroot folders which also kinda of boggles my mind.

Your help is greatly appreciated and I do apologize for having such a primitive 
question but I have no where else to go but here.

Thanks again!

Cheers,

Clint



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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
-~--~~~~--~~--~--~---



AW: Undesired Recursion in Models

2008-11-06 Thread Liebermann, Anja Carolin

Thank you for the hint!

Containable seems to offer amazing possibilities.  I read the cookbook article 
on it (http://manual.cakephp.org/view/474/Containable) and 3 Questions arose:

1st:
I wonder about the syntax to get more than one associated model back.

Lets say I call $this->Hotel->find

Hotel belongs to a town and a country and has many images.

In my call I would be interested in the information on town and country and 
want to ignore the images. 
I sths possible and what would be the correct syntax?
$this->Hotel->contain('Town','Country');
Or
$this->Hotel->contain(array('Town','Country'));

Looking at 
http://api.cakephp.org/1.2/class_containable_behavior.html#41f468f246898fa407bd32fe95a7e838
The first option seems to be better.

2nd:
Let's say I am in my hotels_controller.php and from there I want to call 
information on my Town
E.g.
$this->Hotel->Town->findByFoo($foo);
Now I would like to limit the associated models for town. Can this be done from 
the hotel_cotroller? If yes, how?
E.g.
$this->Hotel->Town->contain('Quarters');
Where would I have to place the 

var $actsAs = array('Containable');

In the hotels_controller.php or in the town_controller.php or both? 

3rd.
Does contain work only with find or also with findBy?

Thank you for all enlightening comments!

Anja


-Ursprüngliche Nachricht-
Von: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] Im Auftrag von Adam 
Royle
Gesendet: Donnerstag, 6. November 2008 07:46
An: CakePHP
Betreff: Re: Undesired Recursion in Models


Well the recursion is just symbolic. Cake will only create one instance for 
each of your models and uses references to that one model throughout your app. 
You can test this out in your controller.

var $uses = array('Site', 'Post');

function test(){
if ($this->Site->Post === $this->Post) {
echo 'adam is right!';
} else {
echo 'ok adam lied!';
}
exit;
}

So really the only issue is that you're requesting more data from your models 
than you actually want. This is where the Containable behavior comes in. It 
will automatically prune your recursive associations based on what data you 
want.

But you can read up on that elsewhere. Hope this helps and best of luck with 
your project!

Cheers,
Adam

On Nov 6, 2:10 pm, Renesistemic <[EMAIL PROTECTED]> wrote:
> Hi. I've scoured the web to my best extent without wasting away days 
> of time on this, and I'm stuck... I'm running a CakePHP site with RC3, 
> and am having some serious memory overhead issues. As I came into this 
> project picking up the pieces of another programmer, I've recently 
> decided it'd be best to restructure the architecture of the model 
> relationships, as that seemed to be the major problem.
>
> I have what could be best understood as three models. We'll call them 
> Site, Post, and Datavalues. The problem comes into play when I look at 
> the variable $this in the app_controller function. When I dump that 
> variable using the debug() method, I'm presented with about 3000 lines 
> of data, among which some of the code references indices of an array 
> inside a Model storing a sub-array of a Parent model, this of course 
> being prefixed by a line indicating * RECURSIVE.
>
> I have a separate CakePHP site running with different models, and on 
> that site everything checks out with my model architecture. I realize 
> that I've left this problem contextually generalized, but there's no 
> sense in writing a novel if no one has any thoughts or interest in 
> this issue. Additionally, I thought that this problem might be known 
> well enough already that, upon reading this article, someone might be 
> able to offer a suggestion.
>
> As such, is anyone familiar with issues involving recursive model 
> architecture in CakePHP? Thanks for any feedback you may have to 
> offer.
>
> The Site model is set up with the assignment:
> var $hasMany = array(
>                         'Post' =>
>                                 array('className' => 'Post',
>                                                 'foreignKey' => 
> 'site_id',
>                                 )
>         );
>
> The Post model is set up with the assignment:
> var $hasMany = array(
>       'Datavalue' =>
>         array('className' => 'Datavalue',
>               'foreignKey' => 'post_id',
>              )
>       );
>
> And lastly, the Datavalue model is set up as follows:
> var $belongsTo = array(
>                   'Post' =>
>         array('className' => 'Post',
>                                                   'foreignKey' => 
> 'post_id',
>                                 )
>         );


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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.g

Re: Multiple records in a single save()

2008-11-06 Thread si-mon

Anupom: thank you very much to redirect me to the saving-your-data
section of the book. It helped me to solve the issue.
Actually, the problem was within the array format:
There is no need to specify the "Model" in the array. i.e. the correct
array format should be:
$this->data = Array(
  Array('office_id' => '7',
'name' => '666', 'description' => '1'),
  Array('office_id' => '7',
'name' => '222', 'description' => 'bbb1'),
  Array('office_id' => '7',
'name' => '333', 'description' => 'ccc1')
 );

Thank you very much...

On Nov 6, 12:42 am, Anupom <[EMAIL PROTECTED]> wrote:
> Try saveAll().http://book.cakephp.org/view/75/Saving-Your-Data
>
>
>
> On Thu, Nov 6, 2008 at 11:32 AM, si-mon <[EMAIL PROTECTED]> wrote:
>
> > Hi...
> > Is it possible to insert multiple records in a single save().
>
> > For example:
> > I need to insert the following array in a single save():
> > $this->data = Array('Model' =>
> >  Array(
> >   Array('office_id' => '7',
> > 'name' => '666', 'description' => '1'),
> >   Array('office_id' => '7',
> > 'name' => '222', 'description' => 'bbb1'),
> >   Array('office_id' => '7',
> > 'name' => '333', 'description' => 'ccc1')
> >  )
> >   );
>
> --
> Anupom Syamhttp://syamantics.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: 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
-~--~~~~--~~--~--~---



Difference between read and find

2008-11-06 Thread Liebermann, Anja Carolin

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



Output started always in cake/libs/file.php and headers already sent

2008-11-06 Thread Primeminister

Hi,

In my app I got a lot of PHP warnings that the headers were already
sent when settin a cookie or before redirecting.
And always it is in the cake/libs/file.php folder on line 146 or 279
This is the file handling lib of cake. So deletig or opening a file.

I investigated it more and I use FIle caching. So when writing or
deleting cache data it opens and delete files.
When the file doesn't exits when deleting it returns false but also
throws a warning.

My question is how can I suppress that  cake way? I know the PHP way
to modify the cake/libs/file.php and add a '@' sign before the calls
(@unlink()) but that is not what I want to do, because I'm changing
the cake libs.

Anyone suggestions so I don't get these errors anymore when debug is
off? (On production server)

Cheers!
- primeminister
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the 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
-~--~~~~--~~--~--~---