Search Results

Search found 768 results on 31 pages for 'cakephp 1 3'.

Page 1/31 | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • cakephp phone number validation

    - by hellosheikh
    i am new to cakephp 2.x so i dont know how to do this .. i want to login the user from his email address and phone number..what my intention is if the number in database is this "12345" and the user is trying to login through this number "+12345" he can be login into the system.. i have written a code but i dont know how can i use this or to adjust my code within the auth component as the auth component is autometically logging the user .. here is my controller public function beforeFilter() { parent::beforeFilter(); $this->Auth->authenticate = array( 'Authenticate.Cookie' => array( 'fields' => array( 'username' => 'email', 'password' => 'password' ), 'userModel' => 'User', 'scope' => array('User.active' => 1) ), 'Authenticate.MultiColumn' => array( 'fields' => array( 'username' => 'email', 'password' => 'password' ), 'columns' => array('email', 'mobileNo'), 'userModel' => 'User', ) ); } public function login() { if ($this->Auth->login() || $this->Auth->loggedIn()) { $this->redirect('/users/dashboard'); }else{ $this->layout='logindefault'; $this->set('title_for_layout', 'Account Login'); /*$this->Auth->logout(); $cookie = $this->Cookie->read('Auth.User'); */ if ($this->request->is('post')) { if ($this->Auth->login() || $this->Auth->loggedIn()) { if ($this->Session->check('Auth.User')){ $this->_setCookie($this->Auth->user('idUser')); $this->redirect('/users/dashboard'); } }else { $this->Session->setFlash('Incorrect Email/Password Combination'); } }} } here is the code which i am trying to add .. $mobileNo='+123456789'; if (strpos($mobileNo,'+') !== false) { $mobileNo=str_replace("+", "",$mobileNo); } ?

    Read the article

  • cakephp read and display from more than one related table

    - by z22
    I have 2 tables Users and Artists. User: id name password city_id state_id country_id Artist: id user_id description I wish to create add and edit form(single form acts as add and edit). But on click of edit link, I wish to fill in the form fields from user as well as artist table. How do i do that? Below is my controller code: public function artist_register() { $this->country_list(); if ($this->request->is('post')) { $this->request->data['User']['group_id'] = 2; if ($this->{$this->modelClass}->saveAll($this->request->data)) { $this->redirect(array('controller' => 'Users', 'action' => 'login')); } } $this->render('artist_update'); } public function artist_update($id) { $artist = $this->{$this->modelClass}->findByuser_id($id); $artist_id = $artist[$this->modelClass]['id']; if($this->request->is('get')) { $this->request->data = $this->{$this->modelClass}->read(null, $artist_id); $this->request->data = $this->{$this->modelClass}->User->read(null, $id); } else { if($this->{$this->modelClass}->save($this->request->data)) { $this->Session->setFlash('Your Profile has been updated'); $this->redirect(array('action' => 'index')); } } } The code doesnt work. how do i solve it?

    Read the article

  • CakePHP sending multiple lines of same cookie information in response header. why??

    - by Vicer
    Hi all, I am having this problem with one of my cakePHP applications. My application displays a big html table on the page. I noticed that when the table goes beyond a certain size limit, IE cannot display that page. While trying to figure out why this happens, I noticed that my html response header contains a HUGE number of lines repeating the same thing. Response Headers ------------------------------ Date Thu, 20 May 2010 04:18:10 GMT Server Apache/2.0.63 (Win32) mod_ssl/2.0.63 OpenSSL/0.9.7m PHP/5.2.10 X-Powered-By PHP/5.2.10 P3P CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM" Set-Cookie CAKEPHP=q4tp37tn9gkhcpgmf1ftr1i6c1; expires=Sun, 20-May-2035 10:18:12 GMT; path=/mywebapp CAKEPHP=q4tp37tn9gkhcpgmf1ftr1i6c1; expires=Sun, 20-May-2035 10:18:12 GMT; path=/mywebapp CAKEPHP=q4tp37tn9gkhcpgmf1ftr1i6c1; expires=Sun, 20-May-2035 10:18:12 GMT; path=/mywebapp CAKEPHP=q4tp37tn9gkhcpgmf1ftr1i6c1; expires=Sun, 20-May-2035 10:18:12 GMT; path=/mywebapp CAKEPHP=q4tp37tn9gkhcpgmf1ftr1i6c1; expires=Sun, 20-May-2035 10:18:12 GMT; path=/mywebapp CAKEPHP=q4tp37tn9gkhcpgmf1ftr1i6c1; expires=Sun, 20-May-2035 10:18:12 GMT; path=/mywebapp CAKEPHP=q4tp37tn9gkhcpgmf1ftr1i6c1; expires=Sun, 20-May-2035 10:18:12 GMT; path=/mywebapp CAKEPHP=q4tp37tn9gkhcpgmf1ftr1i6c1; expires=Sun, 20-May-2035 10:18:12 GMT; path=/mywebapp CAKEPHP=q4tp37tn9gkhcpgmf1ftr1i6c1; expires=Sun, 20-May-2035 10:18:12 GMT; path=/mywebapp CAKEPHP=q4tp37tn9gkhcpgmf1ftr1i6c1; expires=Sun, 20-May-2035 10:18:12 GMT; path=/mywebapp CAKEPHP=q4tp37tn9gkhcpgmf1ftr1i6c1; expires=Sun, 20-May-2035 10:18:12 GMT; path=/mywebapp CAKEPHP=q4tp37tn9gkhcpgmf1ftr1i6c1; expires=Sun, 20-May-2035 10:18:12 GMT; path=/mywebapp CAKEPHP=q4tp37tn9gkhcpgmf1ftr1i6c1; expires=Sun, 20-May-2035 10:18:13 GMT; path=/mywebapp CAKEPHP=q4tp37tn9gkhcpgmf1ftr1i6c1; expires=Sun, 20-May-2035 10:18:13 GMT; path=/mywebapp CAKEPHP=q4tp37tn9gkhcpgmf1ftr1i6c1; expires=Sun, 20-May-2035 10:18:13 GMT; path=/mywebapp CAKEPHP=q4tp37tn9gkhcpgmf1ftr1i6c1; expires=Sun, 20-May-2035 10:18:13 GMT; path=/mywebapp CAKEPHP=q4tp37tn9gkhcpgmf1ftr1i6c1; expires=Sun, 20-May-2035 10:18:13 GMT; path=/mywebapp CAKEPHP=q4tp37tn9gkhcpgmf1ftr1i6c1; expires=Sun, 20-May-2035 10:18:13 GMT; path=/mywebapp CAKEPHP=q4tp37tn9gkhcpgmf1ftr1i6c1; expires=Sun, 20-May-2035 10:18:13 GMT; path=/mywebapp CAKEPHP=q4tp37tn9gkhcpgmf1ftr1i6c1; expires=Sun, 20-May-2035 10:18:13 GMT; path=/mywebapp CAKEPHP=q4tp37tn9gkhcpgmf1ftr1i6c1; expires=Sun, 20-May-2035 10:18:13 GMT; path=/mywebapp CAKEPHP=q4tp37tn9gkhcpgmf1ftr1i6c1; expires=Sun, 20-May-2035 10:18:13 GMT; path=/mywebapp CAKEPHP=q4tp37tn9gkhcpgmf1ftr1i6c1; expires=Sun, 20-May-2035 10:18:13 GMT; path=/mywebapp CAKEPHP=q4tp37tn9gkhcpgmf1ftr1i6c1; expires=Sun, 20-May-2035 10:18:13 GMT; path=/mywebapp CAKEPHP=q4tp37tn9gkhcpgmf1ftr1i6c1; expires=Sun, 20-May-2035 10:18:13 GMT; path=/mywebapp CAKEPHP=q4tp37tn9gkhcpgmf1ftr1i6c1; expires=Sun, 20-May-2035 10:18:13 GMT; path=/mywebapp CAKEPHP=q4tp37tn9gkhcpgmf1ftr1i6c1; expires=Sun, 20-May-2035 10:18:13 GMT; path=/mywebapp CAKEPHP=q4tp37tn9gkhcpgmf1ftr1i6c1; expires=Sun, 20-May-2035 10:18:13 GMT; path=/mywebapp CAKEPHP=q4tp37tn9gkhcpgmf1ftr1i6c1; expires=Sun, 20-May-2035 10:18:13 GMT; path=/mywebapp Keep-Alive timeout=15, max=100 Connection Keep-Alive Transfer-Encoding chunked Content-Type text/html ========================================================================== Request Headers -------------------------- Host localhost:8080 User-Agent Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 ( .NET CLR 3.5.30729) Accept text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language en-us,en;q=0.5 Accept-Encoding gzip,deflate Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive 115 Connection keep-alive Referer http://localhost:8080/mywebapp/section2/bigtable/1 Cookie CAKEPHP=q4tp37tn9gkhcpgmf1ftr1i6c1 Authorization Basic cGt1bWFyYTpwa3VtYXJh Notice the huge set of repeated lines at 'Set-Cookie' in the Response Header. This only happens when I try to display large tables. Does anyone have any clue to what might be causing this? Any help to find the issue is appreciated. I am using CakePHP 1.2.5. As far as I know, I am not messing with any set cookie functions. But yes I am using session variables.

    Read the article

  • CakePHP: trouble configuring .htaccess for user directories enabled server

    - by bullettime
    I've placed the CakePHP files in a directory in /home/user/public_html/cakephp. When I try to reach localhost/~user/cakephp with my browser, there's an error message. In my case, since I'm using Chrome, it is 'Oops! This link appears to be broken.". Looking for a solution on Google, I found a few articles saying that I have to edit the .htaccess files that came with CakePHP, since it was made to work out of the box in /var/www/htdocs. Apparently I have to add a 'RewriteBase' statement to the .htaccess files. I added 'RewriteBase /' to it but it didn't work. If I change the RewriteBase statement in my user web directory to 'RewriteBase /cakephp' and then try to access localhost/~user/cakephp, the browser then shows not the copy in /home/user/public_html/cakephp but the copy in /var/www/htdocs/cakephp. What can I do to fix this?

    Read the article

  • CakePHP Observe field for validation check(already exists)

    - by deck john
    i have already user observe field in cakephp 1.3 Now i want to do the same thing in cakephp 2.0 I have one form.there is a one field named email. When user insert email. onblur there is a popup one message that displays "email already exists" or "right" for that i have write below code in my projects. the below code is my add file code <?php $options = array('url' => array( 'controller' => 'users', 'action' => 'is_exist'), 'update' => 'email_exist'); echo $this->ajax->observeField('UserEmailId',array('url' => array( 'controller' => 'users', 'action' => 'is_exist'), 'update' => 'email_exists')); ?> In my controller i have created one function like public function is_exist($id = null) { $result = "yes"; $this->set('existdata',$result); } i have also created is_exists.ctp fiel in view/uers. i dont know why its not working. i did the same thing in Cakephp 1.3 and its working file but not in cakephp 2.0 can anyone tell me how i implement this ? thanks in advance

    Read the article

  • CakePHP 'Cake is NOT able to connect to the database'

    - by kand
    I've looked at this post about a similar issue: CakePHP: Can't access MySQL database and I've tried everything they mentioned in there including: Changing my database.php so that the 'port' attribute for both $default and $test are the location of my mysqld.sock file Changing the 'port' attribute to the actual integer that represents the port in my my.cnf mysql config Changing the mysql socket locations in php.ini to the location of my mysqld.sock file I'm using ubuntu 11.04, apache 2.2.17, mysql 5.1.54, and CakePHP 1.3.10. My install of mysql and apache don't seem to match any conventions, as in, all the config files are there, they are all just in really weird places--I'm not sure why that is, but I've tried reinstalling both programs multiple times with the same results... At any rate, I can log into mysql from the terminal and use it normally, and apache is working because I can see the CakePHP default homepage. I just can't get it to change the message 'Cake is NOT able to connect to the database'. SOLVED: Figured it out, had to change php.ini so that extension_dir pointed to the correct directory and had to add a line extension=mysql.so.

    Read the article

  • Cakephp 1.3 database migration with

    - by Vijay Kumbhar
    Hello All, I am using cakephp 1.3 on LAMP (ubuntu 9.04) platform. Trying the database migration with cakephp inbuilt schema generation script. I am inside the app folder & When i fire a command in the terminal 'cake schema run create schema file name', It is giving me the error that "Error:schema.php could not be included." Can anybody help me out?

    Read the article

  • CakePHP pair programming practise

    - by The-Di-Lab
    We are on the stage of planning a CakePHP project. It is a relatively a big project for us, as a developer+project manager, I want to hire someone to work with me. But what I really want is to spend less time on actual coding, without losing control of the code quality. What I want to do is that I will design all the functions of the project in CakePHP, at least all the model's functions, and leave the implementation part to the coder who I am going to hire. But my worry is still if I am going to lose control of the code quality using this approach? is it feasible to do so or it is going to turn this project to a chaos. Thank you all in advanced for reading my question and give me answers.

    Read the article

  • MySQL SET and ENUM types in CakePHP framework

    - by Andrew Bashtannik
    Hi! I need to use SET and ENUM types in my CakePHP 1.3 project. I found some advices, but all them are too old (2004-2006) and full of crazy methods, like modifying cake's core files. Also, CakePHP developers said that SET and ENUM types are not supported. Example: I have SET('alpha','beta') field, and I need to use this data as checkboxes in add & edit actions. Is there any way to add normal support (Form helpers etc.) of SET and ENUM fields?

    Read the article

  • Deploy CakePHP to a subfolder

    - by mgroves
    I have created a CakePHP 2 app, and now I'm trying to deploy it to a production web server. My app uses the default folder structure (app/lib/plugins/vendors), default htaccess, default routing, nothing special. I've been developing locally as if the app were in the root folder of the site (e.g. http://mycakeapp.localhost/ takes me to the site). But I'm deploying to a site (shared hosting) where that will not be the case (e.g. http://www.somedomain.com/mycakeapp). It doesn't work (I didn't really expect it to), so I assumed I had to tweak one or more htaccess files. I tried modifying the root .htaccess as suggested in this post, but that only partially worked (the link to the CSS didn't work, for instance): <IfModule mod_rewrite.c> RewriteEngine on RewriteRule ^mycakeapp$ mycakeapp/app/webroot/ [L] RewriteRule ^mycakeapp/(.*)$ mycakeapp/app/webroot/$1 [L] </IfModule> So what should I do to all the htaccess files to make this CakePHP site work in a subfolder?

    Read the article

  • Losing sessions with window.open and cakephp redirection in PHP with cakephp

    - by vsecades
    Hi guys, Ok, here goes a very strange problem... Our team is using cakephp to develop a large application. Everything session related is working properly so far. The only issues we've had so far are related to iframes and opening windows in other subdomains. I'll explain: User opens up site A and logs into it, creation a User in a session. Cookies are set, everything works as expected. The user clicks a link that opens up Site B via Javascript. When they go to that site, they are automatically logged in by a backend mechanism and infrastructure. Site B is a subdomain of Site A. On that site there is another mechanism to go back to the first page (a link rather) that logs them back in to site A. The fun part about this whole process is the following, and that on step 3, when we click on the link, the session on Site A has been lost. I know it's lost because it is forcing login again. I am a bit lost, as the rest of the application that work with AJAX and uses iframes and stuff works flawlessly, just this one item does not work as one would expect. Any assistance would be appreciated. Cheers, Valentin

    Read the article

  • router connect configuration in cakephp 1.3

    - by Gaurav Sharma
    Hello everyone, I have defined the following rule in the router.php file of my cakephp 1.3 based application Router::connect('/tags/*',array('plugin' => 'tags', 'controller' => 'Tags', 'action' => 'index', 'admin' => false)); I have used the tags plugin. When I display the tags related to a topic then the URL on the tags appears something like this http://localhost/testapp/tags/Tags/view/{tag_key_name} I want to make this url for any action to tags plugin like this http://localhost/testapp/Tags/{action}/{tag_key_name} for (view, admin_view and admin_edit) and http://localhost/testapp/Tags/{action} for (index, admin_index and any other action that does not require an id or keyname for execution)

    Read the article

  • Routing configuration in cakephp

    - by ShiVik
    Hello all I am trying to implement routing in cakephp. I want the urls to mapped like this... www.example.com/nodes/main - www.example.com/main www.example.com/nodes/about - www.example.com/about So for this I wrote in my config/routes.php file.. Router::connect('/:action', array('controller' => 'nodes')); Now, I got the thing going but when I click on the links, the url in browser appears like www.example.com/nodes/main www.example.com/nodes/about Is there some way where I can get the urls to appear the way they are routed? Setting in .htaccess or httpd.conf would be easy - but I don't have access to that. Regards Vikram

    Read the article

  • How do I secure all the admin actions in all controllers in cakePHP

    - by Gaurav Sharma
    Hello Everyone, I am developing an application using cakePHP v 1.3 on windows (XAMPP). Most of the controllers are baked with the admin routing enabled. I want to secure the admin actions of every controller with a login page. How can I do this without repeating much ? One solution to the problem is that "I check for login information in the admin_index action of every controller" and then show the login screen accordingly. Is there any better way of doing this ? The detault URL to admin (http://localhost/app/admin) is pointing to the index_admin action of users controller (created a new route for this in routes.php file) Thanks

    Read the article

  • CakePHP 1.3 Plugin Shortcut Route

    - by Cake Baker
    Hi, I searched a lot around the web but I couldn't find any specific sollution to this. In CakePHP 1.3, different from 1.2, if you had a controller inside a plugin, and both had the same name, you could access through "<plugin>/<action>", and it would call the 'default' controller. But in 1.3, according to this: http://cakeqs.org/eng/questions/view/setting_up_magic_routes_for_plugins_in_cakephp_1_3 It was removed, and only the 'index' action in the default plugin controller can be accessed this way. I thought about adding extra code in my routes.php file, and loop through all the plugins in my app, making such routes for every action in the controllers named after the plugin, but it doesn't seem like it's the right thing to do... any other suggestions to make this work in 1.3? or at least some very specific code documentation of this particular change? I've already read something in the 1.3.0-RC4 annoucement, but it was not clear enough.. thanks

    Read the article

  • cakePHP: Filter selected list by variable

    - by gonzela2006
    I'm on cakePHP 2. I have a problem and I need your help. Here is some code of my controller(StudentsController.php) specifically "edit" function: $students = $this -> Student -> find('list', array( 'order' => 'Student.name ASC' )); $this -> set('students', $students); How can I filter the list by the current student's class?? so the list will contain all students that has the same student's class I need some code like this $students = $this -> Student -> find('list', array( 'conditions' => array('Student.class_id' => CURRENT-STUDENT'S-CLASS), 'order' => 'Student.name ASC' )); $this -> set('students', $students); Please Advise Thanks, gonzela2006

    Read the article

  • CakePHP 1.3 and Uploadifive/Uploadify - Change Upload Filename to a random string

    - by CaboONE
    I have somehow implemented UPLOADIFIVE in my CakePHP application. Everything seems to work great including uploading multiple files and inserting the correct information in the Database. Based on the following code, I would like to UPLOAD AND SAVE EVERY FILE WITH A RANDOM NAME TAKING INTO ACCOUNT THE CURRENT DATE OR SOMETHING SIMILAR. How could I accomplish this? In my Photos Controller I have the following function: // This function is called at every file upload. It uploads the file onto the server // and save the corresponding image name, etc, to the database table `photos`. function upload() { $uploadDir = '/img/uploads/photos/'; if (!empty($_FILES)) { debug($_FILES); $tempFile = $_FILES['Filedata']['tmp_name'][0]; $uploadDir = $_SERVER['DOCUMENT_ROOT'] . $uploadDir; $targetFile = $uploadDir . $_FILES['Filedata']['name'][0]; // Validate the file type $fileTypes = array('jpg', 'jpeg', 'gif', 'png'); // Allowed file extensions $fileParts = pathinfo($_FILES['Filedata']['name'][0]); // Validate the filetype if (in_array($fileParts['extension'], $fileTypes)) { // Save the file move_uploaded_file($tempFile,$targetFile); $_POST['image'] = $_FILES['Filedata']['name'][0]; $this->Photo->create(); if ($this->Photo->save($_POST)) { $this->Session->setFlash($targetFile, 'default', array('class' => 'alert_success')); $this->redirect(array('action' => 'index')); } } else { // The file type wasn't allowed //echo 'Invalid file type.'; $this->Session->setFlash(__('The photo could not be saved. Please, try again.', true)); } } } In my View file - admin_add.ctp I have added the following function $('#file_upload').uploadifive({ 'auto' : false, 'uploadScript' : '/photos/upload', 'buttonText' : 'BROWSE FILES', 'method' : 'post', 'onAddQueueItem' : function(file) { this.data('uploadifive').settings.formData = { 'photocategory_id' : $('#PhotoPhotocategoryId').val() }; } }); <input type="file" name="file_upload" id="file_upload" />

    Read the article

  • cakephp: Custom Authentication Object authenticate not called

    - by Kristoffer Darj
    The method authenticate in a Custom Authentication Object is never called. Is this a glicth or am I missing something? I don't get anything in the log, I'm just redirected to users/login (or the one I specified) CakeVersion: 2.4.1 <?php //My custom Auth Class //Path: app/Controller/Component/Auth/HashAuthenticate.php App::uses('BaseAuthenticate', 'Controller/Component/Auth'); class HashAuthenticate extends BaseAuthenticate { public function authenticate(CakeRequest $request, CakeResponse $response) { //Seems to not be called CakeLog::write('authenticate'); debug($this); die('gaah'); } } If I add the method getUser() (or unauthenticated() ), those gets called however so at least I know that cake finds the class and so on. It just skips the authenticate-method. The AppController looks like this class AppController extends Controller { public $helpers = array('Html', 'Form', 'Session'); public $components = array('Auth' => array( 'authenticate' => array('Hash'), 'authorize' => array('Controller'), ) ); } I found a similar question here: CakePHP 2.x custom "Authentication adapter &quot;LdapAuthorize&quot; was not found but there the issue was typos.

    Read the article

  • How to fetch populated associated models in CakePHP when calling read()

    - by Code Commander
    I have the following Models: class Site extends AppModel { public $name = "Site"; public $useTable = "site"; public $primaryKey = "id"; public $displayField = 'name'; public $hasMany = array('Item' => array('foreignKey' => 'siteId')); public function canView($userId, $isAdmin = false) { if($isAdmin) { return true; } return array_key_exists($this->id, $allowedSites); } } and class Item extends AppModel { public $name = "Item"; public $useTable = "item"; public $primaryKey = "id"; public $displayField = 'name'; public $belongsTo = array('Site' => array('foreignKey' => 'siteId')); public function canView($userId, $isAdmin = false) { // My problem appears to be the next line: return $this->Site->canView($userId, $isAdmin); } } In my controller I am doing something like this: $result = $this->Item->read(null, $this->request->id); // Verify permissions if(!$this->Item->canView($this->Session->read('userId'), $this->Session->read('isAdmin'))) { $this->httpCodes(403); die('Permission denied.'); } I notice that in Item->canView() $this->data['Site'] is populated with the column data from the site table. But it merely an array and not an object. On the other hand $this->Site is a Site object, but it has not been populated with the column data from the site table like $this->data. What is the proper way to have CakePHP get the associated model as the object and containing the data? Or am I going about this all wrong? Thanks!

    Read the article

  • Running a Model::find in for loop in cakephp v1.3

    - by Gaurav Sharma
    Hi all, How can I achieve the following result in cakephp: In my application a Topic is related to category, category is related to city and city is finally related to state in other words: topic belongs to category, category belongs to city , city belongs to state.. Now in the Topic controller's index action I want to find out all the topics and it's city and state. How can I do this. I can easily do this using a custom query ($this-Model-query() function ) but then I will be facing pagination difficulties. I tried doing like this function index() { $this->Topic->recursive = 0; $topics = $this->paginate(); for($i=0; $i<count($topics);$i++) { $topics[$i]['City'] = $this->Topic->Category->City->find('all', array('conditions' => array('City.id' => $topics[$i]['Category']['city_id']))); } $this->set(compact('messages')); } The method that I have adopted is not a good one (running query in a loop) Using the recursive property and setting it to highest value (2) will degrade performance and is not going to yield me state information. How shall I solve this ? Please help Thanks

    Read the article

  • Expected time for an CakePHP MVC form/controller and db make up

    - by hephestos
    I would like to know, what is an average time for building a form in MVC pattern with for example CakePHP. I build 8 functions, two of them do custom queries, return json data, split them, expand them in a model in memory and delivers to the view. Those are three queries if you consider and an array to feed view for making some combo box. Why? all these, because I have data from json and I split them in order to make row of data like a table. Like that I changed a bit the edit.ctp but not a lot. And I created a javascript outside, with three functions. One collects data the other upon a change of a combo returnes the selected values, and does also some redirection flow. All this, in average how much time should it take ?

    Read the article

  • What's the correct way to use Cakephp urls?

    - by Pichan
    Hello all, it's my first post here :) I'm having some difficulties with dealing with urls and parameters. I've gone through the router class api documentation over and over again and found nothing useful. First of all, I'd like to know if there is any 'universal' format in CakePHP(1.3) for handling urls. I'm currently handling all my urls as simple arrays(in the format that Router::url and $html-link accepts) and it's easy as long as I only need to pass them as arguments to cake's own methods. It usually gets tricky if I need something else. Mainly I'm having problems with converting string urls to the basic array format. Let's say I want to convert $arrayUrl to string and than again into url: $arrayUrl=array('controller'=>'SomeController','action'=>'someAction','someValue'); $url=Router::url($arrayUrl); //$url is now '/path/to/site/someController/someAction/someValue' $url=Router::normalize($url); //remove '/path/to/site' $parsed=Router::parse($url); /*$parsed is now Array( [controller] => someController [action] => someAction [named] => Array() [pass] => Array([0] => someValue) [plugin] => ) */ That seems an awful lot of code to do something as simple as to convert between 2 core formats. Also, note that $parsed is still not in the same as $arrayUrl. Of course I could tweak $parsed manually and actually I've done that a few times as a quick patch but I'd like to get to the bottom of this. I also noticed that when using prefix routing, $this-params in controller has the prefix embedded in the action(i.e. [action] = 'admin_edit') and the result of Router::parse() does not. Both of course have the prefix in it's own key. To summarize, how do I convert an url between any of these 3(or 4, if you include the prefix thing) mentioned formats the right way? Of course it would be easy to hack my way through this, but I'd still like to believe that cake is being developed by a bunch of people who have a lot more experience and insight than me, so I'm guessing there's a good reason for this "perceived misbehavior". I've tried to present my problem as good as I can, but due to my rusty english skills, I had to take a few detours :) I'll explain more if needed.

    Read the article

  • CakePHP 1.3.4: EmailComponent error - Undefined property: EmailComponent::$Controller

    - by Kevin S.
    I'm trying to develop an invitation system for my website which runs on CakePHP 1.3.4. I am trying to use the built in EmailComponent to send an email. I'm getting this error (expanded): Notice (8): Undefined property: EmailComponent::$Controller [CORE/cake/libs/controller/components/email.php, line 428] Code | Context */ function _render($content) { $viewClass = $this-Controller-view; $content = array( "", "" ) EmailComponent::_render() - CORE/cake/libs/controller/components/email.php, line 428 EmailComponent::send() - CORE/cake/libs/controller/components/email.php, line 368 UsersController::send_quick_add_email() - APP/controllers/users_controller.php, line 77 UsersController::quick_add() - APP/controllers/users_controller.php, line 104 SinglesResultsController::quick_add() - APP/controllers/singles_results_controller.php, line 63 Dispatcher::_invoke() - CORE/cake/dispatcher.php, line 204 Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 171 [main] - APP/webroot/index.php, line 83 I also get the following, which I can expand if necessary: Notice (8): Trying to get property of non-object [CORE/cake/libs/controller/components/email.php, line 428] Notice (8): Undefined property: EmailComponent::$Controller [CORE/cake/libs/controller/components/email.php, line 433] Notice (8): Trying to get property of non-object [CORE/cake/libs/controller/components/email.php, line 433] Notice (8): Undefined property: View::$webroot [CORE/cake/libs/view/view.php, line 805] Warning (2): Cannot modify header information - headers already sent by (output started at /Applications/MAMP/htdocs/cake/cake/libs/debugger.php:673) [CORE/cake/libs/controller/controller.php, line 746] I think that the EmailComponent object holds a reference to the controller it's being called from. I don't know why it's undefined in this case. Here is the code that fails (specifically, it errors on the call to $this-Email-send()): function send_quick_add_email($email) { if($email) { $this->Email->reset(); $this->Email->to = $email; $this->Email->subject = 'Some subject text'; $this->Email->from = '[email protected]'; $this->Email->template = 'email_template'; $this->set('user', $user); $this->set('token', $token); $this->Email->delivery = 'debug'; $this->Email->send(); } } Ok, for more clarification: The main data I am collecting on the site is results of a game played in meatspace. SinglesResultsController has an action, quick_add, which expects email addresses of people not already registered on the site. If the email addresses aren't associated with Users, UsersController::quick_add is called, which creates an inactive user, and sends an invitation email in UsersController::send_quick_add_email() I think the problem is related to the fact that the email isn't being sent in the first controller initialized (SinglesResultsController). Any thoughts on how to make it work? The Email component is declared at the top of both Controllers.

    Read the article

  • CakePHP Shell issue with my directory structure

    - by keslert
    I have structured my Cake files in the following way /cakes /2_3 /app /Console /cake.php /apps /www.website1.com /Console /HelloShell.php /Controllers /etc... /www.website2.com /Console /Controllers /etc... I am getting an error "Error: Shell class HelloShell could not be found." I have added "cakes/2_3/app/Console" to my PATH, and I am running cake from inside www.website1.com. Current Paths: -app: www.website1.com -working: apps\www.website1.com -root: apps -core: cakes\2_3\lib Any ideas on what I am doing wrong?

    Read the article

1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >