Search Results

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

Page 16/31 | < Previous Page | 12 13 14 15 16 17 18 19 20 21 22 23  | Next Page >

  • Are Symphony and CakePHP too slow to be usable?

    - by Aziz Light
    Until now, I have always said that CakePHP is too bloated and slow. I don't really know that, I just saw "some" benchmarks. What I really want to know, is that if those two frameworks (Symfony and CakePHP) are too slow to be usable in a way that the user will get frustrated. I already know that those frameworks are slower than other alternatives, but that's not the question. I ask the question because I want to create a project management web application and I still hesitate between a couple frameworks. I've had some trouble learning Zend, but imho I haven't tried hard enough. So in conclusion, in addition to the first question above, I would like to ask another question: If I want to create a project management tool (which is a pretty big project), which of the following should you suggest, considering the developement time, the speed of the resulting application, and the robustness of the final product: Symphony CakePHP Zend Framework Also I should mention that I don't know any of those frameworks, and that I want to learn one of them (at least).

    Read the article

  • How to stop Nginx sending static file requests to the CakePHP app controller when running Cake in a

    - by Throlkim
    I'm trying to run a CakePHP app from within a subfolder on Nginx, but the static files are not being found and are instead being passed to the app controller. Here's my current config: location /uniquetv { index index.php index.html; if (-f $request_filename) { break; } if (!-e $request_filename) { rewrite ^/uniquetv(.+)$ /uniquetv/webroot/$1 last; break; } } location /uniquetv/webroot { index index.php; if (!-e $request_filename) { rewrite ^/uniquetv/webroot/(.+)$ /uniquetv/webroot/index.php?url=$1 last; break; } } Any ideas? :)

    Read the article

  • How to stop Nginx sending static file requests to the CakePHP app controller when running Cake in a subdirectory?

    - by robotmay
    I'm trying to run a CakePHP app from within a subfolder on Nginx, but the static files are not being found and are instead being passed to the app controller. Here's my current config: location /uniquetv { index index.php index.html; if (-f $request_filename) { break; } if (!-e $request_filename) { rewrite ^/uniquetv(.+)$ /uniquetv/webroot/$1 last; break; } } location /uniquetv/webroot { index index.php; if (!-e $request_filename) { rewrite ^/uniquetv/webroot/(.+)$ /uniquetv/webroot/index.php?url=$1 last; break; } } Any ideas? :)

    Read the article

  • two independent dropdowns with xml binded data - cakephp - best method?

    - by gudinne
    What's best method within cakephp site for- two dropdowns one listing cds, one listing artists on select of either cd or artist I need my additional text to appear below dropdowns I have been searching through tutorials and manual - with no success. I am looking to learn by basic example - from form/view and controller. latest try was something along this example to get dropdown [http://stackoverflow.com/questions/1450457/cakephp-make-select-dropdown]

    Read the article

  • How do I achieve virtual attributes in CakePHP (using code, not SQL) as implemented in Ruby on Rails

    - by ash
    Source: http://asciicasts.com/episodes/16-virtual-attributes I'd like to achieve a similar setup as below, but in CakePHP and where the virtual attributes are created using code, not SQL (as documented at http://book.cakephp.org/view/1070/Additional-Methods-and-Properties#Using-virtualFields-1590). class User < ActiveRecord::Base # Getter def full_name [first_name, last_name].join(' ') end # Setter def full_name=(name) split = name.split(' ', 2) self.first_name = split.first self.last_name = split.last end end

    Read the article

  • Do I have to put parent::__construct($config) in my CakePHP data source?

    - by Angel S. Moreno
    Is there a good reason to put parent::__construct($config) in the construct of a CakePHP data source I am developing? I see it being used in some of the data sources found in https://github.com/cakephp/datasources/blob/master/models/datasources/amazon_associates_source.php but not sure why. I could just do private $_config = array(); function construct($config){ $this->_config = $config; } and access my $config the same way.

    Read the article

  • Method for defining simultaneous has-many and has-one associations between two models in CakePHP?

    - by Hobonium
    One thing with which I have long had problems, within the CakePHP framework, is defining simultaneous hasOne and hasMany relationships between two models. For example: BlogEntry hasMany Comment BlogEntry hasOne MostRecentComment (where MostRecentComment is the Comment with the most recent created field) Defining these relationships in the BlogEntry model properties is problematic. CakePHP's ORM implements a has-one relationship as an INNER JOIN, so as soon as there is more than one Comment, BlogEntry::find('all') calls return multiple results per BlogEntry. I've worked around these situations in the past in a few ways: Using a model callback (or, sometimes, even in the controller or view!), I've simulated a MostRecentComment with: $this->data['MostRecentComment'] = $this->data['Comment'][0]; This gets ugly fast if, say, I need to order the Comments any way other than by Comment.created. It also doesn't Cake's in-built pagination features to sort by MostRecentComment fields (e.g. sort BlogEntry results reverse-chronologically by MostRecentComment.created. Maintaining an additional foreign key, BlogEntry.most_recent_comment_id. This is annoying to maintain, and breaks Cake's ORM: the implication is BlogEntry belongsTo MostRecentComment. It works, but just looks...wrong. These solutions left much to be desired, so I sat down with this problem the other day, and worked on a better solution. I've posted my eventual solution below, but I'd be thrilled (and maybe just a little mortified) to discover there is some mind-blowingly simple solution that has escaped me this whole time. Or any other solution that meets my criteria: it must be able to sort by MostRecentComment fields at the Model::find level (ie. not just a massage of the results); it shouldn't require additional fields in the comments or blog_entries tables; it should respect the 'spirit' of the CakePHP ORM. (I'm also not sure the title of this question is as concise/informative as it could be.)

    Read the article

  • How to make cakePHP retreive the data represented by a foreign key?

    - by XL
    Greetings cake experts, I have a question that I think would really help a lot of people getting started with cakePHP. I have a feeling it will be easy for some of you, but it is quite challenging to me. I have a simple database with multiple tables. I can't figure out how to make cakePHP display the values associated with a foreign key in an index view. Or create a view where the fields of my choice (the ones that make sense to users like location name - not location_id can be updated or viewed on a single page). I have created an example at http://lovecats.cakeapp.com that illustrate the question. If you look at the page and click the "list cats", you will notice that it shows the location_id field from the locations table. You will also notice that when you click "add cats", you must choose a location_id from the locations table. This is the automagic way that cakePHP builds the app. I want this to be the field location_name. The database is setup so that the table cats has a foreign key called location_id that has a relationship to a table called locations. This is my problem: I want these pages to display the location_name instead of the location_id. If you want to login to the application, you can go to http://cakeapp.com/sqldesigners/sql/lovecats and the password 'password' to look at the db relationships, etc. How do I have a page that shows the fields that I want? And is it possible to create a page that updates fields from all of the tables at once? This is the slice of cake that I have been trying to figure out and this would REALLY get me over a hump. You can download the app and sql from the above url.

    Read the article

  • Can I give a different id to define Cakephp model associations?

    - by gacrux
    I have an one to many association in which a Thing can have many Statuses defined as below: Status Model: class Status extends AppModel { var $name = 'Status'; var $belongsTo = array( 'Thing' => array( 'className' => 'Thing', 'foreignKey' => 'thing_id', ); } Thing Model: class Thing extends AppModel { var $name = 'Thing'; var $belongsTo = array( // other associations ); var $hasMany = array( 'Status' => array( 'className' => 'Status', 'foreignKey' => 'thing_id', 'dependent' => false, 'order' => 'datetime DESC', 'limit' => '10', ), // other associations ); } This works OK, but I would like Thing to use a different id to connect to Status. E.g. Thing would use 'id' for all of it's other associations but use 'thing_status_id' for it's Status association. How can I best do this?

    Read the article

  • How can I use a different id field for one of my CakePHP model associations?

    - by gacrux
    I have an one to many association in which a Thing can have many Statuses defined as below: Status Model: class Status extends AppModel { var $name = 'Status'; var $belongsTo = array( 'Thing' => array( 'className' => 'Thing', 'foreignKey' => 'thing_id', ); } Thing Model: class Thing extends AppModel { var $name = 'Thing'; var $belongsTo = array( // other associations ); var $hasMany = array( 'Status' => array( 'className' => 'Status', 'foreignKey' => 'thing_id', 'dependent' => false, 'order' => 'datetime DESC', 'limit' => '10', ), // other associations ); } This works OK, but I would like Thing to use a different id to connect to Status. E.g. Thing would use 'id' for all of it's other associations but use 'thing_status_id' for it's Status association. How can I best do this?

    Read the article

  • Why are some classes created on the fly and others aren't in CakePHP 1.2.7?

    - by JoseMarmolejos
    I have the following model classes: class User extends AppModel { var $name= 'User'; var $belongsTo=array('SellerType' => array('className' => 'SellerType'), 'State' => array('className' => 'State'), 'Country' => array('className' => 'Country'), 'AdvertMethod' => array('className' => 'AdvertMethod'), 'UserType' => array('className' => 'UserType')); var $hasMany = array('UserQuery' => array('className' => 'UserQuery'));} And: class UserQuery extends AppModel { var $name = 'UserQuery'; var $belongsTo = array('User', 'ResidenceType', 'HomeType');} Everything works fine with the user class and all its associations, but the UserQuery class is being completely ignored by the orm (table name user_queries and the generated queries do cast it as UserQuery. Another weird thing is that if I delete the code inside the User class I get an error, but if I do the same for the UserQuery class I get no errors. So my question is why does cakephp generate a class on the fly for the UserQuery and ignores my class, and why doesn't it generate a class on the fly for the User as well ?

    Read the article

  • How to set form name and id using cakephp FormHelper class?

    - by chiggsy
    I'm trying to create a form using Cakephp's FormHelper class. The form needs to have a name and and an id. I fail to see an option for that however. Looking at the documentation for the Formhelper, I see a lot of things, but not a way to set name and option. It's not in the source for the Formhelper either. How are these values set? Cakephp v1.2 is the version of cake i'm running here EDIT: the form is being submitted to an external destination. It is not a form associated with any model in the app.

    Read the article

  • [CakePHP] I am so confused. What should I write in the default.ctp

    - by kwokwai
    Hi all, I am learning cakePHP, everything seems alright except that I am very confused of how to make use of the default.ctp and what should be put inside the Elements folder. Here is the default.ctp file that I have been using since my very first lesson on learning cakePHP: (I copied from this URL http://book.cakephp.org/view/96/Layouts) <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title><?php echo $title_for_layout?></title> <link rel="shortcut icon" href="favicon.ico" type="image/x-icon"> <!-- Include external files and scripts here (See HTML helper for more info.) --> <?php echo $scripts_for_layout ?> </head> <body> <!-- If you'd like some sort of menu to show up on all of your views, include it here --> <div id="header"> <div id="menu">...</div> </div> <!-- Here's where I want my views to be displayed --> <?php echo $content_for_layout ?> <!-- Add a footer to each displayed page --> <div id="footer">...</div> </body> </html> But the problem is that the layout will take effect to all web pages that I have created. Let's see the case that I have recently encountered. In one of the .ctp files, I need to use JQuery function and I need to ass some and tags in the .ctp file. Here are the and tags I used: <Script language="javascript"> $(document).ready(function() { // some functions here }); </Script> <style type="text/css"> { #toppage{ width:800px; } But when I followed the default.ctp file, I noticed that these tags (i.e. and ) happened to appear below the tag. As far as I know, the and self-defined Javascript functions should be put inside the tag of the HTML instead. I have considered to add the and in the default.ctp file, but then these codes would appear in every web pages instead of just a particular web page. Please help.

    Read the article

  • CakePHP: How can I disable auto-increment on Model.id?

    - by tomws
    CakePHP 1.3.0, mysqli I have a model, Manifest, whose ID should be the unique number from a printed form. However, with Manifest.id set as the primary key, CakePHP is helping me by setting up auto-increment on the field. Is there a way to flag the field via schema.php and/or elsewhere to disable auto-increment? I need just a plain, old primary key without it. The only other solution I can imagine is adding on a separate manifest number field and changing foreign keys in a half dozen other tables. A bit wasteful and not as intuitive.

    Read the article

  • Linking to a file (e.g. PDF) within a CakePHP view.

    - by Hobonium
    I'd like to link to some PDFs in one of my controller views. What's the best practice for accomplishing this? The CakePHP webroot folder contains a ./files/ subfolder, I am confounded by trying to link to it without using "magic" pathnames in my href (e.g. "/path/to/my/webroot/files/myfile.pdf"). What are my options? EDIT: I didn't adequately describe my question. I was attempting to link to files in /app/webroot/files/ in a platform-agnostic (ie. no mod_rewrite) way. I've since worked around this issue by storing such files outside the CakePHP directory structure.

    Read the article

  • Can I insert a style tag and contents from a view with CakePHP?

    - by Richard
    From what I can see, CakePHP makes it easy to link to a CSS file in a view with the following: echo $html->css('my-css-filename',null,array(),FALSE); But what if I don't want to exclusively use hardcoded files? How can I get it to create a style tag with some dynamically generated rules in e.g. <style type="text/css" media="all">p {font-size:1.5em}</style> I am trying to do this in a view file, I'd like the CSS to be placed in the head tag, and I'm using CakePHP 1.2.7

    Read the article

  • Does CakePHP treat all INT fields as ID's for join tables?

    - by Jonnie
    I am trying to save a User, their Profile, and some tags and my join table that links the profile and the tags keeps getting messed up. The profile model is called Instructor, the tag model is called Subject. The Instructor has a phone number and a zip code and for some reason CakePHP thinks these are the fields it should use when creating entries in my join table. My Join table always comes out as: id | instructor_id | subject_id | 1 | 90210 | 1 | // thinks that the zip code is an instructor_id 2 | 1112223333 | 1 | // thinks that the phone number is an instructor_id 3 | 1 | 1 | // thinks that user_id is an instructor_id 4 | 1 | 1 | // the actual instructor_id, this one's correct 5 | 90210 | 2 | 6 | 1112223333 | 2 | 3 | 1 | 2 | 4 | 1 | 2 | My Models: class Instructor extends AppModel { var $name = 'Instructor'; var $belongsTo = array('User', 'State'); var $hasAndBelongsToMany = array( 'Subject' = array( 'className' = 'Subject', 'joinTable' = 'instructors_subjects', 'foreignKey' = 'instructor_id', 'associationForeignKey' = 'subject_id', 'unique' = true, 'conditions' = '', 'fields' = '', 'order' = '', 'limit' = '', 'offset' = '', 'finderQuery' = '', 'deleteQuery' = '', 'insertQuery' = '' ) ); } class Subject extends AppModel { var $name = 'Subject'; var $hasAndBelongsToMany = array( 'Instructor' = array( 'className' = 'Instructor', 'joinTable' = 'instructors_subjects', 'foreignKey' = 'subject_id', 'associationForeignKey' = 'instructor_id', 'unique' = true, 'conditions' = '', 'fields' = '', 'order' = '', 'limit' = '', 'offset' = '', 'finderQuery' = '', 'deleteQuery' = '', 'insertQuery' = '' ) ); } My Model Associations: User hasOne Instructor Instructor belongsTo User Instructor hasAndBelongsToMany Subject Subject hasAndBelongsToMany Instructor My form data looks like: Array ( [User] = Array ( [username] = MrInstructor [password] = cddb06c93c72f34eb9408610529a34645c29c55d [group_id] = 2 ) [Instructor] = Array ( [name] = Jimmy Bob [email] = [email protected] [phone] = 1112223333 [city] = Beverly Hills [zip_code] = 90210 [states] = 5 [website] = www.jimmybobbaseballschool.com [description] = Jimmy Bob is an instructor. [user_id] = 1 [id] = 1 ) [Subject] = Array ( [name] = hitting, pitching ) ) My function for processing the form looks like: function instructor_register() { $this-set('groups', $this-User-Group-find('list')); $this-set('states', $this-User-Instructor-State-find('list')); if (!empty($this-data)) { // Set the group to Instructor $this-data['User']['group_id'] = 2; // Save the user data $user = $this-User-save($this-data, true, array( 'username', 'password', 'group_id' )); // If the user was saved, save the instructor's info if (!empty($user)) { $this-data['Instructor']['user_id'] = $this-User-id; $instructor = $this-User-Instructor-save($this-data, true, array( 'user_id', 'name', 'email', 'phone', 'city', 'zip_code', 'state_id', 'website', 'description' )); // If the instructor was saved, save the rest if(!empty($instructor)) { $instructorId = $this-User-Instructor-id; $this-data['Instructor']['id'] = $instructorId; // Save each subject seperately $subjects = explode(",", $this-data['Subject']['name']); foreach ($subjects as $_subject) { // Get the correct subject format $_subject = strtolower(trim($_subject)); $this-User-Instructor-Subject-create($this-data); $this-User-Instructor-Subject-set(array( 'name' = $_subject )); $this-User-Instructor-Subject-save(); echo ''; print_r($this-data); echo ''; } } } } }

    Read the article

  • When using the Auth component with CakePHP, I keep ketting this error. Why?

    - by Josh Brown
    Warning (2): Cannot modify header information - headers already sent by (output started at /Applications/MAMP/htdocs/iframeworking/iframe/app/models/frame.php:7) [COREcake/libs/controller/controller.php, line 647] here is the code from frame.php: <?php class Frame extends AppModel { var $name = 'Frame'; var $belongsTo = array('User' => array('className' => 'User', 'dependent' => true)); } ?>

    Read the article

< Previous Page | 12 13 14 15 16 17 18 19 20 21 22 23  | Next Page >