cakephp

[CakePHP] How to echo selected record?

hi all, i'm still a beginner, and guess it's a simple CakePHP question... all i want is to echo retrieved data from database (one row is selected). i have next code: $cover_page = $this->Publication->find('list', array('conditions' => array('Publication.id' => $id))); now, how can i echo field title from selected database row? tn...

Cakephp - get user id in controller when using Auth

It seems like a two-step process to get this, $u = $this->Auth->user(); $uid = $u['User']['id']; Isn't there a variable set somewhere once a user is logged in? (Sorry for the dumb question.) ...

Cakephp - Ordering containable

Hi, I am using containable to reduce the size of my finds but I have got stuck when trying to order the find data, the find can't seem to see the institution join. Here is my code - $result = $this->Candidate->find('all', array( 'conditions' => array('Candidate.id' => $candidatesCodes), 'contain' => array( 'History' => ...

Return result from a form submit into an iframe in cakephp

How to return the results from the submission of a form to an iframe in cakephp? Another question is, how to return some message to iframe for every iteration over the loop of a controller action. lets say it iterates for 10 times, so after every iteration, it will immediately show message like"iteration 1 completed" and so on... in th...

[CakePHP] How can I get record ID on Edit view layout?

hi all, how can i get ID of current record, on Edit view layout? tnx in adv! ...

cakephp form data , sessions and reusing a view between 2 methods in same controller

Newbie php question I have a textbox where a user searches for something and a bunch of results are returned (search() method in the controller) when i click on a link, i want some more information to be displayed (searchMore() method in controller). Questions 1) How can I go back to the the same search.ctp page instead of creating a ...

Send mail using CakePHP

Hello all I am trying to send mail using CakePHP in-built Email component. When I send the mail, there is this footer [This email was sent using the CakePHP Framework: http://cakephp.org]. How can I lose that? Regards ...

What is the best way to check whether javascript is enabled in client browser?

I am developing an application that uses javascript to perform some arithmetical calculations in forms. I would like to check if javascript is enabled in user's browser. If it is disabled redirect the user to warning page asking to enable javascript. I am aware of <noscript> tag. It is not enough just to display the message for me. I do ...

How to use Youtube DATA API in cakephp ?

I have an application and i want to upload video direct from it to youtube using cakephp. Or how can i use zend framework in cakephp. Any idea ? ...

Cakephp localization routes

Hi, My localization files (.po) work if I change the default language, but I can't make the routes working, here's what I've got atm: Router::connect('/pages/*', array('controller' => 'pages', 'action' => 'display')); Router::connect('/login/*', array('controller' => 'users', 'action' => 'login')); Router::connect('/logout/*', array('co...

Using Zend Lucene in Cakephp

Hello all I am creating a webapp in Cakephp, and am thinking of implementing a search function in it. I read about Zend Lucene providing the search capabilities for native PHP webapps. I have my web pages all created without using any kind of database functionality. How will I able to add webpages to the indexes? I don't mean the code,...

a member function check() on a non-object

Hi all, I am using cakePHP 1.26. In a .ctp file, I have a few like of codes like this: $sess = $this->Session->check('user'); if($sess){ // do soemthing } else{ // do soemthing then } But I got this error then: Fatal error: Call to a member function check() on a non-object in /home/vol12/mysite.com/htdocs/app/views/layouts/te...

what is the variable that stores a message in a session in cakePHP?

Hi all, I am using cakePHP 1.26. I got this line of code in a Controller: $this->Session->setFlash('helloworld'); This line of code works perfectly, but I am not sure if there is a variable to store the message: "helloworld" in cakePHP. If yes, can I change the name of this variable? And how can I check out the variable which stored...

how to define two foreign keys in cakePHP

Hi all, I got a table with a few columns. The table has a primary key (replyid), and two foreigne keys (userid and postid). Here is the structure of the table: {replyid, content, userid, postid} The Reply table got two foreigne keys. I am not sure if this is a correct to set the foreign keys like this: class Post extends AppModel{ ...

Can I randomize an array by providing a seed and get the same order?

I am trying to create a random string based on a fixed string. I'd like to be able, if at all possible, create the same random string (i know its an oxymoron) provided I use the same seed. like so: $base = '0123456789abcdef'; $seed = 'qwe123'; function getRandStr($base, $seed) { } such that so long as I give the same $base and $seed ...

Authentication in CakePHP

how can i use myown login function to authenticate users in cakePHP because my users table structure is different from the cakePHP structure. even i overridden the login function it still executing the login function in parent class can any one provide me a solution for this?? thanks in advance ...

The save() method in cakePHP

Hi all, I am doing some self-learning about cakePHP 1.26. I got a table which has two fields {topic, username} I got a simple HMTL form like this: <input type=text name="data[testing][topic]" id="data[testing][topic]"/> The data from this input field was passed to the specific controller with this code: $who=$this->Session->read('u...

Is it possible to retrieve the ID of a new topic immediately after adding into the database?

Hi all, I have some data recieved from a simple HTML form like this: $newdata = array('Testing'=>array( 'topic'=>$data['Testing']['topic'], 'content'=>$data['Testing']['content']), 'new'=>$data['Testing']['new']) ); The data has been added into the database using this line of code: $this->Testing->save($newdata); ...

CakePHP ACL Individual Object Access Control

I'm working on a project that requires one user to have many, say, posts. But, each user can only access his or her own posts. How can I accomplish this type of behavior with CakePHP's ACL component? Currently, it seems that Cake's ACL is focused on actions and controllers rather than objects. Any ideas (even switching to a different f...

CakePHP beginner's question about views

Hello, I have finally quit the idea of learning Zend and instead i find CakePHP and CodeIgniter to be very impressive and simple to understand rather than cramming the strange global functions and configuration of index.php. Anyways, i wanted to ask you that CakePHP even spits out Html in sort of php language like :- <?= $html->css('d...