Tuesday, January 31, 2012

cake 2.0.5 AppExceptionRenderer not found error

I want to use my custom exception renderer to show 404 pages, I created a AppExceptionRenderer class located in app/Lib/Error/AppExceptionRenderer.php, and I changed exception config to Configure::write('Exception.renderer', 'AppExceptionRenderer');
but when i open a non exist address, cake give this error

Fatal error: Class 'AppExceptionRenderer' not found in ......../lib/Cake/Error/ErrorHandler.php on line 126 Call Stack: 0.0161 4592240 1. ErrorHandler::handleException() ......./lib/Cake/Error/ErrorHandler.php:0

seems it can't locate the AppExceptionRenderer file, but according to the manual, I do put it in app/Lib/Error, please help

--
Perry | 彭琪

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

Re: HttpSocket won't use 443 port for https request automatically

i'm using cake 2.0.5

On Tue, Jan 31, 2012 at 10:58 PM, euromark <dereuromark@googlemail.com> wrote:
could be
you can open a ticket at
cakephp.lighthouseapp.com/projects/42648/tickets/
if you feel like this should be addressed

but dont forget to mention the cake version you are using this time
(as you did here^^)


On 31 Jan., 04:38, Perry <perry...@gmail.com> wrote:
> when I pass a https url to HttpSocket::get, it won't use 443 port
> automatically, and return nothing
>
> but when i specify the port in url, likehttps://example.com:443/, it works
> fine
>
> is this a bug?
>
> --
> Perry | 彭琪http://pengqi.me

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php



--
Perry | 彭琪

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

Re: how to confiure myproject with cakephp 1.3 on shaing host

something wrong it is not work
look at this link
http://alashera.3owl.com/testproject/
you will see this error


Warning: include(cake/bootstrap.php) [function.include]: failed to
open stream: No such file or directory in /home/u560489163/public_html/
testproject/index.php on line 76

Warning: include() [function.include]: Failed opening 'cake/
bootstrap.php' for inclusion (include_path='/home/u560489163/cake:/
home/u560489163/cake/testproject/:.:/usr/lib/php:/usr/local/lib/php')
in /home/u560489163/public_html/testproject/index.php on line 76

Fatal error: CakePHP core could not be found. Check the value of
CAKE_CORE_INCLUDE_PATH in APP/webroot/index.php. It should point to
the directory containing your /cake core directory and your /vendors
root directory. in /home/u560489163/public_html/testproject/index.php
on line 77

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

Re: $this->ModelName->invalidFields(); return duplicates

Hi, Euromark.

Unfortunately, assign value "true" in param "last" not worked for me.
I think this error is strange and I'm trying understand if it have
relation with PHP version.

My test server runs Ubuntu server 11.0 and
PHP 5.3.6-13ubuntu3.3 with Suhosin-Patch (cli) (built: Dec 13 2011
18:18:37)
Copyright (c) 1997-2011 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies

Regards

On Dec 29 2011, 10:43 pm, euromark <dereurom...@googlemail.com> wrote:
> as far as I know cake2 returns arrays for the fields by default -
> especially if there are multiple rules per field.
> if you only want the one error, you need to use "last"=>true in your
> rules
>
> On 30 Dez., 00:21, Moiz <moiz.bhukh...@gmail.com> wrote:
>
>
>
>
>
>
>
> > Hello there,
>
> > Why does $this->ModelName->invalidFields(); returns the following
> > array?
> > array('field1' => array('error1', 'error1'), 'field2' => 'error2',
> > 'error2');
>
> > Is it designed to do this or I am making a mistake somewhere?
> > I am using cake 2.0.x
>
> > Any help on this is greatly appreciated.
> > Thank you.

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

Re: $this->ModelName->invalidFields(); return duplicates

Hi, Moiz.

I have had the same problem and I don't how to fix this.

I edited the method validates in lib/Cake/Model/Model.php, but I don't
had success.

I'm using last version of cake (2.0.x too).

Regards!

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

Re: how to confiure myproject with cakephp 1.3 on shaing host

thatsgreat2345... thanks man .. i will try it now..i hope its works
and i will reply to tell you when work

On Jan 31, 11:03 pm, thatsgreat2345 <thatsgreat2...@gmail.com> wrote:
> This way you can just add as many apps you want inside /cake, and then
> toss the webroots into public_html. You won't have to have tons of
> different cakes for each project you work on.
>
> On Jan 31, 1:01 pm, thatsgreat2345 <thatsgreat2...@gmail.com> wrote:
>
>
>
>
>
>
>
> > Running on shared hosting, I upload my cake folder to just above
> > public_html.
> > Inside this cake folder you should have your app folder, and lib,
> > plugins, vendors, index.php, and .htaccess
> > My app folder I will name after my project, so for this instance we
> > shall call it TestProj
> > Then in public_html I will upload my webroot folder, I generally name
> > this the same as my app folder, so TestProj.
> > Then you just need to configure your index.php in your webroot to
> > point to cake.
> > Change these lines, you will have to adjust the number of dirnames()
> > depending on how far away the cake folder is from your webroot.
> > If you really don't know what you're doing then try 3 dirnames, then
> > 2, then 4. I say this because if you have multiple domains on your
> > shared hosting then you will have multiple subdirectories, you can
> > count how many subdirectories there are and that is how many dirnames
> > you will need but trial and error also works.
> > if (!defined('ROOT')) {
> >                 define('ROOT', dirname(dirname(dirname(__FILE__))) . DS . 'cake');
> >         }
> > /**
> >  * The actual directory name for the "app".
> >  *
> >  */
> >         if (!defined('APP_DIR')) {
> >                 define('APP_DIR', 'TestProj');
> >         }
>
> > /cake
> > -TestProj
> > -lib
> > -plugins
> > -vendors
> > -index.php
> > -.htacces
> > /public_html
> > -/TestProj
> > --css
> > --js
> > --img
> > --files
> > --index.php (Where you make modifications)
> > --.htacces
> > --test.php
>
> > Then you would go to "www.example.com/TestProj/controller/index"
> > And you should be good to go
> > On Jan 29, 2:05 pm, ahmed fakher <spcial...@gmail.com> wrote:
>
> > > At first I prefer to explaine important  things
> > > First, this question very basiclly but I'm Newbie To Cake
> > > Second,doesnt have a place with experts in the cake Except this place,
> > > so I hope that you help me
> > > Third, I've made ​​several attempts but failed
> > > So pleaaaaase do not let me without any help ..
>
> > > i read this link and i miss understanding the full stepshttp://book.cakephp.org/1.3/en/view/912/Installation
>
> > > so please i need clear steps...
> > > this image from ftp have two folders (public_html / myproject )http://www12.0zz0.com/2012/01/29/22/349925194.jpg

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

Re: Cake 2.1 Events:

@phpMagpie a follow up on this subject would be nice ;)

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

Re: how to confiure myproject with cakephp 1.3 on shaing host

This way you can just add as many apps you want inside /cake, and then
toss the webroots into public_html. You won't have to have tons of
different cakes for each project you work on.

On Jan 31, 1:01 pm, thatsgreat2345 <thatsgreat2...@gmail.com> wrote:
> Running on shared hosting, I upload my cake folder to just above
> public_html.
> Inside this cake folder you should have your app folder, and lib,
> plugins, vendors, index.php, and .htaccess
> My app folder I will name after my project, so for this instance we
> shall call it TestProj
> Then in public_html I will upload my webroot folder, I generally name
> this the same as my app folder, so TestProj.
> Then you just need to configure your index.php in your webroot to
> point to cake.
> Change these lines, you will have to adjust the number of dirnames()
> depending on how far away the cake folder is from your webroot.
> If you really don't know what you're doing then try 3 dirnames, then
> 2, then 4. I say this because if you have multiple domains on your
> shared hosting then you will have multiple subdirectories, you can
> count how many subdirectories there are and that is how many dirnames
> you will need but trial and error also works.
> if (!defined('ROOT')) {
>                 define('ROOT', dirname(dirname(dirname(__FILE__))) . DS . 'cake');
>         }
> /**
>  * The actual directory name for the "app".
>  *
>  */
>         if (!defined('APP_DIR')) {
>                 define('APP_DIR', 'TestProj');
>         }
>
> /cake
> -TestProj
> -lib
> -plugins
> -vendors
> -index.php
> -.htacces
> /public_html
> -/TestProj
> --css
> --js
> --img
> --files
> --index.php (Where you make modifications)
> --.htacces
> --test.php
>
> Then you would go to "www.example.com/TestProj/controller/index"
> And you should be good to go
> On Jan 29, 2:05 pm, ahmed fakher <spcial...@gmail.com> wrote:
>
>
>
>
>
>
>
> > At first I prefer to explaine important  things
> > First, this question very basiclly but I'm Newbie To Cake
> > Second,doesnt have a place with experts in the cake Except this place,
> > so I hope that you help me
> > Third, I've made ​​several attempts but failed
> > So pleaaaaase do not let me without any help ..
>
> > i read this link and i miss understanding the full stepshttp://book.cakephp.org/1.3/en/view/912/Installation
>
> > so please i need clear steps...
> > this image from ftp have two folders (public_html / myproject )http://www12.0zz0.com/2012/01/29/22/349925194.jpg

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

Re: how to confiure myproject with cakephp 1.3 on shaing host

Running on shared hosting, I upload my cake folder to just above
public_html.
Inside this cake folder you should have your app folder, and lib,
plugins, vendors, index.php, and .htaccess
My app folder I will name after my project, so for this instance we
shall call it TestProj
Then in public_html I will upload my webroot folder, I generally name
this the same as my app folder, so TestProj.
Then you just need to configure your index.php in your webroot to
point to cake.
Change these lines, you will have to adjust the number of dirnames()
depending on how far away the cake folder is from your webroot.
If you really don't know what you're doing then try 3 dirnames, then
2, then 4. I say this because if you have multiple domains on your
shared hosting then you will have multiple subdirectories, you can
count how many subdirectories there are and that is how many dirnames
you will need but trial and error also works.
if (!defined('ROOT')) {
define('ROOT', dirname(dirname(dirname(__FILE__))) . DS . 'cake');
}
/**
* The actual directory name for the "app".
*
*/
if (!defined('APP_DIR')) {
define('APP_DIR', 'TestProj');
}

/cake
-TestProj
-lib
-plugins
-vendors
-index.php
-.htacces
/public_html
-/TestProj
--css
--js
--img
--files
--index.php (Where you make modifications)
--.htacces
--test.php

Then you would go to "www.example.com/TestProj/controller/index"
And you should be good to go
On Jan 29, 2:05 pm, ahmed fakher <spcial...@gmail.com> wrote:
> At first I prefer to explaine important  things
> First, this question very basiclly but I'm Newbie To Cake
> Second,doesnt have a place with experts in the cake Except this place,
> so I hope that you help me
> Third, I've made ​​several attempts but failed
> So pleaaaaase do not let me without any help ..
>
> i read this link and i miss understanding the full stepshttp://book.cakephp.org/1.3/en/view/912/Installation
>
> so please i need clear steps...
> this image from ftp have two folders (public_html / myproject )http://www12.0zz0.com/2012/01/29/22/349925194.jpg

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

Re: HttpSocket won't use 443 port for https request automatically

could be
you can open a ticket at
cakephp.lighthouseapp.com/projects/42648/tickets/
if you feel like this should be addressed

but dont forget to mention the cake version you are using this time
(as you did here^^)


On 31 Jan., 04:38, Perry <perry...@gmail.com> wrote:
> when I pass a https url to HttpSocket::get, it won't use 443 port
> automatically, and return nothing
>
> but when i specify the port in url, likehttps://example.com:443/, it works
> fine
>
> is this a bug?
>
> --
> Perry | 彭琪http://pengqi.me

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

For raj, PPC Quality Score, Your Business on Facebook, 31-Jan-2012

Use the links at the bottom of this e-mail to change your address or unsubscribe.

Web Marketing Today, your trusted Internet marketing resource since 1995

 

http://www.wilsonweb.com

 

31-January-2012

ISSN 1094-8112

Circ. 88,892

In today's issue ...
  • PPC's Quality Score
  • Businesses on Facebook
  Dear raj,

Today, Melissa Mackey explains Quality Score, while Krista Neher explains what small businesses can do with a Facebook page.

God bless you,
Dr. Ralph F. Wilson

P.S. If you'd like to learn how to begin a Web business the intelligent way, look at the approach of SBI and Dr. Ken Evoy. Good stuff!


Melissa Mackey, Paid Search expert

PPC Basics: Part 7. Quality Score

This article in a series on PPC advertising features paid search expert Melissa Mackey, who explains what Quality Score is, why it dramatically affects the cost and placement of your ads, and steps you can take to improve low Quality Scores.

Read the Article.



Krista Neher, social media expert

How to Have a Small Business Presence on Facebook - with Krista Neher (5:32)

VideoIn this video interview, social media expert Krista Neher offers some tips for small business fan pages on Facebook, where businesses want to get in front of 800 million Facebook users. She sees Facebook as better at increasing loyalty of existing customers than gaining new customers.

Watch the video interview.


Article links

Annotated Links to Recent Articles on Internet Marketing for Jan 31, 2012

Article links

This week we see a number of articles on Google's new "Search Plus Your World," which promises to change search significantly as Google+ cranks up.

View annotated links to recent articles.

Dr. Ralph F. Wilson, Editor, Web Marketing Today®
P.O. Box 565, Loomis, California 95650, USA - 916 652-4659 - Contact Us
You may subscribe to this newsletter online.

Copyright © 2012, Ralph F. Wilson. All rights reserved. Please do NOT reprint or host on your website without explicit permission. Web Marketing Today and Doctor Ebiz are registered trademarks of Wilson Internet Services.

 


This message was sent to php.itmatchonline@gmail.com from:

Web Marketing Today | PO Box 565 | Loomis, CA 95650-0565

Manage Your Subscription  |  Send To a Friend

Switch languages links

I have the following routes:
Router::connect("/:lang", array('controller' => 'pages', 'slug' =>
'home'), array('lang' => '[a-z]{3}', 'pass' => array('slug')));
Router::connect("/:lang/:controller", array(), array('lang' => '[a-
z]{3}', 'pass' => array('slug')));
Router::connect("/:lang/:controller/:slug", array(), array('lang'
=> '[a-z]{3}', 'pass' => array('slug')));

Router::connect('/', array('controller' => 'pages', 'slug' =>
'home'), array('pass' => array('slug')));
Router::connect("/:controller/:slug", array('action' => 'index'),
array('pass' => array('slug')));

And I need to generate the language switch links, I try this

$languages = array('French' => 'fre', 'English' => 'eng');

foreach($languages as $lang => $alias){
if($alias == Configure::read('Config.language')) continue;
echo $this->Html->link($lang, array_merge($this->passedArgs,
array('lang' => $alias)));
}

but I get links with the action inside them and the lang goes as named
parameter (ex. `/posts/index/post1/lang:eng`) and it should be `/eng/
posts/post1`

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

Re: Cake 2.1 Events:

Sam, thanks for getting involved.

The text you have taken is form the example above the one I want to implement.  I want to use the one below as the one you have referenced also states:
"This may not be the cleanest way to do it ..."
"... This simple way of defining them using the Configure class is intended for didactic purposes only ..."

So it made sense to me to start out using 'Registering listeners' as the documentation states:
"Listeners are an alternative, and often cleaner way of registering callbacks for an event"

I think I am going to just carry on coding all my events into my controllers and models for now as I am getting behind on the project I am working on by trying to create en Events system.  And even if I did get this bit working I was still unsure of how I then have these actions accessing models, email components etc.  

I use CakePHP every day, but being self-taught I do not pick up the advanced stuff easily which is infuriating, every time I ask for help in the IRC it appears that I am expected to have a certain level of knowledge, which I don't, and people make a few suggestions then go quiet on me when I don't understand :(

Hmph.

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

Re: how to confiure myproject with cakephp 1.3 on shaing host

Sorry, wading into a discussion I obviously don't know everything about :P

Just never had to do that, running 20+ CakePHP sites and countless more demo sites on local WAMP setup and never strayed from the basic install which has always worked (although I do operate my own hosting company so have full control over my server).

If yours is not working on your shared host then I doubt moving the folders around will help, probably just makes things more confusing, just ensure URL Rewriting is working correctly.

Can you get assistance from your hosting company?


--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

Re: how to confiure myproject with cakephp 1.3 on shaing host

because i see this video and cookbook links
http://book.cakephp.org/1.3/en/view/915/Advanced-Installation
read this sentence (You can even move the webroot folder out of the
app folder as long as you tell Cake where you've put it. )
http://www.youtube.com/watch?v=4GobWo1rIkE


so if i am do the wrong way..please tell me the correct steps..thanks

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

Re: how to confiure myproject with cakephp 1.3 on shaing host

> third i move webroot folder from app to public_html 
Why on earth did you do that?

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

Re: cakephp error interrupts my jquery callback

On Jan 30, 10:59 pm, Tomfox Wiranata <tomfox.wiran...@gmail.com>
wrote:
> any idea how i eliminate any error output like this?

How about by identifying the cause and fixing your code?

AD

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

Monday, January 30, 2012

HttpSocket won't use 443 port for https request automatically

when I pass a https url to HttpSocket::get, it won't use 443 port automatically, and return nothing

but when i specify the port in url, like https://example.com:443/, it works fine

is this a bug?

--
Perry | 彭琪

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

Re: Help Understanding Fat Models

Great explaniation Jeremy! +1

I recently got my head around the principle too. I'd recomend it
included in the cookbook alongside MVC introduction to reinforce the
DRY concept. Essential learning for more complex systems.

On Jan 30, 9:52 pm, jeremyharris <funeralm...@gmail.com> wrote:
> The best advice is to keep things DRY (Don't Repeat Yourself). Generally,
> this results in thin controllers (small controller functions) and fat
> models (more methods on the models). Any functionality that you will find
> yourself reusing across different controllers that appropriately relate to
> a model should be on that model, instead.
>
> As an example (typical blog example).
>
> //posts_controller
> function edit($id) {
> // check if user is the creator of this post and is therefore allowed to
> edit
> $post = $this->Post->read(null, $id);
> if (empty($post) || $post['Post']['created_by'] != $this->Auth->user('id'))
> {
> //redirect
> return;
>
> }
> }
>
> function delete($id) {
> // check if user has rights to delete
> $post = $this->Post->read(null, $id);
> if (empty($post) || $post['Post']['created_by'] != $this->Auth->user('id'))
> {
> //redirect
> return;
>
> }
> }
>
> Your controller would be considered "fat" because you duplicated code and
> this is logic that belongs in the model. Instead, something like this looks
> better:
>
> // post model
> function userOwnsPost($userId, $postId) {
> return $this->hasAny(array(
> 'id' => $postId,
> 'created_by' => $userId
> ));
>
> }
>
> // posts controller
> function edit($id) {
> if (!$this->Post->userOwnsPost($this->Auth->user('id'), $id)) {
> //redirect
>
> }
> }
>
> function delete($id) {
> if (!$this->Post->userOwnsPost($this->Auth->user('id'), $id)) {
> //redirect
>
> }
> }
>
> Perhaps not the *best* example, but you get the idea. This code is also
> much easier to test. If you ever change the behavior of userOwnsPost, it
> will change across the app. It's also very specific, which makes writing
> tests really easy.
>
> If you find yourself writing long, complex find conditions and using them
> over and over again, they probably belong in model. Remember, many small
> functions are easier to test and predict the outcome than large functions.
>
> Another example might be finding a list of posts that belong to a tag. You
> would place this in your Post or Tag model, and might call it in
> /posts/index, /pages/home, /posts/view,
> /users/posts_in_tags_i_have_created, etc.
>
> For small apps, it may not be necessary to move these functions around!
> But, I'd say the more you have in models the better, even if only for
> testing's sake. It's easier to find out what went wrong when your methods
> are smaller and very specific. Controller methods are usually less specific
> than model methods.
>
> Hope that clears it up a bit.

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

Re: how to confiure myproject with cakephp 1.3 on shaing host

this link for you tube tutorial
http://www.youtube.com/watch?v=4GobWo1rIkE

On Jan 31, 4:28 am, ahmed fakher <spcial...@gmail.com> wrote:
> thanls chooch...i follow your steps and also i found this great
> tutorial ad my project works in this linkhttp://alashera.3owl.com/
> /// steps ///
> first i move all folders from myprojectfolder to public_html
> second i remove myprojectfolder
> third i move webroot folder from app to public_html and change path
> from index.php like youtube tutorial
> /// one problem ///
> but something wrong need to correct..when i clicked at any link to
> enter to classes it give me also this errorhttp://www2.0zz0.com/2012/01/30/20/161043849.jpg
> i guess this error because i remove projectfolder like tutorial....i
> will give you one example :
>
> before uploaded my project ..i used this links to enter to this
> classes in localhosthttp://localhost/tet/galleries/http://localhost/tet/articles/
>
> s\and after removed tet folder i use this links but get error ..
>
> http://alashera.3owl.com/gallerieshttp://alashera.3owl.com/articles
>
> so what i can do now...thanks

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

Re: how to confiure myproject with cakephp 1.3 on shaing host

thanls chooch...i follow your steps and also i found this great
tutorial ad my project works in this link
http://alashera.3owl.com/
/// steps ///
first i move all folders from myprojectfolder to public_html
second i remove myprojectfolder
third i move webroot folder from app to public_html and change path
from index.php like youtube tutorial
/// one problem ///
but something wrong need to correct..when i clicked at any link to
enter to classes it give me also this error
http://www2.0zz0.com/2012/01/30/20/161043849.jpg
i guess this error because i remove projectfolder like tutorial....i
will give you one example :

before uploaded my project ..i used this links to enter to this
classes in localhost
http://localhost/tet/galleries/
http://localhost/tet/articles/

s\and after removed tet folder i use this links but get error ..

http://alashera.3owl.com/galleries
http://alashera.3owl.com/articles

so what i can do now...thanks

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

Nick Baker's FileUpload Plugin + phpThumb Generator for existing files

Hi All,

I have Nick Baker's FileUpload working for an image gallery aloong
with a phpThumb generator and all works well except if there is an
existing file in the folder. The FileUpload plugin is renaming the
files correctly e.g. filename-1.jpg but I have something wrong in my
controller where I am calling the original name of the uploaded file
and not the newly generated name so the thumbnail is being created off
filename.jpg.

I have an add function in my GalleryphotosController that has this
line:

if(!$this->PhpThumb-
>generateThumbnail($_SERVER['DOCUMENT_ROOT'] . '/siteadmin/app/webroot/
files/galleryphotos/' . $this->data['Galleryphoto']['file']['name'],
$_SERVER['DOCUMENT_ROOT'] . '/siteadmin/app/webroot/files/
galleryphotos/thumbs/' . $this->data['Galleryphoto']['file']['name']))
{
pr($this->PhpThumb->errors);
}

I'm sure all I need to do is replace $this->data['Galleryphoto']
['file']['name'] with the filename that the plugin makes but I cannot
work out how. I'm sure it is simple but everything I have tried is
failing. I am using cakephp 2.0.5

Thanks

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

Re: Help Understanding Fat Models

Cool, glad it helped. There are other examples around the internet too.

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

Re: Help Understanding Fat Models

Thank you Jeremy. This is a great, concise description and the example code helps a lot to see the difference.

 {c}


On Mon, Jan 30, 2012 at 4:52 PM, jeremyharris <funeralmoss@gmail.com> wrote:
The best advice is to keep things DRY (Don't Repeat Yourself). Generally, this results in thin controllers (small controller functions) and fat models (more methods on the models). Any functionality that you will find yourself reusing across different controllers that appropriately relate to a model should be on that model, instead.

As an example (typical blog example).

//posts_controller
function edit($id) {
// check if user is the creator of this post and is therefore allowed to edit
$post = $this->Post->read(null, $id);
if (empty($post) || $post['Post']['created_by'] != $this->Auth->user('id')) {
//redirect
return;
}
}

function delete($id) {
// check if user has rights to delete
$post = $this->Post->read(null, $id);
if (empty($post) || $post['Post']['created_by'] != $this->Auth->user('id')) {
//redirect
return;
}
}

Your controller would be considered "fat" because you duplicated code and this is logic that belongs in the model. Instead, something like this looks better:

// post model
function userOwnsPost($userId, $postId) {
return $this->hasAny(array(
'id' => $postId,
'created_by' => $userId
));
}

// posts controller
function edit($id) {
if (!$this->Post->userOwnsPost($this->Auth->user('id'), $id)) {
//redirect
}
}

function delete($id) {
if (!$this->Post->userOwnsPost($this->Auth->user('id'), $id)) {
//redirect
}
}

Perhaps not the *best* example, but you get the idea. This code is also much easier to test. If you ever change the behavior of userOwnsPost, it will change across the app. It's also very specific, which makes writing tests really easy.

If you find yourself writing long, complex find conditions and using them over and over again, they probably belong in model. Remember, many small functions are easier to test and predict the outcome than large functions.

Another example might be finding a list of posts that belong to a tag. You would place this in your Post or Tag model, and might call it in /posts/index, /pages/home, /posts/view, /users/posts_in_tags_i_have_created, etc.

For small apps, it may not be necessary to move these functions around! But, I'd say the more you have in models the better, even if only for testing's sake. It's easier to find out what went wrong when your methods are smaller and very specific. Controller methods are usually less specific than model methods.

Hope that clears it up a bit.

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

Re: how to confiure myproject with cakephp 1.3 on shaing host

I'm pretty sure that is an .htaccess file issue. See the Cake Documentation at this link:

Specifically, the last paragraph related to shared hosts.


 {c}

On Mon, Jan 30, 2012 at 3:38 PM, ahmed fakher <spcialist@gmail.com> wrote:
i move files into public_html like this image
http://www10.0zz0.com/2012/01/30/20/968254408.jpg
when request site url (http://alashera.3owl.com/) i see this error
http://www2.0zz0.com/2012/01/30/20/161043849.jpg

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

Re: Cake 2.1 Events:



Listeners configured somewhere else, maybe a config file
a comment from code block on cake event doc page

I was thinking that the events are set much like custom error handling
http://book.cakephp.org/2.0/en/development/errors.html

 - S




On 30 January 2012 20:32, phpMagpie <paul@webbedit.co.uk> wrote:
Book:  http://book.cakephp.org/2.0/en/core-libraries/events.html 

Trying to get to grips with one of the new features of CakePHP 2.1.  Have read the above page in the book and want to implement the code shown in the 'Registering Listeners' section but no indication given as to where the following code goes:

App::uses('CakeEventListener', 'Event'); class UserStatistic implements CakeEventListener {      public function implementedEvents() {         return array(             'Model.Order.afterPlace' => 'updateBuyStatistic',         );     }      public function updateBuyStatistic($event) {         // Code to update statistics     } }
What I need to know is
  • What the file should be named
  • What folder it should reside in
  • How I include it in the app
I assume the following goes in the Order controller, but not confident:
  // Attach the UserStatistic object to the Order's event manager $statistics = new UserStatistic; $this->Order->getEventManager($statistics);
If anyone can make sense of it and give me some pointers I would much appreciate it.  

Here's someone asking the same question on CakePHP Questions:
http://ask.cakephp.org/questions/view/cakephp_2_1_global_events_system  

Paul.

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

Re: cakephp error interrupts my jquery callback

any idea how i eliminate any error output like this?

thx

On Jan 30, 10:51 pm, phpMagpie <p...@webbedit.co.uk> wrote:
> You need to get rid of all the cake errors on a failed save so it only
> returns  {"successful":false}
>
> Looks like you have some sort of model/dbo error related to Not-Null-Constraint
> ... resolve that and all the controller should return true or false and
> your view can handle the response accordingly.

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

Re: Help Understanding Fat Models

The best advice is to keep things DRY (Don't Repeat Yourself). Generally, this results in thin controllers (small controller functions) and fat models (more methods on the models). Any functionality that you will find yourself reusing across different controllers that appropriately relate to a model should be on that model, instead.

As an example (typical blog example).

//posts_controller
function edit($id) {
// check if user is the creator of this post and is therefore allowed to edit
$post = $this->Post->read(null, $id);
if (empty($post) || $post['Post']['created_by'] != $this->Auth->user('id')) {
//redirect
return;
}
}

function delete($id) {
// check if user has rights to delete
$post = $this->Post->read(null, $id);
if (empty($post) || $post['Post']['created_by'] != $this->Auth->user('id')) {
//redirect
return;
}
}

Your controller would be considered "fat" because you duplicated code and this is logic that belongs in the model. Instead, something like this looks better:

// post model
function userOwnsPost($userId, $postId) {
return $this->hasAny(array(
'id' => $postId,
'created_by' => $userId
));
}

// posts controller
function edit($id) {
if (!$this->Post->userOwnsPost($this->Auth->user('id'), $id)) {
//redirect
}
}

function delete($id) {
if (!$this->Post->userOwnsPost($this->Auth->user('id'), $id)) {
//redirect
}
}

Perhaps not the *best* example, but you get the idea. This code is also much easier to test. If you ever change the behavior of userOwnsPost, it will change across the app. It's also very specific, which makes writing tests really easy.

If you find yourself writing long, complex find conditions and using them over and over again, they probably belong in model. Remember, many small functions are easier to test and predict the outcome than large functions.

Another example might be finding a list of posts that belong to a tag. You would place this in your Post or Tag model, and might call it in /posts/index, /pages/home, /posts/view, /users/posts_in_tags_i_have_created, etc.

For small apps, it may not be necessary to move these functions around! But, I'd say the more you have in models the better, even if only for testing's sake. It's easier to find out what went wrong when your methods are smaller and very specific. Controller methods are usually less specific than model methods.

Hope that clears it up a bit.

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

Re: cakephp error interrupts my jquery callback

You need to get rid of all the cake errors on a failed save so it only returns  {"successful":false}

Looks like you have some sort of model/dbo error related to Not-Null-Constraint ... resolve that and all the controller should return true or false and your view can handle the response accordingly.

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

Re: authentication with 2 tables

Thank you for your answers !

I will try your solutions.

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

Re: cakephp error interrupts my jquery callback

hi,
thanks. i know why. i made it. i forced that error to occur to
simulate a failed saving to see if the user gets a proper feedback,
which he does not. so i was right. question is:

how can I handle this error throwing that my data will get returned
correctly????


big big thx :)

On 30 Jan., 21:58, phpMagpie <p...@webbedit.co.uk> wrote:
> If the controller method throws an error it will stop the data being
> returned correctly and will stop your ajax call from functioning as
> expacted.
>
> You need to figure out why Cake is spitting out "uncaught exception:
> Invalid JSON"
>
> With my jQuery AJAX stuff I return values using:
>
>     $response = json_encode($results);
>     echo $response;
>
> Not sure if this make's any difference.

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

Re: cakephp error interrupts my jquery callback

If the controller method throws an error it will stop the data being returned correctly and will stop your ajax call from functioning as expacted.

You need to figure out why Cake is spitting out "uncaught exception: Invalid JSON"

With my jQuery AJAX stuff I return values using:

    $response = json_encode($results);  
    echo $response;

Not sure if this make's any difference.

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

cakephp error interrupts my jquery callback

hi,

i coded a saving procedure. if the saving works the user gets
redirected to a different page. if it fails he is supposed to get an
ajax-like message with jquery. now when the saving really works out,
everything goes fine. BUT:

I created a scenario to simulate a failed saving (a passed a NULL to a
database field when it is not allowed). and somehow it seems, that the
cake thrown error message is blocking my jquery. here it is.

my JS function:
--------------------------------------
function save(id)
{

$.post(installFolder + 'users/save', {

}, function(result){

var result = jQuery.parseJSON(result);

if(result.successful == false)
$.pnotify({ pnotify_title: 'Error.'});
else
window.location.href = installFolder + '/users/view/'+id;


});

}


to check if the jquery pnotify works I I set "if(result.successful ==
TRUE)" and it pops up. so jquery works here.

my controller: save()
---------------------------------
some code here....
.........................
.........................

$saving = $this->User->save($this->data);
if(!$saving)
{
$result = array("successful" => false);
}
else
{
$result = array("successful" =>
true);
$this-
>Session->setFlash('Saving successful');
}


$this->renderJSON($result);

when debugging cakes error with firebug a huge load of text appears
saying stuff like...
"uncaught exception: Invalid JSON: <pre class="cake-debug">"....
AND
"verletzt Not-Null-Constraint......." AND most importantly
" {"successful":false} "


but somehow this callback wont get to my JS-function....just nothing
happens...


hope someone can help me :) thanks a lot

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

Re: how to confiure myproject with cakephp 1.3 on shaing host

i move files into public_html like this image
http://www10.0zz0.com/2012/01/30/20/968254408.jpg
when request site url (http://alashera.3owl.com/) i see this error
http://www2.0zz0.com/2012/01/30/20/161043849.jpg

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

Cake 2.1 Events:

Book:  http://book.cakephp.org/2.0/en/core-libraries/events.html 

Trying to get to grips with one of the new features of CakePHP 2.1.  Have read the above page in the book and want to implement the code shown in the 'Registering Listeners' section but no indication given as to where the following code goes:

App::uses('CakeEventListener', 'Event'); class UserStatistic implements CakeEventListener {      public function implementedEvents() {         return array(             'Model.Order.afterPlace' => 'updateBuyStatistic',         );     }      public function updateBuyStatistic($event) {         // Code to update statistics     } }
What I need to know is
  • What the file should be named
  • What folder it should reside in
  • How I include it in the app
I assume the following goes in the Order controller, but not confident:
// Attach the UserStatistic object to the Order's event manager $statistics = new UserStatistic; $this->Order->getEventManager($statistics);
If anyone can make sense of it and give me some pointers I would much appreciate it.  

Here's someone asking the same question on CakePHP Questions:
http://ask.cakephp.org/questions/view/cakephp_2_1_global_events_system  

Paul.

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

Re: how to confiure myproject with cakephp 1.3 on shaing host

Your project files should be in the root of public_html. So move everything out of the "tet" folder down one level, then delete it.

public_html should look like this:
public_html/
    app
    lib
    plugins
    vendors
    index.php

Also, check with your webhost that the .htaccess files will be processed. If not, consult the documentation site as there are some workarounds.

You may need to "show hidden files" in your ftp client to see the .htaccess files - so make sure they are visible and got uploaded to the host. The .htaccess files are located in the root folder as well as "app" and "app/webroot".

 {c}


On Mon, Jan 30, 2012 at 2:55 PM, ahmed fakher <spcialist@gmail.com> wrote:
ok i uploaded it into public_html , project name is (tet)
now i see this page
http://www12.0zz0.com/2012/01/30/19/838270121.jpg
when click on my project (tet) i see this page
http://www6.0zz0.com/thumbs/2012/01/30/19/650556076.jpg
so what i can do to see my project pleaaaaase

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

Re: how to confiure myproject with cakephp 1.3 on shaing host

ok i uploaded it into public_html , project name is (tet)
now i see this page
http://www12.0zz0.com/2012/01/30/19/838270121.jpg
when click on my project (tet) i see this page
http://www6.0zz0.com/thumbs/2012/01/30/19/650556076.jpg
so what i can do to see my project pleaaaaase

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

Help Understanding Fat Models

I see the oft-repeated phrase "Keep your controllers thin and models fat", but I'm having a problem wrapping my head around it. Most of the tutorials and examples I see have just about all of the code in the controllers, and the models have little more than associations.

So.. what exactly does a fat model look like? How do I know what to pull out of my controllers to move into models - everything seems to be working great the way it is. Do methods/actions/functions look and work the same in a model as they do in a controller?


Any advice, pointers, links are much appreciated!

  {c}

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

Re: Content Type in cakephp 2.0

echo in controller? hmm you might want to try this:

$this->response->type('json');
$this->response->body(json_encode($var));
return $this->response;

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

Re: $persistModel is removed in Cake 2.0?

$persistModels does not exist anymore, the table structure is cached either in files or in APC cache if available (the faster APC cache is used if detected)

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

Re: multiple depending selectfields with ajax?

You should probably just use the Js::submit() method instead, to actually submit the form and replace the div.

// assuming this is the customer_contacts/get view
echo $this->Form->create();
echo $this->Form->input('customer_id', array('id' => 'customer'));
echo $this->Form->input('customer_contact_id', array('id' => 'customercontact'));
 
echo $this->Js->submit('Submit form', array('update'=> '#customercontact'));
echo $this->Form->end();

Then when the user submits the form, it will actually POST to /customer_contacts/get and the resulting view will replace the #customercontact element.

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

Re: how to confiure myproject with cakephp 1.3 on shaing host

You would place it in public_html, since you want people to be able to visit the site. After doing that, you should be able to browse your domain and at least see something (hopefully the site home page with a list of things that may or may not need to be fixed).

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

Re: CakePHP Media Plugin of David Persson and CDN

Add a behavior that has an afterSave and afterDelete that take care of it (or attach those actions to your model).

Here's a helper function to get a list of files based on your filters set (hardcoded for images, but you can adapt it to use whatever "types" you want). Once you have that list of files, you can move them to your CDN or remove them if they were deleted.

function _getFiles(&$model, $id = null) {
if (!$id) {
return array();
}

$result = $model->read(null, $id);

// get all including filtered
$files = array();
$files[] = array(
'path' => $result[$model->alias]['file'],
'url' => MEDIA_TRANSFER_URL . $result[$model->alias]['dirname'] . '/' . $result[$model->alias]['basename']
);
$extension = Mime_Type::guessExtension($files[0]['path']);
$filters = Configure::read('Media.filter.image');
foreach ($filters as $size => $filter) {
if (isset($filter['convert'])) {
$newextension = Mime_Type::guessExtension($filter['convert']);
} else {
$newextension = $extension;
}
$newbasename = str_replace($extension, $newextension, $result[$model->alias]['basename']);
$path = MEDIA_FILTER . $size . DS . $result[$model->alias]['dirname'] . DS . $newbasename;
$url = MEDIA_FILTER_URL . $size . '/' . $result[$model->alias]['dirname'] . '/'. $newbasename;
$files[] = compact('path', 'url');
}

return $files;
}

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php