CakePHP cake back console -app not doing what I expect - cakephp

So so so sorry if this is mentioned somewhere but I've tried searching high and low and can't find it anywhere. :(
Firstly, I'm a right newbie to cake. I purchased a book, beginning cakephp, apress, David Golding, which in here it makes use of the cake bake (really wish it didnt as it really isnt making sense!). I couldn't get this set up with cygwin but have it installed with the windows console.
In the book it tells me to enter:
cake bake -app ~/Sites/blog/app
and next the screen which it shows is the what would like to bake. Views, controllers etc etc.
However I have no idea what the Sites is as its the first time its mentioned this!!
So i'm trying:
cake bake -app ~C:/wamp/www/blog/app
and I'm getting the next screen as:
what is the path to the project you would like to bake?
Please please please help, where am I going wrong why aren't I seeing the what would like to bake. Views, controllers etc etc screen?? I'm really stuck now on this as the next chapter needs the bits the console creates.
I'm using wamp and the latest cakephp.
my cake folder is ~C:/wamp/www/blog/ (blog is the cake renamed).
my console environment setting is set up as: ;C:\wamp\bin\php\php5.3.10;C:\wamp\www\blog\app\Console
I really appreciate anyones/everyones help. I'm probably being a right spanner but can't get my head round understanding what I should enter.
Many Thanks in advance,
Alan

you should always navigate to your app dir and execute cake from there (relatively):
/path/to/test/>../lib/Cake/Console/cake
or - if you have a Config folder - probably also with (although I never used that one before)
/path/to/test/>Console/cake
that's how it works in 2.x. foolproof.
#see http://cakephp.lighthouseapp.com/projects/42648/tickets/2761
also see http://www.dereuromark.de/2011/10/31/freshly-baked-cake2-0-tips/

Related

Preparing to go live with website - what to do or not?

I have finally my project ready to go live, is there a check list of things to go through before uploading the files to the webserver?
Are there any Files or Folders to be deleted before going live.
Version of cake: 2.3.8
I found out to set the debug level to 0.
Set the cookie in core.php
Do I need to remove the following folders?
/app/Console
/lib/Cake/Test
/lib/Cake/TestSuite
Any other security advise please?
Thanks a lot.
Don't deploy anything to production that isn't needed. If your project doesn't require those folders to function, then don't deploy them.
Make sure to check out the short deployment guide from the cake docs.
Also here's a more general website launch checklist.
I recommend making sure your deployment process resets caches appropriately. This can differ depending on how you have things set up, but by default CakePHP uses a file cache. Regardless, it can really hose you to let the cache linger when things should be updated like model schema, etc. For example, see my answer to another StackOverflow question.

CakePHP and Dynamically-Related Files in Dreamweaver

It took me forever to figure out how to customize my Dreamweaver setup so that it would recognize the .ctp file extension (if you're trying to figure it out, there's a second Extensions.txt file under /Users/yourname/Library/ ...)
Now I'm trying to set up Dynamically-Related files on Dreamweaver with CakePHP, and it won't work. I'm assuming that this is because Cake is using those weird .htaccess files to prevent Dreamweaver from seeing the same directory that it is expecting.
Has anyone done this / can anyone help? All of the other q's have been left unanswered!
Thanks
"Not seeing"? I guess you're talking about mod rewrite. Also .htaccess files are nothing weird but something pretty normal in the web. Also see the CakePHP book page about mod rewrite and .htaccess. So either disable it or configure it properly.
I have no clue how dreamweaver is effected by this anyways. Does it come with a webserver?
However the best advice I can give you is simply to throw Dreamweaver away. Even after it became somewhat capable of doing non table based layouts it is still a lot faster to write the HTML/CSS manually or even faster with an editor that simply provides code/tag completion instead of this crutch Dreamweaver.
A sersious php + html/css editor is in my opinion phpstorm, if you want something free... uhm... Try Aptana or Eclipse PDT or pspad.

Paypal Integration in Cakephp

i really can't seem to make it.. im frustrated learning this for almost three days now however im still trying. What i actualy wanna happen is this:
Customer fills up order form
After filling up, he will click the "Buy now" button at the bottom of my page.
I would like to extract the data the user have entered from the order form and save it to may database.
Dunno if it has something to do with the IPN or PDT stuff. The point is im cant move forward for three days now. I wanna know how this starts of perhap ah pseudocode of what i can actually do with this?
I mean where can i possibly start. Okay i downloaded the plugin and extracted it in /app/Plugin/, and then? I have read the manual and tried various tutorials but it's not getting me anywhere. Im totally a beginner. Please help.
this is an update with im doing.
i got this error:
Error: PaypalIpn.PaypalHelper could not be found.
Error: Create the class PaypalHelper below in file: C:\xampp\htdocs\wifidrivescanportal\app\Plugin\paypal_ipn\View\Helper\PaypalHelper.php
<?php
class PaypalHelper extends AppHelper {
}
Since you said this is cake 2.x, make sure that your plugin is loaded:
http://book.cakephp.org/2.0/en/plugins.html#installing-a-plugin
Since cake 2.0, plugins need this to work. Also, make sure that the plugin you're using is made for Cake 2.x versions, not an earlier one, because they are not compatible.
This is because you did'nt configure your global bootstrap. Add the following line to your cakephp/app/Config/bootstrap.php and it should work!
CakePlugin::load('PaypalIpn', array('bootstrap' => array('paypal_ipn_config'), 'routes' => true));
you didnt mention your cake version - which you ALWAYS should.
but I assume it is 2.x
so why aren't you naming your plugin after the convention?
paypal_ipn should be PaypalIpn

Missing Controller Error in Cakephp 2.0.4

Apologies if I ask a silly question, I am quite new to CakePhp
I have installed Cakephp 2.0.4 on dev.ayumma.com (Used Git Clone on, Amazon ec2 machine, amazon linux, with mysql php5, etc.)
I have configured apache with mod_rewrite loaded (you can verify here). I am using the cake 2.0 documentation for a development installation.
My paths are absolute you can see that here as I print them on the page.
I am copying code from the cakephp 2.0 documentation.
Code is in the correct folders, case is correct on file names, and I even copied and renamed files according to error message, just in case. Database was created from the code on the tutorial. The routes.php file has required CAKE . 'Config' . DS . 'routes.php';.
I have ruled out file location. Files are in the correct folders
I have ruled out mod_rewrite. Seems to be loaded, not sure how else to test.
I have ruled out absolute paths. The paths show up correctly.
I have ruled out the routes.php file. Last line is correct.
What am I missing? Any help would be appreciated. I am sure its probably something simple, but at this moment it is out of my grasp.
Offending page is here.
The erorr message means that you have not created the required controller for the posts table.
Make sure you have created Controller, Model and Views for posts table. controller file should be named as PostsController.php, model file as Post.php and View files are named as index.ctp, view.ctp etc .

Receiving / retrieving email in CakePHP

I am developing a basic yet highly customized CRM for a small training centre which has the ability to store student records and also send emails to them. I'm using SwiftMailer following this excellent tutorial in CakePHP to accomplish the sending part.
Of course, students are sometimes going to reply to emails and I'd like to retrieve them within my CRM and store them along with the student record.
However, I cannot find a single reference to doing this. I've tried the following Google searches: "receiving email cakephp" , "retrieving email cakephp" and even "email client cakephp" but all of these queries give results relating to sending mail rather than receiving it -- very frustrating!
Finally, I broadened my search to non-cake solutions and found someone recommending a library called ezComponents. It doesn't seem to have had any active development for about a year, but it includes an email receiving class which is exactly what I want. Unfortunately, I have no idea how to add this to CakePHP and the only post I've been able to find on the entire web on the matter doesn't exactly go into much detail. It's certainly not a step-by-step tutorial on using ezComponents on CakePHP like the SwiftMailer tutorial I mentioned above.
I also found a class on Google Code called php-imap which looks like it would do the job but, again, I haven't the slightest clue how to get it working happily in Cake like SwiftMailer is.
I realize that I may have to learn how to package classes for use in Cake by myself but I'm asking this question first on the off-chance that there is already a Cake-friendly solution to this problem that I just haven't realized :-)
Joseph
Thanks to everyone for your answers, but I've been doing some more searching and it looks like the solution is actually incredibly simple.
Basically, with the help of a plugin, I can set up the mail server in databases.php as a datasource and then write a Model and Controller to interact with it.
Here's the example I found: https://github.com/kvz/cakephp-emails-plugin
Edit: the repo has been deprecated and is now available at https://github.com/kvz/deprecated/tree/cakephp-emails-plugin
You will want to pipe your email to PHP and use stdin:// to read the contents of the email and add the e-mail to your database.
I've done this with cake and the simplest way is to make a Cake console application to handle the parsing. Also using cpanel's account level filtering to generate the pipe is really simple.
http://forums.cpanel.net/f5/piping-mail-php-scripts-howto-checklist-50985.html
http://www.evolt.org/incoming_mail_and_php
Sounds like you want to include SwiftMailer as a Cake plugin, amirite?
http://book.cakephp.org/view/1111/Plugins
-- if you want to package it yourself. Otherwise, a cursory search of the Bakery yielded this result:
http://bakery.cakephp.org/articles/sky_l3ppard/2009/11/07/updated-swiftmailer-4-xx-component-with-attachments-and-plugins
Hopefully it will at least get you pointed in the right direction. HTH. :)

Resources