Search the Community
Showing results for tags 'cakephp'.
-
How to work with frameworks ??? from where whould I start learning this topics ??
-
I have a 3-tables 1-> categories = id,category_name 2-> statuses = id,status_name 3-> evnets = id,event_name,category_id,staus_id events is the main table which has the id`s of categories and statuses table I want to display events display where the names of categories and statuses is displayed instead of name it is possible through join, but what should to model, controller and view to give the desired output. The table must display event_id, event_name,category_name,status_name
-
public function editContact( $c_id = null ) { //echo $c_id; if( !$c_id ) { throw new NotFoundException( __( 'Invalid Post' ) ); } $contact = $this->Contact->findBycId( $c_id ); if( !$contact ) { throw new NotFoundException( __( 'Invalid Post' ) ); } //$id = $c_id; if( $this->request->is( array( 'post', 'put' ) ) ) { $this->Contact->cid = $c_id; if( $this->Contact->save( $this->request->data ) ) { $this->Session->setFlash( __( 'Data Updated' ) ); return $this->redirect( array( 'action' => 'index' ) ); } $this->Session->setFlash( __( 'Unable To update Data!' ) ); } if( !$this->request->data ) { $this->request->data = $contact; } } edit action in my controller in my contacts table I'm having 'c_id' instead of 'id' I also add this public $primaryKey = 'c_id' in Contact.php model file But still I get column not found unknown column contact.id in where clause
-
In my routes.php file, I added this: Router::connect('/Compounds/:action/*',array('controller' => 'Substances')); Router::connect('/Preparations/:action/*',array('controller' => 'Substances')); Router::connect('/Formulations/:action/*',array('controller' => 'Substances')); Router::connect('/Plants/:action/*',array('controller' => 'Substances')); and now, the links generated by Paginator all point to Compounds, even when thats not the model which has been loaded with $this->Paginator->paginate($model); If I change the order, so its: Router::connect('/Plants/:action/*',array('controller' => 'Substances')); Router::connect('/Compounds/:action/*',array('controller' => 'Substances')); Router::connect('/Preparations/:action/*',array('controller' => 'Substances')); Router::connect('/Formulations/:action/*',array('controller' => 'Substances')); then all the paginator links point to Plants. The same problem occurs when I redirect to $this->redirect(array('action' => 'index')); without specifying the controller. So it seems the routes page is altering the links which don't specify a controller. This wouldn't be a problem (on the contrary, it'd be helpful) if it would add the correct controller to the links, I don't know why its adding Compounds to every link.
-
how to raed an xml file in cakephp i tried this in controller http://bakery.cakephp.org/articles/fahad19/2008/08/26/parsing-xml-files-with-cakephp but i am getting error Fatal error: Class 'XML' not found in site.com/app/Controller/UsersController.php on line 79 at line 79 : $parsed_xml =& new XML($file); i am using cakephp 2.0. Any suggestions?
-
I have the following roles: Admin Client Contractor I want to create a new one called Client_site. I want this to route through to the Client prefix's but have different ACL. Basically I want it to use all the same pages, just have read only access to them. How would I set this up in the routing? Also is there anything else I will need to amend to get this working?
-
Just thought I'd share a few useful bits of code I wrote for CakePHP. Heres code to select rows by ID of a nested hierarchical (tree) database: $conditions = array( 'alias' => 'items' ); if (isset($this->request->query['category'])) { $cat_id = $this->request->query['category']; $category = ClassRegistry::init('Categories')->findById($cat_id)['Categories']; $joins = array( array( 'table' => 'categories', 'alias' => 'cats', 'type' => 'INNER', 'conditions' => array( 'cats.lft BETWEEN ? and ?' => array($category['lft'],$category['rght']) ) ), array( 'table' => 'items_cat_rels', 'alias' => 'rels', 'type' => 'INNER', 'conditions' => array( 'Item.id = rels.item_id', 'rels.category_id = cats.id' ) ) ); $conditions['joins'] = $joins; } $this->set('items', $this->Item->find('all',$conditions)); and heres a function for cleaning empty and null arrays out of your multivariable arrays: public function arrayCleaner($results) { $arrayUnsetter = function (&$data) { foreach ($data as $resType => $params) { if (empty($data[$resType])) { unset($data[$resType]); } $keys = array_keys($params); if (isset($keys[0]) && $keys[0] !== 0 && $keys[0] == "id") { if (@$params['id'] === null) { unset($data[$resType]); } } } return $data; }; if (isset($results[0])){ foreach($results as $key => $value){ $output[$key] = $arrayUnsetter($value,$key); } } else { $output = $arrayUnsetter($results,"NULL"); } return $output; }
-
The version of cake I have installed uses MyController.php naming convention. I installed cakephp-scripts for Ubuntu so that I can start using bake, but it uses my_controller.php naming conventions, and it doesn't detect my controllers or models and all that stuff because my cakephp projects all use CamelCase naming conventions for the directories and files. If I run bake in the app folder, it doesn't detect my database config file because its looking for the config folder, it doesn't check the Config folder. So it ends up creating all new lowercase folders (i.e. controllers instead of Controller, views instead of View). Is this my_controller.php naming convention from older versions of cakephp, which are now obsolete? If so, is bake suppose to use the newer camelcase convention?
-
Daily WALKIN... PROVAB is Hiring @ Bangalore... PHP Developers with PHP5/ Codeigniter/ Zend/ Magento/ CakePHP/ Opencart/ Prestashop (1.6 to 8Yrs)... 40 Positions... Education- Any, Please refer friends... Ramesh, 080-40593555, +91-8050006446 ramesh.provab@gmail.com PROVAB, NG Complex, 30th Cross Road, Jayanagar 4th T Block, Tilak Nagar, Bangalore
- 1 reply
-
- php
- codeigniter
-
(and 3 more)
Tagged with:
-
I need to upload SQL file and run it in controller in cakephp. I am unable to execute using exec and shell_exec both returns errors i.e. exec given empty string and shell_exec gives null value. How to run mysql command using exec or shell_exec
-
I want to have role based access in Cakephp. I want that when I create a new Role the menu in tree structure should appear from where the admin can select the menu and operation. I have gone through ACl component but can't understand its functioning
-
I have a form where user uploads file i.e. Excel Sheet The data read from sheet is to be store in mysql database. The headers location is not fixed. So I need to search the header with the mysql table column name. Records below header are to be inserted into database. How can I search teh header row in Excel using cakephp
-
I need to create a module where a user can upload csv,xml or excel file and the data from file can be inserted into MySql database.Any plugin which can do it
-
Hi phpFreaks! I'm starting to learn CakePHP, and for it i decided to build a simple app, and i want your advice. I want to create a simple system to manage my savings and my expenses. I have not done anything, I'm at the stage of designing the database. The problem is that I want to enter an expense and have the option to repeat this expense (month to month /year to year / etc). I was thinking about doing something like this: Table Types (id_type, str_type) Table Categories (id_Categories, str_Categories) Table Records (id_Record, id_type, id_Categories, value, situation (paid / unpaid), date) Now if for example if i add an expense that will be repeated 3 in 3 months, I did not want to save in the database the repeated records because the repeated records dont have a end date to stop repeat. And for example in 3rd month I want to change the value of this expense, I wanted to have several opinions(change the value only in the current month, change the value for all the next repeat records or change the value in all repeat records). I thought creating an auxiliary table: Record_Repeat (id_recRep, id_record, repeat (yes / no), repeat_value) In the App, when you see the a month first is shown if are repeated records and the situation is unpaid, then records of the table records. Only when the Records.situation changes to "Paid" or i edit the value this record is saved into the database. I make myself clear?
-
Hello, am writing a video tutorial using cakephp. I have tried to embed my swf player using Javascript code. It works fine in all the index view of all my controllers but don't in other action/view. What could possibly be the problem. Any help would be appreciated
- 3 replies
-
- cakephp
- flash player
-
(and 2 more)
Tagged with:
-
I am doing Photo gallery using cakephp and flickr by seeing this link http://www.sitepoint.com/photo-gallery-cakephp-flickr/# I am getting Error: Class 'phpFlickr' not found File: C:\wamp\www\cake\app\Controller\Component\flickrComponent.php Line: 28 This is my flickrComponent.php <?php /** * Flickr Component * @author RosSoft * @license MIT * @version 0.1 */ define(‘FLICKR_CACHE_DIR’,CACHE . ‘flickr/’); class FlickrComponent extends Object { /** * Api Key. Change to your own * @var string * @link http://www.flickr.com/services/api/misc.api_keys.html */ //var $_api_key=’CHANGE_TO_YOUR_KEY’; var $_api_key='55d16262ee69f739466b7c45b073cc8a'; function startup(&$controller) { App::import('Vendor', 'phpFlickr', array('file' => 'phpflickr'.DS.'phpFlickr'.DS.'phpFlickr.php')); //vendor(‘phpflickr/phpFlickr’); //FlickrComponent instance of controller is replaced by a phpFlickr instance $controller->flickr =& new phpFlickr($this->_api_key); if (!is_dir(FLICKR_CACHE_DIR)) { mkdir(FLICKR_CACHE_DIR,0777); } $controller->flickr->enableCache(‘fs’, FLICKR_CACHE_DIR); $controller->set(‘flickr’,$controller->flickr); } } ?> This is my gallerycontroller.php <?php class GalleryController extends AppController { var $name = 'Gallery'; var $components = array('Flickr'); var $uses = null; } ?>
-
Hello everyone. I'm relatively new to PHP, and I'm loving how CakePHP has made my life easy, and hard at the same time. I'm having trouble updating the deprecated Forum Plugin from milesj. If anyone there could help me, I'd much appreciate it. First off, deprecated views and controllers. They amaze me to no end. No matter how deep I try to trace them, it's impossible for me to find out what is wrong with it. I do have an idea, but I can't trace where I should change the codes. Second; admin roles, ACL, CRUD is not a fairly new concept to me now, but because of the deprecated codes I can't get a deeper understanding about why I can't disable new users from accessing the admin panel. Third; the Admin Plugin is good, but wouldn't detect the Forum Plugin correctly. I can't trace back where this went wrong. Also, adding new users through the admin panel doesn't hash the password. My codes are here for your viewing and mockery: http://www.mediafire.com/download/00635ajpsn19ba1/AsCIISite.rar