cakephp

php regular expression for validating password with wild characters

I am trying to add wild characters to my current alphanumeric only regular expression to make the password validation stronger. I am not trying to require the user to enter wild characters, just allowing them to enter wild characters. '/^[a-z0-9]{8,16}$/i' I am also using cakephp and doing the validation in the model if that helps, bu...

CakePHP: virtual fields containing model related data fields

Hi there. I've got a model Employee which belongsTo an Address-model. When I fetch data from the Employees model, the associated Address record gets fetched too. Additionally, the Address model has a virtualField full_name. This looks like this: Array ( [0] => Array ( [Employee] => Array ( [id...

CakePHP - Using the RSS Helper without RequestHandler Component

I have set up the RSS Helper (with CakePHP 1.3.4) and all is working - I can access my feeds by /news/feed.rss - as exampled at http://book.cakephp.org/view/1461/Creating-an-RSS-feed-with-the-RssHelper But I want to be able to do this conditionally, in sudo, something like: if (!empty($var)) { switch ($var) { case one : ...

Why i get this error, where i made error?

I tried register script for cake from here and i get this error: Fatal error: Using $this when not in object context in D:\premke\xampps\xampp-win32-1.7.3\xampp\htdocs\register.php on line 23 Where i made error. Thanks in advance. :) ...

PHP image Resize and Crop Function

I want a function which when i upload a photo it should crop the image irrespective of the ration of the image from the centre making sure the crop is well inside the image. the above image is 2592 * 1944 i want to crop an image of 159 * 129 and this is what i get when using a plugin for cakephp (Miles Johnsons Upload Plugin) can...

cakephp console issue : not able to set path

Hello all I am trying to create a controller in cakephp(1.3) using console. I am using windows XP and XAMPP. My current cake console settings below C:\xampp\htdocs\cake\apressblog\cake\console>cake ♀ Welcome to CakePHP v1.3.4 Console --------------------------------------------------------------- Current Paths: -app: console ...

Cakephp - Testing Components - cannot find component

Hi, I am writing a component test in cakephp here is my code <?php class PermissionTestCase extends CakeTestCase { var $fixtures = array('Org'); function testsetPermission() { $this->PermissionComponentTest = new PermissionComponent(); <---- line 5 I get this error - Fatal error: Class 'PermissionComponent' not foun...

CakePHP: $this->Auth->allow() and $this->Auth->allowedActions() - when do I use them?

What is the difference between using the method $this->Auth->allow() and setting the variable $this->Auth->allowedActions ? I can't find any information about setting the allowedActions array where I expected to find it (http://book.cakephp.org/view/1251/Setting-Auth-Component-Variables) - but it exists in the API at http://api13.c...

CakePHP: Make datafield admin-editable only

In my data model, I've got a field that should be admin-editable only. Normal users can edit records in the model and view this specific field, but they should not be able to edit it. Is there a simple/clean approach to do this? I guess that it's necessary to create an extra admin_edit controller action, but what's the best way to "lock"...

Why doesn't my form save the correct value?

Ok, in CakePHP, I have the following code in my view add.ctp: echo $this->Form->radio('color', array('1' => 'red', '2' => 'green', '3' => 'blue'), array('value' => false)); which results in the correct html: <fieldset> <legend>Color</legend> <input type="radio" name="data[Some][color]" id="SomeColor1" value="1" /> <label...

File Upload validation only on record create, not edit

I've got a form that allows a file upload and I'm using data validation to check what type of file it is and that's all good. What I want to do is then allow them to edit that same record but a file upload at that time is not needed. My validation rule is as follows: 'header_pic' => array( 'extension' => array( ...

cakephp: if cache too many page

I want ask : if cache too many page 10000 page is cached. 10000 page create 10000 file cache. Is it ok ? it can create slow? ...

jQuery $.get not returning data anymore

I am using jQuery-1.4.2 with CakePHP and a few days ago I had this working fine but now it isn't. I don't remember changing anything. I am taking the URL generated from the javascript and putting that directly into the browser and I am able to see the results in my browser however javascript is just getting a return value of null. Any...

not able to create controller from console : cakephp : showing fatal error

Hello all I am trying to create a controller in cakephp(1.3) using console. I am using windows XP and XAMPP. My current cake console settings below C:\xampp\htdocs\cake\apressblog\cake\console>cake ♀ Welcome to CakePHP v1.3.4 Console --------------------------------------------------------------- Current Paths: -app: console ...

Return to a form called with <a href login.php class="signin">Sign in</a>

I am calling a login form using jquery with. <div class="session"> <?php if($current_user): ?> <span>Welcome <?php echo $current_user['first_name']; ?></span> <li><a href="logout.php" class="signout">Log Out</a></li> <?php else: ?> <span>Please Login or Register</span> <li><a href="login.php" c...

White labeling CakePHP: What's the best way to provide customization hooks/callbacks to implementers?

I'm developing a CakePHP application that we will provide as a white label for people to implement for their own companies, and they'll need to have certain customization capabilities for themselves. For starters, they'll be able to do anything they want with the views, and they can add their own Controllers/Models if they need to add c...

Change routers cause Cache run invalid

http://book.cakephp.org/view/1382/Clearing-the-Cache It is important to remember that the Cake will clear a cached view if a model used in the cached view is modified. For example, if a cached view uses data from the Post model, and there has been an INSERT, UPDATE, or DELETE query made to a Post, the cache for that view is cleared, ...

CakePHP strange behavior with beforeFilter: I cannot set the variables to the view.

Okay, this will require some setup: I'm working on a method of using nice post title "slugs" in the URL's of my cakePHP powered blog. For example: /blog/post-title-here instead of /blog/view_post/123. Since I'm obviously not going to write a new method for every post, I'm trying to be slick and use CakePHP callbacks to emulate the beh...

CakePHP SignBox Component

Hi, I'm trying to implement a simple login box to my web application, just a regular username and password field if no session is detected and a welcome message if there is one, i started with the following: I thought a simple element will do the job, but i realized than i can't include css or js(not inline) from an element because th...

I selected cakephp as my php framework for my upcoming projects, Is this a good decision ?

Hello I am planning to continue my PHP life with cakephp, I have been a PHP programmer for 2 years,but haven't touched any frameworks, I have to complete a quite big projects immediatly, Is this a good decision ? ...