cakephp

Uploading images with PHP and hitting the script memory limit.

I am trying to upload a JPG image using a PHP script, but the image is keeps causing my script to time out and die giving this error: Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 2136 bytes) in image.php on line 38 How can I prevent the upload from taking place if the image is too big, or have thi...

Mysql : Join/Relating two tables

I have two table 1. Airline -id(primary), name 2. Form - id(primary), operator, other unwanted fields I want to relate Airline.name to Form.operator. Is it possible since Form.operator is not primary key, if yes give me the query. Can some one also guide me as how will the cakephp model relation be in this case ...

Auth timeout problems with CakePHP

This is really bugging me. Has been for years. No matter what I do with core.php or php.ini, my logins timeout after about an hour - usually. Some deployments of identical code and configuration timeout after a respectable amount of time. This is what I have at the moment on one site - timed out after about an hour: session.gc_divisor ...

CakePHP Auth Component Check User Before Login

I want to prevent banned users from logging in to the site and give them a message that they are banned. I tried to use isAuthorized() for this but it allows the user to login and only after that denies him permission to the unauthorized actions. So, basically I want to know where to put the condition that would check if the user table ...

No luck when trying to use JQuery with CakePHP 1.3

Hi, I'm new to cakePHP but am close to quitting using it due to my inability of getting jQuery to work with it. I'm using cakePHP 1.3 and so thought the Html and Js helpers had made Javascript and Ajax redundant but I can't really find any help/api documentation on how to use Js that is sufficient. All I'm trying to do first of all is...

Php framework to slowly refactor an inherited site

Hi, I've recently inherited a medium-sized php site which is horribly coded. It violates every best-practices methodology, from MVC to DRY, is vulnerable to SQL-injection and everything in between. I've visited the other questions and already put everything on a VCS and am considering the framework alternatives. However I'd like your ...

Are there any tools for automatically moving from testing to production servers?

Are there any tools for automatically moving code from testing to (stage and then to) production? We are running on a LAMP stack and don't want to rely on FTP access? Other than that, is there some BASH or PERL script out there for this same process? Our production servers cannot run SVN or HG which we use for development. ...

What is the best way to limit a date range in a CakePHP view?

I have a date field which the users of the system can edit, but there are limitations on what they may be able to select. Right now it is simple and just limited to "n" number of days into the future. But I could see it getting more sophisticated with only allowing weekdays, etc. I can write the select elements manually, but I'm curio...

Custom Login Function with CakePHP's Auth Component

I need to know how to customize the login function that I am using with the Auth Component. Currently, it is blank and being handled automatically by the component. I need to add some conditions in it that which I want to execute before login happens. ...

TCPDF QR Code is different all the time

I've got TCPDF installed in CakePHP 1.3 and am using it to generate a PDF of a QR code. It's a very simple function that creates a A9 sized page, two strings and one QR code. The QR code is for a simple url (ie. 'example.com/12345'). I can load the page in a browser (Safari using it's built in PDF reader.) and each time I reload it, t...

CakePHP HTBTM with extra field : Double Logical Relationship : How to construct $this->data in controller on my own

Hi, I have HABTM relation between "Event" and "Category" models. But in the bridge table, "categories_events" table, there is an extra field called "is_primary"; meaning and Event is belong to 1 primary category and many secondary categories. I deployed 1 select box named "primary_event" and checkboxes named "seconday_event[]". When I...

Cake PHP: How do I make one variable avaiable across all view and elements.

Hello, I want to access id of current logged user name of current logged user group_id of current logged user group_name of current logged user across the view files, to switch menus and tabs on and off according to group_id. How can I achieve this with minimum sacrifice of performance? Thanks ...

Existing CMS or framework

Hi and this is my 1st post here! I am currently getting quotes to build a fairly simple restaurant directory / offers booking website. I have had various companies offer bespoke, joomla, drupal and wordpress solutions. I Have a budget of 20k so should I be looking at something in say phpcake or joomla? I would rather have something cl...

CakePHP: pagination and custom routes

I don't seem to be able to use a custom route with pagination. The URL of the blog should be http://www.domain.com/en/page:2. However, the links generated by the PaginateHelper (prev and next), keep adding the controller and action, so that the URL looks like http://www.domain.com/posts/index/en/page:2. The route config is quite simple...

How to Master/Slave switch, load balancing in CakePHP

I need to implement master/slave/load balancing into an existing site. Does anyone use these (or other) implementations for master/slave switching? The resources I found on how to implement master/slave into Cake:. (preferable) gamephase.net/posts/view/master-slave-datasource-behavior-cakephp bakery.cakephp.org/articles/view/master-...

[CakePHP] How to left outer join next tables?

I have two tables like this: CREATE TABLE IF NOT EXISTS `publications` ( `id` int(11) NOT NULL AUTO_INCREMENT, `numerated` tinyint(1) NOT NULL DEFAULT '0', `title` text COLLATE utf8_unicode_ci, `collection_id` int(11) NOT NULL, `note` text CHARACTER SET utf8, `adminNote` text CHARACTER SET utf8, PRIMARY KEY (`id`), KEY `...

CakePHP - TinyMceHelper helper error: Method TinyMceHelper::__name does not exist

So I'm wanting to implement the TinyMce helper. I've followed instructions from the cakephp bakery but am still getting a error. This is the helpers array in my project controller: var $helpers = array('Form', 'Time', 'Crumb', 'Text', 'Tinymce'); This is the tinymce helper I downloaded: <?php class TinyMceHelper extends AppHelper {...

Dropdown of Numbers

is there a built-in helper that creates a drop-down/select of numbers from start to end like 1 to 50 <select> <option value='1'>1</option> <option value='2'>2</option> <option value='3'>3</option> <option value='4'>4</option> <option value='5'>5</option> </select> I dont want to create a custom helper or use for loop ...

Script restarts executing after a while

Hi, I'm busy with a project in cakePHP where I need to parse a couple of XML files and insert the relevant data in my mysql database. The script inserts what it should insert, that's not the problem. For example if I parse one or 2 files (approx 7000-8000 records), nothing goes wrong. Problems start when I parse the third or fourth xml...

Correct form of indefinite article (a, an) in PHP strings

Is there an easy way to substitute a/an in a string to agree with the following word - much the same as the way 'S' works in Date format? e.g. $apple = 'apple'; $pear = 'pear'; echo "This is a $apple, this is a $pear." --> This is an apple, this is a pear ...