Re: Release: CakePHP 1.2.6

2010-01-29 Thread Miles J
Awesome, upgrading now :]

On Jan 29, 8:37 pm, Marcelo Andrade  wrote:
> On Sat, Jan 30, 2010 at 12:50 AM, mark_story  wrote:
> > (..)
>
> Good job Mark and all of CakePHP Team!
>
> Keep baking!
>
> --
> MARCELO F ANDRADE
> Belem, Amazonia, Brazil
>
> "I took the red pill"

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

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


Re: Release: CakePHP 1.2.6

2010-01-29 Thread Marcelo Andrade
On Sat, Jan 30, 2010 at 12:50 AM, mark_story  wrote:
> (..)

Good job Mark and all of CakePHP Team!

Keep baking!

-- 
MARCELO F ANDRADE
Belem, Amazonia, Brazil

"I took the red pill"

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

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


Release: CakePHP 1.2.6

2010-01-29 Thread mark_story
The CakePHP development team is happy to announce CakePHP 1.2.6[1].
1.2.6 is a bug fix release of the latest stable branch. Check the
changelog[2] for all the changes.

CakePHP 1.2.6 Includes more than 160 commits improving performance and
fixing more than 75 related tickets.  There have been a number of long
standing issues fixed in 1.2.6 that may affect your application
including:

- Controller::$cacheAction now functions as documented
  a87d31cc7f570a1ac03abc2c04b04f71e4f6c955

- returning false from a beforeValidate actually cancels a save
operation
  e609875754103913927f4bab7f67323aa6529165

- DboSource::fields() now accepts expression objects.
  02330b2d9c292110240c606e976e182c973897e9

- Configure::store() now correctly stores values with slashes.
  862ff82ad48ef613df33447697e6b2f33903d464

- App::import() can be used from bootstrap.php without the penalty of
having no cache available.
  82a2b1a01957ccbfd3a6abe31133f49b9005bced

- Controller::paginate() now accounts for  limit:0 -
  4bbfcbff7e90fab42bef39e01003113dc715a3b0

- Debugger::log() does what its doc block says.
  a31a2d264c2cd128de2db839fa2901680c7de2ba

- group key was added to DboOracle
  34deb2a18df1cf15c1b120333d47070c850db3fd

- 'with' models failing validation will now make save() return false.
  a490e249fa76b1076ab5ee255636f1f533560842


Be sure to check the full changelog[2] for all changes that have
occurred. The 1.3 branch continues progress and we hope to have a
release candidate ready for release soon.  If you are interested in
helping with the ongoing development of 1.3 please visit lighthouse[3]
for additional information on how you can help.

In other project news, the API documentation for 1.3 is now available
at http://api13.cakephp.org.  In addition to the 1.3 API, the 1.1 API
has been restored as well, and can be found at http://api11.cakephp.org.
A big thanks to Graham Weldon (aka. Predominant) for getting the API's
online.

And as always, thank you for helping us make a great framework.

[1] http://github.com/cakephp/cakephp1x/downloads
[2] http://cakephp.lighthouseapp.com/projects/42648/changelog-1-2-6
[3] http://cakephp.lighthouseapp.com/how-you-can-help

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

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


scraping / preg_match_all / ->beginner in cakephp

2010-01-29 Thread 512banque
Hi all.
I'm totally newbie to CakePhp.

I have a problem with some preg_math_all function. Let me explain you.

This is what I want to do :

I'm doing a kind of personnal bookmark "software". Something very
easy.
But I can't achieve it. Too bad.

I want to manage my bookmarks by category.

This is how I'd explain : "A category hasMany bookmarks".

A bookmark is composed of a url, a "created" field, a title.

So here's my 1st problem. I do not encounter a bug or anything. I just
don't know how to "say" that in Cakephp language.

I want a field in which I can "paste" some urls, and it "recognizes
it" and add it to the database. It's a way of importing a lot of
bookmarks at a time.

In procedural PHP, I would have no pb to do that. But I try to take
resolutions for this new year : doing some CLEAR code that's why I
started with cake php.

So in procedural, I would have done something like this :

1. explode the $_POST field using "\r\n".
2. for each line in the array, explode it again with ";"
3. for each line, create a MySQL query using the correct cells, and
bulk import it into the database.
4. et voilà !

But here, what must I do ? I thought about creating a function import
() in my controller.
But then ? how to tell cakephp : bulk import it into the database ?


My 2nd problem : how can I "count" how many bookmarks there are in my
category ?
I tried this but it doesn't work. When I debug $nbBookmarks, it's not
giving me the right figure.

class CategoriesController extends AppController {

var $name = 'Categories';
var $hasMany = 'Bookmark';

function index() {
$this->set('Categories', $this->Category->find('all'));
}

function view($id = null) {
$this->Category->id = $id;
$this->set('Category', $this->Category->read());

$q = $this->Category->find('first',array( 'conditions' => array
('Category.id'=>$id) ));
$this->set('Bookmarks',$q);

$nbBookmarks = $this->Category->find('count', 
array('conditions' =>
array('Category.id' => $id)));
$this->set('nbBookmarks',$nbBookmarks);
}

Sorry for my bad english mates, I'm french.

Thanks again for your help people !

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

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


Re: How & where to define a new class for routes

2010-01-29 Thread mark_story
Well considering you're using an example from my post, why not read
the rest of it.  I explain it there.

-Mark

On Jan 28, 11:47 pm, Ram  wrote:
> Hi all,
>
>      In my application i need to analyze the url, I seen in one
> article that in order to do this stuff we can define a class to routes
> like
>
> Router::connect('/:slug', array('controller' => 'posts', 'action' =>
> 'view'), array('routeClass' => 'SlugRoute'));
>
> I want to to where to define this SlugRoute class.
>
> Thanks,
> M.Ramkumar

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

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


CakePHP 1.3 (newest), fatal error while baking views

2010-01-29 Thread Wievior
I've just downloaded the newest beta of CakePHP 1.3 for a new project
(not a serious one, so no worries with the beta, still learning stuff,
I'm actually trying to get grip on acl/auth).

I've baked model and controllers for four databases, but baking a view
results in a fatal error:
Fatal error: Call to a member function on a non-object in /
my_project_folder/cake/console/libs/tasks/controller.php on line 400

I realize that it's just a beta, but maybe someone has already found a
quick way to fix it?

Regards,
Paul

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

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


Re: Setting up Cakephp - hello world?

2010-01-29 Thread Daniel S. Reichenbach
Hi,

the general installation manual is here:
http://book.cakephp.org/view/32/Installation

> The cake php framework is place in a shared folder in the server.
> Under the developer folder is the application.

Cakephp comes with an app/ folder, which basically *is* the hello
world application you are looking for.

Things start in app/webroot/index.php. You'll notice a lot of defines
for paths. This is probably what you have to modify depending on you
specific configuration. This is e.g. where you can point to a
different location for the cake/ folder.

app/webroot/ should be your Apache DocumentRoot for a start.

If you can be more specific about your setup, there's more hints to
come :)

WkR,
Daniel

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

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


CakePHP on Media Temple (dv) - permissions issue for cache

2010-01-29 Thread fahd
Hey,

I just migrated my website from Media Temple's (gs) server to (dv). I
got an error that the /tmp/cache folder is not writable. Changing the
permissions to 777 fixes this error - however it seems unsafe (is this
true?). How come the server can't write to the cache file? The user
for that folder is specified in Plesk as "developer" which corresponds
to the ftp user. The group is pscaln. So it seems the webserver is
neither the ftp user or belongs to this group.

How can I make it so that the web server can write to the tmp folder
without setting permissions to 777?

thanks

Fahd

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

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


Setting up Cakephp - hello world?

2010-01-29 Thread Natkeeran L.K.
The cake php framework is place in a shared folder in the server.
Under the developer folder is the application.  How do I use the
Cakephp in my application.  A simple hello world example would be
helpful.  Thanks.

Nat

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

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


RE: Localsite Virtual Setup

2010-01-29 Thread Dave
Perfect that's what I was looking for. 1 cake for many sites.

Thanks I will give that a try. I have the virtual hosts all set up using
Apache. Its just a pain having to copy cake folders / upgrade them when I
can do it this way once.

Good looking out!

Thanks,

Dave 

-Original Message-
From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf
Of Bryan De Asis
Sent: January-29-10 2:46 PM
To: cake-php@googlegroups.com
Subject: Re: Localsite Virtual Setup

In order for you to setup that kind of structure you need to follow this
structure.

www/
lib/ -- putting all the cakephp versions you can
dump any version of cake here for reference
cakephp1.2.5/ 
cake/
vendors/
.htaccess
index.php

site1/
app/

site2/
app/

site3/
app/

you need to edit the following files:

/site1/app/webroot/index.php
/site2/app/webroot/index.php
/site3/app/webroot/index.php

change the following lines to 

/site1/app/webroot/index.php

if (!defined('ROOT')) { define('ROOT', DS.'www'.DS.'site1'); } if
(!defined('APP_DIR')) { define('APP_DIR', 'app'); } if
(!defined('CAKE_CORE_INCLUDE_PATH')) {
define('CAKE_CORE_INCLUDE_PATH',DS.'www'.DS.'lib'.DS.'cakephp1.2.5'); }

/site2/app/webroot/index.php

if (!defined('ROOT')) { define('ROOT', DS.'www'.DS.'site2'); } if
(!defined('APP_DIR')) { define('APP_DIR', 'app'); } if
(!defined('CAKE_CORE_INCLUDE_PATH')) {
define('CAKE_CORE_INCLUDE_PATH',DS.'www'.DS.'lib'.DS.'cakephp1.2.5'); }


/site3/app/webroot/index.php

if (!defined('ROOT')) { define('ROOT', DS.'www'.DS.'site3'); } if
(!defined('APP_DIR')) { define('APP_DIR', 'app'); } if
(!defined('CAKE_CORE_INCLUDE_PATH')) {
define('CAKE_CORE_INCLUDE_PATH',DS.'www'.DS.'lib'.DS.'cakephp1.2.5'); }

I hope this one will help..

you can add as many site as you want... 




On Fri, Jan 29, 2010 at 11:57 AM, Dave  wrote:


I want to set up my virtual environmant so i can use 1 copy of Cake
and all
site being developed can use that 1 copy.

So i currently have my www folder
www/
   site1/
   app/
   cake/

   site2/
   app/
   cake/


   site3/
   app/
   cake/

But this is not the obvious setup.

I would much preffer

Www/
   cake/
   site1/ (would site1 just be renaming app folder to site1?)
   site2/
   site1/

What would I need to change to get this type of set up running? Just
the
htaccess? Or do I need to do anything with cake also?

Thanks

Dave

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

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



Check out the new CakePHP Questions site http://cakeqs.org and help others
with their CakePHP related questions.
 
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com To
unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group 
cake-php+at http://groups.google.com/group/cake-php?hl=en


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

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


Re: Localsite Virtual Setup

2010-01-29 Thread cricket
On Jan 29, 1:00 pm, Jon Bennett  wrote:
> Hi Dave,
>
> > I want to set up my virtual environmant so i can use 1 copy of Cake and all
> > site being developed can use that 1 copy.
>
> Pressumming you're using Apache. You just need to set a vhost up for
> each site, eg:
>
> domain.dev
> another-domain.dev
>
> you then have the cakephp APP folder inside each, and point the
> document root of each at the web root inside, eg:
>
> domain.dev = /projects/domain.dev/app/webroot
> another-domain.dev = /projects/another-domain.dev/app/webroot
>
> you then have a 'libs' folder at the location, eg:
>
> /projects/libs/cakephp/cake_1.2.5
>
> and set the define in each webroot to point at the correct place, eg:
>
> in /projects/domain.dev/app/webroot/index.php
>
> define('CAKE_CORE_INCLUDE_PATH', DS.'libs'.DS.'cakephp'.DS.'cake_1.2.5');

Just to add to this, I create a soft link to the Cake dist (and I
store it elsewhere but that's not important).

ln -s cake_1.2.5 cake

define('CAKE_CORE_INCLUDE_PATH',
DS.'usr'.DS.'lib'.DS.'php'.DS.'cake');

This way, if testing a newer version, you just need to change the soft
link, instead of your project files.

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

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


Re: Localsite Virtual Setup

2010-01-29 Thread Bryan De Asis
In order for you to setup that kind of structure you need to follow this
structure.

www/
lib/ -- putting all the cakephp versions you can
dump any version of cake here for reference
cakephp1.2.5/
cake/
vendors/
.htaccess
index.php

site1/
app/

site2/
app/

site3/
app/

you need to edit the following files:

/site1/app/webroot/index.php
/site2/app/webroot/index.php
/site3/app/webroot/index.php

change the following lines to

/site1/app/webroot/index.php

if (!defined('ROOT')) { define('ROOT', DS.'www'.DS.'site1'); }
if (!defined('APP_DIR')) { define('APP_DIR', 'app'); }
if (!defined('CAKE_CORE_INCLUDE_PATH')) {
define('CAKE_CORE_INCLUDE_PATH',DS.'www'.DS.'lib'.DS.'cakephp1.2.5'); }

/site2/app/webroot/index.php

if (!defined('ROOT')) { define('ROOT', DS.'www'.DS.'site2'); }
if (!defined('APP_DIR')) { define('APP_DIR', 'app'); }
if (!defined('CAKE_CORE_INCLUDE_PATH')) {
define('CAKE_CORE_INCLUDE_PATH',DS.'www'.DS.'lib'.DS.'cakephp1.2.5'); }


/site3/app/webroot/index.php

if (!defined('ROOT')) { define('ROOT', DS.'www'.DS.'site3'); }
if (!defined('APP_DIR')) { define('APP_DIR', 'app'); }
if (!defined('CAKE_CORE_INCLUDE_PATH')) {
define('CAKE_CORE_INCLUDE_PATH',DS.'www'.DS.'lib'.DS.'cakephp1.2.5'); }

I hope this one will help..

you can add as many site as you want...



On Fri, Jan 29, 2010 at 11:57 AM, Dave  wrote:

> I want to set up my virtual environmant so i can use 1 copy of Cake and all
> site being developed can use that 1 copy.
>
> So i currently have my www folder
> www/
>site1/
>app/
>cake/
>
>site2/
>app/
>cake/
>
>
>site3/
>app/
>cake/
>
> But this is not the obvious setup.
>
> I would much preffer
>
> Www/
>cake/
>site1/ (would site1 just be renaming app folder to site1?)
>site2/
>site1/
>
> What would I need to change to get this type of set up running? Just the
> htaccess? Or do I need to do anything with cake also?
>
> Thanks
>
> Dave
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

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

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


Re: Dojo toolkit integration with CakePHP now supported!!

2010-01-29 Thread LordZardeck
Okay, I have released the version of DojoCake that supports CakePHP
1.3. You can get it at the project page, and read up about the release
at the blog: http://dojocake.blogspot.com

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

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


Bypassing validation

2010-01-29 Thread Craig Francis
(Note: This is my first time using CakePHP).

I have a fairly simple user model, with validation along the lines of:

var $validate = array(
'username' => array(
'notEmpty' => array(
'rule' => 'notEmpty',
'message' => 'Your username is 
required.',
),
'alphaNumeric' => array(
'rule' => 'alphaNumeric',
'message' => 'Your username can 
only use letters and numbers.',
),
'between' => array(
'rule' => array('between', 5, 
15),
'message' => 'Your username can 
only be between 5 to 15
characters.',
),
'isUnique' => array(
'rule' => 'isUnique',
'message' => 'Your username is 
already in use.',
),
),
'password' => array(
'minLength' => array(
'rule' => array('minLength', 4),
'message' => 'Your password 
must be at least 4 characters
long.',
),
),
'repeat_password' => array(
'repeat' => array(
'rule' => 
array('checkRepeatPassword'),
'message' => 'Your repeated 
password is not the same.',
),
),
'name_first' => array('notempty'),
'name_last' => array('notempty'),
);

And I have then been playing with the DOM inspector in my browser,
where I removed the password field (or changed the name attribute).

When I submitted the registration form (username, password,
repeat_password fields), only with the username value supplied... the
user account was created, bypassing the password validation and
leaving the password blank (should be more then 4 characters)...
admittedly this did cause a couple of undefined variables in the
checkRepeatPassword function, but didn't stop anything.

Anyway, I've been wondering how I can avoid this happening, where
someone editing the DOM could bypass the field validation.

I did try adding the "required" attribute via:

var $validate = array(
'username' => array(
'notEmpty' => array(
'rule' => 'notEmpty',
'message' => 'Your username is 
required.',
'required' => true,
),
...
'password' => array(
'minLength' => array(
'rule' => array('minLength', 4),
'message' => 'Your password 
must be at least 4 characters
long.',
'required' => true,
),
),
...

Which seems to imply that the validation rules must be run (what I
want)... but then on the page where the user is able to change their
first/last name, the validation complains when the username and
password fields are not present (username should not be editable).

Craig

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

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


Re: Localsite Virtual Setup

2010-01-29 Thread Jon Bennett
Hi Dave,

> I want to set up my virtual environmant so i can use 1 copy of Cake and all
> site being developed can use that 1 copy.

Pressumming you're using Apache. You just need to set a vhost up for
each site, eg:

domain.dev
another-domain.dev

you then have the cakephp APP folder inside each, and point the
document root of each at the web root inside, eg:

domain.dev = /projects/domain.dev/app/webroot
another-domain.dev = /projects/another-domain.dev/app/webroot

you then have a 'libs' folder at the location, eg:

/projects/libs/cakephp/cake_1.2.5

and set the define in each webroot to point at the correct place, eg:

in /projects/domain.dev/app/webroot/index.php

define('CAKE_CORE_INCLUDE_PATH', DS.'libs'.DS.'cakephp'.DS.'cake_1.2.5');

hth

Jon

-- 
jon bennett - www.jben.net - blog.jben.net

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

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


Re: How & where to define a new class for routes

2010-01-29 Thread Miles J
That new route functionality isn't out yet.

On Jan 28, 8:47 pm, Ram  wrote:
> Hi all,
>
>      In my application i need to analyze the url, I seen in one
> article that in order to do this stuff we can define a class to routes
> like
>
> Router::connect('/:slug', array('controller' => 'posts', 'action' =>
> 'view'), array('routeClass' => 'SlugRoute'));
>
> I want to to where to define this SlugRoute class.
>
> Thanks,
> M.Ramkumar

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

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


Re: How to implement Comet in CakePHP ?

2010-01-29 Thread BrendonKoz
Okay, so looking at it a bit more, if you're going to use the ACTUAL
Comet protocol, you *must* use a server capable of working with it.
Apache HTTPD does not, Apache Tomcat supposedly does.  This would mean
that in addition to the webserver, you'd need a Comet server.  I'm not
completely positive, but you *might* be able to get Nginx to use Comet
without a secondary server.  I really haven't done any research on
this topic at all.

To mimic Comet by using a single server, you have two options: long
polling, and an iFrame hackish sort of way.  Again, I have no research
on these methods, so I'm only explaining this to you so you can have
some better search results on your own.

Good luck.

On Jan 28, 4:23 pm, BrendonKoz  wrote:
> For Comet, I just found a new project that aims to implement Comet for
> you:http://www.ape-project.org/home.html
>
> Other than looking at the main page of the project, I haven't done
> anything with it.  Learn at your own risk.  ;)
>
> On Jan 4, 12:00 am, td-nathan  wrote:
>
>
>
> > I also need to implement a chat room system, are there any good
> > tutorials for integrating these Jabber systems with CakePHP?  Ideally
> > something that covers the server-side installation and then how to
> > build an accessible front-end for users using CakePHP or an existing
> > plugin?
>
> > On Jan 2, 11:26 am, Pablo Viojo  wrote:
>
> > > ForgetComet. Take a look at Jabber (A very good 
> > > serverhttp://www.igniterealtime.org/projects/openfire/) and 
> > > JsJachttp://blog.jwchat.org/jsjac/ifyouwant to write a robust chat 
> > > system. (It
> > > will save a lot of time)
>
> > > Regards,
>
> > > Pablo Viojo
> > > pvi...@gmail.comhttp://pviojo.net
>
> > > ¿Que necesitas?http://needish.com
>
> > > On Sat, Jan 2, 2010 at 3:36 PM, nacho4d  wrote:
> > > > Hey.. Its been a while.
>
> > > > As I said before I want to implementcometchat system in cakePHP,
> > > > (there was a plug-in around there, but it does not seems to work fine
> > > > anymore. not for 1.2)
>
> > > > So, I have my controller: cometchats_controller.php
> > > > and my action
> > > > functioncomet(){
> > > > //get database data and pass it to the view
> > > > //do some other stuff...
> > > > }
> > > > the view will be rendered and the message data will be put in a div
> > > > like this 
> > > > So, let me know If I am in the correct way.
>
> > > > I could use afterFilter() callback to run a loop to check the database
> > > > for new message (since it is a chat system)
> > > > In case there is a new message stop the loop, and render the view
> > > > again like this:
>
> > > > this->render('cometchats/comet/', 'ajax);
>
> > > > but I want to render only the data inside the "content" div, so I have
> > > > to assign a div.
> > > > How do I do this?
> > > > Am I right so far?
>
> > > > On Dec 18 2009, 11:59 pm, nacho4d  wrote:
> > > > > I have been search this (cometin cakephp) for some time, but I
> > > > > couldn't find anything really helpful
> > > > > I would appreciate your help. ;)
>
> > > > > On Dec 17, 5:22 pm, cherif_Gsoul  wrote:
>
> > > > > > hi, you have to learn more about cakephp is not so hard to learn
> > > > > > ajax's implementation in  cakephp who is made to work with the
> > > > > > prototype framework and ther's a helper for jquery developed by the
> > > > > > community i think, i saw one day a plugin for tchat somewhere do 
> > > > > > some
> > > > > > google researchs i am sur you will get it. i do some research if i
> > > > > > find something i ll post it here ok?
> > > > > >  tciao.
>
> > > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelpothers
> > > > with their CakePHP related questions.
>
> > > > You received this message because you are subscribed to the Google 
> > > > Groups
> > > > "CakePHP" group.
> > > > To post to this group, send email to cake-php@googlegroups.com
> > > > To unsubscribe from this group, send email to
> > > > cake-php+unsubscr...@googlegroups.com > > >  om>For more options, visit this group at
> > > >http://groups.google.com/group/cake-php?hl=en- Hide quoted text -
>
> - Show quoted text -

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

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


https links not working

2010-01-29 Thread Lorenzo Bettini

Hi

I'd like to access my cakephp based web site also using https, but I 
always get an error saying that the requested url is not found on the 
server.


Note that apache is configured to serve also https requests and it works 
with other pages...


is there anything to set somewhere?

thanks in advance
Lorenzo

--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
BLOGS: http://tronprog.blogspot.com  http://longlivemusic.blogspot.com

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

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


Localsite Virtual Setup

2010-01-29 Thread Dave
I want to set up my virtual environmant so i can use 1 copy of Cake and all
site being developed can use that 1 copy.
 
So i currently have my www folder
www/
site1/
app/
cake/

site2/
app/
cake/


site3/
app/
cake/

But this is not the obvious setup.

I would much preffer

Www/
cake/
site1/ (would site1 just be renaming app folder to site1?)
site2/
site1/

What would I need to change to get this type of set up running? Just the
htaccess? Or do I need to do anything with cake also?

Thanks

Dave

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

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


RE: JSON View

2010-01-29 Thread Dave
This is my controller function

function manage_edit($id = null)
  {
  if ($this->RequestHandler->isAjax()) {
  Configure::write('debug', 0);
  $award = $this->Award->getAward($id, $this->Auth->user('id'));
  
  if (!empty($award)) {
  $this->layout = 'ajax';
  if (!empty($this->data)) {
  $this->autoLayout = false;
  $this->autoRender = false;
  $this->Award->id = $id;
  $black = array('id', 'profile_id', 'created');
  if ($this->Award->save($this->data, true,
array_diff(array_keys($this->Award->schema()), $black))) {
  $this->set('award', $this->Award->getAward($id,
$this->Auth->user('id')));
  $response['status'] = true;
  $response['html'] =
$this->render('/elements/awards/view_block', 'ajax');
  $this->header('Content-Type: application/json');
  echo json_encode($response);
  exit();
  } else {
  $this->set('errors',
$this->Award->validationErrors);
  $this->data = $award;
  $response['status'] = false;
  $response['html'] =
$this->render('/elements/awards/manage_edit', 'ajax');
  $this->header('Content-Type: application/json');
  echo json_encode($response);
  exit();
  }
  }
  if (empty($this->data)) {
   $this->data = $award;

$this->render('/elements/awards/manage_edit', 'ajax');
  
  }
  }
  } else {

$this->redirect(array('manage' => true, 'action' =>
'index'));
}


  $this->set('errors', $this->Award->validationErrors);
  } 

So this returns noting to the page. I am updating a div and spitting out the
$response['html'] to the specific div which returns only the element. One
thing is the exit(); I think that’s what I forgot to mention seems to not
echo out the actual view / element.

Give that a try.

Dave

-Original Message-
From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf
Of thomaus
Sent: January-29-10 6:50 AM
To: CakePHP
Subject: Re: JSON View

Hi Dave,

I tried it this way but it's the same.

$this->layout = 'ajax';
$this->autoLayout = false;
$this->autoRender = false;
$response['html'] = $this->render('/form/form_json');

So is there a way to get the result content of a view in a var (in this case
$response['html']) without rendering it (= without getting the annoying
echo) ?

thomas...


On Jan 28, 4:57 pm, "Dave"  wrote:
> Hey,
> Simply include
>
> $this->layout = 'ajax';
>           $this->autoLayout = false;
>           $this->autoRender = false;
>
> In the controller action to stop the view from output. All you get is 
> the json data then do what you need with it
>
> Dave
>
> -Original Message-
> From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On 
> Behalf Of thomaus
> Sent: January-28-10 9:08 AM
> To: CakePHP
> Subject: Re: JSON View
>
> Hi there,
>
> I need to render a full HTML view with header, css and js includes and 
> pass it as a JSON.
>
> I liked Dave's trick :
>
> $response['html'] = $this->render('my_view_needed'); Then echo back my
> json_encode($response) and use response.html in the js to render the 
> view / messages / errors.
>
> But there is a problem, when you do : $response['html'] = 
> $this->render ('my_view_needed'); it correctly puts all the HTML view 
> content in your $response['html'] var but still it outputs the view 
> content just after so the JSON callback format is incorrect. Is there 
> a way to get the content of a view render without rendering it?
>
> Otherwise how can I do if I want to send the full HTML content of my 
> view as a JSON callback?
>
> Thanks in advance.
>
> On Jan 21, 8:03 am, Akeda Bagus  wrote:
> > On Mon, Jan 11, 2010 at 10:50 PM, Dave  wrote:
> > > Does anyone know how to return a JSON object from an ajax request 
> > > to return the view and a success status? I see all these tutorials 
> > > to retrn data but no html. Everything is layout = false, 
> > > autoRender = false. I can return the view in normal html but I 
> > > need to get a status = true or false to the js to tell it what to 
> > > do next depending on the status. I need to update 1 of 2 possible 
> > > divs with the response and that's why I need the success to tell 
> > > the js if success
> update this div if no success then do something different.
>
> > > I need to return a view along with my success or fail status. Not 

Re: TimeAgoInWords in another language

2010-01-29 Thread John Andersen
In your po file, you have to define all the terms used in the
timeHelper class. See the code at:

http://api12.cakephp.org/view_source/time-helper/#line-423

There you will find that the timeHelper uses the __() and __n()
function and if you define the translation for these words, you will
get the dutch version of the words.

Enjoy,
   John

On Jan 29, 4:17 pm, Céryl  wrote:
> Hi all,
>
> I keep runnign into this problem and there is probably something I
> don;t understand or do right.
> I'm using the Time helper to display some upcoming activities using
> the timeAgoInWords function. Everything works fine and it displays it
> correct like: "3 days, 15 hours" or "on "12-2-10".
>
> However, I want to display this in another language (Duth in this
> case). I'm trying everything I found, setlocale, Configure::write
> ('Config.language', 'nld'), and something about a __() function, but
> nothing changes. I even tried every localecode I found like this:
>
> setlocale(LC_ALL, array('Dutch_Netherlands', 'Dutch', 'nl_NL', 'nl',
> 'nl_NL.ISO8859-1'));
>
> But to no avail...
>
> Exactly what is needed to change this in another language? Do I need
> to install something, set the server to something, download a
> translation file, use setlocale, __(), Config::Write, or something
> else?

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

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


TimeAgoInWords in another language

2010-01-29 Thread Céryl
Hi all,

I keep runnign into this problem and there is probably something I
don;t understand or do right.
I'm using the Time helper to display some upcoming activities using
the timeAgoInWords function. Everything works fine and it displays it
correct like: "3 days, 15 hours" or "on "12-2-10".

However, I want to display this in another language (Duth in this
case). I'm trying everything I found, setlocale, Configure::write
('Config.language', 'nld'), and something about a __() function, but
nothing changes. I even tried every localecode I found like this:

setlocale(LC_ALL, array('Dutch_Netherlands', 'Dutch', 'nl_NL', 'nl',
'nl_NL.ISO8859-1'));

But to no avail...

Exactly what is needed to change this in another language? Do I need
to install something, set the server to something, download a
translation file, use setlocale, __(), Config::Write, or something
else?

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

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


Re: calling a component in a model

2010-01-29 Thread Florian
Thanks, to all.

Worked with App::Import

On 29 Jan., 08:55, "j0n4s.h4rtm...@googlemail.com"
 wrote:
> While Miles J is right in general, there are exceptions.
>
> This is how I used Emailcomponent from 
> amodel:http://github.com/ionas/sna/blob/master/www/app/app_model.php#L98
> (1.2.5)
>
> I am not sure if an email datasource would be the best approach in
> general (and thecomponentas well as models could use that) or if
> there is something missing to the MVC aka. DS/M/B + C+C + V+H
> architecture, something like "lib" or so...
>
> King regards
>  ionas
>
> On Jan 28, 7:04 pm, Miles J  wrote:
>
> > You should not be using Components from yourModel. If you are, then
> > your application structure is wrong.
>
> > There are if cases like the Email and Sessioncomponent.
>
> > On Jan 28, 9:19 am, bujanga  wrote:
>
> > > I have found 2 MVC use cases for this approach. One is to send email
> > > from amodeland the other is to send email from a shell task. Here is
> > > how I go about it:
>
> > > //      IMPORT AND INITIALIZE EMAILCOMPONENT
> > > App::import('Core', 'Controller');
> > > App::import('Component', 'Email');
> > > $this->Controller =& new Controller();
> > > $this->Email =& new EmailComponent(null);
> > > $this->Email->initialize($this->Controller);
>
> > > $data = $this->Model->find();
> > > $this->Controller->set('data', $data);
>
> > > On Thu, Jan 28, 2010 at 8:33 AM, euromark  
> > > wrote:
> > > > you cant automatically use them
>
> > > > manual inclusion:
>
> > > > App::import('Component', 'My');
> > > > $this->My = new MyComponent();
> > > > ...
>
> > > > On 28 Jan., 11:54, Florian  wrote:
> > > >> Hi @ all,
>
> > > >> my Problem is that i can not call acomponentfrom amodel.
>
> > > >> Source -Model:
>
> > > >> class Approval extends AppModel{
> > > >>       $components = array('CheckKont');
>
> > > >> .
> > > >> .
> > > >> .
> > > >> .
>
> > > >>       function beforeSave(){
> > > >>              $this->CheckKont->execute ();
> > > >>       }
>
> > > >> }
>
> > > >> Source -Component:
>
> > > >> class CheckKont extends Object(){
> > > >>      execute(){
> > > >>           return true;
> > > >>      }
>
> > > >> }
>
> > > >> Over the Controller i can call thecomponent, also included with
> > > >> $components = array()
>
> > > >> Has anybody a hint how do call thecomponentin amodel?
>
> > > >> Thanks
> > > >> Florian
>
> > > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelpothers 
> > > > with their CakePHP related questions.
>
> > > > You received this message because you are subscribed to the Google 
> > > > Groups "CakePHP" group.
> > > > To post to this group, send email to cake-php@googlegroups.com
> > > > To unsubscribe from this group, send email to
> > > > cake-php+unsubscr...@googlegroups.com For more options, visit this 
> > > > group athttp://groups.google.com/group/cake-php?hl=en

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

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


getparentnode and custom validation rule problem

2010-01-29 Thread emmexx
I wrote a model that act as a tree (mymodel).
In mymodel.php file I coded some custom validation rule.
One of the rules is like the following:

function testmyfield($check) {
   $grandfather = $this->getparentnode($this->data['Category']
['parent_id']);
   if ($grandfather)
   {
  $condition=array('Category.id' => $grandfather['Category']
['id']);
  $ret=$this->field('afield', $condition);
  if ($ret)
 return false;
   }
   return true;
}

When this validation rule gets executed $this->data changes after
getparentnode().
Before it is an array with the values entered in the form.
After it is an array like the following:

[Category] => Array
(
[parent_id] => 23
)

[P1] => Array
(
)

(P1 is a model related to Category)

The record gets saved with some of the (required and not empty) fields
empty. :-(

I don't understand if this can be a bug or if I'm doing something
wrong or in the wrong place.

Thank you
   maxx

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

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


Cake PHP Developer wanted in London

2010-01-29 Thread timruffles
If you’re a talented, graduate (of any disicipline) PHP developer with
MVC skills and a desire to learn, I’d love to hear from you. We're a
web development shop with big clients - currently working on software
used by Nike, Discovery and other popular brands. Great Soho office, a
big screen and big challenges.

Please email some code you’re proud of and would be happy to discuss
in the interview along with your CV to
tim.ruff...@stronglycoded.co.uk.

(Apologies in advance to mods if this isn't allowed, read all the
stickies and 'http://book.cakephp.org/view/9/where-to-get-help)

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

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


$Auth problem when 404 type errors occur.

2010-01-29 Thread mhmh
Hi,

I have two elements (short menus) set to appear in the default layout
based upon the group ID of the current user.  If $Auth['User']
['group_id']==1 then menu 1 appears,if $Auth['User']['group_id']==2
then menu 2 appears.  This works just fine, except when I encounter a
404 type error.  When redirected to the default CakePHP error page I
encounter an "Undefined variable: Auth" error and both menus appear.
I can't quite work out why this page wouldn't have access to the $Auth
variable.  I'm using the default error handling in Cakephp, no custom
views etc at this stage.  Am I missing something fundamental here?

TIA for any sage advice.

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

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


How & where to define a new class for routes

2010-01-29 Thread Ram
Hi all,

 In my application i need to analyze the url, I seen in one
article that in order to do this stuff we can define a class to routes
like

Router::connect('/:slug', array('controller' => 'posts', 'action' =>
'view'), array('routeClass' => 'SlugRoute'));

I want to to where to define this SlugRoute class.

Thanks,
M.Ramkumar

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

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


How to make different model-data-array compatible

2010-01-29 Thread Freight
Hi,

I think find-method returns different data-arrays for recursive date.
However I want to use the userdata in the same index-element in
different actions. So there will be an error with the var-names.

MyModel:
Entry hasMany Users
Users belongsTo Group


Entry->find('first') returns an array like

'Entry' => ...
'User' => '0' => 'userid'
 => 'username'
 => 'Group' => 'groupid'
=> 'groupname'
'1' => ...


User->find('all') returns an array like

'0' =>
 'User' => 'userid'
=> 'username'
 'Group' => 'groupid'
  => 'groupname'
'1' => ...

How can I best get these both types compatible?

Thanks

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

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


Re: return tree node from find('threaded')

2010-01-29 Thread Alexandru Ciobanu

On 1/29/2010 8:35 AM, cricket wrote:

But I surely do not have the last word on this. Maybe someone else
knows a better way.

My best advice: go with MPTT.
   



The same table is used in another part of the application (non-CakePHP), 
and has to remain exactly like it is.

I cannot go MPPT, hence this thread.

Thanks for the array of ids idea. I'll give it a try.

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

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


Re: JSON View

2010-01-29 Thread thomaus
Hi Dave,

I tried it this way but it's the same.

$this->layout = 'ajax';
$this->autoLayout = false;
$this->autoRender = false;
$response['html'] = $this->render('/form/form_json');

So is there a way to get the result content of a view in a var (in
this case $response['html']) without rendering it (= without getting
the annoying echo) ?

thomas...


On Jan 28, 4:57 pm, "Dave"  wrote:
> Hey,
> Simply include
>
> $this->layout = 'ajax';
>           $this->autoLayout = false;
>           $this->autoRender = false;
>
> In the controller action to stop the view from output. All you get is the
> json data then do what you need with it
>
> Dave
>
> -Original Message-
> From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf
> Of thomaus
> Sent: January-28-10 9:08 AM
> To: CakePHP
> Subject: Re: JSON View
>
> Hi there,
>
> I need to render a full HTML view with header, css and js includes and pass
> it as a JSON.
>
> I liked Dave's trick :
>
> $response['html'] = $this->render('my_view_needed'); Then echo back my
> json_encode($response) and use response.html in the js to render the view /
> messages / errors.
>
> But there is a problem, when you do : $response['html'] = $this->render
> ('my_view_needed'); it correctly puts all the HTML view content in your
> $response['html'] var but still it outputs the view content just after so
> the JSON callback format is incorrect. Is there a way to get the content of
> a view render without rendering it?
>
> Otherwise how can I do if I want to send the full HTML content of my view as
> a JSON callback?
>
> Thanks in advance.
>
> On Jan 21, 8:03 am, Akeda Bagus  wrote:
> > On Mon, Jan 11, 2010 at 10:50 PM, Dave  wrote:
> > > Does anyone know how to return a JSON object from an ajax request to
> > > return the view and a success status? I see all these tutorials to
> > > retrn data but no html. Everything is layout = false, autoRender =
> > > false. I can return the view in normal html but I need to get a
> > > status = true or false to the js to tell it what to do next
> > > depending on the status. I need to update 1 of 2 possible divs with
> > > the response and that's why I need the success to tell the js if success
> update this div if no success then do something different.
>
> > > I need to return a view along with my success or fail status. Not
> > > just an error message as I have found in my json / cakephp searching.
>
> > > so in the controller
> > > $this->layout = 'ajax';
> > > if(this->Model->save())
> > > {
> > > //return success = true and success view $respounse = array('status'
> > > => true, 'html' => ???
>
> > > } else {
>
> > >  //return false
> > >  $respounse = array('status' => false); }
> > > $this->header('Content-Type: application/json');
> > >        echo json_encode($response);
>
> > > Ideas?
>
> > My approach is:
> > 1. create json layout in views/layout/json/default.ctp which contains:
> >  > header("Pragma: no-cache");
> > header("Cache-Control: no-store, no-cache, max-age=0,
> > must-revalidate");
> > header('Content-Type: application/json');
>
> > echo $content_for_layout;
> > ?>
>
> > 2. create common view for json, says app/views/common/jsonize.ctp --
> > my controllers use this oftenly, which contains:
> > object($result); ?>
>
> > 3. I put jsonize in app_controller.php, so other controllers will benefit
> this:
> > function jsonize() {
> >     $this->layout = 'json/default';
> >     $this->viewPath = "common";
>
> >     if ( Configure::read('debug') > 0 ) {
> >         Configure::write('debug', 0);
> >     }
>
> >     if ( !$this->params['named'] ) {
> >         $this->Session->setFlash('Invalid parameter for JSON',
> > 'error');
> >         $this->redirect(array('action'=>'index'));
> >     }
>
> >     foreach ($this->params['named'] as $field => $value) {
> >         $like = str_replace('*', '%', $value);
> >         $condition[Inflector::singularize($this->name).".$field LIKE"]
> > = $like;
> >     }
> >     $this->{Inflector::singularize($this->name)}->recursive = -1;
> >     $result =
> > $this->{Inflector::singularize($this->name)}->find('all',
> > array( 'conditions' => $condition ));
> >     $this->set('result', $result);
>
> > }
>
> > It just a little modification is you used on $this->Model->save()
>
> > --
> > regards,
> > gedex
>
> > blog:http://gedex.web.id
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com To
> unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group
> cake-php+athttp://groups.google.com/group/cake-php?hl=en

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

You received this message because you are subscribed to the Google Groups

Re: datasource and count()

2010-01-29 Thread John Andersen
Ok, then it is not in the your DataSource class there is a need for
the calculate method, but in your generic filesystem class, to which
the DataSource refers to (through configuration).

As I understand, CakePHP use a DataSource to provide an implementation
independent interface to the DboSource (plus subclasses)
implementation dependent interface.

Thus your FilewidSource class (the implementation dependent interface)
should provide the calculate method.

Am I correct in my understanding of your issue?
Enjoy ;)
   John

On Jan 29, 11:17 am, fain182  wrote:
> 2010/1/27 John Andersen :
>
> > Ok, I would like to understand what is your issue here, because I do
> > not see a calculate method in the DataSource class! Do you mean the
> > DboSource?
> >   John
>
> I tried to make a $this->Image->find('count'); on the model with my
> datasource, and it gives error:
> Fatal error: Call to undefined method FilewidSource::calculate() in
> /home/fain182/workspace/cake/libs/model/model.php on line 2042
>
> if you read the source of _findCount() you see that use 
> calculate..http://api.cakephp.org/view_source/model/#line-2040
>
> maybe with a behaviour i could change this..
> but it's a little dirty make a datasource that depends on behavior..
>
> --
> pietro

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

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


Re: Pretty URLs don't work without .htaccess ?

2010-01-29 Thread robustsolution
Some web hosting companies do not allow the use of htaccess on shared
servers, and sometimes they allow you to use it on linux machines not
windows!
I think Marcelo has the right answer for this kind of situation

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

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


Re: datasource and count()

2010-01-29 Thread fain182
2010/1/27 John Andersen :
> Ok, I would like to understand what is your issue here, because I do
> not see a calculate method in the DataSource class! Do you mean the
> DboSource?
>   John

I tried to make a $this->Image->find('count'); on the model with my
datasource, and it gives error:
Fatal error: Call to undefined method FilewidSource::calculate() in
/home/fain182/workspace/cake/libs/model/model.php on line 2042

if you read the source of _findCount() you see that use calculate..
http://api.cakephp.org/view_source/model/#line-2040

maybe with a behaviour i could change this..
but it's a little dirty make a datasource that depends on behavior..

-- 
pietro

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

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


Re: Pretty URLs don't work without .htaccess ?

2010-01-29 Thread AD7six


On Jan 29, 8:55 am, AD7six  wrote:
> On Jan 29, 3:35 am, Johnny Cupcake  wrote:
>
> > Why did I disable mod_rewrite in the first place?  Well, the core
> > config file says pretty URLs are available regardless (see line 48),
> > so I figured I'd keep complexity to a minimum.
>
> I think you misunderstood the comment, it is not saying you can
> simulate mod_rewrite with cake
>
> /controller/action = with mod rewrite and what all the docs will refer
> to,
> /index.php/controller/action = "pretty" url
>
> AD

PS it's so uncommon for someone to need to do this nowadays I also
followed your lead in mixing up the terminology, sorry about that.

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

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