Re: Auth.php modification.

2009-09-13 Thread Miles J

You should not edit the core CakePHP files. However you can create
your own Auth file in your app/controllers/components directory, and
just copy and paste the original Auth code into it, then modify it.

On Sep 13, 10:08 pm, "Sreenivas S. Nair" 
wrote:
> Hi all
>                i want to store the login ,logout time of all users in my
> application.
> For that i wrote a method, CAN I PUT THAT METHOD IN AUTH.PHP FILE AND CALL
> FROM THE AUTH->LOGIN() AND LOGOUT() METHODS?
> IS DER ANY ISSUES FOR MODIFYING THE AUTH.PHP?
> AM NEW IN CAKE PLZ HELP.
>
> --
> Thanks '&' Regards
> Sreenivas Soman
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: session lost during ajax calls problem

2009-09-13 Thread Martin Westin

You might want to looks at some of these suggested solutions.

http://bakery.cakephp.org/articles/view/redirects-with-ajax

Pick the one that works the best for you.

/Martin


On Sep 11, 6:03 am, learning_cake_php  wrote:
> so theres no way on switching to normal redirect from ajax redirect?
> as what i have understood on your suggestion,correct me if im wrong,
> is to have a view containing a plain javascript redirect?
> how about this one:
> "What I have done though is to have that logic in javascript. Cake
> simply returns success or error on the request and then my javascript
> knows whether to redirect or not. "
> how can this be done?can you please give me some snippets?
> thanx
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: phpThumb

2009-09-13 Thread hahmadi82


I changed the flag you mentioned to true in phpThumb.config.php.default and
phpThumb.class.php (I assume these are the files I was supposed to modify). 
And now, it generates I get:

Array ( [error] => 0 [src] =>
garagecar/thumbs/2a562aaab2efeb439d5b63c753746c3e.jpg [w] => 100 [h] => 100
)

However, that image link does not work (shows up blank) and no image is
created in that folder.  Any ideas why this might be the case?

Here's my helper call code:

$thumbnail = $phpthumb->generate(
array(
'save_path' => WWW_ROOT . 
'garagecar/thumbs',
'display_path' => 'garagecar/thumbs',
'error_image_path' =>  'user/blankuser.jpg',
'src' => WWW_ROOT . 'img/garagecar/' .
'gc'.$garagecars[0]['GarageCar']['id'] . '_i' .
$garagecars[0]['GarageCar']['default_image_id'] . '.jpg',
'w' => 100,
'h' => 100,
'q' => 100,
'zc' => 1
)
);


euromark (munich) wrote:
> 
> 
> i guess i found the problem
> 
> you need $PHPTHUMB_CONFIG['allow_src_above_docroot'] = true;
> if you use /webroot/ as your top level folder (on localhost i use /
> localhost/.../app/
> 
> and as this helper does not use the config.php, you just need to pass
> it before calling the setParameter() method
> 
> 
> On 13 Sep., 22:54, "euromark (munich)" 
> wrote:
>> funny thing
>>
>> i tried that helper
>> and on localhost with xampp/windowsXp it works just fine
>>
>> after uploading it to my webserver (linux), it broke (same error as
>> yours)
>>
>> so my guess is something with the paths?
>> i carefully set them up with DS - and they look all right..
>>
>> i made sure the cache folder is set to 777 etc
>> so missing rights can be ruled out, too
>>
>> did you figure it out, yet?
>>
>> On 13 Sep., 22:51, "euromark (munich)" 
>> wrote:
>>
>> > On 11 Sep., 23:24, hahmadi82  wrote:
>>
>> > > I'm trying to use this helper with the phpThumb
>> library:http://code621.com/content/1/phpthumb-helper-for-cakephp
>>
>> > > When I run the code to give me a thumbnail I get:
>>
>> > >  Array ( [error] => 1 [error_detail] => phpThumb
>> > > v1.7.9200805132119thissourceFilename and thissrc are both empty [src]
>> =>
>> > > user/blankuser.jpg [w] => 100 [h] => 100 )
>>
>> > > Does anyone know what the error_detail means?
>>
>> > > --
>> > > View this message in
>> context:http://www.nabble.com/phpThumb-tp25408589p25408589.html
>> > > Sent from the CakePHP mailing list archive at Nabble.com.
> > 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/phpThumb-tp25408589p25430889.html
Sent from the CakePHP mailing list archive at Nabble.com.


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



Re: cant read a session variable in an ajax action

2009-09-13 Thread Dr. Loboto

I think Cake do actual write to session when send response to the
client. So if main action is not finished yet, its session changes are
not applied.

On Sep 14, 1:46 am, Marcelo Andrade  wrote:
> Hi there,
>
> I'd like to use ajax->remoteTimer to update a status
> message in the view.  The main action is a big loop
> in which I set the current index to a session key with
> $this->Session->write('MyController.currentval, $i).
>
> But when I try to read this session key inside the
> remoteTimer's related action, the value isn't set.
> I changed the Security.level to medium but doesn't works.
>
> What I'm doing wrong?  Any help is appreciated.
>
> Best regards.
>
> --
> MARCELO DE F. ANDRADE
> Belem, PA, Amazonia, Brazil
> Linux User #221105
>
> http://mfandrade.wordpress.com
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Cache Problem with safari 4

2009-09-13 Thread Martin Westin


I am sure Safari does cache the page for you. My feeling is that you
can't fix this with a header. My feeling is that Safari has this
"feature" for some kinds of "back-clicking" no matter what you do.
Possibly it is to aid javascript-heavy sites.

If I click away now, in the middle of typing this post, I can click
back and still have my text in this ajax-loaded field on the page.
Neither the field nor the text were there when the page loaded. That
is not how FF or any other browser works afaik.

I guess the old rule still applies. Back-buttons are for websites...
not applications. :)
(try clicking back in gmail for example)

/Martin


On Sep 13, 7:33 am, p_tucky  wrote:
> Please test on FF3.5, IE7+ , and Safari4
>
> http://perhabs.com/cake_test
>
> user: test
> pass: test
>
> please look at display current time under login button.
> After login then click "back button" then see display time Firefox and
> IE will show you new time but Safari still display cache time.
>
> That's why I mention Safari still cache.
>
> Thanks
>
> On Sep 11, 2:03 pm, Martin Westin  wrote:
>
>
>
> > I am not sure that is a cache problem or anything you can fix. Are you
> > sure
>
> > I use Safari 4 all the time and I am under the impression that the
> > browser sometimes doesn't do any request at all when using the back
> > button. It simply re-displays what it a few moments ago. I have not
> > checked if the browser technically does a request or not. It is just a
> > feeling I get.
>
> > /Martin
>
> > On Sep 11, 6:13 am, p_tucky  wrote:
>
> > > Hi, I have cache problem with safari 4.
> > > Any one have problem like me?
>
> > > I’ve tried with this code but does not work. It take me to the
> > > previous page and have still show the text on form.
>
> > > function beforeFilter()
> > > {
>
> > >    if($this->action == ‘login’) {
> > >           $this->disableCache();
> > >    }
>
> > >     Header( “Last-Modified: ” . gmdate( “D, j M Y H:i:s” ) . ” GMT” );
> > >     Header( “Expires: ” . gmdate( “D, j M Y H:i:s”, time() ) . ”
> > > GMT” );
> > >     Header( “Cache-Control: no-store, no-cache, must-revalidate” );
>
> > > }
>
> > > FF and IE both don’t have any problem, when click “back button” and no
> > > cache.
> > > Safari 4 it seem still have cache when click “back button”.
>
> > > Any solution please advise.
> > > Thanks in advance.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Auth.php modification.

2009-09-13 Thread Sreenivas S. Nair
Hi all
   i want to store the login ,logout time of all users in my
application.
For that i wrote a method, CAN I PUT THAT METHOD IN AUTH.PHP FILE AND CALL
FROM THE AUTH->LOGIN() AND LOGOUT() METHODS?
IS DER ANY ISSUES FOR MODIFYING THE AUTH.PHP?
AM NEW IN CAKE PLZ HELP.

-- 
Thanks '&' Regards
Sreenivas Soman

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



Re: Cake Php Sept GGroup Community Help

2009-09-13 Thread Marcelo Andrade

On Sun, Sep 13, 2009 at 11:00 PM, CoolCourt  wrote:
>
> (..)
> So I would like to use this sept thread to get an idea of all of the
> members who need some sort of help or want to help the knowledge base
> of all of us grow and we can work together to try to make the jump
> from 1.2 to 1.3 as seamless as possible.

I'm in.

Best regards.

--
MARCELO DE F. ANDRADE
Belem, PA, Amazonia, Brazil
Linux User #221105

http://mfandrade.wordpress.com

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



Cake Php Sept GGroup Community Help

2009-09-13 Thread CoolCourt

Hello I have been off and on on this group for a while.

I was wondering if we could all maybe get an idea of the members who
are pretty active in this group and try to get a good solid Group of
individuals that are willing to put their heads together with me and
try to come up with some tips, tricks, tutorials on helping each other
and new members with cake php.

Right now I feel like i am very good with code in general, but with
cakephp I feel as if i have so many options and being that i switch
from workstations often, the bake script doesnt really help me since i
am in the beginning stages and often dont know where or what project i
am gonna put the baked code in.

So I would like to use this sept thread to get an idea of all of the
members who need some sort of help or want to help the knowledge base
of all of us grow and we can work together to try to make the jump
from 1.2 to 1.3 as seamless as possible.

Thanks and reply i sorta ran off at the mouth but as I come to grasps
with what i wanna do it'll get clearer.

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



incorrect resulting array from a multiselect option problem please help

2009-09-13 Thread learning_cake_php

my problem goes this way:
im trying to do a multiple save at once but before i did,
 i checked the resulting array every
after a form submit with different values on it
and i found out that the resulting array of data
seems a little bit wierd.
so first:
heres my rel:

OfferedSubject HABTM Course

heres my view:

flash(); ?>


form(array(
'type' => 'post',
'options'=>array(
'url'=>array(

'controller'=>$this->params['controller'],

'action'=>'offeredSubjectAdd'.'/'.$subjectId.'/'.$lastSec.'/'.
$numSec
),
'model'=>'OfferedSubject',
'update'=>'results'
)
));
 ?>



















>







input($j.'.section'); ?>











input($j.'.days'); ?>


input($j.'.times'); ?>


input($j.'.room'); ?>


input($j.'.limits'); ?>


input($j.'.gender_flag',array(

'type'=>'select',
'options'=>
array(

'M'=>'M',

'F'=>'F'
),

'empty'=>'Choose One'
)

);
?>


input($j.'.college_id');?>


input('Course'); ?>







end('Submit');?>


-

ok $numSec there is used to count how many OfferedSubjects will i
save...
say for instance i wanted to save 4 OfferedSubjects without choosing
any Course first
heres the resulting array: 4 OfferedSubjects without choosing any
Course:


Array
(
[OfferedSubject] => Array
(
[0] => Array
(
[section] =>
[days] => 1
[times] =>
[room] =>
[limits] =>
[gender_flag] =>
[college_id] => 1
)

[1] => Array
(
[section] =>
[days] =>
[times] =>
[room] =>
[limits] =>
[gender_flag] =>
[college_id] => 1
)

[2] => Array
(
[section] =>
[days] =>
[times] =>
[room] =>
[limits] =>
[gender_flag] =>
[college_id] => 1
)

[3] => Array
(
[section] =>
[days] =>
[times] =>
[room] =>
[limits] =>
[gender_flag] =>
[college_id] => 1
)

)

[Course] => Array
(
[Course] => Array
(
[0] =>
[1] =>
[2] =>
)

)

)

As you can see, there are only three Course reflected
--

heres another resulting array: 4 OfferedSubjects choosing 1 Course
from the 4th OfferedSubject-Course View:

Array
(
[OfferedSubject] => Array
(
[0] => Array
(
   

Re: Sort List Question

2009-09-13 Thread brian

I wouldn't bother. Just create the database table in the order you
want them to appear and order by id.

On Sun, Sep 13, 2009 at 4:30 PM, Dave Maharaj :: WidePixels.com
 wrote:
>
> I have in the db states/provinces which has the following fields
>
> id              int(3)
> abrev           varchar(5)
> name            varchar(45)
> region  varchar(3)
>
>
> These just end up in a drop down select and now they are sorted alphbeticaly
> by name. But how can I sort is to all the States are grouped then Canadian
> Provinces? I tried
>
> public function getStates()
>      {
>                  $params = array('contain' => false,
>                                                  'fields' => array(
>
> 'State.name'),
>                                                  'order' => array(
>
> 'State.name ASC'
>
> ),
>                                                  'group' => array(
>
> 'State.region'
>
> ),
>
>                                                  );
>          $q = $this->State->find('list', $params);
>          return $q;
>      }
>
> But then my drop down just shows Alaska and Alberta
>
> Can someone tell me what I amdoing wrong here?
>
> 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 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Complex model associations, pagination and containable

2009-09-13 Thread brian
I see what you mean. My eyes glazed over. :-)

How about posting the output of debug($this->paginate) (after you've
set the conditions)?

On Sun, Sep 13, 2009 at 4:41 PM, martinp  wrote:
>
> It's quite complicated as I have to deal with some craziness in the
> form search form submission. I don't think this is the problem, but
> here's the function that sorts out the conditions:
>
>        private function setPreConditions() {
>                $preConditions = $this->postConditions($this->data);
>                unset($preConditions['Search.search']);
>                $facilitiesConditions = array();
>                if(!empty($preConditions)) {
>                        foreach($preConditions as $key => $value) {
>                                if(empty($value)) {
>                                        unset($preConditions[$key]);
>                                } else {
>                                        if(substr($key, 0, 14) == 
> 'SchoolFacility') {
>                                                $facility_name = substr($key, 
> 15);
>                                                
> $facilitiesConditions[]['School.facilities LIKE ?'] = "%
> \"$facility_name\";s:1:\"1\";%";
>                                                unset($preConditions[$key]);
>                                        }
>                                        if($key == 'School.name') {
>                                                $preConditions[]['or'] = 
> array('LOWER(School.name) LIKE' =>
> '%'.low($value).'%', 'LOWER(Course.name) LIKE' => '%'.low($value).'%',
> 'LOWER(CourseType.name) LIKE' => '%'.low($value).'%', 'LOWER
> (CourseQualification.name) LIKE' => '%'.low($value).'%', 'LOWER
> (CourseLevelMin.name) LIKE' => '%'.low($value).'%');
>                                                unset($preConditions[$key]);
>                                        }
>                                        if($key == 'Course.start_time') {
>                                                switch($value) {
>                                                        case 'AM':
>                                                                
> $preConditions[]['or'] = array('Course.start_time <' =>
> '12:00:00', 'Course.start_time' => null);
>                                                                break;
>                                                        case 'PM':
>                                                                
> $preConditions[]['or'] = array('Course.start_time >=' =>
> '12:00:00', 'Course.start_time' => null);
>                                                                break;
>                                                }
>                                                unset($preConditions[$key]);
>                                        }
>                                        if($key == 'Course.max_class_size') {
>                                                
> $preConditions['Course.max_class_size <='] = $value;
>                                                unset($preConditions[$key]);
>                                        }
>                                        if($key == 'Course.course_level_min') {
>                                                $preConditions[]['or'] = 
> array('CourseLevelMin.order <=' =>
> $value, 'Course.course_level_min' => null);
>                                                unset($preConditions[$key]);
>                                        }
>                                        if($key == 'Student.age') {
>                                                $preConditions[]['or'] = 
> array('Course.minimum_age <=' =>
> $value, 'Course.minimum_age' => null);
>                                                $preConditions[]['or'] = 
> array('Course.maximum_age >=' =>
> $value, 'Course.maximum_age' => null);
>                                                $preConditions[]['or'] = 
> array('Accommodation.minimum_age <=' =>
> $value, 'Accommodation.minimum_age' => null);
>                                                $preConditions[]['or'] = 
> array('Accommodation.maximum_age >=' =>
> $value, 'Accommodation.maximum_age' => null);
>                                                unset($preConditions[$key]);
>                                        }
>                                        if($key == 'Course.lessons_per_week') {
>                                                switch($value) {
>                                                        case 1:
>                                                                
> $preConditions['Course.lessons_per_week <='] = 10;
>                                                                break;
>                                                        case 2:
>                                                                
> $preConditions['Course.lessons_per_week >='] = 10;
>                                                                
> $preConditions['Course.lessons_per_wee

Re: Select only one row

2009-09-13 Thread brian

On Sun, Sep 13, 2009 at 6:01 PM, Jon Bennett  wrote:
>
>> You'd probably be best off creating a view (in the database, not a
>> Cake view) to do this. Off the top of my head, the query would use a
>> self join to grab the most recent record for each client. With proper
>> indexing, it should be fairly efficient.
>
> That seems like overkill to me, it's a simple and common query with a
> little processing of the data. As long as the requests are paginated
> it should never be an issue.
>

Overekill? Sorry, but I can't agree with that. It's just the opposite.
Doing this sort of thing inside any decent database will always beat
doing it in application code. Your suggestions all entail selecting
everything and throwing out what's not needed. That can't be anything
but less efficient. Just because Cake is very handy with a lot of
things doesn't mean that good database practice should be ignored.

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



Re: phpThumb

2009-09-13 Thread brian

Yes, that's exactly what I needed to do.

On Sun, Sep 13, 2009 at 6:10 PM, euromark (munich)
 wrote:
>
> i guess i found the problem
>
> you need $PHPTHUMB_CONFIG['allow_src_above_docroot'] = true;
> if you use /webroot/ as your top level folder (on localhost i use /
> localhost/.../app/
>
> and as this helper does not use the config.php, you just need to pass
> it before calling the setParameter() method
>
>
> On 13 Sep., 22:54, "euromark (munich)" 
> wrote:
>> funny thing
>>
>> i tried that helper
>> and on localhost with xampp/windowsXp it works just fine
>>
>> after uploading it to my webserver (linux), it broke (same error as
>> yours)
>>
>> so my guess is something with the paths?
>> i carefully set them up with DS - and they look all right..
>>
>> i made sure the cache folder is set to 777 etc
>> so missing rights can be ruled out, too
>>
>> did you figure it out, yet?
>>
>> On 13 Sep., 22:51, "euromark (munich)" 
>> wrote:
>>
>> > On 11 Sep., 23:24, hahmadi82  wrote:
>>
>> > > I'm trying to use this helper with the phpThumb 
>> > > library:http://code621.com/content/1/phpthumb-helper-for-cakephp
>>
>> > > When I run the code to give me a thumbnail I get:
>>
>> > >  Array ( [error] => 1 [error_detail] => phpThumb
>> > > v1.7.9200805132119thissourceFilename and thissrc are both empty [src] =>
>> > > user/blankuser.jpg [w] => 100 [h] => 100 )
>>
>> > > Does anyone know what the error_detail means?
>>
>> > > --
>> > > View this message in 
>> > > context:http://www.nabble.com/phpThumb-tp25408589p25408589.html
>> > > Sent from the CakePHP mailing list archive at Nabble.com.
> >
>

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



Re: phpThumb

2009-09-13 Thread euromark (munich)

i guess i found the problem

you need $PHPTHUMB_CONFIG['allow_src_above_docroot'] = true;
if you use /webroot/ as your top level folder (on localhost i use /
localhost/.../app/

and as this helper does not use the config.php, you just need to pass
it before calling the setParameter() method


On 13 Sep., 22:54, "euromark (munich)" 
wrote:
> funny thing
>
> i tried that helper
> and on localhost with xampp/windowsXp it works just fine
>
> after uploading it to my webserver (linux), it broke (same error as
> yours)
>
> so my guess is something with the paths?
> i carefully set them up with DS - and they look all right..
>
> i made sure the cache folder is set to 777 etc
> so missing rights can be ruled out, too
>
> did you figure it out, yet?
>
> On 13 Sep., 22:51, "euromark (munich)" 
> wrote:
>
> > On 11 Sep., 23:24, hahmadi82  wrote:
>
> > > I'm trying to use this helper with the phpThumb 
> > > library:http://code621.com/content/1/phpthumb-helper-for-cakephp
>
> > > When I run the code to give me a thumbnail I get:
>
> > >  Array ( [error] => 1 [error_detail] => phpThumb
> > > v1.7.9200805132119thissourceFilename and thissrc are both empty [src] =>
> > > user/blankuser.jpg [w] => 100 [h] => 100 )
>
> > > Does anyone know what the error_detail means?
>
> > > --
> > > View this message in 
> > > context:http://www.nabble.com/phpThumb-tp25408589p25408589.html
> > > Sent from the CakePHP mailing list archive at Nabble.com.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Select only one row

2009-09-13 Thread Jon Bennett

> You'd probably be best off creating a view (in the database, not a
> Cake view) to do this. Off the top of my head, the query would use a
> self join to grab the most recent record for each client. With proper
> indexing, it should be fairly efficient.

That seems like overkill to me, it's a simple and common query with a
little processing of the data. As long as the requests are paginated
it should never be an issue.

Hth,

j



>
> On Fri, Sep 11, 2009 at 3:42 PM, sindbad  wrote:
>>
>> Okay,
>>
>> thanks for your reply but from where I get the $id. This should be
>> Client.id but... this query selects only one row but I need to select
>> only one row for each client. I have 1000 clients and 21290 reports.
>> For every client I need to select the date of last report.
>>
>> On 11 sep., 21:52, Miles J  wrote:
>>> Well you would have to grab the last date. Heres a query, assuming you
>>> followed cake conventions.
>>>
>>> $result = $this->Report->find('first', array(
>>> 'fields' => 'Report.created',
>>> 'order' => 'Report.id DESC',
>>> 'conditions' => array('Report.client_id' => $id)
>>> ));
>>>
>>> Then echo it in the view: echo $result['Report']['created'];
>>>
>>> On Sep 11, 11:42 am, sindbad  wrote:
>>>
>>> > Hi,
>>>
>>> > first of all I want to say that I'm new to cake but with a little help
>>> > from http://book.cakephp.org and Google I've made a simple application for
>>> > managing clients and reports for the clients.
>>> > Each client has many raports. Now, in the index view of the clients I
>>> > need to show the date of last report. This is what I don't know how to
>>> > do it.
>>> > I'll be glad if you could tell me how to select only the date of the
>>> > last report for each of my clients.
>>> > Thanks.
>> >
>>
>
> >
>

-- 

jon bennett
w: http://www.jben.net/
iChat (AIM): jbendotnet Skype: jon-bennett

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



Re: phpThumb

2009-09-13 Thread hahmadi82


Not really, I still have no idea why it's happening.  My paths seem to be
correct, although I never set up a cache folder... Could this be the source
of the problem?  I basically just followed these instructions:
http://code621.com/content/1/phpthumb-helper-for-cakephp


euromark (munich) wrote:
> 
> 
> funny thing
> 
> i tried that helper
> and on localhost with xampp/windowsXp it works just fine
> 
> after uploading it to my webserver (linux), it broke (same error as
> yours)
> 
> so my guess is something with the paths?
> i carefully set them up with DS - and they look all right..
> 
> i made sure the cache folder is set to 777 etc
> so missing rights can be ruled out, too
> 
> did you figure it out, yet?
> 
> 
> On 13 Sep., 22:51, "euromark (munich)" 
> wrote:
>> On 11 Sep., 23:24, hahmadi82  wrote:
>>
>> > I'm trying to use this helper with the phpThumb
>> library:http://code621.com/content/1/phpthumb-helper-for-cakephp
>>
>> > When I run the code to give me a thumbnail I get:
>>
>> >  Array ( [error] => 1 [error_detail] => phpThumb
>> > v1.7.9200805132119thissourceFilename and thissrc are both empty [src]
>> =>
>> > user/blankuser.jpg [w] => 100 [h] => 100 )
>>
>> > Does anyone know what the error_detail means?
>>
>> > --
>> > View this message in
>> context:http://www.nabble.com/phpThumb-tp25408589p25408589.html
>> > Sent from the CakePHP mailing list archive at Nabble.com.
> > 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/phpThumb-tp25408589p25427611.html
Sent from the CakePHP mailing list archive at Nabble.com.


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



Re: Doing a mysql left join

2009-09-13 Thread Whitty

OK, Sussed this out,

fullname Model:
var $hasAndBelongsToMany = array(
'Address' =>
array(
'joinTable' => 'persons_addresses',
'foreignKey'=> 'name_id',
'associationForeignKey'  => 'addr_id',
'unique'=> true))

Address Model:
var $hasAndBelongsToMany = array(
'Fullname' =>
array(
'joinTable' => 
'persons_addresses',
'foreignKey'=> 'addr_id',
'associationForeignKey' => 'name_id'))

Darren



On Sep 11, 11:07 pm, Whitty  wrote:
> OK,
>
> Getting a little way closer, I've found this article 
> herehttp://jbenner.net/blog/understanding-cakephp-associationsthat
> mirrors what it says on the php site under here 
> :http://book.cakephp.org/view/78/Associations-Linking-Models-Together
>
> What I have at present is a model called personsaddress.php which
> contains this code:
>
>  class PersonsAddress extends AppModel {
>         var $name = 'PersonsAddress';
>         var $hasAndBelongsToMany = array(
>         'addresses' =>
>             array(
>                  'className'              => 'address',
>                  'joinTable'              => 'persons_addresses',
>                  'foreignKey'             => 'name_id',
>                 'associationForeignKey'  => 'addr_id',
>                 'unique'                 => true
>             )
>     );
>
> }
>
> ?>
>
> and on the fullnames_controller.php I have this function:
>
>     function view($id = null) {
>     $this->Fullname->id = $id;
>     $this->set('fullname', $this->Fullname->read());
>     $this->set('linkaddr',  $this->Addresses->read(null, $id));
>
> }
>
> I'm assuming that linkaddr should hold an array with the users
> addressdetails, calling view.cpt but I'm getting the error:
>
> Notice (8): Undefined property: FullnamesController::$Addresses [APP/
> controllers/fullnames_controller.php, line 10]
> Fatal error: Call to a member function read() on a non-object in
> /controllers/fullnames_controller.php on line 10
>
> Would be grateful for some pointers?
>
> Thanks
>
> Darren
>
> On Sep 11, 3:43 pm, Whitty  wrote:
>
> > Hi,
>
> > I'm a bit new to this, I'm trying to do a left join.
>
> > I have a db with People table (id:name_id) in it a linking table
> > (linking name_id to addr_id) and an address table with the index
> > (addr_id)
>
> > the sql command I usually use is:
>
> > SELECT persons_address.addr_id FROM addresses left JOIN
> > persons_address ON persons_address.addr_id = addresses.addr_id WHERE
> > persons_address.name_id ='.$name_id
>
> > I'm assuming I need a model for the linking table.
>
> > How would I go about creating a query to print out the users name with
> > the linked address below? I've got as far as outputting the user name.
>
> > Are their any examples?
>
> > Darren
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: phpThumb

2009-09-13 Thread euromark (munich)

funny thing

i tried that helper
and on localhost with xampp/windowsXp it works just fine

after uploading it to my webserver (linux), it broke (same error as
yours)

so my guess is something with the paths?
i carefully set them up with DS - and they look all right..

i made sure the cache folder is set to 777 etc
so missing rights can be ruled out, too

did you figure it out, yet?


On 13 Sep., 22:51, "euromark (munich)" 
wrote:
> On 11 Sep., 23:24, hahmadi82  wrote:
>
> > I'm trying to use this helper with the phpThumb 
> > library:http://code621.com/content/1/phpthumb-helper-for-cakephp
>
> > When I run the code to give me a thumbnail I get:
>
> >  Array ( [error] => 1 [error_detail] => phpThumb
> > v1.7.9200805132119thissourceFilename and thissrc are both empty [src] =>
> > user/blankuser.jpg [w] => 100 [h] => 100 )
>
> > Does anyone know what the error_detail means?
>
> > --
> > View this message in 
> > context:http://www.nabble.com/phpThumb-tp25408589p25408589.html
> > Sent from the CakePHP mailing list archive at Nabble.com.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: phpThumb

2009-09-13 Thread euromark (munich)



On 11 Sep., 23:24, hahmadi82  wrote:
> I'm trying to use this helper with the phpThumb 
> library:http://code621.com/content/1/phpthumb-helper-for-cakephp
>
> When I run the code to give me a thumbnail I get:
>
>  Array ( [error] => 1 [error_detail] => phpThumb
> v1.7.9200805132119thissourceFilename and thissrc are both empty [src] =>
> user/blankuser.jpg [w] => 100 [h] => 100 )
>
> Does anyone know what the error_detail means?
>
> --
> View this message in 
> context:http://www.nabble.com/phpThumb-tp25408589p25408589.html
> Sent from the CakePHP mailing list archive at Nabble.com.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Complex model associations, pagination and containable

2009-09-13 Thread martinp

It's quite complicated as I have to deal with some craziness in the
form search form submission. I don't think this is the problem, but
here's the function that sorts out the conditions:

private function setPreConditions() {
$preConditions = $this->postConditions($this->data);
unset($preConditions['Search.search']);
$facilitiesConditions = array();
if(!empty($preConditions)) {
foreach($preConditions as $key => $value) {
if(empty($value)) {
unset($preConditions[$key]);
} else {
if(substr($key, 0, 14) == 
'SchoolFacility') {
$facility_name = substr($key, 
15);

$facilitiesConditions[]['School.facilities LIKE ?'] = "%
\"$facility_name\";s:1:\"1\";%";
unset($preConditions[$key]);
}
if($key == 'School.name') {
$preConditions[]['or'] = 
array('LOWER(School.name) LIKE' =>
'%'.low($value).'%', 'LOWER(Course.name) LIKE' => '%'.low($value).'%',
'LOWER(CourseType.name) LIKE' => '%'.low($value).'%', 'LOWER
(CourseQualification.name) LIKE' => '%'.low($value).'%', 'LOWER
(CourseLevelMin.name) LIKE' => '%'.low($value).'%');
unset($preConditions[$key]);
}
if($key == 'Course.start_time') {
switch($value) {
case 'AM':

$preConditions[]['or'] = array('Course.start_time <' =>
'12:00:00', 'Course.start_time' => null);
break;
case 'PM':

$preConditions[]['or'] = array('Course.start_time >=' =>
'12:00:00', 'Course.start_time' => null);
break;
}
unset($preConditions[$key]);
}
if($key == 'Course.max_class_size') {

$preConditions['Course.max_class_size <='] = $value;
unset($preConditions[$key]);
}
if($key == 'Course.course_level_min') {
$preConditions[]['or'] = 
array('CourseLevelMin.order <=' =>
$value, 'Course.course_level_min' => null);
unset($preConditions[$key]);
}
if($key == 'Student.age') {
$preConditions[]['or'] = 
array('Course.minimum_age <=' =>
$value, 'Course.minimum_age' => null);
$preConditions[]['or'] = 
array('Course.maximum_age >=' =>
$value, 'Course.maximum_age' => null);
$preConditions[]['or'] = 
array('Accommodation.minimum_age <=' =>
$value, 'Accommodation.minimum_age' => null);
$preConditions[]['or'] = 
array('Accommodation.maximum_age >=' =>
$value, 'Accommodation.maximum_age' => null);
unset($preConditions[$key]);
}
if($key == 'Course.lessons_per_week') {
switch($value) {
case 1:

$preConditions['Course.lessons_per_week <='] = 10;
break;
case 2:

$preConditions['Course.lessons_per_week >='] = 10;

$preConditions['Course.lessons_per_week <='] = 15;
break;
case 3:

$preConditions['Course.lessons_per_week >'] = 15;
  

Sort List Question

2009-09-13 Thread Dave Maharaj :: WidePixels.com

I have in the db states/provinces which has the following fields

id  int(3)
abrev   varchar(5)   
namevarchar(45)  
region  varchar(3)   


These just end up in a drop down select and now they are sorted alphbeticaly
by name. But how can I sort is to all the States are grouped then Canadian
Provinces? I tried 

public function getStates()
  {
  $params = array('contain' => false, 
  'fields' => array(

'State.name'),
  'order' => array(

'State.name ASC'

),
  'group' => array(

'State.region'

),
  
  );
  $q = $this->State->find('list', $params);
  return $q;
  }

But then my drop down just shows Alaska and Alberta

Can someone tell me what I amdoing wrong here?

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



Re: How to save sorted by 'column'?

2009-09-13 Thread Jeroen

For the whole three I want to sort all the direct childs first on date-
of birth and then on lastname, so I think the reorder-method won't
work.

I tried the following method:
$this->Person->children(array(
  'order' => 'date_of_birth ASC, lastname DESC'))

It works, but it fucks up my whole tree, thats because the tree is
'build' as follows:
$this->Person->children(array(
  'order' => 'lft'))

When I do the following, the direct childs of every parent are NOT
sorted by date_of_birth and then by lastname
$this->Person->children(array(
  'order' => 'lft, date_of_birth ASC, lastname DESC'))

Does anyone know how I can sort direct childs of every parent for a
whole tree at once?

On 13 sep, 11:44, AD7six  wrote:
> On 13 sep, 02:14, Jeroen  wrote:
>
> > By default the Tree-behaviour is sorted by 'name'.
>
> Since when - the tree behavior doesn't care about 'order'.
>
> You probably 
> wanthttp://api.cakephp.org/class/tree-behavior#method-TreeBehaviorreorder
>
> AD
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



cant read a session variable in an ajax action

2009-09-13 Thread Marcelo Andrade

Hi there,

I'd like to use ajax->remoteTimer to update a status
message in the view.  The main action is a big loop
in which I set the current index to a session key with
$this->Session->write('MyController.currentval, $i).

But when I try to read this session key inside the
remoteTimer's related action, the value isn't set.
I changed the Security.level to medium but doesn't works.

What I'm doing wrong?  Any help is appreciated.

Best regards.

--
MARCELO DE F. ANDRADE
Belem, PA, Amazonia, Brazil
Linux User #221105

http://mfandrade.wordpress.com

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



Re: Formatting Dates in a Select form Field?

2009-09-13 Thread Marcelo Andrade

On Sun, Sep 13, 2009 at 4:34 PM, Gerard  wrote:
>
> Marcelo,
>
> I can't see how Set::format will work.  I want to change the string
> '2009-09-06' to '6 Sep'.
>
> The Set::format utility basically uses the sprintf function to
> rearrange the keys into a string. Or am I missing something?
>
> Thanks

Oh, I see.  So I'm afraid Set::format will be useless
in this case.  But you have some alternatives:

1) Take a look at Chankov's DateFormatter behavior
(a litttle bit MVC respectful but more ready-to-use)

http://nik.chankov.net/2007/12/20/using-different-date-format-in-cakephp-12/

2) You can apply the proper PHP's date function to
all members of your list without looping it with an
array_map or even array_walk call.

3) Or you can always overwrite the find method in
your model to get the formatted values.

Hope it helps.

Best regards.

--
MARCELO DE F. ANDRADE
Belem, PA, Amazonia, Brazil
Linux User #221105

http://mfandrade.wordpress.com

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



Re: Cache Problem with safari 4

2009-09-13 Thread Marcelo Andrade

On Sun, Sep 13, 2009 at 7:33 AM, p_tucky  wrote:
>
> Please test on FF3.5, IE7+ , and Safari4
>
> http://perhabs.com/cake_test
>
> user: test
> pass: test
>
> please look at display current time under login button.
> After login then click "back button" then see display time Firefox and
> IE will show you new time but Safari still display cache time.
>
> That's why I mention Safari still cache.

Did you tried to wrap the clock code in
the view with  tags ?

http://book.cakephp.org/view/347/Marking-Non-Cached-Content-in-Views

Best regards.

--
MARCELO DE F. ANDRADE
Belem, PA, Amazonia, Brazil
Linux User #221105

http://mfandrade.wordpress.com

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



Strange 404 error

2009-09-13 Thread Warringer

I have run into a very strange error today.

After baking model, view and controller for one table, I set of to
modify the 'add' action to work with a adding chain of adding data to
several tables.

It worked well until I ran into the problem...

All I added to get additional data into the view for hidden fields...

function add($a = 0, $b = 0)
{
...
$this->set('a',$a);
$this->set('b',$b);
}

... And going through the other adds of the chain, I got a 404 error
from cake.

But its not the prebuild Cake 404 error you get on a missing
controller or action, but simply a blank page with just the SQL query
table on it. And that was it.

The header of the HTML form is normal.



>From the chain the form is requested with 'http://localhost/directory/
controller/add/1/2'. But it can't be the missing number in the end as
'http://localhost/directory/controller/add' also gets me the form.

I hope someone can help me out here

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



Re: Pictures in blog

2009-09-13 Thread brian

If you're using a WYSIWYG control for formatting the blog posts,
there's probably hooks you can use to do this sort of thing. I created
a fairly rudimentary plugin once for WymEditor that did this. The
existing "upload" button simply prompted for an img path, so the image
obviously already had to be on the server and the client needed to
know exactly where it was. Some people have created image browser
plugins that make this simpler but they don't do uploads. Mine
prompted the user to upload a file and also allowed for choosing id,
class, and styles.

So, upload the image from within an iframe (because an AJAX request
can't upload) and have your script re-size (to some maximum
dimensions) and save the file within the files dir. I would create a
subdir with that day's date (if it doesn't exist) and save it there.
Then send back a JSON object with the full path from DOCUMENT_ROOT as
well as the final width & height, and maybe other attributes (eg.
style). Then add an img tag inline within the content. Jquery makes
this pretty painless.

The really great thing about doing it this way is that the img can be
anywhere within the content and it shows up in your preview
immediately. The downside is that the img is not recorded in the DB.
That is, it *could be* but, since the img tag markup is embedded
within the blog content, your Cake app has nothing to do with
displaying it. So, recording it in the DB has few benefits.

On Fri, Sep 11, 2009 at 11:41 AM, Theo McCaie  wrote:
> I'm looking to serve up pictures with a blog post and hoping for
> architectural advice. There can be any number of pictures any where in the
> article.
>
> To create a post there is a form with a text area (for the blog) and a
> picture upload field (and fields with info about the picture eg align right,
> descripton etc).
> Finally a small bit of java which replicates the inputs again so you can add
> more blog or pictures, rinse and repeat.
>
> What is the best way do you guys think to implement this. Currently the file
> is uploaded and a  tag is appended to the blog post and saved in the
> data base. This isn't a great solution.
>
> I'd love to heat some ideas for a flexible way of storing, and editing this
> data.
>
> Thanks
>
> Theo.
>
>
>
>
>
> >
>

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



Re: where are these sections on the cake framework?

2009-09-13 Thread brian

On Sun, Sep 13, 2009 at 11:01 AM, ildw.com  wrote:
>
> Hello,
>
> I just installed cake and it is running for a already designed page,
> my friend who did the installation is out of town and I need to update
> the website, my questions are:
>
>
> 1)where is the header file so I can update the header of all the
> website?

Probably in app/views/layouts/default.ctp

> 2)where is the footer file so I update the footer?

Probably in the same as above or app/views/elements/footer.ctp

> 3)If I put an image in the body of a page index.ctc, the image doesn't
> show up, how is the coding for putting images?

app/webroot/ is the root directory. Any image files in
app/webroot/img/ should show up fine if the src attribute begins with
"/img/...". If your code uses the HtmlHelper to create an img tag, the
path given should NOT include the "/img/" part, ie

$html->image('foo.jpg')

... for an image at app/webroot/img/foo.jpg

> 4)where is the database connection string file?

app/config/database.php

> thank you!!!

Please study these:

http://book.cakephp.org/
http://api.cakephp.org/

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



Re: Select only one row

2009-09-13 Thread brian

You'd probably be best off creating a view (in the database, not a
Cake view) to do this. Off the top of my head, the query would use a
self join to grab the most recent record for each client. With proper
indexing, it should be fairly efficient.

On Fri, Sep 11, 2009 at 3:42 PM, sindbad  wrote:
>
> Okay,
>
> thanks for your reply but from where I get the $id. This should be
> Client.id but... this query selects only one row but I need to select
> only one row for each client. I have 1000 clients and 21290 reports.
> For every client I need to select the date of last report.
>
> On 11 sep., 21:52, Miles J  wrote:
>> Well you would have to grab the last date. Heres a query, assuming you
>> followed cake conventions.
>>
>> $result = $this->Report->find('first', array(
>> 'fields' => 'Report.created',
>> 'order' => 'Report.id DESC',
>> 'conditions' => array('Report.client_id' => $id)
>> ));
>>
>> Then echo it in the view: echo $result['Report']['created'];
>>
>> On Sep 11, 11:42 am, sindbad  wrote:
>>
>> > Hi,
>>
>> > first of all I want to say that I'm new to cake but with a little help
>> > from book.cakephp.org and Google I've made a simple application for
>> > managing clients and reports for the clients.
>> > Each client has many raports. Now, in the index view of the clients I
>> > need to show the date of last report. This is what I don't know how to
>> > do it.
>> > I'll be glad if you could tell me how to select only the date of the
>> > last report for each of my clients.
>> > Thanks.
> >
>

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



Re: Variable substitution

2009-09-13 Thread brian

This is a bit confusing. Why are you setting the variable $test in the
first place? Just put:

Hello, 

... in your view.

On Sat, Sep 12, 2009 at 9:33 AM, djogo  wrote:
>
> Hello all,
>
> The topic on Smarty remembered me of one issue I got.
>
> Suppose I have a string like this:
>
> $test = 'Hello, ';
>
> and I have a variable called $destinatary defined somewhere, and I
> wish to substitute the substring (contained in $test)
>
> 
>
> for the appropriated value that is into the variable $destinatary
> ['Person']['name'].
>
> Is there any class on cakephp to do it? Yeah, I'm currently using
> Smarty for that, it allows me to perform variable substitution not
> only in "view" files, but also in strings.
>
> And I feel that doing something like
>
> eval( "\$return = \"$test\"; " );
>
> is awfully dangerous, as $test actually comes from database, which is
> set by the end-user.
>
> The only way I though of doing that on Cakephp is by actually writing
> the $test contents into a view and rendering it, but it's lame.
>
> Thanks in advance
> >
>

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



Re: Ask : Anyone want this site source code? or give me some advice?

2009-09-13 Thread CoolCourt

my email is coolcourt{}gmail.com maybe u can send it to my email.

are there any other same sites source codes out on the internet?

On Sep 12, 3:26 pm, "Dave Maharaj :: WidePixels.com"
 wrote:
> Hello,
>
> I too would not mind peeking at the search function.
>
> Dave
>
>   _  
>
> From: Robert Popplewell [mailto:r0b...@gmail.com]
> Sent: September-12-09 4:45 PM
> To: cake-php@googlegroups.com
> Subject: Re: Ask : Anyone want this site source code? or give me some
> advice?
>
> I wouldn't mind having a look, I'd like to see how you've implemented your
> search
>
> 2009/9/12 CoolCourt 
>
> Hello I wouldnt mind getting a chance to play with that code. how do I
> get it?
>
> On Sep 11, 4:03 pm, yodi  wrote:
>
> > Hello,
>
> > I have build sites about logo sharing :http://freelogo.web.id.
> > It use CakePHP 1.2 Final and Jquery 1.2 and have build in one week.
>
> > Just asking that anyone interesting with this site code?
> > or maybe give me some advices?
>
> > If there are someone need it, i will opened it to help them.
>
> > Thanks
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



where are these sections on the cake framework?

2009-09-13 Thread ildw.com

Hello,

I just installed cake and it is running for a already designed page,
my friend who did the installation is out of town and I need to update
the website, my questions are:


1)where is the header file so I can update the header of all the
website?

2)where is the footer file so I update the footer?

3)If I put an image in the body of a page index.ctc, the image doesn't
show up, how is the coding for putting images?

4)where is the database connection string file?

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



Re: savefield doesn't work with tinyint

2009-09-13 Thread Bill

You're right when you say "i must have some other problem there".
When I changed the tinyint to int, my update would finally take, but
now I notice that if I try to udate the same record with a different
value in the int field, the update again stops working.  Maybe there's
something about cache I should know about?  This is very frustrating
for me.  What's the point of a framework that takes ten times longer
to figure out than it does to just write your own code?  No offense to
those who are developing cakePHP -- it's a great piece of work.  It's
just sometimes so frustrating.



On Sep 13, 10:39 am, "euromark (munich)" 
wrote:
> save and savefield?
> no way..
> i had millions of those working fine the past 6 months
>
> you must have some other problem there
> just one toggle value like "active": tinyint(1) unsigned NOT NULL
> default '0'
> etc
>
> On 13 Sep., 06:15, awstar  wrote:
>
> > just a heads up, i've spent most of the day trying to get a simple
> > save and savefield to work, only to find it doesn't of the mySQL table
> > defines the field as tinyint.
>
> > Just thought you'd like to know.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: savefield doesn't work with tinyint

2009-09-13 Thread euromark (munich)

save and savefield?
no way..
i had millions of those working fine the past 6 months

you must have some other problem there
just one toggle value like "active": tinyint(1) unsigned NOT NULL
default '0'
etc

On 13 Sep., 06:15, awstar  wrote:
> just a heads up, i've spent most of the day trying to get a simple
> save and savefield to work, only to find it doesn't of the mySQL table
> defines the field as tinyint.
>
> Just thought you'd like to know.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Formatting Dates in a Select form Field?

2009-09-13 Thread Gerard

Marcelo,

I can't see how Set::format will work.  I want to change the string
'2009-09-06' to '6 Sep'.

The Set::format utility basically uses the sprintf function to
rearrange the keys into a string. Or am I missing something?

Thanks


On Sep 13, 12:11 pm, Marcelo Andrade  wrote:
> On Fri, Sep 11, 2009 at 11:50 AM, gedm  wrote:
>
> > I have an array of data ($rounds) retrieved from a find('list')
> > command which looks like:
> >    [1] => 2009-09-06
> >    [2] => 2009-09-13
> >    [3] => 2009-09-20
> >    [4] => 2009-09-27
> >    [5] => 2009-10-04
> >    [6] => 2009-10-11
> >    [7] => 2009-10-18
> >    [8] => 2009-10-25
> >    [9] => 2009-11-01
> >    [10] => 2009-11-08
> >    [11] => 2009-11-15
>
> > The dates populate a Select form field using the view code
> > $form->input('round_id');
>
> > I would like to reformat the dates in the Select field to d-mmm
>
> > How do I reformat the values in the Select form field?
>
> Set::format is all you need! :-P
>
> http://book.cakephp.org/view/672/format
>
> Best regards.
>
> --
> MARCELO DE F. ANDRADE
> Belem, PA, Amazonia, Brazil
> Linux User #221105
>
> http://mfandrade.wordpress.com
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Why can the website not access the value of cookie after the browser access the website again after being closed?

2009-09-13 Thread majna

PHP variables are case sensitive. ($Month vs $month)

setcookie("username", $email, $Month,"/","localdomain.com",0);


On Sep 13, 4:38 am, Phper  wrote:
> I set cookie by the following statements:
>
>         $Month=2592000+time();
> setcookie("username", $email, $month,"/","localdomain.com",0);
>
> I can detect that it was set successfully because I can retrieve the
> value of $_COOKIE['username'].  However, when I shut down my browser
> and access the website again, I find that I don't log in. It seems
> that the website can not read the cookie value after the browser shuts
> down. Any idea?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: How to save sorted by 'column'?

2009-09-13 Thread AD7six



On 13 sep, 02:14, Jeroen  wrote:
> By default the Tree-behaviour is sorted by 'name'.

Since when - the tree behavior doesn't care about 'order'.

You probably want 
http://api.cakephp.org/class/tree-behavior#method-TreeBehaviorreorder

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



Why can the website not access the value of cookie after the browser access the website again after being closed?

2009-09-13 Thread Phper

I set cookie by the following statements:

$Month=2592000+time();
setcookie("username", $email, $month,"/","localdomain.com",0);

I can detect that it was set successfully because I can retrieve the
value of $_COOKIE['username'].  However, when I shut down my browser
and access the website again, I find that I don't log in. It seems
that the website can not read the cookie value after the browser shuts
down. Any idea?

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



[TREE]How to save sorted by 'column'?

2009-09-13 Thread Jeroen

By default the Tree-behaviour is sorted by 'name'.

This means all nodes are saved are sorted by name. How can I save
(insert and update) nodes in the way that the nodes are sorted by for
example date-of-birth instead of name.
So if two nodes has the same parent, I want to save them sorted by
date-of-birth instead of name.

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



Re: Question on the method input of Form helper relative to type 'date'

2009-09-13 Thread byqsri

Please Can you me make an example ?

On 12 Set, 09:52, WebbedIT  wrote:
> Should work without the ModelName if you supply 'type'=>'date'
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Select only one row

2009-09-13 Thread Jon Bennett

Hi Miles,

> I know that, if your read the rest of the posts I told him how to get
> it for multiple clients. And if he doesn't want that way, he needs to
> at least tell us his model associations.

Your first response detailed how to retrieve the most recent report
for a given client, as he isn't working with a specific client it's
not applicable.
The second response suggests removing the conditions array, but again
this doesn't solve his issue, it just retrieves every report for every
client in a great big lump, not grouped by Client etc, ie from the
Reports model and not the Client.

Not trying to pick a fight, just think you misread the question, as he
was (IMO) quite clear and did detail his associations.

Is your forum plugin ready yet? Looking forward to using (BTW, I use
your SQL caching method all the time, though now tied to memcached
rather than the file system).

Thanks,

Jon

-- 

jon bennett
w: http://www.jben.net/
iChat (AIM): jbendotnet Skype: jon-bennett

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