Re: Why unbind directive doesn't works on read function?

2010-12-11 Thread Dr. Loboto
Because unbind works only for one next query but you do two reads. On Dec 11, 6:21 pm, "Mariano C." wrote: > I have two function getBasicInfo read specific book's information > through $book_id then pass the record readed to increaseOwners that > should upgrade owners field of recordset passed. >

Re: Form is not defined

2010-12-11 Thread Rishi
I have to Form & Ajax helper in the controller On Dec 11, 6:39 pm, cricket wrote: > On Sat, Dec 11, 2010 at 6:29 PM, Rishi wrote: > > Hi > > > I am trying to send a ajax call to an action when ever there is a > > change in selection. > > > create(''); ?> > > >                input('selected',arr

Re: Passing Variable to delete

2010-12-11 Thread Jamie
My post didn't mention checking for a valid ID or saving. I said that Cake's DB layer sanitizes values before passing them to your database. In other words, it filters out SQL injection attempts. To connect the dots, this means that, no, you shouldn't have to do extra checking (though a redundant c

Re: Passing Variable to delete

2010-12-11 Thread Ryan Schmidt
On Dec 11, 2010, at 21:12, Dave Maharaj wrote: > I have been taking the $id /$slug / $whatever_anyone_wants_to_call_it at > face value and doing > > $data = $this->Model->some_function($id, $other, $var); > > if(!data){ > > //see ya > > } > > if($data){ > > //good stuff do what I need to do

Re: Localize only some of a controller's pages

2010-12-11 Thread Ryan Schmidt
On Dec 11, 2010, at 21:24, Dave Maharaj wrote: > You mean in the whatever_controller? > > This? > > function beforeFilter() { > //run parent first > parent::beforeFilter(); > //run local to make specific change > $this->layout('alternate_layout'); > > >

RE: Localize only some of a controller's pages

2010-12-11 Thread Dave Maharaj
You mean in the whatever_controller? This? function beforeFilter() { //run parent first parent::beforeFilter(); //run local to make specific change $this->layout('alternate_layout'); } -Original Message- From: Ryan Schmid

RE: Passing Variable to delete

2010-12-11 Thread Dave Maharaj
Thanks for the links. Im am glad someone finally understood the question. I have been taking the $id /$slug / $whatever_anyone_wants_to_call_it at face value and doing $data = $this->Model->some_function($id, $other, $var); if(!data){ //see ya } if($data){ //good stuff do what I need to do

Re: Passing Variable to delete

2010-12-11 Thread Ryan Schmidt
On Dec 11, 2010, at 08:29, Dave Maharaj wrote: > When passing an id / slug thru a url for delete is there any security > precautions to add? > > Example > > Function delete ($id) { > > $this->Model->deleteAll(array(Model.id => $id, Model.owner => > $this->Auth->user(‘id’))); > > } >

Re: Localize only some of a controller's pages

2010-12-11 Thread Ryan Schmidt
On Dec 11, 2010, at 10:58, cricket wrote: > You could extend the test to check which page is being requested. Or, > whether $this->params['admin'] is set, etc. Yes but I wouldn't like to have to put all sorts of page-specific logic into the global beforeFilter. Just as I can access and change

Internationalization in Cake - not works for me

2010-12-11 Thread Andrew Hodirevski
What am I doing wrong? I've got the next part of View: __('Ваш логин', true), After that I've generated using cake 'cake i18n extract' neccessary path and default.pot, which I copied to app/locale/eng/LC_MESSAGES/ default.po and edited with PoEdit. The part of default.po for the previous string

Re: Simple "join => array('Post')" creates invalid SQL command! --psybear

2010-12-11 Thread Joshua Muheim
Thanks, but while hoping that DRY and convention over configuration would apply here too, adding these informations still results in an invalid SQL statement: SELECT COUNT(*) AS `count` FROM `meta_tags` AS `MetaTag` Post posts left LEFT JOIN `posts` AS `Post` ON (`MetaTag`.`post_id` = `Post`.`id`)

Getting $this->values

2010-12-11 Thread Dave Maharaj
I saw something in an earlier post and did not want to hi-jack the thread so. Cricket posted a snip: $this->find( 'count', array( 'joins' => array( array( 'alias' => 'Post', 'table' => 'posts',

Re: Form is not defined

2010-12-11 Thread cricket
On Sat, Dec 11, 2010 at 6:29 PM, Rishi wrote: > Hi > > I am trying to send a ajax call to an action when ever there is a > change in selection. > > create(''); ?> > >                input('selected',array('label'=>'Select > Category','id'=>'selected','type'=>'select','options'=>$select));?> > >  

Re: Tmp is not writable

2010-12-11 Thread cricket
On Sat, Dec 11, 2010 at 11:51 AM, lucaswxp wrote: > Hello guys. > Yesterday I have installed my first linux, and today I'm tryind to get > cakephp to work... But I get the error: > > tmp/cache/ is not writable [CORE/cake/libs/cache/file.php, line 267] > app/tmp/cache/persistent/ is not writable [C

Re: Simple "join => array('Post')" creates invalid SQL command! --psybear

2010-12-11 Thread cricket
On Sat, Dec 11, 2010 at 2:27 PM, psybear83 wrote: > Hey everybody > > class MetaTag extends AppModel { >        var $name = 'MetaTag'; >        var $displayField = 'name'; > >        function allowsAdd(&$user, $options) { >                $this->find('count', array('joins' => array('Post'), > 'con

Form is not defined

2010-12-11 Thread Rishi
Hi I am trying to send a ajax call to an action when ever there is a change in selection. create(''); ?> input('selected',array('label'=>'Select Category','id'=>'selected','type'=>'select','options'=>$select));?> observeField('selected',

Re: $primaryKey not working

2010-12-11 Thread Tilen Majerle
yes, it does, but magic methods findByFieldName is that the method search exacly for 'Fieldname' so in this case 'Id' is not recognized, that this is not primary key, it will work (it should) is u do this is in model $this->Model->id = 'valuefromyourprimarykey'; //even if ur primary_key is not id

Re: $primaryKey not working

2010-12-11 Thread Rishi
Thanks. I am new, so I have look what exactly "conditions" do. But, according to documentation, declaring $primaryKey must override the 'id' field. Please correct me if I am wrong. On Dec 11, 4:26 pm, Jeremy Burns | Class Outfit wrote: > Rather than do findById try find (...'conditions' => > ar

Re: Tmp is not writable

2010-12-11 Thread Jeremy Burns | Class Outfit
Make sure all the folders within tmp are writable too. Jeremy Burns Class Outfit jeremybu...@classoutfit.com http://www.classoutfit.com On 11 Dec 2010, at 16:51, lucaswxp wrote: > Hello guys. > Yesterday I have installed my first linux, and today I'm tryind to get > cakephp to work... But I get

Re: $primaryKey not working

2010-12-11 Thread Jeremy Burns | Class Outfit
Rather than do findById try find (...'conditions' => array('CodeCategory.CodeCatId' => $id)... You might need t experiment with different iterations of the field name but I think that's what you need to do. findById will look for a field called id, just as findByTractor will search for a field

RE: Passing Variable to delete

2010-12-11 Thread Dave Maharaj
Ok from the beginning time to rephrase: Forget delete. Site/page/id Id gets passed to some_controller function some_function($id) { $this->set(pageContent, $this->Page->getContent($id)); } Some_model Function getContent($id) { $params = array( Some.id' => $id); Return $thi

Tmp is not writable

2010-12-11 Thread lucaswxp
Hello guys. Yesterday I have installed my first linux, and today I'm tryind to get cakephp to work... But I get the error: tmp/cache/ is not writable [CORE/cake/libs/cache/file.php, line 267] app/tmp/cache/persistent/ is not writable [CORE/cake/libs/cache/ file.php, line 267] app/tmp/cache/models/

Re: friends please help

2010-12-11 Thread Alok Mishra
Rewrite htaccess file url On Sat, Dec 11, 2010 at 4:51 PM, Miqdad Ali wrote: > tanx 4 ur reply > > i corrected that problem by editing .htaccess file > > > > Miqdad Ali > http://www.miqdadali.co.cc > > > > > On Fri, Dec 10, 201

RE: Passing Variable to delete

2010-12-11 Thread Dave Maharaj
What im trying to say is take site/some/action/id for example Nothing to do with checking if it’s a valid id nothing to do with saving. Can a user add anything into the url to act as an attempt to reek havoc. Say the id is as an example 123 and someone types in select* from I don’t know anything

Re: $primaryKey not working

2010-12-11 Thread Rishi
No I dont have a ''ID ' in the database. This is the strcture of my table CREATE TABLE `cvmdl`.`code_categories` ( `CODE_CAT_ID` int(10) unsigned NOT NULL AUTO_INCREMENT, `CODE_CAT` varchar(45) NOT NULL, `CODE_DESC` varchar(225) DEFAULT NULL, PRIMARY KEY (`CODE_CAT_ID`) USING BTREE ) ENGI

Re: $primaryKey not working

2010-12-11 Thread Tilen Majerle
ofc...have u 'id' field in table in database?...if no, this is problem :D -- Tilen Majerle http://majerle.eu 2010/12/11 Rishi > hi group, > > I have the following model > > //file model name: code_category.php > > class CodeCategory extends AppModel { > >var $name = 'CodeCategory'; >

$primaryKey not working

2010-12-11 Thread Rishi
hi group, I have the following model //file model name: code_category.php when I try to find a row using $this->CodeCategory->findById($id); I have the following error . SQL Error: 1054: Unknown column 'CodeCategory.id' in 'where clause' Can someone please help me. Check out the new CakePH

Re: Media Plugin - How to set different instructions for differents kinds of images?

2010-12-11 Thread huoxito
this is the error i keep getting ... Warning (512): GeneratorBehavior::make - Failed to make version `s` of file `/var/www/optogrupo/app/webroot/media/transfer/img/ dsc02738_13.jpg`. [APP/plugins/media/models/behaviors/generator.php, line 167] ... when I try to set up Media filter instructions i

Re: Passing Variable to delete

2010-12-11 Thread Jamie
Cake's DB layer (i.e. DboSource and its children) sanitizes everything before passing it to your database. - Jamie On Dec 11, 6:29 am, "Dave Maharaj" wrote: > When passing an id / slug  thru a url for delete is there any security > precautions to add? > > Example > > Function delete ($id) { > >

RE: Passing Variable to delete

2010-12-11 Thread Dave Maharaj
It's ok nevermind. You do not understand what I am asking. Dave From: Tilen Majerle [mailto:tilen.maje...@gmail.com] Sent: December-11-10 3:53 PM To: cake-php@googlegroups.com Subject: Re: Passing Variable to delete if u sanitize string it's the same shit as if u slug it...so u in link

Simple "join => array('Post')" creates invalid SQL command! --psybear

2010-12-11 Thread psybear83
Hey everybody class MetaTag extends AppModel { var $name = 'MetaTag'; var $displayField = 'name'; function allowsAdd(&$user, $options) { $this->find('count', array('joins' => array('Post'), 'conditions' => array('MetaTag.id' => $this->id(; } }

Re: Passing Variable to delete

2010-12-11 Thread Tilen Majerle
if u sanitize string it's the same shit as if u slug it...so u in link pass just id (slug) and if slug exists in database, then ok, if not, then won't be deleted... nothing can be error -- Tilen Majerle http://majerle.eu 2010/12/11 Dave Maharaj > No no you do not understand what I am aski

RE: Passing Variable to delete

2010-12-11 Thread Dave Maharaj
No no you do not understand what I am asking. Site/page/$foo $foo can be 1 hundred million things 1 being something correct everything else is wrong so a user can put in &something=this&that=somethingelse. I am asking because that get pumped right into cake is there anything you should do i

Media Plugin - How to set different instructions for differents kinds of images?

2010-12-11 Thread huoxito
Could anybody post any examples on how I could have Media.filter instructions on the same upload? I want to upload two kind of images on the same form, For one of them I need only two copies, versions. And for the other one I need three copies I tried to do it on a beforeFilter but I was still get

Re: Passing Variable to delete

2010-12-11 Thread Tilen Majerle
with Inflector::slug($id) i think that will be ok -- Tilen Majerle http://majerle.eu 2010/12/11 Dave Maharaj > Sorry…. > > > > Not what I was trying to ask. > > Not the if owner delete part of the action…just the passing of variables > thru url…the actual variable. Cake spits out code link/de

Re: ModelBaker

2010-12-11 Thread dtemes
It looks great, but isn't cakephp version 1.2.1 a bit outdated? I would love to see a Windows and Linux version On 10 dic, 18:36, cake-learner wrote: > I was looking for something like this and share with you guys > > http://www.youtube.com/watch?v=JOOhSQqANQs Check out the new CakePHP Questio

Re: How to publish first paragraph only

2010-12-11 Thread cricket
On Fri, Dec 10, 2010 at 12:02 PM, Stephen wrote: > I personally would present a optional field in the table for an introduction > paragraph (optional), if the admin didn't want to write an introduction > paragraph I would then fall back onto creating an excerpt with php/cakephp > and simply ammend

Re: Time Helper to show only the date and not the time

2010-12-11 Thread cricket
echo date('M j, Y', strtotime($post['Post']['created'])); What I've done in the past a couple of times is put code in afterFind() to add something like this as $data[$this->alias]['created_string']. On Fri, Dec 10, 2010 at 11:41 AM, georgeman wrote: > What if I want to only show the date and not

Re: Localize only some of a controller's pages

2010-12-11 Thread cricket
On Thu, Dec 9, 2010 at 9:27 PM, Ryan Schmidt wrote: > I'm reading about how internationalization and localization are handled in > CakePHP. On this page... > > http://book.cakephp.org/view/1229/Internationalizing-Your-Application > > ...the book explains how to use gettext and the __() function t

RE: Passing Variable to delete

2010-12-11 Thread Dave Maharaj
Sorry.. Not what I was trying to ask. Not the if owner delete part of the action.just the passing of variables thru url.the actual variable. Cake spits out code link/delete/this_slug what could a user change the "this_slug" variable too that could be harful. What should you check /clean / for

Re: Passing Variable to delete

2010-12-11 Thread Tilen Majerle
in ur case, i will first check, if given id is id for record from some user, and if is, then delete it, otherwise don't delete it... -- Tilen Majerle http://majerle.eu 2010/12/11 Dave Maharaj > When passing an id / slug thru a url for delete is there any security > precautions to add? > > >

Passing Variable to delete

2010-12-11 Thread Dave Maharaj
When passing an id / slug thru a url for delete is there any security precautions to add? Example Function delete ($id) { $this->Model->deleteAll(array(Model.id => $id, Model.owner => $this->Auth->user('id'))); } So I pretty much always use deleteAll so its got multiple values

Listing 23 & 24. Validate the username (problem understanding at all)

2010-12-11 Thread John Maxim
Taking validation further (TUTORIAL) Sometimes you can't tell if data is valid just by looking at it. For example, the username may be between six and 40 characters, but you will have to check the database to see if the username is already taken. CakePHP provides the ability to manually mark a fiel

Hello

2010-12-11 Thread a.g.p.
Hi, does anybody can tell me how to show a video on a website with php, once it has been uploaded into the server? Thanks! - Crea tus propias redes de amigos. Sin limitaciones ni restricciones. Libérate de publicaciones de desconocidos Llego

Re: friends please help

2010-12-11 Thread Miqdad Ali
tanx 4 ur reply i corrected that problem by editing .htaccess file Miqdad Ali http://www.miqdadali.co.cc On Fri, Dec 10, 2010 at 12:10 AM, cricket wrote: > On Thu, Dec 9, 2010 at 1:49 AM, Miqdad Ali wrote: > >> friends pl

Why unbind directive doesn't works on read function?

2010-12-11 Thread Mariano C.
I have two function getBasicInfo read specific book's information through $book_id then pass the record readed to increaseOwners that should upgrade owners field of recordset passed. This works pretty good, but $this-unbindModel(array('hasMany' => array('BooksUser'))); $this->id =

Re: How to achieve Email Validation - with 2 different messages

2010-12-11 Thread John Maxim
Solved ! Thanks very much Jeremy. On Dec 11, 6:37 pm, Jeremy Burns | Class Outfit wrote: > var $validate = array( >         'email' => array( >                 'notEmpty' => array( >                         'rule' => 'notEmpty', >                         'message' => 'Please enter your email add

Re: The query number and error number display at bottom of the page ..

2010-12-11 Thread John Maxim
Hey just as simple as it would be, may I ask if there's any usefulness in keeping the query number .. while developing my website or should I turn it off, which is a better practice ? The pros and cons ? I know in the end it would have to be off Thanks On Nov 27, 12:14 pm, John Maxim wrote:

Re: How to achieve Email Validation - with 2 different messages

2010-12-11 Thread Jeremy Burns | Class Outfit
var $validate = array( 'email' => array( 'notEmpty' => array( 'rule' => 'notEmpty', 'message' => 'Please enter your email address.', 'last' => true ), 'email' => array(

Re: How to achieve Email Validation - with 2 different messages

2010-12-11 Thread John Maxim
I have to be honest here I am not programming inclined. I have no idea how to apply your sample to my actual problem... On Dec 11, 6:30 pm, Jeremy Burns | Class Outfit wrote: > You need an nested array: > > var $validate = array( >         'fieldName' => array( >                 'ruleName1' => ar

Re: How to achieve Email Validation - with 2 different messages

2010-12-11 Thread Jeremy Burns | Class Outfit
You need an nested array: var $validate = array( 'fieldName' => array( 'ruleName1' => array( 'rule' => ..rule..., 'message' => ...message..., 'last' => true ), 'ruleName2

Re: UNIQUE key doesn't work as it is supposed ? How to check and confirm if it is UNIQUE

2010-12-11 Thread John Maxim
Hi Jeremy, I want each column to be unique and it has been solved by altering the users table... well I actually dropped it and created a new one with each of the field I wanted unique to be unique.. I posted as solved above, thanks anyway. JM On Dec 11, 3:26 pm, Jeremy Burns | Class Outfit

How to achieve Email Validation - with 2 different messages

2010-12-11 Thread John Maxim
In email validation - tutorial IBM build a quick web: if it is left blank, the message displays "enter a valid email". How to make it so it displays "this field cannot be left blank" ? Only when something not-email entered in it so does it display "enter a valid email" ... I see we at least need