Search Results

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

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

  • CakePHP: Accessing the controller or model from a view helper

    - by tombazza
    I have a view helper that manages generating thumbnails for images. The images are stored using a unique ID and then linked to a file resource in the database. I am trying to find out if it is possible for the view helper that generates these images to access the model or controller directly, as it is not possible to load the image data at any other point in the controller work flow. I know this is a bit of a hack really, but it is easier than trying to rebuild the entire data management stack above the view.

    Read the article

  • cakephp group based permissions

    - by Elwhis
    Hey guys, I would like to have group based restrictions that would allow users to access only specified parts of the web. I am new to the whole ACL stuff and I didn't quite get it from the manual :/ therefore I would like to ask some questions. But before any questions, my routes look like this: Router::connect('/', array('controller' => 'users', 'action' => 'login')); Router::connect('/admin/:controller/:action/*', array('prefix' => 'admin', 'admin' => true)); Router::connect('/registered/:controller/:action/*', array('prefix' => 'registered', 'registered' => true)); 1.) How do I restrict users from any other group than Administrator to access ONLY the /registered/ part of the web 2.) How do I prevent anyone from using the default addresses like www.example.com/users/add on a global scale (I want only www.example.com/admin/users/add or www.example.com/registered/users/add type of addresses)? This kind of addresses is not event set in the routes.php but they still work. Any answers apprecated

    Read the article

  • prefix routing cakephp

    - by nick martin
    Hello, Just a quick one.. I am unsure how to prevent a prefix, for example if I am in domain.com/admin/orders or domain.com/user/order which are admin_ and user_ actions and the navigation menu contains links to pages displays (controller pages action display, **) when they are clicked on they are automatically prefixed by the current prefix. How can I set in the router file to redirect wildcards prefixes (ie. /pages/)?

    Read the article

  • [CakePHP] Dynamic fields on insert/edit form

    - by user198003
    hi all, let's say that i have 3 tables: books properties book_properties of course, i would like that when i want to insert new book (or update existing), to fill the form. fields that exist on form have to be defined as records in table properties. when i fill up those fields, data has to be saved in table book_properties. can you help me by giving some advices and references, how to achieve that? thank you very much in advance!

    Read the article

  • cakePHP, multiple hasOne in a single model

    - by jason
    say you have 3 models : user, hair_color, and eye_color user hasOne hair_color user also hasOne eye_color however var $hasOne = 'hair_color'; var $hasOne = 'eye_color'; obviously wont work. So how do you implement many hasOne relationships in a single model? I assume the answer is in the cookbook, Im going over that area now, I suspect it has something to do with passing an array to $hasOne, but no example of doing this.

    Read the article

  • Cakephp, i18n, SQL Error, Not unique table/alias

    - by ion
    I get the following SQL error: SQL Error: 1066: Not unique table/alias: 'I18n__name' when doing a simple find query. Any ideas on possible situations that may have caused this?? I'm using a bindModel method to retrieve the data is that related? This is my code: $this->Project->bindModel(array( 'hasOne' => array( 'ProjectsCategories', 'FilterCategory' => array( 'className' => 'Category', 'foreignKey' => false, 'conditions' => array('FilterCategory.id = ProjectsCategories.category_id') )))); $prlist = $this->Project->find('all', array( 'fields' => array('DISTINCT slug','name'), 'conditions' => array('FilterCategory.slug !='=>'uncategorised') ))

    Read the article

  • movedown method not saving new position - cakephp tree

    - by Ryan
    Hi everyone, I am experiencing a problem that has popped up recently and is causing quite a bit of trouble for our system. The app we have relies on using the movedown method to organize content, but as of late it has stopped working and began to generate the following warning: Warning (2): array_values() [<a href='function.array-values'>function.array-values</a>]: The argument should be an array in [/usr/local/home/cake/cake_0_2_9/cake/libs/model/behaviors/tree.php, line 459] The line being referenced: list($node) = array_values($Model->find('first', array( 'conditions' => array($scope, $Model->escapeField() => $id), 'fields' => array($Model->primaryKey, $left, $right, $parent), 'recursive' => $recursive ))); The line calling the method: $this->movedown($id,abs((int)$position)); I have exhausted every idea I could come up with. Has anyone else crossed this issue before? Any help, or pointing in a direction would be much appreciated!

    Read the article

  • User permission check steps in CakePHP

    - by bancer
    I want to understand the sequence of steps how it is verified that a user has permission to particular application page ('Acl', 'Auth', 'Security' components are used). For example, a visitor clicks a link on another site that directs him to my application. What is the sequence of steps that my application does to verify that this user has access to the page? What controllers and methods are called?

    Read the article

  • Cakephp Autoconvert find() fields?

    - by Razor Storm
    In cake php I can grab a model's fields by using the find() method. What if I wish to apply a transformation function to the fields? Is there a way to directly accomplish this task? Suppose I have a model called RaceTime with the fields racerId and timeMillis RaceTime +------------+ | Field | +------------+ | id | | racerId | | timeMillis | +------------+ timeMillis is an int specifying how long the race took in milliseconds. Obviously saying a race took 15651 milliseconds isn't very useful to a human reader, and I would wish to convert this to a human readable format. Is there a way to accomplish this directly in find()? Or is the only option to loop through the results after find() finishes?

    Read the article

  • cakephp redirecting to wrong relative address (htaccess?)

    - by jay
    Hi All: I have an issue with not getting the correct relative url. Right now, say my home page is at (please ignore quotation) "http://www.foo.com/user/home" I have links on the homepage that should go to "http://www.foo.com/user/home/page1" but right now I'm getting "http://www.foo.com/page1" Everything worked locally, can this be fixed with modifying .htaccess and how? Thank you.

    Read the article

  • [cakephp] problem with find query

    - by luk4s
    Hi I have a problem with find query: $userInProjects = $this->Timesheet->RegularPost->UserInProject->find('all', array('conditions' => array('UserInProject.user_id' => $id))); The result array: Array ( [0] => Array ( [UserInProject] => Array ( [id] => 11 [project_id] => 3 [position_id] => 1 [user_id] => 15 ) [Project] => Array ( [id] => 3 [short_name] => proj1 [full_name] => project 1 [start_date] => 2010-01-01 [end_date] => 2010-05-01 [agreement_number] => 12/34U/23 [active] => 1 [user_id] => 1 ) [Position] => Array ( [id] => 1 [name] => some_name ) [User] => Array ( [id] => 15 [username] => foo [first_name] => [last_name] => [email] => [email protected] [active] => 1 [created] => [modified] => ) [RegularPost] => Array ( [0] => Array ( [id] => 792 [date] => 2010-01-01 [size] => 0.20000 [users_in_project_id] => 11 ) [1] => Array ( [id] => 793 [date] => 2010-02-01 [size] => 0.20000 [users_in_project_id] => 11 ) ( and many more ...) ) ) [1] => Array ( [UserInProject] => Array ( [id] => 20 [project_id] => 3 [position_id] => 2 [user_id] => 15 ) [Project] => Array ( [id] => 3 [short_name] => proj1 [full_name] => project 1 [start_date] => 2010-01-01 [end_date] => 2010-05-01 [agreement_number] => 12/34U/23 [active] => 1 [user_id] => 1 ) [Position] => Array ( [id] => 2 [name] => some_name2 ) [User] => Array ( [id] => 15 [username] => foo [first_name] => [last_name] => [email] => [email protected] [active] => 1 [created] => [modified] => ) [RegularPost] => Array ( [0] => Array ( [id] => 836 [date] => 2010-01-01 [size] => 0.2 [users_in_project_id] => 20 ) [1] => Array ( [id] => 837 [date] => 2010-02-01 [size] => 0.3 [users_in_project_id] => 20 ) [2] => Array ( [id] => 838 [date] => 2010-03-01 [size] => 0.3 [users_in_project_id] => 20 ) ( and many more ...) ) ) ) What I want to achive is the array like above but RegularPost with [date] = 2010-02-01 only. Is there any way to pass the date '2010-02-01' to the RegularPost in this query? This query doesn't work: $userInProjects = $this->Timesheet->RegularPost->UserInProject->find('all', array('conditions' => array('UserInProject.user_id' => $id, 'RegularPost.date' => '2010-02-01'))); 1054: Unknown column 'RegularPost.date' in 'where clause' Please help. :)

    Read the article

  • CakePHP pagination with HABTM models

    - by nickf
    I'm having some problems with creating pagination with a HABTM relationship. First, the tables and relationships: requests (id, to_location_id, from_location_id) locations (id, name) items_locations (id, item_id, location_id) items (id, name) So, a Request has a Location the request is coming from and a Location the Request is going to. For this question, I'm only concerned about the "to" location. Request --belongsTo--> Location* --hasAndBelongsToMany--> Item (* as "ToLocation") In my RequestController, I want to paginate all the Items in a Request's ToLocation. // RequestsController var $paginate = array( 'Item' => array( 'limit' => 5, 'contain' => array( "Location" ) ) ); // RequestController::add() $locationId = 21; $items = $this->paginate('Item', array( "Location.id" => $locationId )); And this is failing, because it is generating this SQL: SELECT COUNT(*) AS count FROM items Item WHERE Location.id = 21 I can't figure out how to make it actually use the "contain" argument of $paginate... Any ideas?

    Read the article

  • cakephp find('list') - problem using

    - by MOFlint
    I'm trying to get an array to poplulate a Counties select. If I use find('all') I can get the data but this array needs flattening to use in the view with $form-input($counties). If I use find('list') I can't seem to get the right array - which is simple array of county names. What I have tried is this: $ops=array( 'conditions' => array( 'display' => '!=0', 'TO_DAYS(event_finish) >= TO_DAYS(NOW())' ), 'fields' => 'DISTINCT venue_county', 'order' => 'venue_county DESC' ); $this->set('counties', $this->Event->find('list',$ops)); but the SQL this generates is: SELECT Event.id, DISTINCT Event.venue_county FROM events AS Event WHERE display = 1 AND TO_DAYS(event_finish) = TO_DAYS(NOW()) ORDER BY venue_county DESC which generates an error because it first inserts the Event.id field in the query - which is not wanted and causes the error. In my database I have a single table for Events which includes the venue address and I don't really want to create another table for address. What options should I be using efor the find('list') call?

    Read the article

  • [Cakephp] How to use Read()

    - by kwokwai
    Hi all, In a Controller, I got this: $this->Site1->post_id=$id; $this->set('posts', $this->Site1->read()); And when I replaced it by this line of code: $this-set('posts', $this-Site1-read('post_id', $id)); But the returned result is totally different. Is there any difference between them? Is it possible to make this two lines of code neat by re-writing it into one line of code? $this->Site1->post_id=$id; $this->set('posts', $this->Site1->read());

    Read the article

  • CakePHP "down for maintenance" page

    - by user1852176
    I found this post about how to create a "down for maintenance" page but I'm having some trouble getting it to work properly. define('MAINTENANCE', 1); if(MAINTENANCE > 0){ require('maintenance.php'); die(); } When I place this code in /webroot.index.php it works. However, the answer suggests adding an IP address check so that if it's down, I would still be able to view it and make sure any updates went through smoothly. So, it would look something like this define('MAINTENANCE', 0); if(MAINTENANCE > 0 && $_SERVER['REMOTE_ADDR'] !='188.YOUR.IP.HERE'){ require('maintenance.php'); die(); } The issue is, my IP address will NOT be detected by cake. I've typed echo $_SERVER['REMOTE_ADDR'] and it just shows ::1. I also tried using my user_id but I got the following error Class 'AuthComponent' not found in.... I tried /index.php and /App/index.php but the maintenance page wasn't triggered and the page loads normally.

    Read the article

  • auth component issue

    - by madphp
    Im trying to get my admin routing working with the auth component. I want the following routing to work. Router::connect('/admin', array('controller' => 'pages', 'action' => 'index', 'admin' => true)); but when i type in /admin it redirects to /admin/users/login and display this error. Create UsersController::admin_login() in file: cms.local/controllers/users_controller.php here is my app_controller code. class AppController extends Controller { var $components = array('DebugKit.Toolbar','Auth','Session'); function beforeFilter(){ //Set up Auth Component $this->Auth->loginAction = array('controller' => 'users', 'action' => 'login'); $this->Auth->loginRedirect = array('controller' => 'pages', 'action' => 'admin_index'); $this->Auth->allow('display'); } } users_controller <?php class UsersController extends AppController { var $name = 'Users'; function login(){ } function admin_logout(){ $this->Session->destroy(); $this->redirect($this->Auth->logout()); } } ?> If you require more information let me know. Thanks

    Read the article

  • database schema explanation of the cakedc tags plugin

    - by Gaurav Sharma
    Hello everyone, I found an awesome tags plugin on cakedc site. This plugin makes your tagging concerns very easy and is able to make anything taggable. Has anyone used it? I find it a bit difficult to understand few things listed below: difference between the name and keyname columns of the tags table. the use of columns 'identifier', 'weight' in tags table Thanks

    Read the article

  • Passing get values mangles my urls

    - by SibLiant
    Just upgraded from 1.3 to 2.0.3 and I'm trying to migrate all the changes. I'm noticing that the following line echo $this->Html->link('Quote', array('controller'=>'crm_quotes', 'action'=>'index', $lead['id'].'/'.$crmContact['CrmContact']['id']), null); builds the url "/crm_quotes/index/15/21". When I click the link I'm taken to url: "/crm_quotes/index/15%2F212 so it's replacing the characters with the html # but it's ultimately breaking the link. When I manually edit the URL to the correct one: "/crm_quotes/index/15/21" the page loads. Can someone enlighten me? Should I be using the url function rather than link? I have a lot of pages that need multiple parameters passed in the url. I was using named parameters but after reading some comments by Mark Story I decided to stop the named parameters as he hinted at their possible removal from future versions.

    Read the article

  • Array comparion for multidimensinal array in php

    - by Learner
    Array 1 = pr($plan_data); Array ( [0] => Array ( [AveragePrice] => 9.631161 [EFLUrl] => http://www.championenergyservices.com/register/EFL_API.asp?rateid=161456 [EarlyTerminationFee] => 150 [HurricaneRecovery] => 0.132 [MeterSurcharge] => 3.05 [OffCycle] => 5 [PUCAssessment] => 0.00167 [PlanDescription] => Savings Champ-6 [PlanId] => 57 [PlanIssueDate] => 12/10/2012 [PlanMonthlyFee] => 0 [PlanName] => PN1058 [PlanRate] => 9.3 [PlanRenewablePercent] => 7.2 [PlanTerm] => 6 [PriorityMoveIn] => 36 [ProviderDisplayName] => CenterPoint Energy [ProviderId] => 21 [ProviderInternalName] => CNP_COAST [RateId] => 161456 [RegularMoveIn] => 16 [TDSPPassThrough] => 0.03791 [TOCUrl] => http://www.championenergyservices.com/register/termsandconditions.asp?rateid=161456 [YRACUrl] => http://www.championenergyservices.com/register/\affiliatefiles\YRAC.PDF [provider] => ces [ProductType] => Fixed [Rep] => Champion Energy Services [Zone] => 77479 ) [1] => Array ( [AveragePrice] => 10.1311693 [EFLUrl] => http://www.championenergyservices.com/register/EFL_API.asp?rateid=161458 [EarlyTerminationFee] => 150 [HurricaneRecovery] => 0.132 [MeterSurcharge] => 3.05 [OffCycle] => 5 [PUCAssessment] => 0.00167 [PlanDescription] => Savings Champ-12 [PlanId] => 59 [PlanIssueDate] => 12/10/2012 [PlanMonthlyFee] => 0 [PlanName] => PN1060 [PlanRate] => 9.8 [PlanRenewablePercent] => 7.2 [PlanTerm] => 12 [PriorityMoveIn] => 36 [ProviderDisplayName] => CenterPoint Energy [ProviderId] => 21 [ProviderInternalName] => CNP_COAST [RateId] => 161458 [RegularMoveIn] => 16 [TDSPPassThrough] => 0.03791 [TOCUrl] => http://www.championenergyservices.com/register/termsandconditions.asp?rateid=161458 [YRACUrl] => http://www.championenergyservices.com/register/\affiliatefiles\YRAC.PDF [provider] => ces [ProductType] => Fixed [Rep] => Champion Energy Services [Zone] => 77479 ) [2] => Array ( [AveragePrice] => 10.4311743 [EFLUrl] => http://www.championenergyservices.com/register/EFL_API.asp?rateid=161459 [EarlyTerminationFee] => 150 [HurricaneRecovery] => 0.132 [MeterSurcharge] => 3.05 [OffCycle] => 5 [PUCAssessment] => 0.00167 [PlanDescription] => Green Power-12 [PlanId] => 60 [PlanIssueDate] => 12/10/2012 [PlanMonthlyFee] => 0 [PlanName] => PN1061 [PlanRate] => 10.1 [PlanRenewablePercent] => 100 [PlanTerm] => 12 [PriorityMoveIn] => 36 [ProviderDisplayName] => CenterPoint Energy [ProviderId] => 21 [ProviderInternalName] => CNP_COAST [RateId] => 161459 [RegularMoveIn] => 16 [TDSPPassThrough] => 0.03791 [TOCUrl] => http://www.championenergyservices.com/register/termsandconditions.asp?rateid=161459 [YRACUrl] => http://www.championenergyservices.com/register/\affiliatefiles\YRAC.PDF [provider] => ces [ProductType] => Fixed [Rep] => Champion Energy Services [Zone] => 77479 ) ) Array 2 = pr($temp_val); Array ( [0] => Array ( [id] => 6 [PlanId] => 60 [PlanName] => Bounce 12 + A/C Protection [PlanDescription] => Bounce 12 + A/C Protection - CNP [PlanTerm] => 12 [PlanRate] => [RateId] => [PlanIssueDate] => [PlanMonthlyFee] => [EarlyTerminationFee] => 200.00000 [AveragePrice] => 12.00000 [HurricaneRecovery] => [PlanRenewablePercent] => [ProviderDisplayName] => [ProviderId] => 1 [provider] => bounce [ProductZoneId] => 353 [Zone] => 77479 [ProviderInternalName] => [RegularMoveIn] => [PriorityMoveIn] => [OffCycle] => [TDSPPassThrough] => [PUCAssessment] => [EFLUrl] => [EFLLinkUrl] => http://www.bounceenergy.com/efls/bounce12.pdf [TOCUrl] => [TOCLUrl] => http://www.bounceenergy.com/terms-of-service-fixed.pdf [YRACUrl] => [YRACLUrl] => http://www.bounceenergy.com/yraac.pdf [REP_Name] => [REP_PUCT] => [customer_service_email] => [toll_free_number] => [status] => active [created] => 2012-12-14 12:40:05 [modified] => 2012-12-14 ) [1] => Array ( [id] => 18 [PlanId] => 17 [PlanName] => Online Only - 12 [PlanDescription] => Online Only - 12 [PlanTerm] => 12 [PlanRate] => [RateId] => 386 [PlanIssueDate] => [PlanMonthlyFee] => 100.00000 [EarlyTerminationFee] => 175.00000 [AveragePrice] => 10.00000 [HurricaneRecovery] => [PlanRenewablePercent] => [ProviderDisplayName] => [ProviderId] => 2 [provider] => fulcrum [ProductZoneId] => [Zone] => 77479 [ProviderInternalName] => [RegularMoveIn] => [PriorityMoveIn] => [OffCycle] => [TDSPPassThrough] => [PUCAssessment] => [EFLUrl] => [EFLLinkUrl] => [TOCUrl] => [TOCLUrl] => [YRACUrl] => [YRACLUrl] => [REP_Name] => [REP_PUCT] => [customer_service_email] => [toll_free_number] => [status] => active [created] => 2012-12-14 12:40:15 [modified] => 2012-12-14 ) ) I want to compare this two array and if any key value is different i want to take it an different array.. $result_val= array_diff_assoc($plan_data, $temp_val); Please help me out !!

    Read the article

  • Convert html with image to ms.word

    - by user1629258
    I have the html code as below: file.html <body> <h1>TEST</h1> <p>this is test</p> <table> <tr> <td>1</td> <td>2</td> </tr> <tr> <td>3</td> <td>4</td> </tr> <tr> <td>5</td> <td><img src="../../../wamp/www/html2doc/SGEPP.jpg"></td> </tr> </table> html2doc.php <?php $handle = fopen("doc2html.html","r"); $contents = ''; while (!feof($handle)) { $contents .= fread($handle, 8192); } header("Content-type: application/vnd.ms-word"); header("Content-Disposition: attachment;Filename=html2word.doc"); echo $contents; ?> The problems: when I convert it,I get html2word.doc but I can get only all texts from html file.For the images in html file I can not get it, it is missing images.So I want to get all data from html and images also.How do I fix this?Anyone help me please,Thanks.

    Read the article

  • URL Frame redirection CakePHP

    - by themanbehindoftheprojectmayhem
    I need to redirect CakePHP installation host to my domain. Location of my Cakephp installation: myhosting.com/newsite/ Domain: www.mydomain.com I'm currently using URL Frame to direct www.mydomain.com to myhosting.com/newsite/. Problem When I load www.mydomain.com, I see all links in the site is pointing to the hosting location - example - myhosting.com/newsite/product/1 It should be pointing to www.mydomain.com/product/1 Any simple way to fix this? Probably very simple to solve it, but I can't bend it. Help much appreciated.

    Read the article

  • 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

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