cakephp bake console acting weird? - cakephp

I'm pretty new to CakePHP and i'm running through both the Cake Book and the Apress Book CakePHP from novice to professional, but i can't seem to understand what's going on on my bake console.
I've got it installed and seems to work fine. But when i type in cake bake it shows me this
Welcome to CakePHP v2.0.0 Console
--------------------------------------------------------------------
App: htdocs
Path: W:\xampp\htdocs\
--------------------------------------------------------------------
What is the path to the project you want to bake?
[W:\xampp\htdocs\myapp] >
instead of what the books say it should be
---------------------------------------------------------------
App : app
Path: /path-to/project/app
---------------------------------------------------------------
Interactive Bake Shell
---------------------------------------------------------------
[D]atabase Configuration
[M]odel
[V]iew
[C]ontroller
[P]roject
[F]ixture
[T]est case
[Q]uit
What would you like to Bake? (D/M/V/C/P/F/T/Q)
>
if i follow the questions on my cake console, it asks me the path to the directory layout i wish to copy, and then seems to override everything i have with that skel one.
on the other hand, if i follow the book's steps and type cake bake view or cake bake model it seems to understand that i'm talking about projects named view and model and tell me there's no database configuration for those projects, etc. So, if i type the project path first, i don't get to choose what to do. But if i leave it out, it has no way of knowing. See where this is going?
I'm using the regular Windows cmd.exe, not cygwin as i've seen some people recommending, and can provide more detail if needed. There's probably an easy solution for this, so I appreciate your help!

you are in the wrong path.
If you want to bake internal stuff (models, controllers, views, ...) etc
you need to navigate to the app folder and execute cake there
(or define your app path with -app)
details and hot tip for windows:
http://www.dereuromark.de/tag/cake-console-windows/

Related

Localhost points to different address

I have an app developed with CakePHP and it is working just fine on my local machine. Now, I wanted to develop another app with CakePHP. I installed cake in a different folder, configured vhost and server block and did everything like for the first app. I created an empty app, just basic controller and view and when I type the address for the second app I get the first app!!! Weird thing is that all links are working and when I click I get in browser url like secondapp/companies but the content is firstapp/companies. Once more, the second app is empty, no controllers, views and models, just a basic one. Then I did all that in htdocs, and the same problem occurs (none of the apps wasn't in htdocs, but in folders on E partition).
Can someone please give me some help before I kill myself?
Thank you...
If the problem is not on the database configuration, maybe cache problems ? Try it on a private browser/incognito ?

Alaxos Acl plugin internationalization issue

Im using alaxos Acl plugin for managing user roles and groups in my cakephp 2.6 project,the plugin use english as the default language, the problem i want to change it to the french language in my cakephp project, but i don't know how.
i added
Configure::write('Config.language', 'fre'); to the bootstrap.php of the plugin or the bootstrap.php of my main application but it didn't work.
Thanks in advance
You just made me realize that I always see my own plugin in English as well...
The point is that at some point (Internationalizing Your Application) the french code has changed from fre to fra but I've never updated the plugin.
Rename the folder plugins/Acl/Locale/fre to plugins/Acl/Locale/fra, and use Configure::write('Config.language', 'fr') and it should work.

CakePHP bake stacked by database Config:

It's the first time I made a bake through the CakePHP console.
I run the cmd as admin and there is a strange thing that after setting
the database config: (default/test) it is stucked there and I don't know
why.
The environment path is setting up correctly.

Deploying AngularJS Seed application in WebStorm

I recently started to learn about AngularJS and came across WebStorm and the AngularJS plugin by John Lindquist. Started by creating a new project using the angular-seed project and imported to WebStorm using File -> Open Directory. My directory structure looks like this
Now when I try to Debug it I get a 404 error. If I move the file app/index.html to the root folder and adjust all URL's to begin with app then it works fine. Is there a way to keep the default folder structure without moving the index.html to the root folder and also make it work with WebStorm?
I am using WebStorm 6.0.2.
I use WebStorm 7, so there might be some discrepancy in comparison with version 6 that you're using, but the over-all functionality is the same.
Quick solution:
Open the file in the editor and right click in the code to access the context menu. Choose the "Debug" option, which should start a debug session pointing to the current page.
Configuration solution:
WebStorm supports configurations for setting up different debugging scenarios. From the "Run" menu, choose the "Configurations" option. Add a JavaScript debug configuration, and add the URL you want in the designated field within the dialog presented.
Then, when you initialize a debugging session (a general one, not one for a specific page), you're presented a small dialog that allows you to choose a debug configuration.
Maybe there are more options or ways to accomplish the same thing as well, but I've never really given it more thought. I hope this is a working solution for you, but if not there's alway the documentation. If you need further clarification with regard to my answer, just give me a comment.

CakePHP: best way to remove a field from the admin scaffold

When I admin-scaffold the Users model, everything works great. However, it also has the "password" field. Which is a hash of the actual password.
When you save a user in the admin console, it saves the hashed password, which screws everything up.
What's the simplest way to exclude a field from the admin-scaffold with minimal interference to the awesome auto-magic of the admin-scaffold?
Thanks
You will want to make your own bake theme, so you can then edit the template to remove the file.
It really is as simple as this, http://book.cakephp.org/2.0/en/console-and-shells/code-generation-with-bake.html#modify-default-html-produced-by-baked-templates
Just copy the files from inside lib/Cake/Console/Templates/default/views into your project under app/Console/Templates/[themename]/views and then you can edit the view templates.
The same applies to all the other files too, such as controllers and models. Then when you bake your project you'll be asked which theme you want to use and you can select your own.
Here is an example from one of my projects.
The only real thing to note is that your theme names must be unique!

Resources