Search Results

Search found 772 results on 31 pages for 'cakephp appmodel'.

Page 9/31 | < Previous Page | 5 6 7 8 9 10 11 12 13 14 15 16  | Next Page >

  • CakePHP dynamic element

    - by Logic Artist
    I am trying to create a message-board type element in a CakePHP app. This element will be displayed on all pages and views that use a particular layout. I want it to display all the messages in the model, then show the add form when a link is clicked, then return to the updated message list when submitted. All this without affecting the current view/page. I have my message model/controller/index set up, with a message board element that requests the index action. This works fine. However I am perplexed about how to return back to the original page/action from which the link was clicked. I can't use $this-referer() because that will link back to the add() action; what I want rather is to link to the page/view before that. Any general pointers on how to achieve something like this?

    Read the article

  • CakePHP Accessing Dynamically Created Tables?

    - by Dave
    As part of a web application users can upload files of data, which generates a new table in a dedicated MySQL database to store the data in. They can then manipulate this data in various ways. The next version of this app is being written in CakePHP, and at the moment I can't figure out how to dynamically assign these tables at runtime. I have the different database config's set up and can create the tables on data upload just fine, but once this is completed I cannot access the new table from the controller as part of the record CRUD actions for the data manipulate. I hoped that it would be along the lines of function controllerAction(){ $this->uses[] = 'newTable'; $data = $this->newTable->find('all'); //use data } But it returns the error Undefined property: ReportsController::$newTable Fatal error: Call to a member function find() on a non-object in /app/controllers/reports_controller.php on line 60 Can anyone help.

    Read the article

  • cakephp filter index pages according to foreign keys

    - by Marki
    Hi there, I'm pretty new to CakePHP and was missing a crucial feature not generated as scaffold: filtering. What do I have to do to provide dropdowns or multi-selects on the index pages for each field that is a (foreign) key, thereby allowing to filter the table ("OR" inside multi-select, "AND" between different multi-selects, if any)? From what my websearch has shown me there are many more people trying to accomplish the same thing, although I couldn't find anything that would work for me because either they have text fields and do wildcard filtering, or the plugins they propose only work for 1.2 whereas i now started with 1.3 etc. etc. Can someone alleviate the confusion and maybe present some working code or direct me to the definitive guide[tm] where this matter has been solved? Thx

    Read the article

  • CakePHP and jQuery - Unobtrusive actions

    - by fortysixandtwo
    I'm trying to make an unobtrusive action for deleting bookmarks in CakePHP. Allthough it's working just fine, I suspect there must be a better way to do this. Could someone please point me in the right direction? function delete($id = null) { $ok = $this->Bookmark->delete($id); if($this->RequestHandler->isAjax()) { $this->autoRender = false; $this->autoLayout = false; $response = array('status' => 0, 'message' => 'Could not delete bookmark'); if($ok) { $response = array('status' => 1, 'message' => 'Bookmark deleted'); } $this->header('Content-Type: application/json'); echo json_encode($response); exit(); } // Request isn't AJAX, redirect. $this->redirect(array('action' => 'index')); }

    Read the article

  • Cakephp - detect if unable to connect to database and recover gracefully

    - by Phantz
    I have a few sites built with Cakephp. If any of these sites lose their connection to the database for whatever reason it does not handle it well. Basically it renders itself inside itself trying to display an error over and over until the browser crashes. The rendering itself inside itself is caused by the use of requestAction from elements. What I want to know is how can I check if the database connection exists I tried this in the app_controller before filter: if(!ConnectionManager::getDataSource('default')) { die(); //this will be a message instead } but it does not seem to work. Thanks

    Read the article

  • confused of $this in cakePHP

    - by kwokwai
    Hi all, I got a few lines of codes in a Model in cakePHP 1.26: function beforeSave() { $this->data['User']['pswd'] = md5($raw['User']['pswd']); return true; } // this beforeSave() works The code above has been tested and it is working in my database. Yet, I am not sure if I can understand it well, so, I re-wrote the code in other way, and it just failed to work then. function beforeSave() { $raw=$this->data; $raw['User']['pswd'] = md5($raw['User']['pswd']); return true; } // this beforeSave() failed to work Why the second method can not work?

    Read the article

  • CakePHP based project is throwing error saying " return value of new by Reference is Deprecated"

    - by Bindas
    I have upgraded my Xampp to newer version(1.7.2).But right now when I run my project(done in CakePHP) it is throwing bug saying Deprecated: Assigning the return value of new by reference is deprecated in C:\xampp\htdocs\ebayn\cake\libs\debugger.php on line 99 Deprecated: Assigning the return value of new by reference is deprecated in C:\xampp\htdocs\ebayn\cake\libs\debugger.php on line 108 Deprecated: Assigning the return value of new by reference is deprecated in C:\xampp\htdocs\ebayn\cake\libs\file.php on line 96 Deprecated: Assigning the return value of new by reference is deprecated in C:\xampp\htdocs\ebayn\cake\libs\cache\file.php on line 89 Can anyone help me how can I rectify this stuff....??? Thanks In Advance

    Read the article

  • Cakephp, Retreive Data for HABTM Models using find

    - by user298079
    I am new to cakephp and I'm trying to accomplish something that should be relatively easy. I have 2 models projects & categories bind by HABTM relationship. I am trying to perform the following query - find all projects that belong to a category $projects = $this->Project->find('all', array('conditions' => array('Category.slug' => $category))); However when I'm doing so it generates an SQL error: SQL Error: 1054: Unknown column 'Category.slug' in 'where clause' What am I doing wrong??

    Read the article

  • CakePHP Shell issue

    - by aboxy
    Hello, I am just getting started with Cakephp shell and running into issues. My cake core library is under path d:/libs/cake My app is setup under d:/servers/htdocs/myapp I wrote a test shell under d:/servers/htdocs/myapp/vendor/shells class ReportShell extends Shell { var $uses = array('Appt'); function main() { echo $this->Appt->find('first'); } } When I try to run this code from d:/servers/htdocs/myapp , It gives me an error Warning: include_once(d:/servers/htdocs/myapp/config/database.php): failed to open stream: No such file or directory in d:/libs/cake\libs\mode l\connection_manager.php on line 23 Warning: include_once(): Failed opening 'd:/servers/htdocs/myapp/config/database.php' for inclusion (include_path='.;D:\work\xampp\php\PEAR') in d:/libs/cake\libs\model\connection_manager.php on line 23 Fatal error: ConnectionManager::getDataSource - Non-existent data source default in d:/libs/cake\libs\model\connection_manager.php on line 102 Reason is that it is trying to find database.php under 'd:/servers/htdocs/myapp/config/' and the correct path is 'd:/servers/htdocs/myapp/app/config/database.php' What am I doing wrong here? thanks

    Read the article

  • [CakePHP] what is the aim to declare $name in each controller

    - by kwokwai
    Hi all, I am leaning cakePHP. I noticed that a variable $name is declared in each Controller. What is its purpose? Is it referring to the name of table Sites? <?php class SitesController extends AppController { var $name = 'Sites'; ... } ?> If yes, Can users refer to more than one table like this? var $name = 'Sites', 'Sites2', 'Sites3';

    Read the article

  • Installing CakePHP on Windows with Apache

    - by GeoSQL
    Hi, I'm trying to install CakePHP on my Windows XP machine running Apache 2.2. I have installed the Cake folder in my doc root. I've read the installation instructions that say to include this line in the httpd.conf file; <Directory /path/to/cake> Does anyone know how to translate that into Windows? I currently have the following in my conf file: <Directory "C:/Apache/Apache2.2/htdocs/cakeapp/"> Whenever I uncomment this line it crashes Apache. I've tried switching the slashes to "\" and I tried taking the slash off the end. Any advice? Thanks

    Read the article

  • Cakephp with OpenID and User Authentication

    - by nolandark
    I have a table "users" and I want to enable my visitors to login with their openID Account. For this I use the OpenId Component for Cakephp and it works fine (When I login with the Google URL I receive the "successfully authenticated!" notification). But now I'm kind of stuck because I don't know how to go on from there. Do I have to create a User-Entry for every user which has a new entry in the "oid_associations" table (I save all OpenId interaction in the mysql database)? Do I have to authenticate the User after the login (or is the OpenID-component doing that automatically?). Am I completely misunderstanding the concept?

    Read the article

  • Form helper for creating Radio button in Cakephp

    - by Aruna
    hi, i am trying to create a Radio button using Cakephp like the one the result should resemble like <div data-attr="radio" id="1"> <label id="label1">Untitled1</label><br/> <input type="radio" value="option1" id="Radio11" name="Workexperience"/> <label for="Radio11">Option1</label> <input type="radio" value="option2" id="Radio12" name="Workexperience"/> <label for="Radio12">Option2</label> </div> how to generate so using Form helper.. Please suggest me..

    Read the article

  • CakePhp: model recursive associations and find

    - by Petecocoon
    Hello to everybody! I've some trouble with a find() on a model on CakePhp. I have three model relationed in this way: Project(some_fields, item_id) ------belongsTo----- Item(some_fields, item_id) ------belongsTo----- User(some_fields campi, nickname) I need to do a find() and retrieve all fields from project, a field from Item and the nickname field from User. This is my code: $this->set('projects', $this->Project->find('all', array('recursive' => 2))); but my output doesn't contains the user object. I've tried with Containable behaviour but the output is the same. What is broken? Many many Thanks Peter

    Read the article

  • How to handle customers with multiple addresses in CakePHP

    - by Ryan
    I'm putting together a system to track customer orders. Each order will have three addresses; a Main contact address, a billing address and a shipping address. I do not want to have columns in my orders table for the three addresses, I'd like to reference them from a separate table and have some way to enumerate the entry so I can determine if the addressing is main, shipping or billing. Does it make sense to create a column in the address table for AddressType and enumerate that or create another table - AddressTypes - that defines the address enumeration and link to that table? I have found other questions that touch on this topic and that is where I've taken my model. The problem I'm having is taking that into the cakePHP convention. I've been struggling to internalize the direction OneToMany relationships are formed - the way the documentation states feels backwards to me. Any help would be appreciated, Thanks!

    Read the article

  • CakePHP hasAndBelongsToMany (HABTM) Delete Joining Record

    - by Jason McCreary
    I have a HABTM relationship between Users and Locations. Both Models have the appropriate $hasAndBelongsToMany variable set. When I managing User Locations, I want to delete the association between the User and Location, but not the Location. Clearly this Location could belong to other users. I would expect the following code to delete just the join table record provided the HABTM associations, but it deleted both records. $this->Weather->deleteAll(array('Weather.id' => $this->data['weather_ids'], false); However, I am new to CakePHP, so I am sure I am missing something. I have tried setting cascade to false and changing the Model order with User, User-Weather, Weather-User. No luck. Thanks in advance for any help.

    Read the article

  • CakePHP Routing Alias, no prefix

    - by Jason McCreary
    I have a dashboard with a series of widgets. Per specification, the widgets need to be buried under a /widgets/ directory. So I have added the following to my routes.php Router::connect('/widget/:controller/:action/*', array()); But I seem to be running into trouble on widgets/links/ and widgets/links/view/1 I am new to CakePHP, but this doesn't seem all that impressive. I have yet to find anything in the Book or by search. So any help is appreciated. Thanks.

    Read the article

  • Cakephp, an elegant solution to quantities?

    - by Smickie
    Hi, I have a shopping cart system in Cakephp, this table has all your usual maguffins: user_ids, product_ids, option_lists ect. It also has quantity. I currently have some awful nested loops to check if the record is the same as any in there, if so add one to the quantity. If not add a new cart item. This loop has to check associated list items and product options, so it goes quite deep. What I'm wondering is if there is a more elegant way of checking to see if two cart items in a database are similar (everything except for quantity). Cheers!

    Read the article

  • CakePHP Form Helper Database Interaction

    - by xtine
    Currently I am developing a CakePHP that will list various businesses. In the database, there is a table for businesses that lists them like so: id | name | address | city | state | state_id | zip | url The state column are abbreviations of states (for listing purposes) CA, AK, FL, etc and the state_id matches up with the ids in the states table: id | name | state_abbr I have an admin_add.ctp template with form helpers for inserting new businesses. For entering a state for a business I am going to have a pull down that lists all the states. However, how do I make the database insert so it will know how to add the state abbreviation and state id when I submit the form to add the business?

    Read the article

  • In CakePHP, how to leave all prefixes?

    - by Victor Piousbox
    I have a link that goes like this: $this->Html->link('Welcome', array('controller' => 'users', 'action' => 'add')); I suspect it doesn't work (Firefox says the redirect will never complete), so I did this: $this->Html->link('Welcome', array('controller' => 'users', 'action' => 'add', 'my'=>false)); 'my' is a prefix. I also have 'admin', 'ajax', and 'rss'. So now instead of pointing to /users/add or /my/users/add, the link points to /rss/users/add. The link is in a header, in a layout so I don't know which prefix it will be invoked from. I want to go to /users/add, that is, leave all prefixes altogether. How do I do that in CakePHP? I'm using 1.3 version.

    Read the article

  • Pass dynamic value in URL with CakePHP

    - by Renato Dinhani Conceição
    I have the following method that performs an Ajax request passing some dynamic value obtained from a select input. It works fine, but the dynamic value is passed as parameter in the URL, something like states/listCities/?big_string_of_serialized_parameter . $this->Js->event( 'change', $this->Js->request( array( #url 'controller' => 'states', 'action' => 'listCities'), array( # ajax options that generates the serialized parameter 'update' => '#DealerCityId', 'data' => '$("#DealerStateId").serialize()', 'dataExpression' => true ) ) ); I'm trying to do this in a more friendly URL way, something like states/listCities/2. It's possible in CakePHP to generate a friendly URL like this with dynamic value from a input or is only possible passing the dynamic values as parameters?

    Read the article

  • Validation file upload CakePHP

    - by kicaj
    How validate file upload in CakePHP? When i wrote some like this:var $validate = array( 'file' => array( 'select' => array( 'rule' => array('selectFile', false), 'message' => 'There is no file!'), 'type' => array( 'rule' => array('typeFile'), 'message' => 'Bad type!'), 'size' => array( 'rule' => array('sizeFile'), 'message' => 'Bad with size!'))); Works only with the last validate, here 'size'. Maybe You know solution, for validation for files with many messages?

    Read the article

  • Commenting system for CakePHP blog tutorial

    - by Ryan
    I'm building off the CakePHP tutorial for the blog engine by adding comments to each post. I am able to add comments by selecting the post that it should be attached to, via a select box. I would like to be able to click an "Add Comment" link within the post and have the association to the post formed programatically. I am unsure how I can pass the post_id to the add method within my comments_controller. The body of my add method is the auto-generated scaffold code. Is it as easy as adding a $postId argument to the add method and write this to the post_id in my comments model? This doesn't feel right though, since I would expect add to be called when my submit button is click on my comments add view. Thanks all.

    Read the article

  • CakePHP delete() function is not working

    - by Logic Artist
    Hello, Im just cracking open cakePHP (v1.3.2). I set it up on my local wamp server, seems to work fine except the delete() function doesn't work. I'm following their blog tutorial exactly, its as simple as it can be so I don't understand why its not working. Heres the function in my PostsController class: function delete($id = NULL) { $this->Post->delete($id); $this->Session->setFlash('The post with id: '.$id.' has been deleted.'); $this->redirect(array('action'=>'index')); } The "Delete" link's url looks like http://localhost/posts/delete/id:1 (where the id number matches the particular post, obviously). It redirects and sets the flash message, however there is no number where $id should be in the message, and the post isn't deleted. It seems the proper id is passed through the url, but I don't think it is getting into the function. I dont get it. Any ideas???

    Read the article

  • cakephp isUnique for 2 fields?

    - by jodeci
    I have a registration form in which users can fill in two email address (email1 & email2). Marketing's requirement is that they need to be unique (unique as in if we had 10 users, then there would be 10*2=20 unique email address). The system is already built on cakephp, so what I'd like to know is, is there something similar to the isUnique feature (unique in one field) that can do this right out of the box? Or am I doomed to code this myself? Thanks in advance.

    Read the article

< Previous Page | 5 6 7 8 9 10 11 12 13 14 15 16  | Next Page >