Re: Strange behavior usage problem

2007-10-26 Thread william

You can try this:
$this->Member->invalidate('username', 'must be between 3 to 20
characters.');

On Oct 26, 10:03 pm, MoD <[EMAIL PROTECTED]> wrote:
> Hello everyone!
> I'm currently developing a project using CakePHP version 1.2.0.5875
> pre-beta though I'm also familiarizing myself with it. I used a
> TreeBehavior for categories module. Everything seemed ok, until I
> didn't start using this behavior's own public methods - any method I
> try to call from controller returns error. For example:
> "Fatal error: Call to undefined function: generatetreelist()"
> That is the way I connected behavior to the model:
> "class Category extends AppModel
> {
> var $name = 'Category';
>
> var $actsAs = array('Tree');
> ...}"
>
> And that's how I called it from controller:
> "$categories = $this->Category->generateTreeList(null,
> '{n}.Category.id', '{n}.Category.title');"
> And that happen with just any public method in any behavior though
> each behavior was surely loaded and before* methods in them work fine.
> What am I missing?
>
> Thanks in advance.
>
> P.S.
> By the way, API documentation on TreeBehavior is different from what
> is actually in the source.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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
-~--~~~~--~~--~--~---



Function that Creates Empty $data Array?

2007-10-26 Thread Wole

Is there a function I can call that will return an empty $data array
for a particular model? Say my model is called Event. When I call this
function I want it to return and empty $data array that may look
something like this:

Array
(
[Event] => Array
(
[name] => '',
[starttime] => '',
[endtime] => ''
)
);

So the array only contains the keys but empty values. Please let me
know if this makes sense or if more explanation is needed. Thanks.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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
-~--~~~~--~~--~--~---



Session Problem

2007-10-26 Thread [EMAIL PROTECTED]

Hi, I'm new to CakePHP.  I'm using WinXP, Apache 2.2, PHP 5 and
CakePHP 1.2.

I run into this problem about session. I can't retrieve the session
when I redirect the user to another page like "/articles" after login
except if it's on the same controller 'UsersController'.

class UsersController extends AppController {
var $name = "Users";
var $helpers = array("Html", "Form", "Countrylist");

function register() {
$this->set('password_verification_error','');

if (!isset($this->user) || !$this->user) {
if(!empty($this->data)) {

$this->User->data = $this->data;

if ($this->User->validates()) {
if($this->data['User']['password'] != 
$this->data['User']
['password2']) {

$this->set('password_verification_error','Please verify your
password again.The passwords specified do not match.');
} else {
$this->data['User']['password'] 
= md5($this->data['User']
['password']);

$this->data['User']['last_login'] = date("Y-m-d H:i:s");

$this->data['User']['join_date'] = date("Y-m-d H:i:s");

$this->cleanUpFields();
$this->User->create();


if($this->User->save($this->data)) {

$this->Session->write('user', $this->data['User']['email']);

$this->redirect('/users/index');
} else {

$this->flash("problem.");
}
}
} else {
$this->validateErrors($this->User);
}
}
}  else {
$this->autoRender = false;
$this->redirect("/");
}
}

function index() {
$this->checkSession();
}

function login() {
$this->pageTitle = "iMallow - Author Login";

$this->set('error', '');
if ($this->data) {
$results = 
$this->User->findByEmail($this->data['User']['email']);
if ($results && $results['User']['password'] == 
md5($this-
>data['User']['password'])) {
$_SESSION['user'] = 
$this->data['User']['email'];
$this->Session->write('user', 
$this->data['User']['email']);
$this->Session->write('last_login', 
$results['User']
['last_login']);

$results['User']['last_login'] = date("Y-m-d 
H:i:s");
$this->User->save($results);

$this->redirect('/articles');
} else {
$this->set('error', 'Invalid login 
credential.');
}
}
}

function logout() {
$this->Session->delete('user');
$this->redirect('/users/login');
}
}


My ArticlesController looks like this:


class ArticlesController extends AppController {
var $name = "Articles";

function index() {
$this->Session->renew();
}
}


I'm trying to get the session on my layout view which looks like this:


http://www.w3.org/1999/xhtml";>


meta('favicon.ico','/
favicon.ico',array('type'=>'icon')); ?>
charset('utf-8'); ?>
css('main','import'); ?>





link($html->image("logo.gif",
array("alt"=>"iMallow Articles",
"boder"=>"0")),"/",false,false,false) ?>

read('user')) {
?>
Hi, read('user') ?>! 
link('My Account', 
'/users/profile') ?>, link('logout', '/users/logout') ?>

Welcome Guest! 
link("Sign 
In","/users/login") ?> , link("Register Here","/users/register") ?>








Submit An Article | Find 
Articles |
Terms of Use | Privacy Policy | Contact Us
Copyright © 2007. All rights reserved.





Re: cake php causes bad programming

2007-10-26 Thread the_woodsman

Ooop...

Davidlohr Bueso´s post mentions PHP5

I don´t want to be the one to blame for sidetracking a thread, but
Nate, surely you´re not saying there are no OO advantages to PHP5?

I know none of them are show stoppers, but IMHO, a lot of the work
arounds necessary to improve PHP4s OO make code less clear... for
example:

Privacy: the _ and ___ workarounds in Cake are nice, but to my mind is
far from ideal, I much prefer to have method and variable names
without these.

Interfaces: I know with PHPs loose typing these aren´t so essential,
but again, they make things cleaner I`d always assumed the
implementation of Behaviours in Cake 1.2 was necessary because
interfaces were only supported in PHP5, although I would take no
offence to be proved wrong about this!

Better reflection passing by referencethe list goes on!

Like I said, all of these, and other issues, have work arounds: but
personally Im glad to have them in my tool kit :)


On 27 oct, 07:10, nate <[EMAIL PROTECTED]> wrote:
> On Oct 27, 12:05 am, the_woodsman <[EMAIL PROTECTED]> wrote:
>
> > Although I have to disagree that PHP5 features are used in Cake,
> > generally I think Cake encourages good programming practice.
>
> Who said anything about PHP5?  And how exactly does *not* using PHP5
> make OO programming any harder?


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



Re: cake php causes bad programming

2007-10-26 Thread nate



On Oct 27, 1:10 am, nate <[EMAIL PROTECTED]> wrote:
> On Oct 27, 12:05 am, the_woodsman <[EMAIL PROTECTED]> wrote:
>
> > Although I have to disagree that PHP5 features are used in Cake,
> > generally I think Cake encourages good programming practice.
>
> Who said anything about PHP5?

My mistake, I was only referencing John's post.  But the second
question still stands.


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



Re: cake php causes bad programming

2007-10-26 Thread nate

On Oct 27, 12:05 am, the_woodsman <[EMAIL PROTECTED]> wrote:
> Although I have to disagree that PHP5 features are used in Cake,
> generally I think Cake encourages good programming practice.

Who said anything about PHP5?  And how exactly does *not* using PHP5
make OO programming any harder?


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



Re: cake php causes bad programming

2007-10-26 Thread the_woodsman

Although I have to disagree that PHP5 features are used in Cake,
generally I think Cake encourages good programming practice.

Even OO programmers can easily lapse into bad habits with PH, simpyl
because its such an easy language to ´just get things done.´

But now I am so much more familiar with MVC, front controller,
Registry, and various other patterns because of Cake, my normal PHP
code is much cleaner.

On Oct 27, 12:08 am, "John David Anderson (_psychic_)"
<[EMAIL PROTECTED]> wrote:
> On Oct 26, 2007, at 3:50 PM, carSign wrote:
>
>
>
> > So today I was having a discussion with a coworker who is not a fan of
> > using CAKEphp.
>
> > He is in favor of building his sites from scratch and clams that he
> > gets a faster development time (though I argue that he is writing puny
> > sites)
>
> Alas, I must agree with your wise friend.
>
> Recreating and testing a database access layer from scratch is  
> usually faster than downloading one. And when you've re-invented the  
> wheel, it is far more tested than say, a widely popular framework ORM  
> layer used by tens of thousands across many different platforms and  
> installations. I mean, you know what you wrote, right?
>
> Besides, the free work you get from the community could be from evil  
> hackers.
>
> Why use something that works, is well tested, documented, in wide  
> use, and freely contributed to... when you can do what's already been  
> done?
>
> > He also claimed that use of a framework like CAKE will result in
> > programmers that don't know how to write object oriented code.  Anyone
> > agree - disagree?
>
> Once again, this friend is correct.
>
> Since CakePHP is purely procedural, most OOP programmers' skills will  
> indeed wane when using this framework. Those using some sort of black  
> box written by someone they *dont* *even* *know* can't be trusted.  
> You have to intimately know what's going on during every line.
>
> That's why most PHP programmers know all the C and machine language  
> underlying these mystery PHP functions like "strlen" or "echo."  
> Anyone who blindly uses these functions without understanding the  
> full ramifications is fooling themself.
>
> ;o)
>
> -- John


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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: Handling image uploads

2007-10-26 Thread Lamiunto

Hey Rajesh,

Yeah, have a look here in the API
http://api.cakephp.org/class_html_helper.html#53a70ae6ec0f5e6bd77c5126a4e6e5e1

You will see that the first parameter is the $path variable. That path
is relative to the /webroot/img directory.
So you could load an image like this $html->image('img1.jpg'), that
will fetch out of the /webroot/img directory,
or you could do this $html->image('/profile/1/pic.jpg') which would
load from the /webroot/img/profile/1 directory.

If you want to load images from a different location, them simply use
an HTML  tag.

With security, what do you mean? Like to stop hotlinking?

Shaun

On Oct 27, 12:11 pm, Rajesh <[EMAIL PROTECTED]> wrote:
> Thanks Guys for your help. I got the image upload working. When i use
> $html>image() to display the uploaded image, it picks up from /webroot/
> img. Is there any way i can use $html->image() to load an image from a
> different location. And also where can we move the uploaded images
> from tmp_dir, i mean which location (in terms to security) is better
> to store images.
>
> Thanks
> Rajesh


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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: Handling image uploads

2007-10-26 Thread Rajesh

Thanks Guys for your help. I got the image upload working. When i use
$html>image() to display the uploaded image, it picks up from /webroot/
img. Is there any way i can use $html->image() to load an image from a
different location. And also where can we move the uploaded images
from tmp_dir, i mean which location (in terms to security) is better
to store images.

Thanks
Rajesh


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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: Reversible encrypt functions in Cake?

2007-10-26 Thread Wayne Fay

Ah nevermind, I see it now:
https://trac.cakephp.org/browser/trunk/cake/1.2.x.x/cake/libs/security.php

Thanks.

On 10/26/07, Wayne Fay <[EMAIL PROTECTED]> wrote:
> Must be new, I've got cake_1.2.0.5427alpha and there's no
> Security.cipher(). I'll go check a more recent build...
>
>
> On 10/26/07, nate <[EMAIL PROTECTED]> wrote:
> >
> > Check the cipher() function in the Security class.
> >
> > On Oct 26, 2:06 pm, "Wayne Fay" <[EMAIL PROTECTED]> wrote:
> > > I solved the problem with mcrypt (so I can build my own stuff if
> > > necessary) but I'm still wondering if anyone else has advice on
> > > reversible encryption in Cake...
> > >
> > > Wayne
> > >
> > > On 10/26/07, Wayne Fay <[EMAIL PROTECTED]> wrote:
> > >
> > > > Hi bakers,
> > >
> > > > I need a reversible encrypt function in Cake, and I need to be able to
> > > > use it in a non-Cake PHP class as well. Basically I've got an export
> > > > function that is nontrivial and previously written in PHP, and instead
> > > > of rewriting things to make it work in Cake, I'm planning to encrypt
> > > > the URL parameters with Cake and then decrypt them in my export
> > > > function.
> > >
> > > > I wrote a little EncryptionHelper using some code I took from
> > > >www.php.combut it doesn't seem to be working in Cake though it works
> > > > fine in "standard" PHP. I had to uncomment the
> > > > "extension=php_mcrypt.dll" line in php.ini of course.
> > >
> > > > Here's the error:
> > > > Fatal error: Call to undefined function mcrypt_get_iv_size() in
> > > > C:\dev\cake\app\views\helpers\encryption.php on line 18
> > >
> > > > Here's the code:
> > > > $iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB);
> > > > $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
> > > > $key = "This is a very secret key";
> > > > return urlencode(base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256,
> > > > $key, $text, MCRYPT_MODE_ECB, $iv)));
> > >
> > > > So it seems like I can't use these built-in PHP functions for some
> > > > reason... Any advice?
> > >
> > > > Wayne
> >
> >
> > > >
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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: Out of memory and findall

2007-10-26 Thread Paolo

I linked them through an ID, but I need to display the name of the
cities/regions, so I need to "join" the id in the house row with the
name in the city table
to francky06l , what do you mean cache? How can I use caching in cake?

On 26 Ott, 18:03, "J. Eckert" <[EMAIL PROTECTED]> wrote:
> > In house index action I use findAll in all tables in order to show the
>
> Why are you using findAll on ALL tables?
>
> If your Models are corretly associated
> (
>   house belongsTo city
>   city belongsTo region
>   region belongsTo State
> )
> you shouldn't get more information than you need if you do a
>
> $this->House->findAll()
>
> For every house you will get 1 city, 1 region, 1 state...
>
> On Oct 26, 12:01 pm, Paolo <[EMAIL PROTECTED]> wrote:
>
> > Hi all!
> > I have a problem using cake. I have a table that is linked to it's
> > geographical location
> > (i.e. house -> ... city_id
> > city -> ... region_id
> > region -> -... state_id)
> > city, region and state in the list of houses. The problem is that I
> > have 8000 cities so i get out of memory error. Is there another way to
> > associate the id to the name of the city (region and state)?
>
> > Thanks


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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: Display "Recent posts" lists in layout

2007-10-26 Thread Adam Risser

Exactly what I was looking for! Thank you hydra12!

On Oct 26, 5:05 pm, hydra12 <[EMAIL PROTECTED]> wrote:
> I'd use an element with requestAction.  You can find a tutorial on how
> to use them 
> here:http://bakery.cakephp.org/articles/view/creating-reusable-elements-wi...
>
> Hope that helps.
> hydra12
>
> On Oct 26, 2:34 pm, Adam Risser <[EMAIL PROTECTED]> wrote:
>
> > I have a section in my default layout (default.ctp) called "Recent
> > Posts".  The posts are stored in my database.  Currently, each method
> > in my posts controller includes the following code.
>
> > # code snippet 1
> > $fields = array('id', 'title');
> > $this->set('data_for_layout', $this->Post->findAll(null, $fields,
> > null, 5));
>
> > Then I use this in my layout (default.ctp) to print out the posts
>
> > #layout code snippet.
> > foreach($data_for_layout as $post)
> > {
> >echo ''.
> > $post['Post']['title'] . "\n";
>
> > }
>
> > My problem is that I have to include the top code snippet in each
> > method to make it work this way, which seems wrong.  I have been
> > trying to find a better way to do this in the manual, but am coming up
> > empty.  Am I supposed to use elements or helpers to do this? Can I tie
> > those to the database somehow?  Any help would be greatly appreciated
> > since I am new to cakePHP! Thanks!


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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: Plugin Models Not Loading for 1.2.0.5875 pre-beta release?

2007-10-26 Thread [EMAIL PROTECTED]

I found this thread searching for CakePHP plugin help as my plugins
weren't loading.

Finally got my plugins to work by putting the
pluginname_app_controller.php and pluginname_app_model.php files
*under* the plugin/pluginname/ directory and *not* the plugin/ root
directory as the documentation tells you too.

http://devzone.zend.com/node/view/id/593 contains the correct
instructions.

Not sure if that's relevant to either of the problems in this thread
but hopefully it may be of use to whoever finds this thread.

Kind regards,
Gareth

On Oct 25, 3:46 pm, McFadly <[EMAIL PROTECTED]> wrote:
> Ryan -  I'm having the same problem.  Have you found a solution?
>
> On Oct 25, 8:35 am, "Ryan Rose" <[EMAIL PROTECTED]> wrote:
>
> > Has anyone else experienced problems with loading plugin models using the
> > 1.2.0.5875 pre-beta release? The standard "Missing Model" error message says
> > it expects the model to be in app/models, which is incorrect because it
> > should be in app/plugins/plugin_name/models.
>
> > Ryan Rose
> > Vice President
> > Digiwize, Inc.
> > One Technology Drive
> > Tolland, CT 06084
> > e: [EMAIL PROTECTED]
> > p: 860.730.2631http://www.digiwize.com


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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: sanitize bug or ?

2007-10-26 Thread vg2k

i forgot say, using cakephp 1.2 alpha


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



Re: cake php causes bad programming

2007-10-26 Thread John David Anderson (_psychic_)


On Oct 26, 2007, at 3:50 PM, carSign wrote:

>
> So today I was having a discussion with a coworker who is not a fan of
> using CAKEphp.
>
> He is in favor of building his sites from scratch and clams that he
> gets a faster development time (though I argue that he is writing puny
> sites)

Alas, I must agree with your wise friend.

Recreating and testing a database access layer from scratch is  
usually faster than downloading one. And when you've re-invented the  
wheel, it is far more tested than say, a widely popular framework ORM  
layer used by tens of thousands across many different platforms and  
installations. I mean, you know what you wrote, right?

Besides, the free work you get from the community could be from evil  
hackers.

Why use something that works, is well tested, documented, in wide  
use, and freely contributed to... when you can do what's already been  
done?

> He also claimed that use of a framework like CAKE will result in
> programmers that don't know how to write object oriented code.  Anyone
> agree - disagree?

Once again, this friend is correct.

Since CakePHP is purely procedural, most OOP programmers' skills will  
indeed wane when using this framework. Those using some sort of black  
box written by someone they *dont* *even* *know* can't be trusted.  
You have to intimately know what's going on during every line.

That's why most PHP programmers know all the C and machine language  
underlying these mystery PHP functions like "strlen" or "echo."  
Anyone who blindly uses these functions without understanding the  
full ramifications is fooling themself.

;o)

-- John

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



Re: cake php causes bad programming

2007-10-26 Thread Davidlohr Bueso
Until you gather a good amount of experience with the framework he is right,
it's much faster to write software from scratch. However, once you get
familiar with design patterns, the architecture and go around of certain
things that aren't that clear (because nothing is perfect) of any framework,
development becomes much much easier, faster and just better.

About OOP, cakePHP uses heavily the PHP5 object oriented features, and one
must be familiar with key concepts (like inheritance) to understand what one
is doing.

2007/10/26, carSign <[EMAIL PROTECTED]>:
>
>
> So today I was having a discussion with a coworker who is not a fan of
> using CAKEphp.
>
> He is in favor of building his sites from scratch and clams that he
> gets a faster development time (though I argue that he is writing puny
> sites)
>
> He also claimed that use of a framework like CAKE will result in
> programmers that don't know how to write object oriented code.  Anyone
> agree - disagree?
>
>
> >
>

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



Re: cake php causes bad programming

2007-10-26 Thread Repsah
disagree and I shouldn't add a word but

1) I just coded a web application for a small company, they didn't know
cake, I showed it to them, the coding took half time the time they expected
the project to be done and I worked on it part time instead than full time
like they wanted to. They were able to touch my application without having
to figure out everything behind it, they now use Cake on all their new
projects
2) Cake is the core of object oriented, not knowing how to handle it is
probably the biggest problem when first approaching cake.
3) With a proper framework behind you can benefit the use of MVC (and if you
don't know MVC you can learn why is it so good),  implementing  an MVC
application from scratch... sure... ask your friend how faster that is going
to be.

On 10/26/07, carSign <[EMAIL PROTECTED]> wrote:
>
>
> So today I was having a discussion with a coworker who is not a fan of
> using CAKEphp.
>
> He is in favor of building his sites from scratch and clams that he
> gets a faster development time (though I argue that he is writing puny
> sites)
>
> He also claimed that use of a framework like CAKE will result in
> programmers that don't know how to write object oriented code.  Anyone
> agree - disagree?
>
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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 php causes bad programming

2007-10-26 Thread carSign

So today I was having a discussion with a coworker who is not a fan of
using CAKEphp.

He is in favor of building his sites from scratch and clams that he
gets a faster development time (though I argue that he is writing puny
sites)

He also claimed that use of a framework like CAKE will result in
programmers that don't know how to write object oriented code.  Anyone
agree - disagree?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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: Display "Recent posts" lists in layout

2007-10-26 Thread hydra12

I'd use an element with requestAction.  You can find a tutorial on how
to use them here: 
http://bakery.cakephp.org/articles/view/creating-reusable-elements-with-requestaction

Hope that helps.
hydra12

On Oct 26, 2:34 pm, Adam Risser <[EMAIL PROTECTED]> wrote:
> I have a section in my default layout (default.ctp) called "Recent
> Posts".  The posts are stored in my database.  Currently, each method
> in my posts controller includes the following code.
>
> # code snippet 1
> $fields = array('id', 'title');
> $this->set('data_for_layout', $this->Post->findAll(null, $fields,
> null, 5));
>
> Then I use this in my layout (default.ctp) to print out the posts
>
> #layout code snippet.
> foreach($data_for_layout as $post)
> {
>echo ''.
> $post['Post']['title'] . "\n";
>
> }
>
> My problem is that I have to include the top code snippet in each
> method to make it work this way, which seems wrong.  I have been
> trying to find a better way to do this in the manual, but am coming up
> empty.  Am I supposed to use elements or helpers to do this? Can I tie
> those to the database somehow?  Any help would be greatly appreciated
> since I am new to cakePHP! Thanks!


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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: Code Fixes?

2007-10-26 Thread Damon

Oh, yeah.  Forgot to register on Trac.  Once I did, I see I can add
tix.  Perhaps I shouldn't be committing changes if I can't figure out
Trac for the n-teenth time!

Thanks!

On Oct 26, 1:25 pm, "Chris Hartjes" <[EMAIL PROTECTED]> wrote:
> On 10/26/07, Damon <[EMAIL PROTECTED]> wrote:
>
>
>
> > Hey,  I've got some code fixes for the Pre-Beta; how can I post these?
>
> Post tickets athttps://trac.cakephp.orgwith your code fixes.
>
> --
> Chris Hartjes
>
> My motto for 2007:  "Just build it, damnit!"
>
> @TheKeyboard -http://www.littlehart.net/atthekeyboard


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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
-~--~~~~--~~--~--~---



Display "Recent posts" lists in layout

2007-10-26 Thread Adam Risser

I have a section in my default layout (default.ctp) called "Recent
Posts".  The posts are stored in my database.  Currently, each method
in my posts controller includes the following code.

# code snippet 1
$fields = array('id', 'title');
$this->set('data_for_layout', $this->Post->findAll(null, $fields,
null, 5));

Then I use this in my layout (default.ctp) to print out the posts

#layout code snippet.
foreach($data_for_layout as $post)
{
   echo ''.
$post['Post']['title'] . "\n";
}

My problem is that I have to include the top code snippet in each
method to make it work this way, which seems wrong.  I have been
trying to find a better way to do this in the manual, but am coming up
empty.  Am I supposed to use elements or helpers to do this? Can I tie
those to the database somehow?  Any help would be greatly appreciated
since I am new to cakePHP! Thanks!


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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: Code Fixes?

2007-10-26 Thread nate

Code fixes that also include unit tests are particularly appreciated
and will be reviewed sooner.

On Oct 26, 2:19 pm, Damon <[EMAIL PROTECTED]> wrote:
> Hey,  I've got some code fixes for the Pre-Beta; how can I post these?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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: Reversible encrypt functions in Cake?

2007-10-26 Thread Wayne Fay

Must be new, I've got cake_1.2.0.5427alpha and there's no
Security.cipher(). I'll go check a more recent build...


On 10/26/07, nate <[EMAIL PROTECTED]> wrote:
>
> Check the cipher() function in the Security class.
>
> On Oct 26, 2:06 pm, "Wayne Fay" <[EMAIL PROTECTED]> wrote:
> > I solved the problem with mcrypt (so I can build my own stuff if
> > necessary) but I'm still wondering if anyone else has advice on
> > reversible encryption in Cake...
> >
> > Wayne
> >
> > On 10/26/07, Wayne Fay <[EMAIL PROTECTED]> wrote:
> >
> > > Hi bakers,
> >
> > > I need a reversible encrypt function in Cake, and I need to be able to
> > > use it in a non-Cake PHP class as well. Basically I've got an export
> > > function that is nontrivial and previously written in PHP, and instead
> > > of rewriting things to make it work in Cake, I'm planning to encrypt
> > > the URL parameters with Cake and then decrypt them in my export
> > > function.
> >
> > > I wrote a little EncryptionHelper using some code I took from
> > >www.php.combut it doesn't seem to be working in Cake though it works
> > > fine in "standard" PHP. I had to uncomment the
> > > "extension=php_mcrypt.dll" line in php.ini of course.
> >
> > > Here's the error:
> > > Fatal error: Call to undefined function mcrypt_get_iv_size() in
> > > C:\dev\cake\app\views\helpers\encryption.php on line 18
> >
> > > Here's the code:
> > > $iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB);
> > > $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
> > > $key = "This is a very secret key";
> > > return urlencode(base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256,
> > > $key, $text, MCRYPT_MODE_ECB, $iv)));
> >
> > > So it seems like I can't use these built-in PHP functions for some
> > > reason... Any advice?
> >
> > > Wayne
>
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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: Code Fixes?

2007-10-26 Thread Chris Hartjes

On 10/26/07, Damon <[EMAIL PROTECTED]> wrote:
>
> Hey,  I've got some code fixes for the Pre-Beta; how can I post these?
>

Post tickets at https://trac.cakephp.org with your code fixes.

-- 
Chris Hartjes

My motto for 2007:  "Just build it, damnit!"

@TheKeyboard - http://www.littlehart.net/atthekeyboard

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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: Reversible encrypt functions in Cake?

2007-10-26 Thread nate

Check the cipher() function in the Security class.

On Oct 26, 2:06 pm, "Wayne Fay" <[EMAIL PROTECTED]> wrote:
> I solved the problem with mcrypt (so I can build my own stuff if
> necessary) but I'm still wondering if anyone else has advice on
> reversible encryption in Cake...
>
> Wayne
>
> On 10/26/07, Wayne Fay <[EMAIL PROTECTED]> wrote:
>
> > Hi bakers,
>
> > I need a reversible encrypt function in Cake, and I need to be able to
> > use it in a non-Cake PHP class as well. Basically I've got an export
> > function that is nontrivial and previously written in PHP, and instead
> > of rewriting things to make it work in Cake, I'm planning to encrypt
> > the URL parameters with Cake and then decrypt them in my export
> > function.
>
> > I wrote a little EncryptionHelper using some code I took from
> >www.php.combut it doesn't seem to be working in Cake though it works
> > fine in "standard" PHP. I had to uncomment the
> > "extension=php_mcrypt.dll" line in php.ini of course.
>
> > Here's the error:
> > Fatal error: Call to undefined function mcrypt_get_iv_size() in
> > C:\dev\cake\app\views\helpers\encryption.php on line 18
>
> > Here's the code:
> > $iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB);
> > $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
> > $key = "This is a very secret key";
> > return urlencode(base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256,
> > $key, $text, MCRYPT_MODE_ECB, $iv)));
>
> > So it seems like I can't use these built-in PHP functions for some
> > reason... Any advice?
>
> > Wayne


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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
-~--~~~~--~~--~--~---



Code Fixes?

2007-10-26 Thread Damon

Hey,  I've got some code fixes for the Pre-Beta; how can I post these?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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: MAMP and Cake 1.2 Pre-Beta: 1.2.0.5875

2007-10-26 Thread mastorna

Upgrading MAMP was the solution.  Thanks all!!

On Oct 26, 8:44 am, pdBaker <[EMAIL PROTECTED]> wrote:
> Hey, there.
>
> I had the same issues with my app upgrading to the pre-beta.  For some
> reason, when MAMP's php has an error related to Mysql, there's a good
> possibility that it will freak out, and not render your page.
>
> I tracked down my issue by commenting out relationships between
> models.  I couldn't get any debug() or even echo to work because of
> Mamp's freakout - even though I had PHP error reporting set to E_ALL.
> Once I found the relationship that was causing no page display, I
> could look at the particular model and form a theory.
>
> In my case, the specific issue seemed to be self-referencing models.
> I'm guessing that this generates some strange looping error or crazy
> SQL string in 1.2 pre-beta that's causing the timeout.  I changed the
> model in question over to using TreeBehavior, rather than defining
> parent/belongsTo and child/hasMany relationships, and everything was
> smooth sailing again.
>
> Hopefully, that should get you pointed in the right direction.  Also,
> you might try checking /Applications/MAMP/logs/php_error.log, just to
> see if php is logging any issues before bailing.  Although, one would
> think that if it has a chance to report, you'd get something in
> Safari.
>
> Rock.
>
> -PD
>
> On Oct 26, 10:58 am, Charlie van de Kerkhof <[EMAIL PROTECTED]>
> wrote:
>
> > No. I use MAMP + MAMP Pro 1.7 and no problems in safari
>
> > On Oct 25, 9:55 pm, mastorna <[EMAIL PROTECTED]> wrote:
>
> > > Is anyone having difficulty upgrading to 1.2 pre-beta from a 1.1 or
> > > earlier 1.2 lines when using MAMP?  I've got all my htaccess files
> > > configured as normal, as well as MAMP's Apache documentRoot pointing
> > > to the right path, but this latest release sees Safari timing out when
> > > attempting to light it up.  Any reasons why?
>
> > > cheers,
> > > lm


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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: Reversible encrypt functions in Cake?

2007-10-26 Thread Wayne Fay

I solved the problem with mcrypt (so I can build my own stuff if
necessary) but I'm still wondering if anyone else has advice on
reversible encryption in Cake...

Wayne

On 10/26/07, Wayne Fay <[EMAIL PROTECTED]> wrote:
> Hi bakers,
>
> I need a reversible encrypt function in Cake, and I need to be able to
> use it in a non-Cake PHP class as well. Basically I've got an export
> function that is nontrivial and previously written in PHP, and instead
> of rewriting things to make it work in Cake, I'm planning to encrypt
> the URL parameters with Cake and then decrypt them in my export
> function.
>
> I wrote a little EncryptionHelper using some code I took from
> www.php.com but it doesn't seem to be working in Cake though it works
> fine in "standard" PHP. I had to uncomment the
> "extension=php_mcrypt.dll" line in php.ini of course.
>
> Here's the error:
> Fatal error: Call to undefined function mcrypt_get_iv_size() in
> C:\dev\cake\app\views\helpers\encryption.php on line 18
>
> Here's the code:
> $iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB);
> $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
> $key = "This is a very secret key";
> return urlencode(base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256,
> $key, $text, MCRYPT_MODE_ECB, $iv)));
>
> So it seems like I can't use these built-in PHP functions for some
> reason... Any advice?
>
> Wayne
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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
-~--~~~~--~~--~--~---



sanitize bug or ?

2007-10-26 Thread vg2k

sanitize.php
/**
 * Makes a string SQL-safe.
 *
 * @param string $string String to sanitize
 * @param string $connection Database connection being used
 * @return string SQL safe string
 * @access public
 * @static
 */
function escape($string, $connection = 'default') {
$db = ConnectionManager::getDataSource($connection);
$value = substr($db->value($string), 1);
$value = substr($value, 0, -1);
return $value;
}



if try at controler code:

$san = new Sanitize();
$var = $san->escape('12345');
die(var_dump($var));

take: string '234' (length=3)

WHY ?

if code:

$san = new Sanitize();
$var = $san->escape('1');
die(var_dump($var));

take: boolean false


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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
-~--~~~~--~~--~--~---



Reversible encrypt functions in Cake?

2007-10-26 Thread Wayne Fay

Hi bakers,

I need a reversible encrypt function in Cake, and I need to be able to
use it in a non-Cake PHP class as well. Basically I've got an export
function that is nontrivial and previously written in PHP, and instead
of rewriting things to make it work in Cake, I'm planning to encrypt
the URL parameters with Cake and then decrypt them in my export
function.

I wrote a little EncryptionHelper using some code I took from
www.php.com but it doesn't seem to be working in Cake though it works
fine in "standard" PHP. I had to uncomment the
"extension=php_mcrypt.dll" line in php.ini of course.

Here's the error:
Fatal error: Call to undefined function mcrypt_get_iv_size() in
C:\dev\cake\app\views\helpers\encryption.php on line 18

Here's the code:
$iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB);
$iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
$key = "This is a very secret key";
return urlencode(base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256,
$key, $text, MCRYPT_MODE_ECB, $iv)));

So it seems like I can't use these built-in PHP functions for some
reason... Any advice?

Wayne

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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
-~--~~~~--~~--~--~---



How to display error (when saving data)?

2007-10-26 Thread Steveston

Hello!

When saving data via a form, I can use $html->tagErrorMsg (along with
invalidate function & model validation) to display error message.

However, if I am not saving data via a form, how shall I display error
message?

For example, instead of adding one by form, I am adding many records
by importing a csv file. Some records violates validation, some
records are duplicate, etc. How shall I do to display error message to
visitors (on View page)?

Thank you very much


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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 create button in layout with ***Helper in CakePHP 1.2.0.5875-pre-beta

2007-10-26 Thread Chambrln

I put together a simple formButton helper if you want to use it it
appears to work.

 ''
);
/**
 * Creates a input type="button"
 *
 * @param  string  $fieldName The label appearing on the button
 * @param  array   $options
 * @return string  A HTML input button
 */
function create ($fieldName, $options = array())
{
return $this->output(sprintf($this->tags['button'], 
$fieldName,
$this->_parseAttributes($options, null, null, ' ')));
}

}
?>

save the code in /app/views/helpers/form_button.php
add var $helpers = array('formButton'); to your controller

Use the following example to create a button
create('CancelStep',
array('value'=>'Cancel')) ."\n"; ?>


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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: Out of memory and findall

2007-10-26 Thread J. Eckert

> In house index action I use findAll in all tables in order to show the

Why are you using findAll on ALL tables?

If your Models are corretly associated
(
  house belongsTo city
  city belongsTo region
  region belongsTo State
)
you shouldn't get more information than you need if you do a

$this->House->findAll()

For every house you will get 1 city, 1 region, 1 state...

On Oct 26, 12:01 pm, Paolo <[EMAIL PROTECTED]> wrote:
> Hi all!
> I have a problem using cake. I have a table that is linked to it's
> geographical location
> (i.e. house -> ... city_id
> city -> ... region_id
> region -> -... state_id)
> city, region and state in the list of houses. The problem is that I
> have 8000 cities so i get out of memory error. Is there another way to
> associate the id to the name of the city (region and state)?
>
> Thanks


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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 1.2: saveField, why ?

2007-10-26 Thread daphonz

I was getting a similar problem when I was using saveField.  In Cake
1.2.4605 alpha I used a saveField call while updating my Category
model.  The SQL command would look like this:

UPDATE `categories` SET `options` = 'a:2:{i:0;s:1:\"0\";i:1;s:
0:\"\";}' WHERE `id` IN (66)

and work just fine.

Whereas in Cake 1.2.5875 pre-beta, the same command would result in
the SQL line:

UPDATE `categories` SET `id` = 67,`parent_id` = 66,`numberOfChildren`
= NULL,`options` = 'a:2:{i:0;s:1:\"0\";i:1;s:0:\"\";}',`name` =
'Default',`teaser` = NULL,`description` = NULL,`model` =
'Image',`ordering` = 1,`created` = '2007-08-27 17:33:24',`modified` =
'2007-08-27 17:33:24' WHERE `id` IN (66)

Notice it would set the category ID incorrectly, as well as update the
entire entry, which sounds similar to what's happening to you.

I fixed this by moving from saveField to the model save function, as
such:
$saveData = array('Category'=>array('id'=>$category['ParentCategory']
['id'],'options'=>serialize($options)));
$this->Image->Category-
>save($saveData,false,array('Category.options'));

And that seemed to work.

So in your case, try:
$saveData = array('Category'=>array('id'=>$category_id,'title'=>
$title));
$this->Category->save($saveData,false,array('Category.title'));

And hopefully that will work for you.


On Oct 26, 4:58 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> I have model Category with fields:
>
> id
> title
> parent_id
>
> (yep category with subcategory, like threaded in bakery).
> In model I don't put any belongs/has... base, empty model...
>
> Ok.
>
> So, when I change title by saveField
>
> $this->Category->saveField('title',$title);
>
> I see this query:
>
> UPDATE `categories` SET `parent_id` = '0',`title` = 'My new title'
> WHERE `id` IN (1)
>
> So, WHY I get "parent_id = 0", Why???


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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: MAMP and Cake 1.2 Pre-Beta: 1.2.0.5875

2007-10-26 Thread pdBaker

Hey, there.

I had the same issues with my app upgrading to the pre-beta.  For some
reason, when MAMP's php has an error related to Mysql, there's a good
possibility that it will freak out, and not render your page.

I tracked down my issue by commenting out relationships between
models.  I couldn't get any debug() or even echo to work because of
Mamp's freakout - even though I had PHP error reporting set to E_ALL.
Once I found the relationship that was causing no page display, I
could look at the particular model and form a theory.

In my case, the specific issue seemed to be self-referencing models.
I'm guessing that this generates some strange looping error or crazy
SQL string in 1.2 pre-beta that's causing the timeout.  I changed the
model in question over to using TreeBehavior, rather than defining
parent/belongsTo and child/hasMany relationships, and everything was
smooth sailing again.

Hopefully, that should get you pointed in the right direction.  Also,
you might try checking /Applications/MAMP/logs/php_error.log, just to
see if php is logging any issues before bailing.  Although, one would
think that if it has a chance to report, you'd get something in
Safari.

Rock.

-PD

On Oct 26, 10:58 am, Charlie van de Kerkhof <[EMAIL PROTECTED]>
wrote:
> No. I use MAMP + MAMP Pro 1.7 and no problems in safari
>
> On Oct 25, 9:55 pm, mastorna <[EMAIL PROTECTED]> wrote:
>
> > Is anyone having difficulty upgrading to 1.2 pre-beta from a 1.1 or
> > earlier 1.2 lines when using MAMP?  I've got all my htaccess files
> > configured as normal, as well as MAMP's Apache documentRoot pointing
> > to the right path, but this latest release sees Safari timing out when
> > attempting to light it up.  Any reasons why?
>
> > cheers,
> > lm


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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: ordering a model through related model order

2007-10-26 Thread grigri

I can see what you want to achieve, but in your specific example it
doesn't make sense.

Each baker has MANY cookies associated with him, so you can't sort by
a list; only by a 1:1 field.

So you don't want to sort the bakers by the rate of their baked
cookies - you need to be much more specific.

How about sorting the bakers by the rate of their personal best? Or by
their personal worst? Or some other, more complicated metric (mean
average for example)

As you can see, you need to create a 1-to-1 relationship between Baker
and Cookie, dynamically bind on it, and perform the sort on that
cookie's rating.

If you have Baker hasMany Cookie, you'd do it like this (I know you've
got a HABTM, but this is easier to explain - HABTM is similar but more
long-winded)

$this->Bakery->Baker->bindModel(array('hasOne' => array('BestCookie'
=> array('className' => 'cookie', 'order' => 'BestCookie.rating
DESC';
$this->Bakery->hasMany['Baker']['order'] = 'BestCookie.rating DESC';
$bakeries = $this->Bakery->findAll(...);

(The order clause in the hasOne binding specifies the best cookie -
use ASC for the worst. The second order clause is what order the
bakers appear in - here I've done best to worst - use ASC for worst to
best)

On Oct 26, 2:22 pm, David Spreekmeester <[EMAIL PROTECTED]>
wrote:
> Thanks for replying, Paul. So I seem not to be the only one, do none
> of the gurus here have a clue how to do this in a tidy efficient way
> without sorting afterwards?
>
> On Oct 26, 3:04 am, "Paul Webster" <[EMAIL PROTECTED]> wrote:
>
> > I tried to do something very similar not so long ago, and too had trouble
> > getting it to do as I wanted.
>
> > In the end not having time to pursue it further I did just sort after the
> > query was made, as far as I could tell due to the way habtm's are querried
> > it wasn't a simple case of altering the association settings etc.
>
> > I'd be interested to see if anyone has some clear thoughts on this too.
>
> > -Original Message-
> > From: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf
>
> > Of David Spreekmeester
> > Sent: Friday, 26 October 2007 9:02 a.m.
> > To: Cake PHP
> > Subject: ordering a model through related model order
>
> > Hey there bakers.
>
> > I couldn't find an appropriate answer to this anywhere. Suppose I have
> > three models:
>
> > Bakery <- hasAndBelongsToMany -> Baker <- hasAndBelongsToMany ->
> > Cookie
>
> > Suppose there is a cookie baking contest going on. Every cookie is
> > rated for quality (int Cookie.quality). I would like to do a find()
> > for a certain bakery, and then *sort the employed bakers there by the
> > rate of their baked cookies*. I tried stuff like setting the 'order'
> > property to 'Cookie.quality' in the Cookie model file, but of course
> > that just orders the cookies, and doesn't sort the bakers. The same
> > goes for setting 'Cookie.quality' as the sorting parameter in the
> > find() call.
>
> > Of course I could just sort the bakers afterwards with my own custom
> > sort function, but is there a way to do this automagically?
>
> > __ NOD32 2617 (20071025) Information __
>
> > This message was checked by NOD32 antivirus system.http://www.eset.com


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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: filter/search/paginate

2007-10-26 Thread RichardAtHome

Here's one method (Cake 1.2):

Create a form in your view:


find
 



And change the index method of your controller to:

function index() {

$this->Programme->recursive = 0;

$params = $this->params['url'];

if (!array_key_exists("find", $params)) {

$this->set('programmes', $this->paginate());

}
else {

$this->set('programmes', 
$this->paginate(array("Programme.name LIKE
'{$params['find']}%'")));

}

}

I'm still a n00b when it comes to cake so there is probably a better
way to create the paginate parameter, but this works for me.

Hope this helps.


On Oct 23, 10:51 am, inma <[EMAIL PROTECTED]> wrote:
> Hello,
>
>  I'm looking for component or helper to filter/search/paginate
> results. I need it for version 1.1.15 (not version 1.2).
>
>  I want something exactly like 
> thishttp://www.javascriptkit.com/script/script2/tablefilter.shtml,
> but I need to  refresh data from database when the filter or the
> pagination are applied, and this script doesn't do it.
>
> Thanks in advance.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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: Help with Navigation

2007-10-26 Thread RichardAtHome

The way I manage navigation is:

Primary site nav goes in the layout

Secondary/Tertiary goes in the view

If you find yourself repeating navigation code in your views, stick it
in an Element

Hope this helps.


On Oct 24, 2:19 am, James <[EMAIL PROTECTED]> wrote:
> Does anybody have any good ways/examples to handle standard site
> navigation? Primary, secondary, and tertiary levels?
>
> Thanks,
>
> James


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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: MAMP and Cake 1.2 Pre-Beta: 1.2.0.5875

2007-10-26 Thread Charlie van de Kerkhof

No. I use MAMP + MAMP Pro 1.7 and no problems in safari

On Oct 25, 9:55 pm, mastorna <[EMAIL PROTECTED]> wrote:
> Is anyone having difficulty upgrading to 1.2 pre-beta from a 1.1 or
> earlier 1.2 lines when using MAMP?  I've got all my htaccess files
> configured as normal, as well as MAMP's Apache documentRoot pointing
> to the right path, but this latest release sees Safari timing out when
> attempting to light it up.  Any reasons why?
>
> cheers,
> lm


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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
-~--~~~~--~~--~--~---



cakephp , fastcgi, APC

2007-10-26 Thread DJ Spark

  Hi

  I managed to put fastcgi and APC to work on dreamhost, a shared
host, but I'm not very experienced with those concepts...

  I'd like to know a little more from cake folks, how to use these
benefits in a good way.

  is it any good to use APC as a view cache holder ?
  fastcgi on a shared enviroment is really useful, since the thread
dies in a few minutes ?
  fastcgi and persistent DB connections are a good thing ?

  i know these are not directly related to cake dev, but maybe useful
to any php developer...



-- 
[livesets] http://djspark.com.br/
[web] http://sydi.net
[filmes] http://melhoresfilmes.com.br

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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
-~--~~~~--~~--~--~---



Strange behavior usage problem

2007-10-26 Thread MoD

Hello everyone!
I'm currently developing a project using CakePHP version 1.2.0.5875
pre-beta though I'm also familiarizing myself with it. I used a
TreeBehavior for categories module. Everything seemed ok, until I
didn't start using this behavior's own public methods - any method I
try to call from controller returns error. For example:
"Fatal error: Call to undefined function: generatetreelist()"
That is the way I connected behavior to the model:
"class Category extends AppModel
{
var $name = 'Category';

var $actsAs = array('Tree');
...
}"
And that's how I called it from controller:
"$categories = $this->Category->generateTreeList(null,
'{n}.Category.id', '{n}.Category.title');"
And that happen with just any public method in any behavior though
each behavior was surely loaded and before* methods in them work fine.
What am I missing?

Thanks in advance.

P.S.
By the way, API documentation on TreeBehavior is different from what
is actually in the source.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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: Empty page response

2007-10-26 Thread francky06l

have you tried to ask your hosting peovider ?
I had the same problem and I asked if I could tweak as follow :

- having a CGI that would run php using a special .ini (they have done
it, since I can't control everything in it)
- make it workd in my htaccess as :

Action application/x-httpd-php5 /php5.cgi

the cgi does contain :

#!/bin/sh
exec /usr/local/cpanel/cgi-sys/php5 -c /home/mydomain/php.ini

hope this helps

On Oct 26, 11:48 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> Hi,
>
> As I had written in my previous post:"cannot access php.ini as I am
> using a shared hosting."
> So, I need some .htaccess based solution.
>
> I am running cake 1.1, 1.2-alpha and 1.2-pre-beta on the same server
> but only pre-beta is giving problems.
>
> regards,
> Prateek
>
> On Oct 25, 9:15 pm, francky06l <[EMAIL PROTECTED]> wrote:
>
> > To disable Zend optimiser you need to comment the lines in php.ini.
>
> > On Oct 25, 5:01 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
>
> > > Hi all,
>
> > > I tried the following:
>
> > > 1. lemp>>Replace __("CakePHP: the rapid development php framework",
> > > true)  ... did not work
>
> > > 2. Kunthar>>adding "php_flag display_errors on" in .htaccess file ...
> > > did not work
>
> > > 3. Zend Optimizer was running. I tried disabling it by adding the
> > > following lines in .htaccess file. I was not able to disable it.
> > > php_flag display_errors on
> > > php_flag zend_optimizer.optimization_level 0
> > > php_flag eaccelerator.enable 0
> > > php_flag eaccelerator.optimizer 0
> > > php_flag zlib.output_compression off
>
> > > Does anybody have a better idea of how to disable Zend Optimizer? I
> > > cannot access php.ini as I am using a shared hosting.
> > > Zend Optimizer version is 3.2.2.
> > > This problem only appears on the above server configuration. I am
> > > running WAMP on my laptop and it does not appear there.
>
> > > Still no luck. Thanks to all for your suggestions. If there are any
> > > other ideas, do let me know.
>
> > > regards,
> > > Rex
>
> > > On Oct 25, 2:53 am, francky06l <[EMAIL PROTECTED]> wrote:
>
> > > > The zend optimizer fails on the __("") ..I had to remove from php.ini
> > > > in order to avoid the crash ..Maybe this is linked.
>
> > > > On Oct 24, 11:40 pm, lemp <[EMAIL PROTECTED]> wrote:
>
> > > > > On Oct 24, 6:22 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
>
> > > > > > After install, when I go to the cake link, a blank page is returned.
>
> > > > > Had the same problem.
>
> > > > > In cake/libs/view/templates/layouts/default.ctp at line 59
>
> > > > > Replace __("CakePHP: the rapid development php framework", true) by
> > > > > any string and it will work.
>
> > > > > The same function is used on line 45, so I presume the problem is
> > > > > contextual but I don't know why yet.
>
> > > > > Someone has a suggestion?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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
-~--~~~~--~~--~--~---



Any changes to $session->check from within view in 1.2.0.5875 pre-beta?

2007-10-26 Thread stewartc

Hi,

I've just updated to 1.2.0.5875 pre-beta and now can't log-in to my
password protected area of my site.

In my view I have

check('User')) : ?>

Any ideas what's changed and how I can check what's in my session?

Cheers

sc


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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: ordering a model through related model order

2007-10-26 Thread David Spreekmeester

Thanks for replying, Paul. So I seem not to be the only one, do none
of the gurus here have a clue how to do this in a tidy efficient way
without sorting afterwards?


On Oct 26, 3:04 am, "Paul Webster" <[EMAIL PROTECTED]> wrote:
> I tried to do something very similar not so long ago, and too had trouble
> getting it to do as I wanted.
>
> In the end not having time to pursue it further I did just sort after the
> query was made, as far as I could tell due to the way habtm's are querried
> it wasn't a simple case of altering the association settings etc.
>
> I'd be interested to see if anyone has some clear thoughts on this too.
>
> -Original Message-
> From: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf
>
> Of David Spreekmeester
> Sent: Friday, 26 October 2007 9:02 a.m.
> To: Cake PHP
> Subject: ordering a model through related model order
>
> Hey there bakers.
>
> I couldn't find an appropriate answer to this anywhere. Suppose I have
> three models:
>
> Bakery <- hasAndBelongsToMany -> Baker <- hasAndBelongsToMany ->
> Cookie
>
> Suppose there is a cookie baking contest going on. Every cookie is
> rated for quality (int Cookie.quality). I would like to do a find()
> for a certain bakery, and then *sort the employed bakers there by the
> rate of their baked cookies*. I tried stuff like setting the 'order'
> property to 'Cookie.quality' in the Cookie model file, but of course
> that just orders the cookies, and doesn't sort the bakers. The same
> goes for setting 'Cookie.quality' as the sorting parameter in the
> find() call.
>
> Of course I could just sort the bakers afterwards with my own custom
> sort function, but is there a way to do this automagically?
>
> __ NOD32 2617 (20071025) Information __
>
> This message was checked by NOD32 antivirus system.http://www.eset.com


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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: Access Control Project Question

2007-10-26 Thread [EMAIL PROTECTED]

Can PHPGACL  be a solution for resolve this?

On 26 Ott, 12:07, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:
> Hi
> I have this situation.
> I want to create a site where there are many services.
> Then there are many users of the site.
> These users have acces to some service and not have acces to other
> service.
> The users,that have acces to a service, can be admin of the service or
> simple user of the service.
>
> Now my project's choice is that:
> Associate every service with a controller.
> Inside a controller I'll have actions for admin and normal actions.
> Now I'll project a acces control component for control acces to the
> action of every controller(service).
>
> My first question is : How can I use the cake ACL component to do
> this?
>
> But there is a further complication : I have some view in some
> controller that use ajax->request to load inside their div  a view of
> another controller .
>
> Now I would avoid that a user that has acces to a service(controller/
> action) and loads a view
> of the service like the previous , sees a "NO ACCESS" message in the
> div where the controller loads the other view.
>
> Practically I would manage this particular relation that exists
> between different services.
> Can I do that with cake ACL  component? How can I do this?
>
> Many Thanks
> Marco


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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: Out of memory and findall

2007-10-26 Thread francky06l

best I guess would to "cache" your regions, state etc  Then do not
grab the associated region / state / city, instead use an element for
displaying the information. The element can use the cached list of
even be cached itself

On Oct 26, 12:01 pm, Paolo <[EMAIL PROTECTED]> wrote:
> Hi all!
> I have a problem using cake. I have a table that is linked to it's
> geographical location
> (i.e. house -> ... city_id
> city -> ... region_id
> region -> -... state_id)
> In house index action I use findAll in all tables in order to show the
> city, region and state in the list of houses. The problem is that I
> have 8000 cities so i get out of memory error. Is there another way to
> associate the id to the name of the city (region and state)?
>
> Thanks


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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
-~--~~~~--~~--~--~---



Out of memory and findall

2007-10-26 Thread Paolo

Hi all!
I have a problem using cake. I have a table that is linked to it's
geographical location
(i.e. house -> ... city_id
city -> ... region_id
region -> -... state_id)
In house index action I use findAll in all tables in order to show the
city, region and state in the list of houses. The problem is that I
have 8000 cities so i get out of memory error. Is there another way to
associate the id to the name of the city (region and state)?

Thanks


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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: Empty page response

2007-10-26 Thread [EMAIL PROTECTED]

Hi,

As I had written in my previous post:"cannot access php.ini as I am
using a shared hosting."
So, I need some .htaccess based solution.

I am running cake 1.1, 1.2-alpha and 1.2-pre-beta on the same server
but only pre-beta is giving problems.

regards,
Prateek


On Oct 25, 9:15 pm, francky06l <[EMAIL PROTECTED]> wrote:
> To disable Zend optimiser you need to comment the lines in php.ini.
>
> On Oct 25, 5:01 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
>
> > Hi all,
>
> > I tried the following:
>
> > 1. lemp>>Replace __("CakePHP: the rapid development php framework",
> > true)  ... did not work
>
> > 2. Kunthar>>adding "php_flag display_errors on" in .htaccess file ...
> > did not work
>
> > 3. Zend Optimizer was running. I tried disabling it by adding the
> > following lines in .htaccess file. I was not able to disable it.
> > php_flag display_errors on
> > php_flag zend_optimizer.optimization_level 0
> > php_flag eaccelerator.enable 0
> > php_flag eaccelerator.optimizer 0
> > php_flag zlib.output_compression off
>
> > Does anybody have a better idea of how to disable Zend Optimizer? I
> > cannot access php.ini as I am using a shared hosting.
> > Zend Optimizer version is 3.2.2.
> > This problem only appears on the above server configuration. I am
> > running WAMP on my laptop and it does not appear there.
>
> > Still no luck. Thanks to all for your suggestions. If there are any
> > other ideas, do let me know.
>
> > regards,
> > Rex
>
> > On Oct 25, 2:53 am, francky06l <[EMAIL PROTECTED]> wrote:
>
> > > The zend optimizer fails on the __("") ..I had to remove from php.ini
> > > in order to avoid the crash ..Maybe this is linked.
>
> > > On Oct 24, 11:40 pm, lemp <[EMAIL PROTECTED]> wrote:
>
> > > > On Oct 24, 6:22 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
>
> > > > > After install, when I go to the cake link, a blank page is returned.
>
> > > > Had the same problem.
>
> > > > In cake/libs/view/templates/layouts/default.ctp at line 59
>
> > > > Replace __("CakePHP: the rapid development php framework", true) by
> > > > any string and it will work.
>
> > > > The same function is used on line 45, so I presume the problem is
> > > > contextual but I don't know why yet.
>
> > > > Someone has a suggestion?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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
-~--~~~~--~~--~--~---



join query

2007-10-26 Thread [EMAIL PROTECTED]

I am beginner in cakephp. How to write join query?  I am declare in
location model page " var $hasAndBelongsToMany =
array('BusinessMaster'); " and business master model page "var
$hasAndBelongsToMany = array('Location');".


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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 Control Project Question

2007-10-26 Thread [EMAIL PROTECTED]

Hi
I have this situation.
I want to create a site where there are many services.
Then there are many users of the site.
These users have acces to some service and not have acces to other
service.
The users,that have acces to a service, can be admin of the service or
simple user of the service.

Now my project's choice is that:
Associate every service with a controller.
Inside a controller I'll have actions for admin and normal actions.
Now I'll project a acces control component for control acces to the
action of every controller(service).

My first question is : How can I use the cake ACL component to do
this?


But there is a further complication : I have some view in some
controller that use ajax->request to load inside their div  a view of
another controller .

Now I would avoid that a user that has acces to a service(controller/
action) and loads a view
of the service like the previous , sees a "NO ACCESS" message in the
div where the controller loads the other view.


Practically I would manage this particular relation that exists
between different services.
Can I do that with cake ACL  component? How can I do this?

Many Thanks
Marco


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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
-~--~~~~--~~--~--~---



Link button

2007-10-26 Thread Earnest

Hi all,

I have to include a link button in a view. How ca I do?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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.1 and 1.2

2007-10-26 Thread Daniel Hofstetter

No, it is not backward-compatible.

I would extract 1.2, and then copy your models, controllers, etc. from
the old app folder to the new app folder. From there you can fix your
app step-by-step if necessary (e.g. some functionality has been moved
from the HtmlHelper to the FormHelper).

HTH, and good luck!

daniel

--
Daniel Hofstetter
http://cakebaker.42dh.com


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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.1 and 1.2

2007-10-26 Thread Steveston

Does cake 1.2 support backward compatibility for cake 1.1?

Can I just download latest 1.2, extract it, copy its cake folder,
delete my old cake folder, and paste  the new cake folder to make my
app run on the top of cake 1.2? I tried, but did not go through.

Thanks,


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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: Handling image uploads

2007-10-26 Thread Lamiunto

Hey Rajesh,

The best way is to use the normal PHP method. So here is how I would
do it, it is just a small example, but it does do what you want.

Your form:

labelTag('Profile/username', 'Category');?>
input('Profile/username');?>
tagErrorMsg('Profile/username', 'A username for the
profile is required') ?>

Image



Now for the controller code:
$id = $this->Profile->getLastInsertId();
if (!empty($this->params['form']['image']))
{
$upload_dir = WWW_ROOT.'/img/properties/'.$id.'/';

if (!is_dir($upload_dir))
{
mkdir($upload_dir);
}

$upload_file = $upload_dir . basename($this->params['form']['image']
['name']);

move_uploaded_file($this->params['form']['image']['tmp_name'],
$upload_file);
}

There is a bit of filesystem management going on there, but the main
thing is the $this->params['form']['image'] array. The above would go
in the if conditional where you save the data, ie:
if ($this->Profile->save($this->data)) {
[...]
}

Hope this helps
Shaun

On Oct 25, 1:09 pm, Rajesh <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I am new to cake PHP and i am using version 1.1.17. I am little
> confused as to how to handle image uploads within a single form that
> has other fields to capture additional information, for example
> contact info and i have 2 seperate models (contact and image).
>
> Could someone please let me know how do i implement this
> functionality.
>
> Thanks
> Rajesh


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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
-~--~~~~--~~--~--~---



cakephp 1.2: saveField, why ?

2007-10-26 Thread [EMAIL PROTECTED]

I have model Category with fields:

id
title
parent_id

(yep category with subcategory, like threaded in bakery).
In model I don't put any belongs/has... base, empty model...

Ok.

So, when I change title by saveField

$this->Category->saveField('title',$title);

I see this query:

UPDATE `categories` SET `parent_id` = '0',`title` = 'My new title'
WHERE `id` IN (1)

So, WHY I get "parent_id = 0", Why???


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



1.2.0.5875 pre-beta error

2007-10-26 Thread Steveston

Just replace my old cake library with 1.2.0.5875 pre-beta's new
library, got this error:

Parse error: syntax error, unexpected '.', expecting '(' in C:
\apache224\htdocs\cake\libs\view\helpers\ajax.php on line 723

Checked ajax.php, no syntax error, though.

Any idea why?

Thanks


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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: Shell script questions

2007-10-26 Thread Charlie van de Kerkhof

Still having these questions above and another one:

- what is the way to give params to the shell script?
I want to do this like bash commands but I get cake errors:
cake/console/cake shellname -qVo filene.txt

PHP Notice:  Undefined offset:  5 in /.../cake/console/cake.php on
line 409
Notice: Undefined offset:  5 in /.../cake/console/cake.php on line 409

What is the right syntax? Or is it an enhancement...
thnx!!

On Oct 23, 4:46 pm, Charlie van de Kerkhof <[EMAIL PROTECTED]>
wrote:
> Hi,
> I love theShellscripts features in cake 1.2. But I have a couple of
> questions:
>
> 1. Can I remove the first output of everyshellscript:
> Hello charlie,
>
> Welcome to CakePHP v1.2.0.5875 pre-beta Console
> ---
> It is not the function _welcome() but something else. Does someone if
> I can turn it off?
>
> 2. Can I use builtin components and helpers like Email and Time?
> if yes, How? ;)
>
> Thanks in advance!
> - Charlie


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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
-~--~~~~--~~--~--~---



Stange chars in all apges

2007-10-26 Thread Paolo

Hi all!
I have a problem with CAke. In every page it displays a "m" at the
top, sometimes it add  something more, such as null,null,null,'Comuni/
nome');?>

What can be the cause of this?

Also, I have a model called Clienti, I use this name in model and
controller, but it complains saying it can't find Clintus Model!!! If
in the controller I change the name in Client for example it tells me
it can't find Client, but when I add the i it changes it to
Clientus!!!

Any help?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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: Time page load

2007-10-26 Thread [EMAIL PROTECTED]

I have thougth to do this.
TimeStart in beforeFilter().
TimeEnd in afterFilter().
I would  manage this inside the controller object.
But I am not so good in php and OOP.Can you help me to do this?
Many Thanks
Marco




On 26 Ott, 01:08, Grant Cox <[EMAIL PROTECTED]> wrote:
> If you do that time check in the controller afterFilter() it shouldn't
> be too far from the correct time.  You are correct that checking it in
> a controller action could easily be misleading.
>
> On Oct 26, 4:47 am, "J. Eckert" <[EMAIL PROTECTED]> wrote:
>
> > Hi,
>
> > That doesn't make sense.
> > In your Contoller the page hasn't been yet completly parsed ... so you
> > won't get a correct page loading/parsing time.
>
> > This:
> > round(getMicrotime() - $TIME_START, 4)
> > tells you how many seconds passed after Start, but in your Controller
> > it wouldn't be equal to the complete parsing time...
>
> > Cheers,
> > Joachim


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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
-~--~~~~--~~--~--~---