static function in model

2011-01-24 Thread cake-learner
I want to define the static function so that the user name ( firstname + lastname ) can be used everywhere in view. Class User{ static function getName( $id ){ $userObj = $userObj - read( 'id', $id ); return $userObj[ 'User' ][ 'firstname' ] . ' ' . $userObj[ 'User' ] [ 'lastname' ]; } }

Re: Need Ajax Help

2011-01-24 Thread andy_the ultimate baker
i have added helpers and component of request handler in controller. i have created a view with delete link as bellow ?php foreach ($users as $user): ? tr td?php echo $user['User']['id']; ?/td td?php echo $this-Html-link($user['User']['name'],

Re: static function in model

2011-01-24 Thread Jeremy Burns | Class Outfit
Use a virtual field: http://book.cakephp.org/view/1608/Virtual-fields Jeremy Burns Class Outfit jeremybu...@classoutfit.com http://www.classoutfit.com On 24 Jan 2011, at 08:01, cake-learner wrote: I want to define the static function so that the user name ( firstname + lastname ) can be used

Re: Need Ajax Help

2011-01-24 Thread andy_the ultimate baker
i have added helpers and component of request handler in controller. i have created a view with delete link as bellow ?php foreach ($users as $user): ? tr td?php echo $user['User']['id']; ?/td td?php echo $this-Html-link($user['User']['name'],

Re: ACL how controll more type of action?

2011-01-24 Thread alaxos
Actually you can do exactly what you say with CakePHP ACL. By default, the AclComponent allow() and deny() methods save 1 and -1 respectively for all fields _create, _read, _update and _delete. Then if you use the AclComponent to check if a user is authorized to do some actions, the check() method

Re: CakePHP 1.3.7 released

2011-01-24 Thread netusco
regarding the comments I feel they should be more visible, definetly, but... I would do 2 thinks to prevent misleading info: 1- post them as a thread to this group with the text of the page above so it allows quick answer from this group and... 2- have a rating system like thumbs up or down to

Re: CakePHP 1.3.7 released

2011-01-24 Thread AD7six
On Jan 24, 9:50 am, netusco ernestcon...@gmail.com wrote: regarding the comments I feel they should be more visible, definetly, but... why? Has anyone pro-comments SEEN what's in the existing comments? Comments were added to the book because it was easy to do so. However they were /not/

$this-Form-select(...) creates HTML tag with ID, but with empty name! --psybear

2011-01-24 Thread psybear83
Hey everybody I wish you all a good start into the new week. :-) Sadly the first thing I encountered after starting the PC today at my workplace is a strange little problem. View: ?php echo $this-Form-create(array('action' = 'detailangaben', 'type' = 'get')); ? fieldset legend?php

Re: $this-Form-select(...) creates HTML tag with ID, but with empty name! --psybear

2011-01-24 Thread andy_the ultimate baker
hi, i have tested ur code and it is giving me output as bellow tdselect name=data[geburtsdatum_tag] id=geburtsdatum_tag /select /td which showing that the name of select tag is not empty. this may ur misconception but it is working fine. ok bye On Jan 24, 2:12 pm, psybear83

Re: $this-Form-select(...) creates HTML tag with ID, but with empty name! --psybear

2011-01-24 Thread Joshua Muheim
Thanks for testing it, Andy! I used CakePHP 1.3.6, and now I upgraded to CakePHP 1.3.7 - and now it works again! But on friday it also worked on the old version, and I can't remember any significant change that could have stopped it from working! Hell - strange...! Anyway, it's working again.

Re: Allow empty selection for relationship id (NULL)

2011-01-24 Thread euromark
you will need to create a custom template /templates/custom/views/form.ctp and add your empty='' snippet for all belongsTo relations On 24 Jan., 02:45, Ryan Schmidt google-2...@ryandesign.com wrote: Thanks, that works great, specifically:         echo $this-Form-input('some_id',

Small question about L10n: Configure::write('Config.language', 'de'); doesn't seem to do anything? --psybear

2011-01-24 Thread psybear83
Hey everybody I'm currently doing l10n for my web. I have browsed through some articles, and their alltogehter-verdict was: - Put uses('L10n'); into your AppController. - Put Configure::write('Config.language', 'de'); into your bootstrap.php File - Change the display language by setting the

Re: Small question about L10n: Configure::write('Config.language', 'de'); doesn't seem to do anything? --psybear

2011-01-24 Thread Joshua Muheim
Oh, and it seems uses('L10n'); is also not needed? On Mon, Jan 24, 2011 at 12:06 PM, psybear83 psybea...@gmail.com wrote: Hey everybody I'm currently doing l10n for my web. I have browsed through some articles, and their alltogehter-verdict was: - Put uses('L10n'); into your AppController.

Always having trouble adding new tables

2011-01-24 Thread cake-learner
When i add new table it sometimes say request address /somepath/ somepath was not found on this server. I know i configure model wrong because of this it takes time to find the problem. Is there any way to see proper error? -- Our newest site for the community: CakePHP Video Tutorials

evalScripts and AJAX forms

2011-01-24 Thread Rory
I've recently stumbled across a major problem which has brought the development of my application to a complete stand still. Basically, the way the application has been working up until now, is a view would be loaded into a div tag via AJAX. This view would contain an AJAX form which when

Re: Always having trouble adding new tables

2011-01-24 Thread Shinya Koizumi
never mind i didn't have debug level to 2 On Mon, Jan 24, 2011 at 3:37 AM, cake-learner sh.koiz...@gmail.com wrote: When i add new table it sometimes say request address /somepath/ somepath was not found on this server. I know i configure model wrong because of this it takes time to find the

Re: Small question about L10n: Configure::write('Config.language', 'de'); doesn't seem to do anything? --psybear

2011-01-24 Thread John Andersen
As far as I remember, you should use the same abbreviations in your configure statements as you have in your language folder name - so german is not de but deu and so on. Enjoy, John On 24 Jan., 12:06, psybear83 psybea...@gmail.com wrote: Hey everybody I'm currently doing l10n for my web. I

Re: Creating a Preview page

2011-01-24 Thread WhyNotSmile
Thanks, yes, i'd renamed them for my own purposes, sorry about that! I'll give all that a go. Thanks again. On Jan 22, 2:53 pm, cricket zijn.digi...@gmail.com wrote: On Sat, Jan 22, 2011 at 9:37 AM, WhyNotSmile sharongilmor...@gmail.com wrote: Another question: what are 'pages_modal'

Re: year only combobox

2011-01-24 Thread Joshua Muheim
I have problems understanding your question. If you have a date field in your model, then $this-Form-input('date') should result in a day select box, a month select box and a year select box. If you have a datetime field, then it should also result in hour/minute/second select boxes. You can also

How to know that user login failed due to wrong information?

2011-01-24 Thread raymond
How do you do every one. I used ACL for user authentication, and now it works well. However, when user logs in with wrong information, he(or she) gets redirected to login page without any message. I am wondering if no way to show any message like Your login information is not correct, etc. No

ACL How to get logged user information, like user name, id in user table, group name, etc.

2011-01-24 Thread raymond
Hi, everyone. I ve entered CakePHP world recently and bumped into one issue. I need to get logged users information, especially primary key value in user table. I have tried $this-Auth-user[id] because I have read it from one post in this group, but I checked that $this-Auth does not have any user

Re: ACL How to get logged user information, like user name, id in user table, group name, etc.

2011-01-24 Thread alaxos
If it is not a typo, the reason is that it is not $this-Auth- user[id] but $this-Auth-user(id). user() is a function of the AuthComponent, not a property. Regards, nIcO On Jan 24, 11:49 am, raymond raymond...@gmail.com wrote: Hi, everyone. I ve entered CakePHP world recently and bumped into

Re: Save and Update 2 or more Tables

2011-01-24 Thread chris...@yahoo.com
Thanks Amit, I manage to do that, but I have another problem,... Once user is a member now I need that Join button replaced with Leave and I can not make that php statement. e.g. ?php if(($favorite['Favorite']['user_id'] ==)): ? ...? ? ? the table I have is id int(11)

Re: php statement as to appear replaced in views

2011-01-24 Thread chris...@yahoo.com
Hi Sam, thanks for help... and how do I do that...? Here is another example, what I have is a video to be favorite. And once its favorite it, the button Add to Favorites should not be seen. The table for favorites I have is: id int(11) UNSIGNEDNo auto_increment

Re: php statement as to appear replaced in views

2011-01-24 Thread Jon Bennett
Hi Sam, thanks for help... and how do I do that...? Here is another example, what I have is a video to be favorite. And once its favorite it, the button Add to Favorites should not be seen. Well, there's 2 ways to do this: 1. Process the 'favourite' action via ajax, and on success hide the

Re: php statement as to appear replaced in views

2011-01-24 Thread Miles J
Your pages should be on different actions? /resume/add /resume/edit /resume/delete And within each of those you show the context specific links. On Jan 24, 11:10 am, chris...@yahoo.com chris...@yahoo.com wrote: Hi Sam, thanks for help... and how do I do that...? Here is another example,

Re: php statement as to appear replaced in views

2011-01-24 Thread cricket
On Mon, Jan 24, 2011 at 2:10 PM, chris...@yahoo.com chris...@yahoo.com wrote: Hi Sam, thanks for help... and how do I do that...? Here is another example, what I have is a video to be favorite. And once its favorite it, the button Add to Favorites should not be seen. The table for

Re: php statement as to appear replaced in views

2011-01-24 Thread ShadowCross
Chris, forgive me if I'm not reading your original request properly, because I seem to be missing something... In CakePHP, the view.ctp is usually used to display the contents of an EXISTING record, so having the option to Create Resume using this view doesn't make sense to me. In fact, if you

Re: CakePHP 1.3.7 released

2011-01-24 Thread LunarDraco
I do NOT see comments on the cakephp documentation to be valuable. I think comments like php.net are great when your talking about how to use a function. Most of the content of the cakephp book is how to use the framework a little bit more extensive than a sequence of function calls. This is

Re: Has anyone connected cakePHP to SQL Azure?

2011-01-24 Thread LunarDraco
gobb0, Microsoft SQL Azure can be connected to by php using the Microsoft SQL Server Driver for PHP So you should be able to connect to the db from CakePHP using the dbo_mssql.php DataSource Driver. http://book.cakephp.org/view/1075/DataSources You see, Cakephp has supported Azure since before

Select Box - Table or Tinyint?

2011-01-24 Thread Stephen
Hey there I am designing a database layout for a project and it has quite a few drop down menus, these are mostly static, lets say for example: Income: - Do not disclose - £15,000 - £25,000 - £25,000 - £35,000 - etc. These are unlikely to change over time whilst the website grows, normally

Re: Ordering by associated dates

2011-01-24 Thread ShadowCross
Assuming ModelA hasMany ModelB ModelB includes a date column called 'date' you could try: $this-ModelA-bindModel(array( 'hasOne' = array( 'MaxDateModelB' = array( 'className' = 'ModelB', 'foreign_key = 'model_a_id', 'conditions' =

Re: What are your personal conventions for Helper names and using helper classes?

2011-01-24 Thread connrs
Thanks euromark. You, and the other cakers below confirmed that I’m not insane. The most important thing I’ve gleaned from this thread is that I really need to start following the roadmap (and migration guides) for 2 and beyond to get a better idea of the direction the development team are

Re: What are your personal conventions for Helper names and using helper classes?

2011-01-24 Thread connrs
That’s a neat little solution. I always enjoy getting dirty forking the libs/ directory myself. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related

Re: Plain SQL query in Pagination

2011-01-24 Thread mmamedov
cricket, It's not about just 'union'. I don't want to be dealing with cakephp style quering here. I am talking about plain sql query. Passing a pure mysql query into pagination. I did it, and it worked. The problem however is when I am trying to go with reqular CakePHP pagination within the same

Paginate 2 models data as 1

2011-01-24 Thread Dave Maharaj
Is it possible to take 2 models and paginate as 1? I have 2 models where (model 1) the data is automatically generated thru the site database simply has 3 fields (id, User_id, and entry_id) = all the data is gathered thru the entry_id (model 2) user fills out a form and enters all the data

Re: .htaccess for https site

2011-01-24 Thread ShadowCross
The line RewriteCond %{SERVER_PORT} !^80$ seems to indicate that your RewriteRule's are only applied if the incoming request is NOT coming in from port 80 (port 80 is usually the http:// port, while port 443 is usually the https:// port). The ! negates the pattern, so I think you will get

Re: Select Box - Table or Tinyint?

2011-01-24 Thread Stephen
By the way, the tinyint method I mentioned, this involves defining arrays in bootstrap.php and using Configure::write // Configure::read for the select boxes. On 24 January 2011 21:26, Stephen step...@ninjacodermonkey.co.uk wrote: Hey there I am designing a database layout for a project and

RE: CakePHP 1.3.7 released - Comments 2 cents

2011-01-24 Thread Dave Maharaj
I agree comments CAN BE great! BUT Should be left to the professionals. Mr Cake Baker (sorry if someone has that name...not intentional) who has 2 days use with Cake thinking he is an expert posting bad comments everywhere adding misguided information helps no-one. With the framework

Re: Need Ajax Help

2011-01-24 Thread ShadowCross
I'm not seeing anything in your code that would produce a confirmation request. Your delete link in your view is echo $html-link('Delete',array('action'='delete', $user['User']['id']),array('class'='confirm_delete')); Are you attaching JS code to the click event of DOM objects with the

Re: Plain SQL query in Pagination

2011-01-24 Thread cricket
On Mon, Jan 24, 2011 at 5:04 PM, mmamedov mmame...@gmail.com wrote: cricket, It's not about just 'union'. I don't want to be dealing with cakephp style quering here. I am talking about plain sql query. Passing a pure mysql query into pagination. As I said, 'union' was an arbitrary key. I

Re: Select Box - Table or Tinyint?

2011-01-24 Thread cricket
On Mon, Jan 24, 2011 at 4:26 PM, Stephen step...@ninjacodermonkey.co.uk wrote: Hey there I am designing a database layout for a project and it has quite a few drop down menus, these are mostly static, lets say for example: Income:  - Do not disclose  - £15,000 - £25,000  - £25,000 -

Re: Allow empty selection for relationship id (NULL)

2011-01-24 Thread Ryan Schmidt
Well, I don't want all belongsTo relations to allow NULL selections; logically, I only want this allowed for those defined in the database as allowing NULL values. So my question is how can I do that, and my second question is why the default cake baking templates don't already do that. On

Re: Select Box - Table or Tinyint?

2011-01-24 Thread euromark
you might wanna try: http://www.dereuromark.de/2010/06/24/static-enums-or-semihardcoded-attributes/ On 25 Jan., 00:11, cricket zijn.digi...@gmail.com wrote: On Mon, Jan 24, 2011 at 4:26 PM, Stephen step...@ninjacodermonkey.co.uk wrote: Hey there I am designing a database layout for a

Re: Allow empty selection for relationship id (NULL)

2011-01-24 Thread euromark
debug your bake scripts variables - especially the content of the schema it might be in there somewhere if NULL is allowed or not then you can easily change the default behavior well, because its not that important - at least not for anybody else :) but as the core team would say: feel free to

Re: Need Ajax Help

2011-01-24 Thread andy_the ultimate baker
thanks ShadowCross i was looking for the same, thank u, by, Andy On Jan 25, 3:49 am, ShadowCross adri...@jps.net wrote: I'm not seeing anything in your code that would produce a confirmation request.  Your delete link in your view is      echo $html-link('Delete',array('action'='delete',