cakephp-1.2

CakePHP: Passing $this->data to the View from Controller

Hi all, I'm using CakePHP 1.2 and I'm just wondering if there is any side affect on passing the $this->data to the View from the Controller. Ex: // inside PostsController, I have this code: $this->data['Posts'] = $this->Post->find('all'); instead of : $posts = $this->Post->find('all'); $this->set(compact('posts')); // inside the /...

Cakephp 1.2 Paginator and PassedArgs

Problem: when i have a search resultset with pagination, the links next, prev and numbers do not keep the search parameters. Seems to be a common problem. I searched everywhere on the internet, and at last i found that i should put this statement in the view: $paginator->options(array('url' => $this->passedArgs)); However, i can't ...

Writing PHP5 only code for CakePHP 1.2

Given that CakePHP 1.2 supports both PHP 4 and 5, what's the politics on writing plug-ins, helpers, components etc to be shared with the public that only run in PHP5? I want to be better my own code, properly marking functions as protected or private which is only possible in PHP5, but at the same time make reusable code that benefits o...

CakePHP URL with HTML Anchor

I'm using cakePHP 1.2, and wondering how I can handle a URL that dynamically builds the page with a slug, but then links to the appropriate area with an HTML anchor. An example: www.mysite.com/pageSlug#anchor I would parse out the slug, which would be used to dynamically build the page. Once built, I would need to jump to the anchor. A...

cakephp unit testing models, fixtures problem

Hey all, So i'm working with CakePHP v1.2.5. On my current project, I decided to start writing tests as I code the functionality (yay TDD). I'm having trouble with fixture loading though. To aid in the process, I'll describe my code (Really quite simple right now). My model is defined like so // app/models/newsitem.php <?php class New...

Turn of Cakephp Auth password hashing.

I am upgrading a cakephp app at my new job from l.1 to 1.2. I am replacing the homegrown 1.1 authorization code with the great Auth component. The problem is that the passwords are not hashed in the legacy DB. How can I turn off the password hashing temporarily so I can start using the Auth component. Don't worry, I will hash the passwo...

cakephp 1.2 good simple authetication sample

Hello, I was trying several authentication samples for cakephp 1.2 but didn't find any flawless piece of code. Can you suggest me some code? Thank you ...

Pagination of Multiple Models in CakePHP 1.2.5

I'm working on a view for a blog that mixes blog posts, comments, and uploaded media items into one large grid layout. I've set up the individual models in CakePHP and the associations, some of which are as follows: Comment BelongsTo Post or Media Post HasMany Media What I'm working with is trying to sort all three models (Comment, M...

CakePHP dynamic element function placement

This site is built using CakePHP 1.2* I have an element that needs to be placed in multiple views under multiple controllers. This element is very dynamic, every time a page is loaded it needs to call a function (which is rather large) and then display what was returned. There are a few options that I have thought of, none of which I ...

Slow server response time - CakePHP

I am using CakePHP 1.2 for building a website. The problem i am facing is when ever a page loads it takes a lot of time in "waiting for www.example.com". The server response time is very slow. First i thot it was my database queries, but they were executing in less than seconds time. Next i also contacted the server people. They told it ...

CakePHP Auth retrieve extra data

I am just learning CakePHP, so excuse me I am using CakePHP 1.2.5 Auth component with UsersController. User model contains two tables: class User extends AppModel { var $name = 'User'; var $belongsTo = 'Company'; } When login() is called, I see the data being retrieved in the SQL log (LEFT JOIN is being executed), so the mod...

Names of HTML form naming conventions

In Rails and CakePHP1.2, forms tend to include input elements with names like the following: <input name="comment[author]" /> Is there a formal name for the notation used in the "name" attribute? Likewise, in CakePHP1.1 I do believe that the same would have looked like this: <input name="comment/author" /> Again, is there a formal...

Cake PHP - Form Validiation doesn't work

Hi everybody, my CakePHP (1.2.5.) doesn't validate my form correct. $this->UserData->save($this->data); gives me always a true value back. I can't find the problem. The label for UserData.nichname works. That's the View: <?php echo $form->create('UserData'); echo $form->error('UserData.nick_name'); echo $form->input('UserData.nic...

CakePHP Media plugin with php safe_mode

Hi, i'm trying CakePHP( 1.2.6 ) and Media plugin( 0.60 ) on shared server with php_5.2.5( safe_mode : On ). And upload jpeg file by media plugin, following error message apear on attachments.ctp( media plugin's element ). An error occured while transferring the file. How can i fix this error without php cgi_mode on shared server...

Refreshing or double clicking on a link too quickly causes a CakePHP app using the Auth component to log the user out

I've noticed that when I refresh the page twice in a row or double click on a link, the user is automatically logged out. I'm using cakephp 1.2 and the Auth component. I don't have a lot of experience with CakePHP, any ideas what could cause this? ...

FullCalendar not Working in CakePHP 1.2.5 with jQuery 1.4.1

I am trying to fetch the events data through a URL which will return JSON data. The same code is working with jQuery 1.3.2 but not with jQuery 1.4.1 I am getting this error in FireBug console a is undefined for (var i=0; i fullcalendar.js (line 369) I am getting the JSON data as I can check it in response header of FireBug jQuer...

Strtotime error in Cake 1.2.6

PHP Warning: strtotime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date. timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still ge tting this warning, you most likely misspelled the timezone identifier. We selected 'America/Los_...

CakePHP 1.2.6 / PHP5.2.12 Error in Array Loop in Assignment by Reference

I'm working on retrieving a stack of data and for some reason some of the data gets corrupted. For instance, I've got some Post models that each are related to Comment models (hasMany), and each of the Comment models belongsTo a User. When retrieving the data, here's what I get from the database for the comments: [Post] => Array ( ) [...

HABTM Data Corrupted During __saveMulti()?

I'm using Cake 1.2.6 and last night I noticed that a HABTM relationship wasn't being saved when I submit a form. I have a HABTM relationship between Committee and Volunteer. The primary key for a Volunteer is a UUID while the primary key for a Committee is a human readable string (e.g. BOARDOFDIRECTORS, FAIRCOMMITTEE, FAIRASSOCIATES, e...

CakePHP: find neighbors, order on 'name' or 'order'

Hi, I have a list of ordered items, ordered according to the int field order. I'm creating a gallery in CakePHP 1.2 that has a prev and next button and those should link to the previous and next item according to their ordering, not according to their id. In order to get this result I've included the 'order' parameter to the find funct...