Re: HABTM Count

2009-04-09 Thread yodi
You can use Set::extract for tidying array On Thu, 2009-04-09 at 06:56 -0700, rossjha wrote: > This seems to be working. > > $this->Tag->unbindModel(array('hasAndBelongsToMany' => array > ('Improvements'))); > $this->Tag->bindModel(array('hasOne' => array( > 'Improv

Setting up ACL permissions

2009-04-09 Thread djXternal
Hey everyone I have been following the tutorial on setting up an ACL system, and everything has gone well until I got the the section on setting permissions: http://book.cakephp.org/view/648/Setting-up-permissions I put in the initDb() code they give you there, but when I try and load the page to

Re: AppController not loaded for missing controller pages

2009-04-09 Thread Dr. Loboto
Make you own error handler and call these methods manually if it wasn't done in normal flow. It is the only way. On Apr 8, 11:21 pm, "rich...@home" wrote: > In my AppController, I set a bunch of view variables in the > beforeFilter() {} callback. > > I use these view variables ($authUser) in the

Re: XML parsing

2009-04-09 Thread mscdex
On Apr 9, 3:08 pm, "smithtrev...@googlemail.com" wrote: > Ok, now I've done that, I've spent the last couple of hours trying to > insert the parsed xml into a database table called teams. > Well, depending on what your table columns are named, you may need to change some of the keys in the array

Re: Live Validation

2009-04-09 Thread yodi
If you using Jquery, maybe i can give some hand. My method is: 1. Sending input using JSON -> Controller. 2. Validates on controller 3. Send back report using JSON to View On Wed, 2009-04-08 at 20:06 -0230, Dave Maharaj :: WidePixels.com wrote: > Has anyone have any advice on live validation u

Re: Lightbox

2009-04-09 Thread Manisha
Ok, thank you Miles, I will try for the thickbox. On Apr 9, 5:09 pm, Miles J wrote: > Im pretty positive lightbox is images only. You would have to try > thickbox, or another equivalent. --~--~-~--~~~---~--~~ You received this message because you are subscribed to

Re: What does this mean?

2009-04-09 Thread Miles J
Have you edit the cake for libs at all? Because thats where its located. Or have you overwritten that method? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-

Re: login voodoo

2009-04-09 Thread Jorge Horacio Cué Cantú
Your wellcome, sorry for the small mistake. 2009/4/9 brian > > 2009/4/9 Jorge Horacio Cué Cantú : > > Hello, > > > > > > Set > > > > $this->Auth->redirect = false > > > > in AppController::beforeFilter(). > > > > The the login() action will be called after a successful login. > > > > Thanks,

Model config for table with no ID

2009-04-09 Thread mattalexx
Hi I am trying to access a database table that was built without a primary key (I know). How would I go about this in CakePHP. Is it possible or do I have to just use Model::query all the time? --~--~-~--~~~---~--~~ You received this message because you are subscri

What does this mean?

2009-04-09 Thread Dave Maharaj :: WidePixels.com
I keep getting Fatal error: Call to undefined function loadmodel() I have no idea what has happened butikeep seeing this error. If i delete cookies it disappears but i am sure thats not a good thing. Anynoe know why I am getting this message so i canback track to see what i have done wrong? T

Re: New CakePHP book available.

2009-04-09 Thread GrumpyCanuck
On Apr 3, 8:05 am, Fábio "Kym" Nascimento wrote: > Hey, > > I'd like to see a summary of yourbookbefore buying, I think people > wants to know a little deep what are you talking about on thebook, > chapters and sub-chapters names at least. > > Thanks Hrm...maybe I should put that up there on the

Re: Get "last deleted id" from afterDelete?

2009-04-09 Thread park
Wow, never heard of this before! Thank you very much! On Apr 9, 11:27 pm, grigri wrote: > In the afterDelete() callback, $this->id(or $model->id) in a behavior > will refer to the just-deletedmodel. It's cleared after the callbacks > have been called, just before Model::del() returns. > > hth >

Re: complex HABTM question

2009-04-09 Thread Miles J
Use Containable over Recursion. http://book.cakephp.org/view/474/Containable --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscri

Re: complex HABTM question

2009-04-09 Thread luke83
The problem is the attribute recursive: i cannot set it to 3 as i need! Is there a way to bypass the problem or a trick to have more deep association fatching? Thanks! On 9 Apr, 16:27, luke83 wrote: > Hi there, > first question, complex question :D > > i have tables in db like this: > > + league

Pagination with non-fixed page size (how can I customize paginateCount?)

2009-04-09 Thread ahmedhelmy007
Hi all. A brief description of my problem: I need to make pagination with non-fixed page size, every page must contain items from certain month only. I wrote the query correctly , but the CAKE cannot count pages correctly because it calculates the number of pages by dividing the total count of i

Re: Lightbox

2009-04-09 Thread Miles J
Im pretty positive lightbox is images only. You would have to try thickbox, or another equivalent. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googleg

Re: Reverse "LIKE" sql statement

2009-04-09 Thread Miles J
NOT LIKE '%term%' Is that what you mean? http://dev.mysql.com/doc/refman/5.0/en/string-comparison-functions.html --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to

Re: Putting a label on same line as an input field

2009-04-09 Thread Danny Lieberman
Dardo Thanks - I already tried this direction and it doesn't affect the location of the label - it still appears above the input box. I can change label placement for all the forms but in this case I only want to change one particular field label In the view: echo $form->input('idcode', array(

Re: The right way to pass vars from a view to the layout?

2009-04-09 Thread martinp
If I've understood correctly I had a very similar problem. I was using the inbuilt pages controller and had an 'AddThis' widget in the footer of the layout that I generally wanted to be visible, but on certain pages it wasn't required. All I did was at the top of the pages I didn't want the 'AddTh

Re: What am I missing ($conditions in a find)?

2009-04-09 Thread czg
Same thing happens if I replace "generatetreelist" with "findAll" -BP On Apr 9, 3:22 pm, cartosys wrote: > my conditions: > >                 $sqlConditions = array( >                                 'Node.lft' => ">= ".$node["Node"]["lft"], >                                 'Node.rght' => "<= "

What am I missing ($conditions in a find)?

2009-04-09 Thread cartosys
my conditions: $sqlConditions = array( 'Node.lft' => ">= ".$node["Node"]["lft"], 'Node.rght' => "<= ".$node["Node"]["rght"]); $nodes = $this->Node->generateTreeList($sqlConditions); and this is the r

Re: XML parsing

2009-04-09 Thread smithtrev...@googlemail.com
Ok, now I've done that, I've spent the last couple of hours trying to insert the parsed xml into a database table called teams. However, I am struggling to do so. I've had a few tries using a number of different methods. http://abeautifulsite.net/notebook/42 http://www.codewalkers.com/c/a/Databa

Re: XML parsing

2009-04-09 Thread smithtrev...@googlemail.com
Ok, I've managed to do it by using the XML file directly from the website, and not using a local copy. This is definitely much better. Thanks for your help. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" gr

Re: CAKE_ADMIN

2009-04-09 Thread Gwoo
You probably downloaded 1.2 but are reading about 1.1. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, se

Re: XML parsing

2009-04-09 Thread smithtrev...@googlemail.com
Ok, I tried the test, and also print_r($parsed_xml) and var_dump ($parsed_xml). When I tried the test, with all of them except var_dump($parsed_xml), it again just showed "Array". But with var_dump($parsed_xml) it shows: array(1) { ["Testxml"]=> array(2) { ["test2"]=> string(17) "Content of tes

Re: DB2 and integer ids!

2009-04-09 Thread Gwoo
You will have to look at the driver for DB2. If you need to override it you can place it in app/models/datasources or submit a patch. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this gr

Re: read () select data to return

2009-04-09 Thread Dave
OK unbind model. I managed to unbind 1 model but how unbind multiple models at one? $this->User->unbindModel(array('hasMany' => array('Message'))); thanks Dave On Apr 9, 2:29 pm, "Dave Maharaj :: WidePixels.com" wrote: > Can anyone assist me with this? > > In the standard controller view func

RE: read () select data to return

2009-04-09 Thread Dave Maharaj :: WidePixels.com
I actually just used unbind to not get any results from the 2 models since in that particular layout I do not need any data from those associated tables. Thanks for the info and time. Dave -Original Message- From: brian [mailto:bally.z...@gmail.com] Sent: April-09-09 2:33 PM To: cake

Re: login voodoo

2009-04-09 Thread brian
2009/4/9 Jorge Horacio Cué Cantú : > Hello, > > > Set > > $this->Auth->redirect = false > > in AppController::beforeFilter(). > > The   the login() action will be called after a successful login. > Thanks, that's it (sort of). The var is actually $this->Auth->autoRedirect. So, for the record: A

Re: read () select data to return

2009-04-09 Thread brian
You could either use find() along with 'contain' or you could simply not display certain fields in the view. On Thu, Apr 9, 2009 at 12:29 PM, Dave Maharaj :: WidePixels.com wrote: > > Can anyone assist me with this? > > In the standard controller view function there is this: > > $this->set('user

CAKE_ADMIN

2009-04-09 Thread centavo
Hi! In the 1.1 Collection of the manual, section: 5 Configuration, I'm reading through the section "Advanced Routing Configuration: Admin Routing and Webservices" The third paragraph begins: "To enable this, first, uncomment the CAKE_ADMIN line in your /app/ config/core.php file." So, I go to

Re: login voodoo

2009-04-09 Thread Jorge Horacio Cué Cantú
Hello, Set $this->Auth->redirect = false in AppController::beforeFilter(). The the login() action will be called after a successful login. Regards. 2009/4/9 brian > > Actually, yes, I did consider that and I think I will do it that way. > But that still leaves with this problem: how to

read () select data to return

2009-04-09 Thread Dave Maharaj :: WidePixels.com
Can anyone assist me with this? In the standard controller view function there is this: $this->set('user', $this->User->read(null, $id)); which gets all the User info from the tables based on the ID but I do not want every thing returned. I have information for that User in their profile fun

Re: XML parsing

2009-04-09 Thread Mathias Hunskår Furevik
Hi, $parsed_xml should be an array representation of the XML. If nothing is returned (you could also try print_r($parsed_xml) or var_dump($parsed_xml) ) then your XML is probably malformed or not loaded. Try making a simple test like this and show us the output: $tstxml = " Content of test 2 Co

Re: XML parsing

2009-04-09 Thread smithtrev...@googlemail.com
Thanks for your help. I've been using this code and I think it's sort of worked. function index() { App::import('Xml'); $file = "http://localhost\parses\y.xml";; $parsed_xml =& new XML($file); $parsed_xml = Set::reverse($parsed_xml); // this is what i call magic debug($pars

Re: login voodoo

2009-04-09 Thread brian
Actually, yes, I did consider that and I think I will do it that way. But that still leaves with this problem: how to check this field after a successful login? On Thu, Apr 9, 2009 at 11:48 AM, Angry Coder wrote: > > Have you considered a separate column in your users table of > "accepted_eula"

Re: login voodoo

2009-04-09 Thread Angry Coder
Have you considered a separate column in your users table of "accepted_eula" or "eula_version_accepted" if you want to track which version of the EULA they have accepted? It would be easy then to force users to re-accept if it changes and you do not have to lose the "last_login" data if you wish

Re: Get "last deleted id" from afterDelete?

2009-04-09 Thread grigri
In the afterDelete() callback, $this->id (or $model->id) in a behavior will refer to the just-deleted model. It's cleared after the callbacks have been called, just before Model::del() returns. hth grigri On Apr 9, 4:09 pm, park wrote: > Hi, > > Working on a set of models, in which after one mo

Re: login voodoo

2009-04-09 Thread brian
OK, it looks like one can't override login() with AuthComponent in place. I was sure I could, and it doesn't make sense to me that I can't. If someone knows otherwise, please advise. So, I tried putting my code in isAuthorized(). AppController: function beforeFilter() { $this->Auth->fiel

Reverse "LIKE" sql statement

2009-04-09 Thread sylvainhugues
Hi every one, If I wanna fetch a db entry how got "blue car" in a field, 1 > I can set "WHERE fieldName LIKE '%blue%' " 2 > But how could I make the opposite ? I got "blue car" and I wanna find an entry whith "blue". Obviously LIKE '%blue car%' will not work. (I don't wanna (can't) handle "blue

DB2 and integer ids!

2009-04-09 Thread nvrs
Hi all, I am considering cake as a front-end to a large db2 database and i have this weird problem, which does not apply to mssql and mysql databases. Whenever i try to a view an entry from a table by clicking on the respective link on the index page, i get an SQL Error: 42818. The cause is that

complex HABTM question

2009-04-09 Thread luke83
Hi there, first question, complex question :D i have tables in db like this: + leagues | - lid | - name + users | - uid | - name + groups | - gid | - name + league_staff | - lid | - gid | - uid The models: class League extends AppModel { var $name = 'League'; var $primaryKey = 'lid'

Limiting select to certain values

2009-04-09 Thread Toby
Hi there, I have 4 table that relate to this problem... - Products - Types - Sizes - StockItems I have set CakePHP so that each product has a Type. I am now sorting out the StockItems controller/views. Each StockItem will relate to a single Product and will specify the Size of the StockItem. M

Get "last deleted id" from afterDelete?

2009-04-09 Thread park
Hi, Working on a set of models, in which after one model got its record updated, the Log model will be manipulated accordingly. $cascade = true of Model:del() doesn't seem to work, 'coz models mentioned above are not associated. (Log model has a field 'item_id' that is shared by all other models

login voodoo

2009-04-09 Thread brian
I need to direct first-time users to an EULA page for a client's extranet. I thought I'd check the last_login field in order to decide whether to redirect there or not. However, for some reason, I'm being logged in but none of my custom code is running. function beforeFilter() { parent::b

Re: Paginator with "table name"."field"

2009-04-09 Thread Celso
sortBy do not exists !!! :( http://api.cakephp.org/class/paginator-helper On 8 abr, 03:24, Elavazhagan chidambaram wrote: > this is ur code sort('MUNICIPIO', > 'Municipio.Nome_municipio'); ?> > > this code right code $paginator->sortBy('Municipio.Nome_municipio', 'MUNICIPIO'); ?> > > On Tue,

Re: Data validation always return true

2009-04-09 Thread brian
set() is called from within save() before validation. If you need to call validates() yourself, you must first set the data. http://book.cakephp.org/view/410/Validating-Data-from-the-Controller http://api.cakephp.org/view_source/model/#line-1094 On Thu, Apr 9, 2009 at 10:05 AM, Rhee wrote: > >

Re: Get $Auth->user() in Model?

2009-04-09 Thread park
I see. Thanks a lot! On Apr 8, 4:45 am, Miles J wrote: > You are not able to use Components in models. The best is to import > the session component. > > App::import('Component', 'Session'); > $Session = new SessionComponent(); > > $user = $Session->read('Auth.User'); --~--~-~--~~--

Re: Data validation always return true

2009-04-09 Thread Rhee
Maybe I am just too idiot to understand this. I know what $this->Model->set() do. But I used for adding a new data set in database. Also, it has no ID / primary key yet, by the time i called set() method. So what did set() do, so that validate() can be called properly after that? On Apr 9, 3:52 p

Re: HABTM Count

2009-04-09 Thread rossjha
This seems to be working. $this->Tag->unbindModel(array('hasAndBelongsToMany' => array ('Improvements'))); $this->Tag->bindModel(array('hasOne' => array( 'ImprovementsTag', 'FilterTag' => array( 'className' => 'Tag',

Re: Data validation always return true

2009-04-09 Thread brian
On Thu, Apr 9, 2009 at 8:06 AM, Rhee wrote: > > Next question, why is it now working? What did $this->Model->set() do? > Can you gimme short explanation? > It sets the Primary Key for the model and $Model->data values. http://api.cakephp.org/class/model#method-Modelset --~--~-~--~~

Re: The right way to pass vars from a view to the layout?

2009-04-09 Thread mark_story
$this->set() doesn't work? http://api.cakephp.org/class/view#method-Viewset -Mark On Apr 8, 9:40 am, the_woodsman wrote: > To my mind, a controller shouldn't need to know about the ugly > semantics of Javascript dependencies etc - it's entirely presentation > related, is irrelevant to other ou

HABTM Count

2009-04-09 Thread ross.hagg...@googlemail.com
Hi i have the following associations: var $hasAndBelongsToMany = array('Improvements'); var $hasAndBelongsToMany = array('Tags'); With a join table improvements_tags I want to be able to count the number of time a tag has been used. The following sql query works, but i'm not sure how to do this

Re: Data validation always return true

2009-04-09 Thread Rhee
@ logout: sure maybe there is an error there, I didn't only copy paste the source, I did some modification to cover up the real messages ... But thanks a lot for your concern. ;-) On Apr 9, 2:02 pm, logout wrote: > Is this a typo here: > > 'alphanumeric' => array ( >                              

Re: Data validation always return true

2009-04-09 Thread Rhee
Yes of course, i did test it in if-block ... ;-) Code looks like this: if ($this->User->validates($this->data)) { // This block will be always executed } Anyway, i found how to work around it. Before if-block, i put set(). Code: $this->User->set($this->data); if ($this->User->validates())

Re: Data validation always return true

2009-04-09 Thread logout
Is this a typo here: 'alphanumeric' => array ( 'rule' => 'alphaNumeric', 'message' => 'Error ) because the Error is missing the closing ' On Apr 8, 6:41 pm, brian wrote: > > $this->User->validates($this->data); // al

Re: Sessions lost

2009-04-09 Thread logout
In the core.php there is this section: * The preferred session handling method. Valid values: * * 'php'Uses settings defined in your php.ini. * 'cake' Saves session files in CakePHP's /tmp directory. * 'database' Uses CakePHP's database sessions. * *

Re: share elements, helpers etc across multiple apps

2009-04-09 Thread majna
Did you see output from debug(Configure::getInstance()); ? $behaviorPaths= array(ROOT.'common'.DS.'models'.DS.'behaviors'); controllerPaths componentPaths helperPaths pluginPaths On Apr 8, 3:19 pm, Ernesto wrote: > And... to share a behavior? > > On 7 Apr, 18:11, majna wrote: > > > Setup

Re: Subdomains and Routes

2009-04-09 Thread Aurelius
thx! That was much easier as I expected, Cake rocks! On 9 Apr., 02:31, schneimi wrote: > Hi Aurelius, > > I use something like this in config/routes.php: > > $subdomain = substr(env("HTTP_HOST"), 0, strpos(env("HTTP_HOST"), > ".")); > > if ($subdomain != 'domain') { > Router::connect('/', ar

Lightbox

2009-04-09 Thread Manisha
Hello All, I am using http://bakery.cakephp.org/articles/view/lightroom-helper for lightbox effect. This is working properly for showing images not for HTML Is it only for Images? Manisha --~--~-~--~~~---~--~~ You received this message because you are subscribed

Re: Question about Routes and honoring MVC

2009-04-09 Thread Martin
The pages on my website are hierarchicaly structured as a tree, and one of the mandatory requests for the website is to represent the page hierarchy in the URLs. The pages and their relationships are defined in a database table. So, what I would like to do is query the database (and cache the resu

Re: IN statement in Findall

2009-04-09 Thread Markus Jürgens
hi! $data = $this->Blog->findAll(array(' > > Blog.id' => array(7, 8, 9),array('Blog.blogId','Blog. >> >> blogImage','Blog.blogTitle')); > > 2009/4/9 kaushik > > How to use not 'IN' in condition in finall()? > >$data = $this->Blog->findAll(array('Blog.id' => > '5'),array > ('Blog

Re: Use another model function from an unrelated model

2009-04-09 Thread dr. Hannibal Lecter
grigri had a nice clean solution for this: http://bin.cakephp.org/saved/38624 On Apr 9, 12:13 am, Joe Critchley wrote: > You should probably use the ClassRegistry class. > > You can instantiate an unrelated model by doing the following: > > $ModelName = ClassRegistry::init('ModelName'); > > ...

Re: validation notEmpty

2009-04-09 Thread sologroupmc
'Required' is not a rule as noted in http://book.cakephp.org/view/127/One-Rule-Per-Field Your code should be: var $validate = array( 'blogCategoryId' => array( 'rule' => 'notEmpty', 'required' => true, 'message'=>'Please select Blog category.' ) ); On M