cakephp

HABTM with additional columns for recipe ingredients

For my recipe-sharing website, I want to create a database and CakePHP models for the recipes and their ingredients. I created two tables: recipes and ingredients. The third table is a HABTM table for ingredients_recipes, which also stores the amount of ingredients needed for the recipes. How do I create a model for the third table? Th...

MVC and Classic OO Paradigm. How to?

Hi, I'm a little bit confused about MVC and OO paradigms. I have read some documentation about classical OO in the book "The Object-Oriented Thought Process". Now I need to apply what I have learn in this book in the context of MVC pattern. How can I design from scratch using the OO paradigm and implement it in a MVC Framework like C...

JQuery UI Click call works on local machine but not when published to server - also using CakePHP

I have some javascript that looks like this: $('.resultitem').click(function(event){ alert('check this gets called'); location.href='viewinfo/'+$(this).attr('rel'); }); this code works fine on my local machine but after uploading to the server it doesn't seem to get called at all. Can anybody help me un...

Www and non www sites

I have a domain say http://www.testexample.com. When I login to http://www.testexample.com and come back to http://testexample.com in browser; the logged in user information is not displayed. I know that the both of the above are treated differently and hence it is not retaining the session for http://www.testexample.com while accessing ...

Missing argument in controller

I'm getting this warning below for one of my controllers, but its not just about warning, it actually doesn't do the work because of this missing argument. I checked the controller file and I see that I'm already sending 3 arguments. In the object.php file of cakephp, on line 127, I see the following: return $this->{$method}($params[0]...

Destroy CakePHP session when close browser.

I need to keep Security.level set on medium for Ajax reason. But I want that If the user close browser his session will destroy. How can I do that? Thanks in advance! ...

problem paginating habtm relations

hi, got this situation. Reports habtm users. So im trying to paginate just the Reports that are linked to the Auth user... I read when you have a habtm relationship you have to bind the model temporarily using 'hasOne' like this: funtion index(){ $conditions=array('ReportsUser.user_id'=>$this->Auth->User('id'), 'ReportsUser.report_id'=...

Accessing a database from CakePHP when behind a proxy server

I'm working on a web application that's using CakePHP and MySQL. Depending on the circumstances, I may be using one of two computers and I may be behind a proxy server that won't allow me to directly modify any code on my web server. Because of this, I've installed XAMPP on my machines to act as a local web server, and I keep my code i...

Pre-configured CakePHP with common things like authentication

Has anyone come across a CakePHP system with pre-configured things like authentication with all the login/logout forms, etc? Most websites have some sort of a basic authentication system on top of which everything is built. I was hoping to not go about re-inventing the wheel setting up the most common pages like login, logout, forgot-pas...

How to echo a formatted date in PHP from an array

I have a datetime column in MySQL let's call it $time. It's coming form a CakePHP form. If I try to echo it I get I just get "Array". If I print_r() on it I get: Array ( [month] => 10 [day] => 30 [year] => 2010 [hour] => 16 [min] => 30 ) I want to echo this out as a formatted date, nothing seems to work because it's not a string bu...

Cakephp Complex Relation Find

I have a little complex Database model on which i am not able to make a proper find user(id, name...) 1 Harsha 2 Jasmine modules (id, name ) 1 Users 2 Restaurants 3 Dishes restaurant (id, name.... ) 1 KFC 2 Pizza Hut dishes (id, name, restaurant_id .. ) 1 Cheese Pizza 2 items (id, module_id, item_id) 1 1 1 (refers to U...

hasMany reduced to hasOne in CakePHP

hi, basically i have following models in CakePHP: User(id, username) Photo(id, user_id, path) i have set up following relation: User hasMany Photo. now, on one screen, i would like to list users, and show random photo next to each user. i tried setting up following relation: User hasOne SamplePhoto (where SamplePhoto is just Photo mo...

transfer function in cakephp see my explanation please

please help me with my simple cakephp application. i have a products_warehouses table: -- -- Table structure for table `products_warehouses` -- CREATE TABLE IF NOT EXISTS `products_warehouses` ( `id` int(5) NOT NULL auto_increment, `product_id` int(5) NOT NULL, `buyprice` decimal(8,2) NOT NULL, `sellprice` decimal(8,2) NOT NU...

CakePHP: how to use a model in the app_controller

Hi, Iv got a method in a model that I want to be executed everytime a page is requested so I think I need to call it from the app_controller but can't seem to get it to work. The model i want to use is called Blacklist and it has a method in it called check_blacklist() which is what I want to run every time a page is requested. Does anyo...

Bring PHPdoc to include CakePHP .ctp files

Hello. I'm documenting my CakePHP app using PHPdocumentor. As you might know, after CakePHP convention, the views are contained in .ctp files (e.g. app/views/addresses/index.ctp), which are basically normal PHP files just with a changed file extension. PHPdocumentor only recognizes .php files, and I cannot find an option in the config fi...

Portable View Engine Options (PHP / ASP.NET)

With MVC possible in both ASP.NET MVC and PHP (CodeIgniter, CakePHP etc) what are the options when it comes to using a view engine that could work with both platforms, enabling copy/paste without any changes? Ones I can think of are: NHaml / PHPHaml (not updated for 3 years though) / PHamlP I am assuming this works with CodeIgniter or...

How to extract the email id from textarea field.

Hi, I am using cakephp. And I have textarea field where users paste data, I using tinymce plugin to format text. I have warned users not to enter telephone number or email address inside the textarea. But, I dont want to take chances. Is there a way I can extract the telephone number and email from textarea and replace it something li...

Having actions/pages without requiring a login

Hello, I am building an application using cakePHP. Do we have a method where we can allow public users access to certain pages without logging in. There would be a few pages such as about us regarding the whole organisation or a contact us page. Is there a method to avoid login access, something similar to how we have ways to add compone...

how should I render views when users habtm roles. cake

ok here is my issue... user habtm groups(roles) i have views for admins, boardmembers, managers, and vps. so when an user have just one role the app reads the role and we're going fine... BUT when he/she/it have two or more roles it just take the first one and dissmiss the others... the questions how should i manage those role so...

manage users views with different roles cakephp

Possible Duplicate: how should I render views when users habtm roles. cake hi i got users habtm roles the thing is when i login i dont know how to separate or mix the views for users that have more than one role... any help? how would you manage this issue? by letting the user select which role he wants to play? or mixing ...