Re: Help with a plugin called "Favorites"

2010-10-14 Thread Jonathan Sibley
Hey all,

It seems as though I get the "Missing Controller" error for all
plugins.  For example, if I bake a plugin called "test" (in console:
"cake bake plugin test"), it creates test_app_controller.php and
test_app_model.php in app/plugins/test/.  Then, I create
test_controller.php in app/plugins/test/controllers/ and a
test_model.php in app/plugins/test/models/, I still get the "Missing
Controller" error.  Could this be a problem with my system
configuration?  I'm running XAMPP 1.7.3 on Windows 7, in case that
helps.  I've also tried downloading a fresh copy of the cake/ folder
and it doesn't help.  I've also tried putting my "favorites" plugin
directory in both cake/plugins and app/plugins.

Thanks,
Jonathan

On Oct 14, 9:13 pm, Jonathan Sibley  wrote:
> Hello, I'm not sure if I've reached the right outlet for support, but I will
> explain my problem.  And thank you for any help you may provide!
>
> I'm pretty new to CakePHP, and I'm trying to get the Favorites plugin (by
> CakeDC.org) working on my site.  My problem currently is that I can't
> "toggleFavorite" in my app/views/photos/view.ctp.  My "view" helper displays
> a photo and allows the user to "favorite it" with:
> ===
> echo $this->Favorites->toggleFavorite('favorite', $photo['Photo']['id']);
> ===
>
> This renders a link, but when I click the link, it goes to
> example.com/favorites/favorites/add/favorite/94 (94 is the "id" of the
> Photo):
> 
> Missing Controller
> Error: FavoritesController could not be found.
> Error: Create the class FavoritesController below in file:
> app\controllers\favorites_controller.php
> ===
>
> I read on the book.cakephp.org "Plugin Tips" page that a common cause of the
> "Missing Controller" error is to not have a favorites_app_controller.php and
> favorites_app_model.php in the /app/plugin/favorites/ directory.  I have
> them, and they extend "AppController" and "AppModel" respectively.
>  Likewise, my app/plugins/favorites/controllers/favorites_controller.php
> extends "FavoritesAppController" and
> my app/plugins/favorites/models/favorite.php extends "FavoritesAppModel".
>
> For those of you who are familiar with this plugin, here is some more
> information on my set-up.  I have placed the following in
> app/config/core.php:
> ===
> Configure::write('Favorites.types', array('favorite' => 'Photo', 'follow' =>
> 'User'));
>  Configure::write('Favorites.defaultTexts', array('favorite' => __('Favorite
> it', true),'watch' => __('Follow it', true)));
>  Configure::write('Favorites.modelCategories', array('Photo', 'User'));
> ===
>
> Other than that, I have copied the files I downloaded from the Github page
> into my app/plugins/favorites/
>
> Thanks in advance for any help you can provide!
>
> Best,
> Jonathan Sibley

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


Router bug?

2010-10-14 Thread cricket
1.3.4

I'm trying to dynamically set Auth's redirect route but something's
not right. The controller action's route:

Router::connect(
   '/galleries/:year/:month/:day/:slug',
   array(
   'controller' => 'galleries',
   'action' => 'slug'
   ),
   array(
   'year' => '2[0-9]{3}',
   'month' => '0[1-9]|1[012]',
   'day' => '0[1-9]|1[0-9]|2[0-9]|3[01]',
   'slug' => '[-_a-z0-9]+',
   'pass' => array('year', 'month', 'day', 'slug')
   )
);

What I want to do is set the redirect route to the current action. The
reason being that, if a user is not logged in, they'll see a login
link instead of a comment button and I want them to be directed
straight back to this action/view after logging in. So, in the action:

$this->Session->write(
   'Auth.redirect',
   Router::parse($this->params['url']['url'])
);

This results in:

/galleries/slug/year:2010/month:07/day:13/slug:a_slug_here/pass:Array

So nothing is passed correctly to the action. What's with the "Array"?
In a flash of inspiration:

$route = Router::parse($this->params['url']['url']);
unset($route['pass']);

$this->Session->write(
'Auth.redirect',
$route
);

Voila! Works like a charm, if a little ungainly.

I'm wondering if Router should ignore a param named 'pass'. That would
make it impossible for a route to have a passed param named 'pass'.
But, come to think of it, it's already impossible:

Router::connect(
   '/foo/:bar/:slug/:pass',
   array(
   'controller' => 'foos',
   'action' => 'slug'
   ),
   array(
   'bar' => '[0-9]+',
   'slug' => '[-_a-z0-9]+',
   'pass' => '[some regexp here]',
   'pass' => array('bar', 'slug', 'pass')
   )
);

It's clearly already unworkable. So, should 'pass' be silently ignored?

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: add target (#) to url without ruining routes?

2010-10-14 Thread cricket
Please disregard. I've just figured out that the '#' param is not the
culprit. I'll post another query with a better subject line.

On Thu, Oct 14, 2010 at 9:40 PM, cricket  wrote:
> 1.3.4
>
> I'm working on a Comment plugin. If a user is not logged in, they'll
> see a "log in to comment" link instead of a button. I'd like it so
> that, after the user has logged in, they'll be directed back to the
> page. Easy enough, I set Session's Auth.redirect in the action.
> However, I'd also like for theuser to be redirected to where the
> comments begin on the page. I tried adding '#' => 'comments', like so:
>
> $this->Session->write(
>        'Auth.redirect',
>        array_merge(
>                Router::parse($this->params['url']['url']),
>                array('#' => 'comments')
>        )
> );
>
> (Actually, this was set in the controller, as I'm still figuring this
> out,, but would normally be done in the plugin component)
>
> So, this will be set in the session when the view is displayed. The
> trouble is, this causes the original controller's action route, which
> is already complex, to be different. eg.
>
> Router::connect(
>        '/galleries/:year/:month/:day/:slug',
>        array(
>                'controller' => 'galleries',
>                'action' => 'slug'
>        ),
>        array(
>                'year' => '2[0-9]{3}',
>                'month' => '0[1-9]|1[012]',
>                'day' => '0[1-9]|1[0-9]|2[0-9]|3[01]',
>                'slug' => '[-_a-z0-9]+',
>                'pass' => array('year', 'month', 'day', 'slug')
>        )
> );
>
> After adding the '#' param to the redirect route, the controller's
> route is no longer properly recognised. I'm still somehow directed to
> the slug action of GalleriesController, but all of the params that
> should be passed are instead in the URL itself.
>
> Now, I was under the impression that '#' should not interfere with a
> route. So, I'm wondering if the way I've merged it in is incorrect.
> Notice how the target is added to the URL:
>
> /galleries/slug/year:2010/month:07/day:13/slug:a_slug_here/pass:Array#comments
>
> This being a plugin, I don't want to have to add a '#' param to every
> route. Can anyone suggest of a better way of dealing with this?
>

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


add target (#) to url without ruining routes?

2010-10-14 Thread cricket
1.3.4

I'm working on a Comment plugin. If a user is not logged in, they'll
see a "log in to comment" link instead of a button. I'd like it so
that, after the user has logged in, they'll be directed back to the
page. Easy enough, I set Session's Auth.redirect in the action.
However, I'd also like for theuser to be redirected to where the
comments begin on the page. I tried adding '#' => 'comments', like so:

$this->Session->write(
'Auth.redirect',
array_merge(
Router::parse($this->params['url']['url']),
array('#' => 'comments')
)
);

(Actually, this was set in the controller, as I'm still figuring this
out,, but would normally be done in the plugin component)

So, this will be set in the session when the view is displayed. The
trouble is, this causes the original controller's action route, which
is already complex, to be different. eg.

Router::connect(
'/galleries/:year/:month/:day/:slug',
array(
'controller' => 'galleries',
'action' => 'slug'
),
array(
'year' => '2[0-9]{3}',
'month' => '0[1-9]|1[012]',
'day' => '0[1-9]|1[0-9]|2[0-9]|3[01]',
'slug' => '[-_a-z0-9]+',
'pass' => array('year', 'month', 'day', 'slug')
)
);

After adding the '#' param to the redirect route, the controller's
route is no longer properly recognised. I'm still somehow directed to
the slug action of GalleriesController, but all of the params that
should be passed are instead in the URL itself.

Now, I was under the impression that '#' should not interfere with a
route. So, I'm wondering if the way I've merged it in is incorrect.
Notice how the target is added to the URL:

/galleries/slug/year:2010/month:07/day:13/slug:a_slug_here/pass:Array#comments

This being a plugin, I don't want to have to add a '#' param to every
route. Can anyone suggest of a better way of dealing with this?

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: Loading a cookie inside a model's constructor

2010-10-14 Thread Miles J
You should be passing the cookie from the controller to the model.

$this->Model->cookie = $this->Cookie->read('cookieName');

But to answer your question, you need to initialize the cookie
component.

$cookie = new CookieComponent();
$cookie->initialize($this, array());

On Oct 14, 4:15 pm, cricket  wrote:
> On Thu, Oct 14, 2010 at 4:38 PM, Raisen  wrote:
> > So I want to read a cookie using the Cakephp's Cookie class. First, I
> > tried to import only the cookie class and read the cookie, but I was
> > getting an error stating that the cipher key cannot be null. So I
> > imported the Configure class, set the key property of the cookie
> > instance to the respective cipher key, but the cookie is returning a
> > different result from what it's set to. Any ideas?\
> > The override constructor class looks like:
>
> > class Member extends AppModel {
> >        function __construct( $id = false, $table = NULL, $ds = NULL ) {
> >                App::import('Component','Cookie');
> >                App::import('Core','Configure');
>
> >                $conf = new Configure();
> >                $cookie = new CookieComponent();
>
> >                $cookie->key = $conf->read("Security.cipherSeed");
> >                var_dump($cookie->read('sel_app'));
> > ...
>
> >                parent::__construct($id,$table,$ds);
>
> You should read & write to cookies in the controller (or component)
> not the model.

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


Help with a plugin called "Favorites"

2010-10-14 Thread Jonathan Sibley
Hello, I'm not sure if I've reached the right outlet for support, but I will
explain my problem.  And thank you for any help you may provide!

I'm pretty new to CakePHP, and I'm trying to get the Favorites plugin (by
CakeDC.org) working on my site.  My problem currently is that I can't
"toggleFavorite" in my app/views/photos/view.ctp.  My "view" helper displays
a photo and allows the user to "favorite it" with:
===
echo $this->Favorites->toggleFavorite('favorite', $photo['Photo']['id']);
===

This renders a link, but when I click the link, it goes to
example.com/favorites/favorites/add/favorite/94 (94 is the "id" of the
Photo):

Missing Controller
Error: FavoritesController could not be found.
Error: Create the class FavoritesController below in file:
app\controllers\favorites_controller.php
===

I read on the book.cakephp.org "Plugin Tips" page that a common cause of the
"Missing Controller" error is to not have a favorites_app_controller.php and
favorites_app_model.php in the /app/plugin/favorites/ directory.  I have
them, and they extend "AppController" and "AppModel" respectively.
 Likewise, my app/plugins/favorites/controllers/favorites_controller.php
extends "FavoritesAppController" and
my app/plugins/favorites/models/favorite.php extends "FavoritesAppModel".

For those of you who are familiar with this plugin, here is some more
information on my set-up.  I have placed the following in
app/config/core.php:
===
Configure::write('Favorites.types', array('favorite' => 'Photo', 'follow' =>
'User'));
 Configure::write('Favorites.defaultTexts', array('favorite' => __('Favorite
it', true),'watch' => __('Follow it', true)));
 Configure::write('Favorites.modelCategories', array('Photo', 'User'));
===


Other than that, I have copied the files I downloaded from the Github page
into my app/plugins/favorites/

Thanks in advance for any help you can provide!

Best,
Jonathan Sibley

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: Loading a cookie inside a model's constructor

2010-10-14 Thread cricket
On Thu, Oct 14, 2010 at 4:38 PM, Raisen  wrote:
> So I want to read a cookie using the Cakephp's Cookie class. First, I
> tried to import only the cookie class and read the cookie, but I was
> getting an error stating that the cipher key cannot be null. So I
> imported the Configure class, set the key property of the cookie
> instance to the respective cipher key, but the cookie is returning a
> different result from what it's set to. Any ideas?\
> The override constructor class looks like:
>
> class Member extends AppModel {
>        function __construct( $id = false, $table = NULL, $ds = NULL ) {
>                App::import('Component','Cookie');
>                App::import('Core','Configure');
>
>                $conf = new Configure();
>                $cookie = new CookieComponent();
>
>                $cookie->key = $conf->read("Security.cipherSeed");
>                var_dump($cookie->read('sel_app'));
> ...
>
>                parent::__construct($id,$table,$ds);
>

You should read & write to cookies in the controller (or component)
not the model.

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: Different way to pass a value to my controller, than "array('controller' => 'products', 'action' => 'view', $product['Product']['id'])"

2010-10-14 Thread cricket
On Thu, Oct 14, 2010 at 5:20 PM, Tomfox Wiranata
 wrote:
> thx cricket.
>
> my jquery request looks like this, calling the action "rate" and
> passing a value..
>
> $('#rating').load('rate', {data: ratingValue});

That doesn't look like a proper URL. In any case, how dies this affect
your call to /products/view?

> i have to admit, I still dont get the sense of routingwhen I use
> the first one, the action view will still be called by view(id),
> right???

Yes. It's saying that any requests for /products/view/SOME_ID should
be routed to the view action.

> could you go into details with     array('id' => '[0-9]+' ?? why 0-9?

[0-9]+ is a regular expression. It matches any integer number.

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


time limit for group tests

2010-10-14 Thread euromark
does anyone know how to raise the time limit for group tests?
i always get
"Maximum execution time of 10 seconds exceeded in H:\...\trunk\vendors
\Zend\Gdata\Gapps.php on line 27"

set_time_limit(HOUR); etc does not work
i guess the test case itself resets the time limit for each test case

thx

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: Different way to pass a value to my controller, than "array('controller' => 'products', 'action' => 'view', $product['Product']['id'])"

2010-10-14 Thread Tomfox Wiranata
thx cricket.

my jquery request looks like this, calling the action "rate" and
passing a value..

$('#rating').load('rate', {data: ratingValue});


i have to admit, I still dont get the sense of routingwhen I use
the first one, the action view will still be called by view(id),
right???

could you go into details with array('id' => '[0-9]+' ?? why 0-9?

thx :)


On 14 Okt., 20:03, cricket  wrote:
> On Thu, Oct 14, 2010 at 5:11 AM, Tomfox Wiranata
>
>
>
>  wrote:
> > Hi,
>
> > this cry for help might seem weird. on my homepage are product sites.
> > user clicks on a link to get to product "abc". this is how the link
> > looks like :
>
> > echo $html->image($product['Product']['flyer_path_thumb'], array(
> >                    "alt" =>$product['Product']['title'],
> >                    'url' => array('controller' => 'products', 'action' => 
> > 'view',
> > $product['Product']['id'])
> >                ));
>
> > the URL then looks like this: products/view/id_of_abc
>
> > as you can see I pass this products ID to the controller "products"
> > and action "view" and use the ID to retrieve the data for "abc" from
> > my database. and this is the action that gets all information about
> > the product from the database:
>
> >        function view($id = null)
> >        {
> >                $this->Product->id = $id;
> >                $pr = $this->Product->find(bla bla bla Product.id = $id);
> >        }
>
> > it works fine. but I need to find a different way to pass the ID to
> > the controller action. because It interrupts jquery sending data to
> > another action in this controller. and it does not matter if I send
> > via GET or POST, and/or .load() or .ajax(). as long as I pass the ID
> > like mentioned above, i cant pass data with jquery
>
> > so is there another way to pass the product ID to the action, when
> > user clicks the link?
>
> You could wish upon a star. Why not just create a route and pass the id?
>
> Router::connect(
>         '/products/view/:id',
>         array('controller' => 'products', 'action' => 'view'),
>         array('id' => '[0-9]+', 'pass' => array('id'))
> );
>
> Or even:
>
> Router::connect(
>         '/products/:id',
>         array('controller' => 'products', 'action' => 'view'),
>         array('id' => '[0-9]+', 'pass' => array('id'))
> );
>
> But you'd need to be careful where you place that one. What does the
> JQuery request URL look like? If you create the above route, and
> another for the other request, you should be fine. It all depends on
> how the route URLs look and how they're situated in routes.php with
> respect to each other.

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


Loading a cookie inside a model's constructor

2010-10-14 Thread Raisen
So I want to read a cookie using the Cakephp's Cookie class. First, I
tried to import only the cookie class and read the cookie, but I was
getting an error stating that the cipher key cannot be null. So I
imported the Configure class, set the key property of the cookie
instance to the respective cipher key, but the cookie is returning a
different result from what it's set to. Any ideas?\
The override constructor class looks like:

class Member extends AppModel {
function __construct( $id = false, $table = NULL, $ds = NULL ) {
App::import('Component','Cookie');
App::import('Core','Configure');

$conf = new Configure();
$cookie = new CookieComponent();

$cookie->key = $conf->read("Security.cipherSeed");
var_dump($cookie->read('sel_app'));
...

parent::__construct($id,$table,$ds);

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: Custom router question

2010-10-14 Thread Michael Tokar
Raisen - this looks ideal! Will try it out some time soon. Thanks for
sharing.

On 15 October 2010 04:28, Raisen  wrote:

> I created the report plugin using the cake command line:
>
> cake bake plugin report
>
> The folder structure for the plugin looks just like the main
> application's one - views, controllers, models, etc.
>
> So I created a view/controller for each report I want.
>
> It's very simple. Be sure to read
> http://book.cakephp.org/view/119/Plugin-Tips
>
> "Once a plugin has been installed in /app/plugins, you can access it
> at the URL /pluginname/controllername/action. In our pizza ordering
> plugin example, we'd access our PizzaOrdersController at /pizza/
> pizzaOrders."
>
> That's what triggered me to use plugins - the url format.
>
>
> On Oct 13, 1:49 pm, Michael Tokar  wrote:
> > Interesting. Do you think you could post some sample code of your report
> > plugin?
> >
> > On 14 October 2010 09:41, Raisen  wrote:
> >
> >
> >
> >
> >
> >
> >
> > > I did find a way to make a reports section the way I want - plugins!
> > > Just create a reports plugin and then you can add the sales,
> > > customers, etc... controllers/views. The url will look like:
> >
> > >http://url.com/reports/sales/
> >
> > > On Oct 13, 1:15 pm, Michael Tokar  wrote:
> > > > On 14 October 2010 07:17, cricket  wrote:
> >
> > > > > But let's back up a bit--do you have Sale & Customer models? What I
> > > > > was getting at in my earlier suggestion was that you could declare
> > > > > options in each model for how its reporting would be conducted.
> >
> > > > For my situation at least, that doesn't seem like a great solution,
> as I
> > > > don't have a one-to-one relationship with Models and Reports. Several
> of
> > > my
> > > > reports use multiple models, and several models have different
> reports
> > > > associated to them.
> >
> > > 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 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.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: ajax error

2010-10-14 Thread cricket
On Thu, Oct 14, 2010 at 5:30 AM, farisi  wrote:
> I got this error
>
> Error: uncaught exception: [Exception... "Cannot modify properties of
> a WrappedNative"  nsresult: "0x80570034
> (NS_ERROR_XPC_CANT_MODIFY_PROP_ON_WN)"  location: "JS frame ::
> chrome://global/content/bindings/autocomplete.xml ::
> onxblpopuphiding :: line 825"  data: no]

Search online for  "Cannot modify properties of a WrappedNative".
Looks like a Firefox bug:
http://www.jampmark.com/browser-side/firefox-3-0-6-autocomplete-bug.html

> what the problem is ?

Difficult to say without seeing the code.

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: Different way to pass a value to my controller, than "array('controller' => 'products', 'action' => 'view', $product['Product']['id'])"

2010-10-14 Thread cricket
On Thu, Oct 14, 2010 at 5:11 AM, Tomfox Wiranata
 wrote:
> Hi,
>
> this cry for help might seem weird. on my homepage are product sites.
> user clicks on a link to get to product "abc". this is how the link
> looks like :
>
> echo $html->image($product['Product']['flyer_path_thumb'], array(
>                    "alt" =>$product['Product']['title'],
>                    'url' => array('controller' => 'products', 'action' => 
> 'view',
> $product['Product']['id'])
>                ));
>
> the URL then looks like this: products/view/id_of_abc
>
> as you can see I pass this products ID to the controller "products"
> and action "view" and use the ID to retrieve the data for "abc" from
> my database. and this is the action that gets all information about
> the product from the database:
>
>        function view($id = null)
>        {
>                $this->Product->id = $id;
>                $pr = $this->Product->find(bla bla bla Product.id = $id);
>        }
>
>
> it works fine. but I need to find a different way to pass the ID to
> the controller action. because It interrupts jquery sending data to
> another action in this controller. and it does not matter if I send
> via GET or POST, and/or .load() or .ajax(). as long as I pass the ID
> like mentioned above, i cant pass data with jquery
>
> so is there another way to pass the product ID to the action, when
> user clicks the link?

You could wish upon a star. Why not just create a route and pass the id?

Router::connect(
'/products/view/:id',
array('controller' => 'products', 'action' => 'view'),
array('id' => '[0-9]+', 'pass' => array('id'))
);

Or even:

Router::connect(
'/products/:id',
array('controller' => 'products', 'action' => 'view'),
array('id' => '[0-9]+', 'pass' => array('id'))
);

But you'd need to be careful where you place that one. What does the
JQuery request URL look like? If you create the above route, and
another for the other request, you should be fine. It all depends on
how the route URLs look and how they're situated in routes.php with
respect to each other.

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 get last inserted ids from saveall

2010-10-14 Thread cakebaker
I am also looking for this solution. Someone post if you find it, or
i'll keep looking.
This is not for related data right? its just when inserting multiple
rows using cakephp saveAll into the same time, to return the insert_id
or primary ids of all of the rows.

On Sep 1, 6:07 am, RJ  wrote:
> I am doing a saveall to insert multiple row at once. Is there any way
> by which i can get the primary ids of all the rows inserted.
> $this->Model->getlastinsertedid() returns the id of the latest row..
>
> Any ideas?

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


display many tables in cake php on the same page

2010-10-14 Thread blablabla
I am using cake php

I have a table called relates that holds the primary id values from
the other tables.

I used cakephp to generate the crud. it works fine. if you click on
the number in the relates table it goes to the appropriate table and
displays the information like it should.


how can you combine the information from the other tables and display
the information instead of showing the relationships primary ids?

example:
//relate table show this
Client 1
Client Address 1
Contact 1
Contact Info 1
Accounting 1

I would like to look like this

client: john smith
client: address 123 easy st
Contact: sam
Contact Info: 714-822-
Accounting: 500.00

I know my code for the model is not correct but when i join the tables
i get no errors but the tables that i join do not display. basically i
need this query to be used but i cant figure how to make it show more
than one table at a time

PHP Syntax (Toggle Plain Text)

   1.
   array(
  11.
  'className' => 'Relate',
  12.
  'foreignKey' => 'relate_id',
  13.
  'conditions' => '',
  14.
  'fields' => '',
  15.
  'order' => ''
  16.
  ),
  17.
  'Client' => array(
  18.
  'className' => 'Client',
  19.
  'foreignKey' => 'client_id',
  20.
  'conditions' => '',
  21.
  'fields' => '',
  22.
  'order' => ''
  23.
  ),
  24.
  'ClientAddress' => array(
  25.
  'className' => 'ClientAddress',
  26.
  'foreignKey' => 'client_address_id',
  27.
  'conditions' => '',
  28.
  'fields' => '',
  29.
  'order' => ''
  30.
  ),
  31.
  'Contact' => array(
  32.
  'className' => 'Contact',
  33.
  'foreignKey' => 'contact_id',
  34.
  'conditions' => '',
  35.
  'fields' => '',
  36.
  'order' => ''
  37.
  ),
  38.
  'ContactInfo' => array(
  39.
  'className' => 'ContactInfo',
  40.
  'foreignKey' => 'contact_info_id',
  41.
  'conditions' => '',
  42.
  'fields' => '',
  43.
  'order' => ''
  44.
  ),
  45.
  'Accounting' => array(
  46.
  'className' => 'Accounting',
  47.
  'foreignKey' => 'accounting_id',
  48.
  'conditions' => '',
  49.
  'fields' => '',
  50.
  'order' => ''
  51.
  ),var $hasOne = array(
  52.
  'ChildRelate' => array(
  53.
  'className' => 'Relate',
  54.
  'foreignKey' => 'relate_id',
  55.
  'dependent' => false,
  56.
  'conditions' => '',
  57.
  'fields' => '',
  58.
  'order' => ''
  59.
  )
  60.
  );
  61.

  62.
  var $hasMany = array(
  63.
  'ChildRelate' => array(
  64.
  'className' => 'Relate',
  65.
  'foreignKey' => 'relate_id',
  66.
  'dependent' => false,
  67.
  'conditions' => '',
  68.
  'fields' => '',
  69.
  'order' => '',
  70.
  'limit' => '',
  71.
  'offset' => '',
  72.
  'exclusive' => '',
  73.
  'finderQuery' => '',
  74.
  'counterQuery' => ''
  75.
  )
  76.
  );
  77.

  78.
  }
  79.
  ?>

 array( 'className' => 'Relate', 'foreignKey'
=> 'relate_id', 'conditions' => '', 'fields' => '', 'order' => '' ),
'Client' => array( 'className' => 'Client', 'foreignKey' =>
'client_id', 'conditions' => '', 'fields' => '', 'order' => '' ),
'ClientAddress' => array( 'className' => 'ClientAddress', 'foreignKey'
=> 'client_address_id', 'conditions' => '', 'fields' => '', 'order' =>
'' ), 'Contact' => array( 'className' => 'Contact', 'foreignKey' =>
'contact_id', 'conditions' => '', 'fields' => '', 'order' => '' ),
'ContactInfo' => array( 'className' => 'ContactInfo', 'foreignKey' =>
'contact_info_id', 'conditions' => '', 'fields' => '', 'order' =>
'' ), 'Accounting' => array( 'className' => 'Accounting', 'foreignKey'
=> 'accounting_id', 'conditions' => '', 'fields' => '', 'order' =>
'' ),var $hasOne = array( 'ChildRelate' => array( 'className' =>
'Relate', 'foreignKey' => 'relate_id', 'dependent' => false,
'conditions' => '', 'fields' => '', 'order' => '' ) ); var $hasMany =
array( 'ChildRelate' => array( 'className' => 'Relate', 'foreignKey'
=> 'relate_id', 'dependent' => false, 'conditions' => '', 'fields' =>
'', 'order' => '', 'limit' => '', 'offset' => '', 'exclusive' => '',
'finderQuery' => '', 'counterQuery' => '' ) ); } ?>

heres the sql query. relate is the table that relates all the tables
together
I know that the names are not complaint to cakephp's name scheme but
it will be. I am justing looking for some direction and a format to
help me out

"SELECT
agency.agency,
agency_address.agent_address,
agency.agency_id,
bond.bond_number,
bond.Surety,
bond.bond_type,
bond.paying_state,
bond.bond_state,
bond.term,
bond.cancellation_clause,
bond.bond_amt,
bond.first_issue_date,
bond.issue_date,
bond.exp_date,
bond.red_stared,
bond.red_stared_date,
bond.date_purged,
bond.bond_id,
client.client_id,
client.client_name,
agency_contact.agent_first,
agency_contact.agent_last,
agency_info.agent_phone,
agency_info.agent_fax,
agency_info.agent_email,
bond.bond_nu

Re: Custom router question

2010-10-14 Thread Raisen
I created the report plugin using the cake command line:

cake bake plugin report

The folder structure for the plugin looks just like the main
application's one - views, controllers, models, etc.

So I created a view/controller for each report I want.

It's very simple. Be sure to read http://book.cakephp.org/view/119/Plugin-Tips

"Once a plugin has been installed in /app/plugins, you can access it
at the URL /pluginname/controllername/action. In our pizza ordering
plugin example, we'd access our PizzaOrdersController at /pizza/
pizzaOrders."

That's what triggered me to use plugins - the url format.


On Oct 13, 1:49 pm, Michael Tokar  wrote:
> Interesting. Do you think you could post some sample code of your report
> plugin?
>
> On 14 October 2010 09:41, Raisen  wrote:
>
>
>
>
>
>
>
> > I did find a way to make a reports section the way I want - plugins!
> > Just create a reports plugin and then you can add the sales,
> > customers, etc... controllers/views. The url will look like:
>
> >http://url.com/reports/sales/
>
> > On Oct 13, 1:15 pm, Michael Tokar  wrote:
> > > On 14 October 2010 07:17, cricket  wrote:
>
> > > > But let's back up a bit--do you have Sale & Customer models? What I
> > > > was getting at in my earlier suggestion was that you could declare
> > > > options in each model for how its reporting would be conducted.
>
> > > For my situation at least, that doesn't seem like a great solution, as I
> > > don't have a one-to-one relationship with Models and Reports. Several of
> > my
> > > reports use multiple models, and several models have different reports
> > > associated to them.
>
> > 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 > om>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 at 
http://groups.google.com/group/cake-php?hl=en


Re: How to use a controller for layout logic?

2010-10-14 Thread Jeremy Burns | Class Outfit
http://articles.classoutfit.com/2009/11/cakephp-dynamic-navigation-bars/

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 14 Oct 2010, at 10:15, ravidp wrote:

> Hi,
> 
> In my layout I have a menu which I want a part of it to be filled
> dynamically from the data base.
> 
> Any ideas of the best way to make it happen?
> 
> Thanks in advance,
> 
> 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 at 
http://groups.google.com/group/cake-php?hl=en


ajax error

2010-10-14 Thread farisi
I got this error

Error: uncaught exception: [Exception... "Cannot modify properties of
a WrappedNative"  nsresult: "0x80570034
(NS_ERROR_XPC_CANT_MODIFY_PROP_ON_WN)"  location: "JS frame ::
chrome://global/content/bindings/autocomplete.xml ::
onxblpopuphiding :: line 825"  data: no]

what the problem is ?

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 use a controller for layout logic?

2010-10-14 Thread ravidp
Hi,

In my layout I have a menu which I want a part of it to be filled
dynamically from the data base.

Any ideas of the best way to make it happen?

Thanks in advance,

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: "Sticky" URL parameters?

2010-10-14 Thread O.J. Tibi
Wonderful, thanks Tilen!

On Oct 12, 11:07 am, Tilen Majerle  wrote:
> it's the better way to recreate url function in AppHelper
>
> {{{
>
> function url($url, $full = false)
> {
>    if (!isset($url["country"] && isset($this->params["country"]))
>    {
>       $url["country"] = $this->params["country"];
>    }
>    return parent::url($url, $full);
>
> }
> }}}

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: Web tests using fixtures: Finally got them working!

2010-10-14 Thread Joshua Muheim
OK, I slightly updated the post and corrected the download link.
Please, give it a try! :-)

On Thu, Oct 14, 2010 at 10:31 AM, Joshua Muheim  wrote:
> Thanks for your reply, David.
>
> On Thu, Oct 14, 2010 at 10:30 AM, dtemes  wrote:
>> Thanks for sharing!
>>
>> check the link to the source code, it's not working for me.
>
> I'll take a look at it.
>
>> I have not
>> seen the code, but you mention that you have just copy and pasted the
>> fixtures code into your CakeWebTestCaseWithFixtures class. Instead of
>> doing that you can instantiate a CakeTestCase inside your class and
>> create some wrapper methods that call the corresponding methods of the
>> CakeTestCase instance.
>
> Great idea! Thank you.
>

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


Different way to pass a value to my controller, than "array('controller' => 'products', 'action' => 'view', $product['Product']['id'])"

2010-10-14 Thread Tomfox Wiranata
Hi,

this cry for help might seem weird. on my homepage are product sites.
user clicks on a link to get to product "abc". this is how the link
looks like :

echo $html->image($product['Product']['flyer_path_thumb'], array(
"alt" =>$product['Product']['title'],
'url' => array('controller' => 'products', 'action' => 
'view',
$product['Product']['id'])
));

the URL then looks like this: products/view/id_of_abc

as you can see I pass this products ID to the controller "products"
and action "view" and use the ID to retrieve the data for "abc" from
my database. and this is the action that gets all information about
the product from the database:

function view($id = null)
{
$this->Product->id = $id;
$pr = $this->Product->find(bla bla bla Product.id = $id);
}


it works fine. but I need to find a different way to pass the ID to
the controller action. because It interrupts jquery sending data to
another action in this controller. and it does not matter if I send
via GET or POST, and/or .load() or .ajax(). as long as I pass the ID
like mentioned above, i cant pass data with jquery

so is there another way to pass the product ID to the action, when
user clicks the link?

thanks. I really need your help here.

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: passing data to controller via POST makes trouble

2010-10-14 Thread Tomfox Wiranata
ok thx to you :)

i got the .ajax working, passing data with POST. but it just works as
long as I stop passing the product id to my controller.so I need
to find a new way to identify the product that the user views to get
the correct data from the DB

i guess jquery really isnt supposed to go with cake^^


On 13 Okt., 22:59, euromark  wrote:
> he is right
> you can always use native query/js helper functions
>
> i just assumed you want to use jquery manually
> and $ is the same as jquery :)
>
> On 13 Okt., 22:12, Michael T  wrote:
>
> > Tomfox,
>
> > Just so you know, you can achieve a similar result to what EUROMARK
> > was suggesting using the JsHelper's "request" method. This might help
> > in that you have to write less raw Javascript? See the book for more
> > details:http://book.cakephp.org/view/1593/Methods
>
> > Also, once you send the form data via POST, you can handle it with an
> > action like this in your controller:
>
> > function handle_ajax_request() {
> >         if($this->RequestHandler->isAjax()) {
> >                 $my_field = $this->data['my_field'];
> >                 ...
> >         }
>
> > }
>
> > (Note: you need to have the RequestHandler component present in your
> > controller)
>
> > Hope this helps!
>
> > On Oct 14, 12:00 am, Tomfox Wiranata 
> > wrote:
>
> > > first, thx to everyone..
>
> > > I am using 1.3 and i dont mind using POST instead of GET. seems to
> > > make more sense anyay so based on both of your answers I'll try
>
> > > to use a form , sending with post and accept the data in my controller
> > > via request..
>
> > > @ EUROMARK:
>
> > > so when i send the data with ajax to my controller, how should I
> > > receive it? with this->params? or $_POST
>
> > > why do you use Jquery instead of # ? do i need to import a specific
> > > jquery file to make that work? i got the jquery1.4.2 already
>
> > > thx :)
>
> > > On 13 Okt., 11:46, euromark  wrote:
>
> > > > use jquery .ajax()
> > > > this will work
>
> > > > example:
>
> > > > jQuery('.delAjax').click(function(e) {
> > > >         e.preventDefault();
> > > >         var targeturl = jQuery(this).attr("href");
> > > >         var id = jQuery(this).parent('td').parent('tr');
> > > >                 $.ajax({
> > > >                         type: "post", url: targeturl,
> > > >                         //beforeSend: showRequest, //show loading just 
> > > > when link is clicked
> > > >                         //complete: showResponse, //stop showing 
> > > > loading when the process
> > > > is complete
> > > >                         success: function(html){ //so, if data is 
> > > > retrieved, store it in
> > > > html
> > > >                                 if (html == '') {
> > > >                                         id.hide();
> > > >                                 } else {
> > > >                                         alert(html);
> > > >                                 }
> > > >                                 }
> > > >                 });
> > > >         });
>
> > > > On 13 Okt., 11:17, Michael T  wrote:
>
> > > > > I had similar problems like yours and I found that using Firebug to
> > > > > debug what was being sent back to the server via Javascript was *very*
> > > > > helpful. If you haven't done so already, you should install it.
>
> > > > > What version of CakePHP are you using? I know that in 1.3 you can use
> > > > > the JsHelper's 'request' method and you can specify that it does a
> > > > > POST instead of a GET. But this might only work if you employ a
> > > > > .
>
> > > > > Otherwise, if you want to continue using GET, can't you just get the
> > > > > passed value from $this->params['url']['value'] ?
>
> > > > > Hope this helps.
>
> > > > > On Oct 13, 9:30 pm, Tomfox Wiranata  wrote:
>
> > > > > > but dont I need a form when I use this->data??? and still i have to
> > > > > > pass them in my view. but how?
>
> > > > > > just checkedthe load function is a get command, saysd
> > > > > > api.jquery.com
> > > > > > "This method is the simplest way to fetch data from the server. It 
> > > > > > is
> > > > > > roughly equivalent to $.get(url, data, success) "
>
> > > > > > so i definitely have to find a different way to pass data to my
> > > > > > controller.
>
> > > > > > thanks
>
> > > > > > On 13 Okt., 00:40, euromark  wrote:
>
> > > > > > > you can post it in cake style and use $this->data to access it 
> > > > > > > (not by
> > > > > > > using $_POST)
>
> > > > > > > but besides that:
> > > > > > > sure that "load" is a POST and not GET command?
> > > > > > > what does firebug say?
>
> > > > > > > On 13 Okt., 00:25, Tomfox Wiranata  
> > > > > > > wrote:
>
> > > > > > > > hmm...why not??
>
> > > > > > > > because i am sending data from my view to the controller? how 
> > > > > > > > else
> > > > > > > > would i process a rating?
>
> > > > > > > > On 13 Okt., 00:21, euromark  wrote:
>
> > > > > > > > > its not very cake like, what you are doing there, i'm afraid
>
> > 

Re: Web tests using fixtures: Finally got them working!

2010-10-14 Thread Joshua Muheim
Thanks for your reply, David.

On Thu, Oct 14, 2010 at 10:30 AM, dtemes  wrote:
> Thanks for sharing!
>
> check the link to the source code, it's not working for me.

I'll take a look at it.

> I have not
> seen the code, but you mention that you have just copy and pasted the
> fixtures code into your CakeWebTestCaseWithFixtures class. Instead of
> doing that you can instantiate a CakeTestCase inside your class and
> create some wrapper methods that call the corresponding methods of the
> CakeTestCase instance.

Great idea! Thank you.

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: Web tests using fixtures: Finally got them working!

2010-10-14 Thread dtemes
Thanks for sharing!

check the link to the source code, it's not working for me. I have not
seen the code, but you mention that you have just copy and pasted the
fixtures code into your CakeWebTestCaseWithFixtures class. Instead of
doing that you can instantiate a CakeTestCase inside your class and
create some wrapper methods that call the corresponding methods of the
CakeTestCase instance.

Regards
David

On 14 oct, 08:35, psybear83  wrote:
> Yeah, it was quite late that day... So finally here's the link to my
> blog post... ;-)
>
> http://josh.ch/wordpress/?p=8
>
> On Oct 13, 6:13 pm, psybear83  wrote:
>
> > Hi everybody
>
> > After long days of hard work I finally got web tests running using
> > fixtures. I wrote a blog post about this (my first post in my first
> > blog ever!), so if you're interested please take a look at it.
>
> > Any good advice is welcome (whether it's about my not-so-very-
> > experienced blogging-skills or about the article itself).
>
> > Thanks and I hope, this helps some of you :-)
> > Josh

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: Validation causes memory exhausting

2010-10-14 Thread senser
No, I don't use isUnique validation rule. Here is my $validation
array:

var $validate=array(
'for_date'=>array('required'=>VALID_NOT_EMPTY,
   'date'=>array('rule'=>array('date', 'ymd')),
   'length'=>array('rule'=>array('between',10,10))),

'marketing_campaign_id'=>array('number'=>array('rule'=>VALID_NUMBER,
'allowEmpty'=>true, 'required'=>false),
   'maxlength'=>array('rule'=>array('between',1,12),
'allowEmpty'=>true, 'required'=>false)),

'marketing_group_id'=>array('number'=>array('rule'=>VALID_NUMBER,
'allowEmpty'=>true, 'required'=>false),
   'maxlength'=>array('rule'=>array('between',1,12),
'allowEmpty'=>true, 'required'=>false)),

'marketing_creative_id'=>array('number'=>array('rule'=>VALID_NUMBER,
'allowEmpty'=>true, 'required'=>false),
   'maxlength'=>array('rule'=>array('between',1,12),
'allowEmpty'=>true, 'required'=>false)),

'marketing_criterion_id'=>array('number'=>array('rule'=>VALID_NUMBER,
'allowEmpty'=>true, 'required'=>false),
   'maxlength'=>array('rule'=>array('between',1,12),
'allowEmpty'=>true, 'required'=>false)),

'impressions'=>array('number'=>array('rule'=>VALID_NUMBER,
'allowEmpty'=>true, 'required'=>false),
   'maxlength'=>array('rule'=>array('between',1,12),
'allowEmpty'=>true, 'required'=>false),
   'positive'=>array('rule'=>array('comparison', '>=', 0),
'allowEmpty'=>true, 'required'=>false)),

'clicks'=>array('number'=>array('rule'=>VALID_NUMBER,
'allowEmpty'=>true, 'required'=>false),
   'maxlength'=>array('rule'=>array('between',1,12),
'allowEmpty'=>true, 'required'=>false),
   'positive'=>array('rule'=>array('comparison', '>=', 0),
'allowEmpty'=>true, 'required'=>false)

'ctr'=>array('number'=>array('rule'=>VALID_NUMBER, 'allowEmpty'=>true,
'required'=>false),
   'maxlength'=>array('rule'=>array('between', 1, 22),
'allowEmpty'=>true, 'required'=>false),
   'positive'=>array('rule'=>array('comparison', '>=', 0),
'allowEmpty'=>true, 'required'=>false)),

'cpc'=>array('number'=>array('rule'=>VALID_NUMBER,
'allowEmpty'=>true, 'required'=>false),
   'maxlength'=>array('rule'=>array('between', 1, 22),
'allowEmpty'=>true, 'required'=>false),
   'positive'=>array('rule'=>array('comparison', '>=', 0),
'allowEmpty'=>true, 'required'=>false)),

'conversions'=>array('number'=>array('rule'=>VALID_NUMBER,
'allowEmpty'=>true, 'required'=>false),
   'maxlength'=>array('rule'=>array('between',1,12),
'allowEmpty'=>true, 'required'=>false),
   'positive'=>array('rule'=>array('comparison', '>=', 0),
'allowEmpty'=>true, 'required'=>false)),

'conversion_rate'=>array('number'=>array('rule'=>VALID_NUMBER,
'allowEmpty'=>true, 'required'=>false),
   'maxlength'=>array('rule'=>array('between', 1, 22),
'allowEmpty'=>true, 'required'=>false),
   'positive'=>array('rule'=>array('comparison', '>=', 0),
'allowEmpty'=>true, 'required'=>false)),

'cost'=>array('number'=>array('rule'=>VALID_NUMBER,
'allowEmpty'=>true, 'required'=>false),
   'maxlength'=>array('rule'=>array('between', 1, 5)),
   'positive'=>array('rule'=>array('comparison', '>=', 0)

Today I've tried to just validate data with $Model->saveAll($data,
array('validate'=>only)) and problem is still present, so I don't
think caching queries(or not)  would solve it.
On Oct 14, 9:31 am, "Dr. Loboto"  wrote:
> What validation rules do you use? If there is isUnique, for example,
> for each check it makes database query, result is saved in memory (if
> cacheQueries is on) and query string is saved in SQL log (if debug is
> 2).
>
> On Oct 13, 5:15 pm, senser  wrote:
>
> > Hello,
>
> > I try to save a large number of records with Cake (latest stable 1.2
> > branch) but script stops with fatal error because of memory exhausted.
> > I have about 3 records that must be stored in mysql. I use 
> > $Model->saveAll($data, array('validate'=>true, 'atomic'=>true)), but even
>
> > with 1024MB memory limit, script fails. I've tried to save each record
> > with loop and $Model->save($data) instead of $Model->saveAll(), but
> > this makes no difference. Disabling validation makes the trick though.
> > When records are not validated script consumes (almost) constant
> > amount of memory, in contrast to case when data is validated then on
> > every loop iteration memory consumption grows (I measure memory with
> > memory_get_usage()).
>
> > Any ideas how to solve this?
> > 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


Ajax observefield input text update problem

2010-10-14 Thread Tom
Please help!
I want to update vatnumber after selecting client but don't work


... tests_controler.php
---
function update_input()
{
   $xvalue = '123';
   $this->set('xvalue', $xvalue);
   $this->render('/tests/ajax_value','ajax');
}

... /tests/form_test.ctp
--
link('prototype', false); ?>
input('client_id',
array('label' => 'Clients',
'options' => $clients,
 'selected' => isset($this->data['Test']['client_id']) ? $this-
>data['Test']['client_id'] : ''));

echo $form->input('vatnumber',
array('label' => 'VAT',
'value' => isset($this->data['Test']['vatnumber']) ? $this-
>data['Test']['vatnumber'] : '' ));

$options = array('url' => 'update_value', 'update' =>
'TestVatnumber');
echo $ajax->observeField('TestClientId', $options );
?>

... /tests/ajax_value.ctp
--


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: CakePHP 1.3.4 Stable - Weird problem with sessions! HELP!

2010-10-14 Thread and


On 12 Okt., 15:04, 浪漫様  wrote:
> In a normal world, the following code would work... you receive a
> variable on your function, and you save it on a session, then the next
> page is able to read it ( the SET is just to display it on the
> views )... however, in CakePHP 1.3.4 Stable seems to fail, i can see
> the variable on the initial function [ browse ], but is empty in the
> following function [ display ]
>
> function browse($variable) {
>   $this->Session->write('mysession.variable', $variable);
>   $this->set('variable', $variable);
>
> } // function: browse
>
> function display() {
>   $this->set('variable', $this->Session->read('mysession.variable'));
>
> } // function: display
>
> More funny is that the following code DOES WORK:
>
> function browse() {
>   $variable = 5;
>   $this->Session->write('mysession.variable', $variable);
>   $this->set('variable', $variable);
>
> } // function: browse
>
> function display() {
>   $this->set('variable', $this->Session->read('mysession.variable'));
>
> } // function: display
>
> So seems the problem i'm experiencing is only with the variable you
> get through the functions parameters... anyone has a clue on what's
> going on? is driving me crazy and it makes no fuc*ing sense. I didn't
> seem to experience that behavior on CakePHP 1.2 though.
> thanks
>
> Rohman

what does your router say? you probably should use something like:

Router::connect('browser/:VAR', array('plugin' => '', 'controller' =>
'yours', 'action' => 'browse', VAR);

i had lot's of problems without using the acronyms after the actions.
i have no idea why but with this router configuration it always worked.

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: Framework benefit?

2010-10-14 Thread Zaky Katalan-Ezra
"Premature optimization is the root of all evil" Donald Knuth

1. Make it work. Following the KISS principle, and developing the minimum
features needed for the first release.
2. Look for the problems that pop up (Any thing that the customer think its
a problem, not you).
3. Fix these problems only.

In other words, don't try to fix problems you don't have it will not reduce
the problems you will have, actually most of the time it will raise some
more.

If you are developing a life saving software forget all I wrote above and
develop in C++.

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: Framework benefit?

2010-10-14 Thread Miles J
Easy: fast development.

Also, caching will improve everything. For example, my APC can deal
with about 120 cache requests per second and my memcache about 90 per
second. Site loads blazingly fast.

On Oct 13, 11:41 pm, Andrei Mita  wrote:
> Plus, hardware is MUCH cheaper then software.
>
> On Wed, Oct 13, 2010 at 6:34 PM, WW  wrote:
> > Thank you Jeremy for taking the time to write and hearing the main
> > benefit if for cutting down the bulk of code.
>
> > On Oct 13, 11:14 am, Jeremy Burns | Class Outfit
> >  wrote:
> > > It depends what your priorities are, your personal experiences with
> > frameworks and who you believe.
>
> > > The major benefit of a framework is that it cuts down the bulk of the
> > code you need to write, and that code will (probably) be better than you
> > could write yourself. So if time to market is critical, a framework is a
> > good head start. And that core code is always being worked on and improved,
> > so your code will benefit from that development effort.
>
> > > If you are a master whizz bang bleeding edge developer that might not be
> > attractive to you. And you might have heard of bad experiences with
> > frameworks and might well want to muddy the waters because you can or you
> > feel like it. But a framework is just a set of tools with which you can
> > build something bigger and better. If you use them badly you'll get a bad
> > site, and that might lead to bad publicity for the framework - which is
> > probably unjust. I have sites that peak at 200,000 hits per hour without
> > breaking a sweat and without running on stupid hardware. So my experiences
> > with frameworks (well, having looked at most frameworks I've only ever used
> > CakePHP) have been totally satisfactory. So you pick who you believe.
>
> > > There has been quite a bit of banter on this forum about Cake's capacity
> > and trying to measure performance relative to other frameworks, but I've yet
> > to see anything that makes me think that it isn't up to the job or that it
> > is the best thing since sliced bread. In fact it's all probably an
> > intellectual w*nk and a complete waste of time.
>
> > > My advice? Don't think about it too much, give it a go yourself and form
> > your own opinion.
>
> > > Jeremy Burns
> > > Class Outfit
>
> > > jeremybu...@classoutfit.comhttp://www.classoutfit.com
>
> > > On 12 Oct 2010, at 20:33, WW wrote:
>
> > > > Hi everyone, I could use some help on a question.
>
> > > > Question:  What is benefit of coding with a framework if frameworks
> > > > only deliver between 55 to 210 req/sec? (see Paul Jones report below)
>
> > > > With only being able to deliver between 55 to 210 req/sec using a
> > > > framework this would mean I would need a monster expensive server to
> > > > keep the CPU usage down to a minimum.   Where if you code in native
> > > > PHP I can get 1413 req/sec.
>
> > > > -Reported by Paul Jones…http://paul-m-jones.com/archives/238
> > > > -
>
> > > > Webserver itself – delivers 2328 req/sec
> > > > Invoking PHP – delivers 1413 req/sec
> > > > Invoking a Framework – delivers between 55 to 210 req/sec
>
> > --
>
> > > > Thank you for taking the time to share your thoughts.
> > > > Best,
> > > > WW
>
> > > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp
> > 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 athttp://
> > groups.google.com/group/cake-php?hl=en
>
> > 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.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