Re: 1 model for multiple database tables

2009-05-03 Thread Bogdan I. Bursuc
You could do something like this: Add a field in the posts table named type and do the associations like this: var $hasAndBelongsToMany = array( // this here is the HABTM for teams 'Team' = array( 'className' = 'Tag', 'joinTable' = 'posts_teams',

Re: Trying to Understand the Containable Behavior

2009-05-03 Thread majna
http://bakery.cakephp.org/articles/view/quick-tip-doing-ad-hoc-joins-in-model-find On May 3, 4:40 am, Brendon Kozlowski brendon...@hotmail.com wrote: If you can figure out the SQL query, then it could be reverse engineered in to a CakePHP find call.  Containable is merely a mechanism to

Re: Timezone issues

2009-05-03 Thread Miles J
Perhaps a decimal? -5.5 or -5.75 On May 2, 6:36 pm, Turgs timb@gmail.com wrote: Hi The TimeHelper's convert() function takes a userOffset parameter as an integer (hours from GMT). What do you do for locations that are not an *exact* hour from GMT? Such as:    * Mumbai, Maharashtra,

Cake Bake not in app

2009-05-03 Thread damanlovett
When I cake bake my application isn't created in a 'app' folder. Instead all folders are created in the root directory. All though the application works isn't constucted like I have been taught --~--~-~--~~~---~--~~ You received this message because you are

Re: Trying to Understand the Containable Behavior

2009-05-03 Thread j0n4s.h4rtm...@googlemail.com
Hello Rob, I am not sure, but I think Polymorphic Behavior might help you. It is on the bakery. You can bind that one model dynamically to other models by specifying it category (called class). I am not sure but I do not see why it should not work with containable. I'd frist try to use complex

Re: SUBQUERY Question

2009-05-03 Thread harpax
Hello Fabian, Are you sure that you have a HABTM relationship or a belongsTo? In your query there is a field 'user.verse_id', that is not needed. For a habtm, there should be three tables in your db: -- USERS: == id, name, ... VERSES: === id, name, ... USERS_VERSES: == id,

Complex pages using CakePHP MVC

2009-05-03 Thread Rangi
In the blog-style MVC examples, you have one model (eg. post), a controller with actions like write, view and list, and views for each action. This is all quite easy to understand and works really well. What about more complex pages, such as the Yahoo Homepage, or the Facebook Homepage or

Re: Help using special character #171; in paginator

2009-05-03 Thread j0n4s.h4rtm...@googlemail.com
For me putting real UTF-8 characters in worked as well: → for instances (thats rarr;) On a sidenote: I recommend moving pagination header and footer to elements btw :) On Mar 15, 7:54 pm, mklappen mklap...@gmail.com wrote: thanks! working now :) On Mar 14, 12:24 pm, brian bally.z...@gmail.com

Re: Will httpd.conf change affect other applications?

2009-05-03 Thread Aivaras
Why not setting different modes for your virtual host only? And yes - this changing will affect other sites aswell. (assuming your Directiory / is /var/www) Greets, Faifas On Sat, May 2, 2009 at 11:10, shinokada okada.s...@gmail.com wrote: My school server is running on Windows 2003, XAMPP.

Re: Trying to Understand the Containable Behavior

2009-05-03 Thread jmcneese
it works if you associate your models correctly. in each of your models, associate them with the Alert model, like so: public $hasMany = array( 'AccountAlert' = array( 'className' = 'Alert', 'foreignKey' = 'entity_id', 'conditions' = array( 'AccountAlert.model' = 'Account'

user status enum

2009-05-03 Thread Paulos23
Hi Cake people, I have a problem in setting user status.In particular i have a field in users table which is called status and i have set it to enum ('active','inactive') default 'active'.now in users/views/ change_status i want to have a select tag to set status as active or inactive.Here is the

Re: (noob) trouble with belongsTo from another controller

2009-05-03 Thread craig.kaminsky
Thank you, Brian! I thought I was supposed to use the Controller class (var $uses), which would have then 'cascaded' down to incorporate the appropriate Model but, having seen the fix, that seems like some pretty stupid logic on my part ;)! Thank you, again. Your suggestion worked perfectly and

Re: (noob) trouble with belongsTo from another controller

2009-05-03 Thread PCH
I'm having problems with this solution. I've got my child model - state.php class State extends AppModel { var $name = 'State'; var $hasMany = array('Store' = array('className' = 'Store', 'foreignKey' = 'store_id')); } I've got my parent model - store.php class Store extends

Re: (noob) trouble with belongsTo from another controller

2009-05-03 Thread brian
var $uses = array('Store', State'); If you add a 2nd model you have to include both of them in $uses. If the variable is present, Cake will not bother figuring it out for you. Thus, Store is not found. Incidentally, I changed States to State. The model name should generally be singular. On

Re: (noob) trouble with belongsTo from another controller

2009-05-03 Thread brian
Wait a sec. I just looked closer at your models (yes, I've only just started my coffee, again). There are legitimate reasons for having more than one model in $uses but you shouldn't need to have State in there in this case. var $uses = array('Store'); ... $states =

PEAR Spreadsheet_Excel_Writer

2009-05-03 Thread shird
I am trying to get the Spreadsheet_Excel_Writer to work as a vendor in CakePHP 1.2. I have downloaded the PEAR library and the Spreadsheet_Excel_Writer libraries to the following: app/vendors/PEAR/PEAR app/vendors/PEAR/Spreadsheet_Excel_Writer-0.9.1 I am trying to export a list of registrations

Re: user status enum

2009-05-03 Thread brian
Cake has no official support for ENUM. (there may be ways to use them, of course) The simplest way to deal with this would be to change your column to (mysql version): active BOOLEAN DEFAULT FALSE (or TRUE, whichever you want) or active BIT(1) DEFAULT 0 (or 1) or active TINYINT(1) DEFAULT 0 (or

Re: Cake Bake not in app

2009-05-03 Thread Gwoo
how are you trying to create it? Did you setup the console properly? you can also use -app whatever but in general you should always be working from the application directory. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google

Re: Complex pages using CakePHP MVC

2009-05-03 Thread Gwoo
http://bakery.cakephp.org/articles/view/creating-reusable-elements-with-requestaction --~--~-~--~~~---~--~~ 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

Re: Complex pages using CakePHP MVC

2009-05-03 Thread brian
Have a look at elements. And you'll find that, no matter how insignificant, creating a separate model buys you much ease of use. On Sun, May 3, 2009 at 7:04 AM, Rangi rangi...@gmail.com wrote: In the blog-style MVC examples, you have one model (eg. post), a controller with actions like write,

Re: PEAR Spreadsheet_Excel_Writer

2009-05-03 Thread brian
You didn't provide the correct class name. Try it this way: App::import('vendor', 'Spreadsheet_Excel_Writer', array('file' = 'vendors/PEAR/ Spreadsheet_Excel_Writer-0.9.1/Writer/Writer.php')); On Sun, May 3, 2009 at 12:17 PM, shird howsoo...@gmail.com wrote: I am trying to get the

View Element - Unable to call him

2009-05-03 Thread AGD
Hi I created a element called 'user_navigation' and placed it in views/ elements/user_navigation.ctp.I am now trying to call him but am unable to. I tried from the default layout page and from my home.ctp view, but no luck I'm trying to do this, according to the manual. If i change the name, i

Re: user status enum

2009-05-03 Thread Paulos23
Ok Brian so i ll use tinyint.But after that i make default 1 for active and when i wanr to change it to inactive nothing happen.I am using a checkbox coz i think it's the most appropriate for my needs.Can you help me if i am wrong?Here is my code: view ?php echo $form-create('User',

Auth allow works on controllers, but what about pages?

2009-05-03 Thread AGD
I'm using $this-Auth-allow('index'); in my controllers wildly, but cannot figure out how to allow one specific page (like the home). Has anyone experienced this, and how did you solved it? --~--~-~--~~~---~--~~ You received this message because you are subscribed

Re: multiple from error message with escape = false

2009-05-03 Thread KoPanda
Hi Amit, Thanks for your help! Kwun. On Apr 30, 8:00 pm, Amit Badkas amitrb...@gmail.com wrote: Hi, The FormHelper::error() needs second argument in same fashion as you used it in Form::input() method's second argument's 'error' key. i.e., echo $form-error('fieldName', array('rule1 =

Re: user status enum

2009-05-03 Thread brian
That looks ok, I think. Did you try that? One thing I noticed is that your form won't have $id in the action, so $this-User-id = $id; won't always work the way you expect. I usually do something along these lines: function change_status($id=null) { if (empty($this-data)) {

Re: View Element - Unable to call him

2009-05-03 Thread brian
On Sun, May 3, 2009 at 12:58 PM, AGD anibaldam...@gmail.com wrote: Hi I created a element called 'user_navigation' and placed it in views/ elements/user_navigation.ctp.I am now trying to call him but am unable to. I tried from the default layout page and from my home.ctp view, but no luck

Forms - How to give an ID or class to my reset button

2009-05-03 Thread Bankai
How to give an ID to my reset button so that I can style it with CSS. Please advise. This is what I have: echo $form-button('Reset', array('type'='reset')); This is the output: input type=reset value=Reset / This is something like I need to style it: input type=reset value=Reset id=resetBtn /

Re: Auth allow works on controllers, but what about pages?

2009-05-03 Thread brian
In the PagesController context, 'home' is a param, not an action. I guess you could deal with this through ACL (which is likely overkill) or add an isAuthorized() method to PageController. Return false if you don't want the User to see a page. Or just check the param in display() and redirect if

Re: Forms - How to give an ID or class to my reset button

2009-05-03 Thread Bogdan I. Bursuc
echo $form-button('Reset', array('type' = 'reset', 'id' = 'resetBtn')); On Sun, 2009-05-03 at 11:15 -0700, Bankai wrote: How to give an ID to my reset button so that I can style it with CSS. Please advise. This is what I have: echo $form-button('Reset', array('type'='reset')); This is

Re: PEAR Spreadsheet_Excel_Writer

2009-05-03 Thread shird
Thank you for that. I made the changes as needed, but I am still getting the error that it can not find the class. Am I possibly doing the import wrong for the vendor? Or is it that I need to put a different path in there for the PEAR libraries? On May 3, 9:32 am, brian bally.z...@gmail.com

Re: PEAR Spreadsheet_Excel_Writer

2009-05-03 Thread shird
Thank you. I found the problem I was having when I first replied to this. I am now set on this. I did have to declare the vendors path though, I am keeping my vendors in the app directory, instead of a level above, so I had to change that one. After that, it works like a charm. On May 3, 9:32 

Re: Forms - How to give an ID or class to my reset button

2009-05-03 Thread Bankai
Thanks! On 4 mayo, 13:22, Bogdan I. Bursuc bogdanbursu...@gmail.com wrote: echo $form-button('Reset', array('type' = 'reset', 'id' = 'resetBtn')); On Sun, 2009-05-03 at 11:15 -0700, Bankai wrote: How to give an ID to my reset button so that I can style it with CSS. Please advise.

Re: Timezone issues

2009-05-03 Thread Brendon Kozlowski
Although the API says it is an INT variable, it will also accept a float. Because CakePHP 1.2 is also PHP4 compatible, the class methods can't explicitly define the input parameter type, so the only thing telling you it must be an integer is the PHPDoc; however you may run the risk of having odd

Re: Auth allow works on controllers, but what about pages?

2009-05-03 Thread Brendon Kozlowski
As brian pointed out, you could do certain things if you didn't want to allow *all* pages to be visible. To allow non-registered users to view pages, you would add 'display' to your array of allowed pages, as that's the method the PagesController uses to render your pages. (Just like viewing

Is Set::classicExtract depreciated in 1.3?

2009-05-03 Thread techlands
Will Set::classicExtract be depreciated in 1.3 and removed in 1.4 or is it still ok to use? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to

Re: Telling PHP to put NOT amp;

2009-05-03 Thread rartavia
Hello guys, thanks for your answers. As I supposed, it was the debugger::log() function the one converting '' into amp, the real problem was in Dr. Loboto's (thanks man) observation about the reference parameter. After correcting it, I got in my DB #NUMBER; no need for more, here is the

Re: View Element - Unable to call him

2009-05-03 Thread AGD
Thanks for helping out a newbie. All the best On May 3, 8:10 pm, brian bally.z...@gmail.com wrote: On Sun, May 3, 2009 at 12:58 PM, AGD anibaldam...@gmail.com wrote: Hi I created a element called 'user_navigation' and placed it in views/ elements/user_navigation.ctp.I am now trying to

Re: Telling PHP to put NOT amp;

2009-05-03 Thread rartavia
Anybody knows how is it that cake sends the ampersand when it does it on its own? I mean if you use standard forms and for example one textbox contains a value with '', how cake sends it? --~--~-~--~~~---~--~~ You received this message because you are subscribed to

After baked a MVC for keywords, how to view only keywords filtered by user?

2009-05-03 Thread AGD
Hi I've successfully added some user access control and now would like to change the views to show only keywords related to that specific user. How should i do it? For instance for the keywords/index page, i have this simple controller (baked): function index() {

Re: user status enum

2009-05-03 Thread paulos nikolo
I still have problem.And i can't figure out what cause it!I used a checkbox and still nothing. view/change_status ?php echo $form-create('User', array('action' = 'change_status')); echo $form-input('User.status', array ('type' = 'checkbox','label'=

Re: user status enum

2009-05-03 Thread brian
It's usually best to state exactly what problems one is encountering. That being said, for a single checkbox, I usually use this format: ?php echo $form-hidden('User.id'); ? labelActive ?php echo $form-checkbox(’User.status’); ? /label The way you were doing it is more like what one would use

Re: After baked a MVC for keywords, how to view only keywords filtered by user?

2009-05-03 Thread brian
Adjust the conditions in the controller's $paginate array. function index() { $this-Keyword-recursive = 0; $this-paginate['conditions'] = array( 'Keyword.user_id' = $user_id ); $this-set('keywords', $this-paginate()); } But this seems

Re: Trying to Understand the Containable Behavior

2009-05-03 Thread Rob Wilkerson
On May 3, 10:55 am, jmcneese jmcne...@gmail.com wrote: it works if you associate your models correctly. in each of your models, associate them with the Alert model, like so: public $hasMany = array(   'AccountAlert' = array(     'className' = 'Alert',     'foreignKey' = 'entity_id',    

What's Wrong w/ This Loop?

2009-05-03 Thread Kyle Decot
I am attempting to make a loop that goes through all the tags a user has provided(comma seperated) and then if it's not already in the tags table, save it then add it to the event they just added. I can't seem to get it to work because $tag_id is always the same for all the tags so only the last

Re: What's Wrong w/ This Loop?

2009-05-03 Thread brian
It's likely because you're not calling create() before each save. In any case, that code is a bit unweildy. You can save yourself a lot of trouble by using TagBehavior: http://bakery.cakephp.org/articles/view/simple-tagging-behavior No muss, no fuss. Ain't the Bakery grand? On Sun, May 3, 2009

Re: Trying to Understand the Containable Behavior

2009-05-03 Thread Rob Wilkerson
On May 3, 6:43 pm, Rob Wilkerson r...@robwilkerson.org wrote: Hey, Joshua - This is the first solution I've seen/found that looked like it had any hope, but I'm not even a little bit familiar with the association syntax you're using. I already have, in my Account model: public $hasMany =

Re: What's Wrong w/ This Loop?

2009-05-03 Thread Kyle Decot
Thanks, the create() fixed everything and I didn't know there was a Tag Behavior, I'll look into that! On May 3, 7:28 pm, brian bally.z...@gmail.com wrote: It's likely because you're not calling create() before each save. In any case, that code is a bit unweildy. You can save yourself a lot of

Re: user status enum

2009-05-03 Thread paulos nikolo
Yes you are right.Sorry for not being more accurate.The problem i am facing is that when i select a choice check/uncheck the checkbox the controller function dont do anything.In other words the new data in user status cant replace the older.And i cant find if it is problem in form or in

Using Two Tables for Information

2009-05-03 Thread damanlovett
I'm new to CakePHP, so this might be an extremely stupid question. I'm converting an old application to CakePHP. The problem I can't figure out is how to use the users table correctly. I have a table that uses the user table to assign a person to the log, as well as a creater. I can't figure

Re: Fatal error: Call to a member function find()

2009-05-03 Thread kani
Tnx i solved On May 1, 7:40 am, kani infok...@gmail.com wrote: ok tnx i trying to make simple edictionary i created 3 table /mnens,enmns,wordtypes/ Relations is mnens - n wordtypes n - enmns i used scaffolding mnens belongsTo wordtypes enmns belongsTo wordtypes On Apr 30, 8:13 am,

Re: Telling PHP to put NOT amp;

2009-05-03 Thread Dr. Loboto
in form textarea will be sent as exactly. Cake replace by amp; only on output with $html-link(), h(), etc. Not in $form-input(). On May 4, 3:32 am, rartavia royarta...@gmail.com wrote: Anybody knows how is it that cake sends the ampersand when it does it on its own? I mean if you use

Basic Question: Behaviors

2009-05-03 Thread takabanana
So - if I needed a controller to be able to modify multiple tables that are related to each other - I would do the changes in Behaviors, which would be used by each Model (of each affected table) - correct? i.e. If multiple tables need to be modified at once, use a Behavior (called by multiple

Re: Using Two Tables for Information

2009-05-03 Thread brian
Yup, moving a legacy app to Cake can be a bit confusing. Can you post the schema for the tables in question? I mean the old app's, as well as whatever you've come up with so far for Cake. I'm sure something can be worked out. On Sun, May 3, 2009 at 10:46 PM, damanlovett ed...@lovettcreations.org

Re: Basic Question: Behaviors

2009-05-03 Thread brian
On Sun, May 3, 2009 at 11:57 PM, takabanana ttorim...@gmail.com wrote: So - if I needed a controller to be able to modify multiple tables that are related to each other - I would do the changes in Behaviors, which would be used by each Model (of each affected table) - correct? i.e. If