Re: How to get related username in view?

2011-11-04 Thread Jeremy Burns | Class Outfit
Sometimes, I give up. Jeremy Burns Class Outfit http://www.classoutfit.com On 4 Nov 2011, at 23:06, Andras Kende wrote: > Daniel, > > The easiest way to do what you need is: > > class CategoriesController extends AppController { > > public function index($id = null) { >

Re: create() Function Dies On Sql Server?

2011-11-04 Thread euromark
what is the request data containing prior to passing them on to the model? oh, and why dont u use the session component to access the session? your code will most certainly trigger lots of warnings On 5 Nov., 00:20, Will <000w.s.s@gmail.com> wrote: > Hi all, > > I'm using CakePHP 2.0 on a sy

create() Function Dies On Sql Server?

2011-11-04 Thread Will
Hi all, I'm using CakePHP 2.0 on a system running Windows 7, Apache 2, PHP 5.3 and SQL Server. I'm using a User model and UsersController that are essentially the same as the example in the online book. Here's my add function: public function add() { if($_SESSION['Auth']['User'

Re: How to get related username in view?

2011-11-04 Thread Andras Kende
Daniel, The easiest way to do what you need is: Category->Post->find('all', array( 'conditions' => array('Category.id' => $id), )); // print_r($posts); to debug... $this->set(compact('posts')); } } This will just do a single query with 2 left joins.. Just make sure all 3 models has the relati

Re: Getting logged in username and group id

2011-11-04 Thread Nate
Aw yeah that's definitely helpful. Thanks! Starting to really enjoy CakePHP :) -- 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 questions. To unsubscr

Re: How to get related username in view?

2011-11-04 Thread Daniel
On Nov 4, 6:55 pm, Jeremy Burns | Class Outfit wrote: > It's in the right place but you have amended it. > > You are populating a variable called $categories - you normally do that for a > list. You are using find 'all'  and then restricting it with a condition. Use > find first instead (that

Re: Getting logged in username and group id

2011-11-04 Thread Meroe Meroe
How about something like this... if(AuthComponent::user('group_id') == 1) { echo $this->Element('group1View'); } On Fri, Nov 4, 2011 at 4:11 PM, Nate wrote: > Just trying to improve how I'm doing things. > > I'm checking a user's usergroup id and displaying additional options > if they are in

Getting logged in username and group id

2011-11-04 Thread Nate
Just trying to improve how I'm doing things. I'm checking a user's usergroup id and displaying additional options if they are in a particular usergroup. (followed the 2 part ACL tutorial in the 2.0 book) Here's an example I have in one of my views, to display different content if you have the per

Re: How to get related username in view?

2011-11-04 Thread Jeremy Burns | Class Outfit
It's in the right place but you have amended it. You are populating a variable called $categories - you normally do that for a list. You are using find 'all' and then restricting it with a condition. Use find first instead (that was my original mistake). Your $category variable is being popula

Re: how can i protect my code from the duplicaters

2011-11-04 Thread Jeremy Burns | Class Outfit
I'm thinking of apps running on internal banking servers (real case scenario) where hosting it remotely is a no-no for security reasons. Encrypting that would be pretty fantastic. Jeremy Burns Class Outfit http://www.classoutfit.com On 4 Nov 2011, at 18:42, WebbedIT wrote: > @Jeremy: I would

Re: How to get related username in view?

2011-11-04 Thread Daniel
On Nov 4, 6:35 pm, Jeremy Burns | Class Outfit wrote: > You're doing something wrong - this is very standard stuff. Have you got the > Containable behaviour attached to the Category model? Or app_model? > Here is my category model: array( 'notempty' => array(

Re: how can i protect my code from the duplicaters

2011-11-04 Thread WebbedIT
@Jeremy: I would be wary of allowing any software licensed annually to be hosted on another server. Apps licensed in this way tend to be more like an SAAS app and as such would be centrally stored to allow for maintenance, upgrades etc. If it is a plugin that we're talking about then the license t

Re: How to get related username in view?

2011-11-04 Thread Jeremy Burns | Class Outfit
You're doing something wrong - this is very standard stuff. Have you got the Containable behaviour attached to the Category model? Or app_model? Jeremy Burns Class Outfit http://www.classoutfit.com On 4 Nov 2011, at 17:41, Daniel wrote: > On Nov 4, 5:20 pm, Jeremy Burns | Class Outfit > wrote

Test - getMock

2011-11-04 Thread R0ckET
Hello, I'm starting to realize my helpers test and reviewing test the core helpers find a function (getMock ()) and I could not find documentation of this. Someone can help me to know he does? or where to find the API documentation. Greetings. -- Our newest site for the community: CakePHP Vid

Re: Run a cron job in cakephp

2011-11-04 Thread Eric Blanpied
My workers are just PHP. I've got one doing curl stuff to transfer big files, and another to drive ffmpeg for slow encodes. You can write your Gearman clients in pretty much anything, though. They've got a bunch of client libraries. The PHP one is pretty comprehensive, and I've experimented with py

Re: How to get related username in view?

2011-11-04 Thread Daniel
On Nov 4, 5:20 pm, Jeremy Burns | Class Outfit wrote: > Daniel - this is 101 CakePHP - no, PHP - stuff. > > Your controller function will call a model function to do the find. Put the > code inside that model function. Or - if you want to call this find directly > from a controller (the revised

Re: How to get related username in view?

2011-11-04 Thread Jeremy Burns | Class Outfit
Daniel - this is 101 CakePHP - no, PHP - stuff. Your controller function will call a model function to do the find. Put the code inside that model function. Or - if you want to call this find directly from a controller (the revised version I just sent you) - put it in a controller function (vie

Re: How to get related username in view?

2011-11-04 Thread Daniel
On Nov 4, 5:10 pm, Jeremy Burns | Class Outfit wrote: > Can you paste all your model code from the top until the end of this code. > Looks like you're pasting outside of a function. > Your're right, oops, what function should it be in? -- Our newest site for the community: CakePHP Video Tutori

Re: How to get related username in view?

2011-11-04 Thread Sam Sherlock
perhaps you have a missing semicolon on within the code above this - S On 4 November 2011 17:08, Daniel wrote: >$categories = $this->find( >'all', >array( >'conditions' => > array('Category.catego

Re: How to get related username in view?

2011-11-04 Thread Jeremy Burns | Class Outfit
Can you paste all your model code from the top until the end of this code. Looks like you're pasting outside of a function. Jeremy Burns Class Outfit http://www.classoutfit.com On 4 Nov 2011, at 17:08, Daniel wrote: > > > On Nov 4, 4:49 pm, Jeremy Burns | Class Outfit > wrote: >> This code

Re: How to get related username in view?

2011-11-04 Thread Daniel
On Nov 4, 4:49 pm, Jeremy Burns | Class Outfit wrote: > This code would go into the Category model. $categories = $this->find( 'all', array( 'conditions' => array('Category.category_id' => $id),

Re: Querying unassociated model

2011-11-04 Thread toby1kenobi
PPS Gah, really sorry for the spam, it *is* the call to find() where the problem happens, sorry! On Nov 4, 4:55 pm, toby1kenobi wrote: > PS Apologies, to clarify the error happens even with just the call to > ClassRegistry::init() > > On Nov 4, 4:44 pm, toby1kenobi wrote: > > > > > > > > > Hi th

Re: Querying unassociated model

2011-11-04 Thread toby1kenobi
PS Apologies, to clarify the error happens even with just the call to ClassRegistry::init() On Nov 4, 4:44 pm, toby1kenobi wrote: > Hi there, > >   I'm using CakePHP 2, and in the afterFind callback of one model I > conditionally want to retrieve data from another. The two models > aren't associa

Re: How to get related username in view?

2011-11-04 Thread Jeremy Burns | Class Outfit
This code would go into the Category model. If you want to call it from the categories_controller, make a small change: $categories = $this->Category->find(... Still add the Containable behaviour and recursive setting to the Category model or app_model though. Jeremy Burns Class Outfit http:/

Querying unassociated model

2011-11-04 Thread toby1kenobi
Hi there, I'm using CakePHP 2, and in the afterFind callback of one model I conditionally want to retrieve data from another. The two models aren't associated. In the first model, when certain conditions are met, I'm trying to do something along the lines of: $model2 = ClassRegistry::init('Mode

Re: How to get related username in view?

2011-11-04 Thread Daniel
Thanks for your help, but where do I put the "find" ? On Nov 2, 4:10 am, Jeremy Burns | Class Outfit wrote: > This is basic stuff. > > var $actsAs = array('Containable'); > var $recursive = -1; > > Ideally do this in app_model so that your whole app uses the Contain > behaviour. > > Your Categor

Re: Why are file names now CamelCased?

2011-11-04 Thread mark_story
And applying two naming conventions to similar things is kind of silly. The issues of camelcase folders was discussed on the cakephp- core list and the general consensus there was to camelcase folders. This meant the eventual namespace names would be cased the same as classnames. -Mark On Nov 3,

Re: error while running shell as cron

2011-11-04 Thread Jon Bennett
On 4 November 2011 13:09, abhimanyu bv wrote: > 1.3it is > > On Fri, Nov 4, 2011 at 6:27 PM, euromark wrote: >> >> cake1.3 or 2.0? >> >> On 4 Nov., 13:35, abhimanyu bv wrote: >> > I am getting the following error when cron is running- 'PHP Fatal >> > error:  Class 'Shell' not found in /var/www/w

Re: error while running shell as cron

2011-11-04 Thread euromark
maybe you should post your shell code or better how exactly you try to call your shell On 4 Nov., 14:09, abhimanyu bv wrote: > 1.3it is > > > > > > > > On Fri, Nov 4, 2011 at 6:27 PM, euromark wrote: > > cake1.3 or 2.0? > > > On 4 Nov., 13:35, abhimanyu bv wrote: > > > I am getting the followi

Re: Problem with echo in the controllers with CakePHP 2.0.1 and 2.0.2 on NGINX

2011-11-04 Thread José Lorenzo
This issue was resolved yesterday, please checkout the latest code in the 2.0 branch -- 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 questions. To u

Re: Run a cron job in cakephp

2011-11-04 Thread zuha
Cron is not only for particular times, its also for recurring events. It certainly does make sense if you simply set your task to check what time it is before executing. Then you just "try" to run it every minute (or every page load), and it will fire only at the appropriate time. This makes

Re: Run a cron job in cakephp

2011-11-04 Thread zuha
Oh that looks promising, if anything it should at least get us started. Thank you for that : https://github.com/MSeven/cakephp_queue/wiki -- 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 h

Re: Daylight Saving Time (DST) in cakephp

2011-11-04 Thread Jeremy Burns | Class Outfit
I was thinking of the new key to display a localised version, but keep the old one for editing; if you just convert it and then save the record it'd save the 'local' version, wouldn't it? Jeremy Burns Class Outfit http://www.classoutfit.com On 4 Nov 2011, at 13:32, euromark wrote: > probably

Re: Daylight Saving Time (DST) in cakephp

2011-11-04 Thread euromark
probably i wouldt apply new keys then, just override the old ones. if you don't change the current keys your forms will have to be modified. There is no jack of all trades device for this, i guess. setting the default_time_zone to your location only fixes the dtc problem for this specific country

Re: Daylight Saving Time (DST) in cakephp

2011-11-04 Thread Jeremy Burns | Class Outfit
Couldn't you do an afterFind in a behaviour that sets new keys like 'LocalTime'? Jeremy Burns Class Outfit http://www.classoutfit.com On 4 Nov 2011, at 13:04, euromark wrote: > maybe you can adopt some of this > https://raw.github.com/jellehenkens/lemon_utils/master/View/Helper/TimeMachineHelpe

Re: error while running shell as cron

2011-11-04 Thread abhimanyu bv
1.3it is On Fri, Nov 4, 2011 at 6:27 PM, euromark wrote: > cake1.3 or 2.0? > > On 4 Nov., 13:35, abhimanyu bv wrote: > > I am getting the following error when cron is running- 'PHP Fatal > > error: Class 'Shell' not found in /var/www/web/vendors/shells/ > > deals.php on line 3'. > > How to rec

Re: Daylight Saving Time (DST) in cakephp

2011-11-04 Thread euromark
maybe you can adopt some of this https://raw.github.com/jellehenkens/lemon_utils/master/View/Helper/TimeMachineHelper.php I am wondering: How do you guys handle the daylight saving time issue? Currently we face this problem in 2.0: - dates (created, modified, own ones) are saved without it (-1 hou

Re: error while running shell as cron

2011-11-04 Thread euromark
cake1.3 or 2.0? On 4 Nov., 13:35, abhimanyu bv wrote: > I am getting the following error when cron is running- 'PHP Fatal > error:  Class 'Shell' not found in /var/www/web/vendors/shells/ > deals.php on line 3'. > How to rectify this error? -- Our newest site for the community: CakePHP Video Tu

error while running shell as cron

2011-11-04 Thread abhimanyu bv
I am getting the following error when cron is running- 'PHP Fatal error: Class 'Shell' not found in /var/www/web/vendors/shells/ deals.php on line 3'. How to rectify this error? -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questi

Re: Rudeness

2011-11-04 Thread dave
Hi Paul Thanks, and yeah, have officially stopped banging head :) Basically I'm really enjoying cakephp in the few short weeks I've been using it...and don't want to disparage it - I agree that the issue is almost without doubt in my code... I have seen it working ok..as mentioned in my second l

Re: Problem with echo in the controllers with CakePHP 2.0.1 and 2.0.2 on NGINX

2011-11-04 Thread Jon Bennett
> Same for behavior as you described for me on cake 2.0.2 nginx ubuntu if > echoing from controller... Interesting that one can no longer echo from the controller though, much more tailing required when debugging :) -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakeph

Re: Problem with echo in the controllers with CakePHP 2.0.1 and 2.0.2 on NGINX

2011-11-04 Thread Jon Bennett
> Same for behavior as you described for me on cake 2.0.2 nginx ubuntu if > echoing from controller... > > I guess its better to use a Views, this works: > > Controller : > > public function registerc() { >        $data = ……….. >        $this->set(compact('data')); >        $this->layout = false;

Re: How about using real HTML templates for Form input fields?

2011-11-04 Thread AD7six
On Nov 4, 11:41 am, majna wrote: > @sams and @AD7six > Yes, one element for each input. Performance is not issue here. Finally, > you can cache those elements as any other View::element() calls. Try what you're suggesting and benchmark it before dismissing performance - rendering elements is no

Re: How about using real HTML templates for Form input fields?

2011-11-04 Thread majna
@sams and @AD7six Yes, one element for each input. Performance is not issue here. Finally, you can cache those elements as any other View::element() calls. This is not only about applying Twitter Bootstrap. FormHelper is not flexible enough and extending large methods is not best solution. It'

Re: Run a cron job in cakephp

2011-11-04 Thread Werner Petry Moraes
Hi, that cake method you call from within the worker, is it written as a shell? Or how do you do it? I'm not familiar with gearman, but I think I'm gonna need it soon. thanks atenciosamente, Werner Petry Moraes werne...@gmail.com On Fri, Nov 4, 2011 at 06:16, Eric Blanpied wrote: > I think t

Re: Convert UTF-8 Problem , but i don't know how to do .

2011-11-04 Thread Điển vũ
Thanks a lot, i used AD7six's shell . All work , now. -- 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 questions. To unsubscribe from this group, send

Re: how can i protect my code from the duplicaters

2011-11-04 Thread AD7six
On Nov 4, 10:13 am, WebbedIT wrote: > @Ryan: If you could not raise a smile at Andy's response in this > thread then you really could do with a weekend off.  Your response is > nicer than Andy's but they both mean the same thing ... "Why on earth > do you need to protect your code?!?" Actually

Re: Convert UTF-8 Problem , but i don't know how to do .

2011-11-04 Thread Điển vũ
thanks for answer my question. I will tried it . -- 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 questions. To unsubscribe from this group, send emai

Re: How about using real HTML templates for Form input fields?

2011-11-04 Thread AD7six
On Nov 4, 2:47 am, Miles J wrote: > Ive always wanted this. Cakes defaults are pretty handy but once you > want to break out of the norm it gets tedious. > > I would also change the HTML structure but thats just me :P > > @Sherlock - There's not much overhead in doing a basic PHP include. using

Re: how can i protect my code from the duplicaters

2011-11-04 Thread Jeremy Burns | Class Outfit
I can see a point though. If you develop an application that is going to be installed on a customer site, encrypting it in someway gives you a degree of protection, particularly if you sell it on an annual license basis. Without some sort of key, how can you ensure that they are not still using

Problem with DboSource - Fatal error: Access to undeclared static property: DboSource::$methodCache

2011-11-04 Thread J.W.F. Thirion
Dear Community, Not sure if this is the right place, but here goes. I've upgraded an application from 1.3.10 to 2.0.2 and now get the following error: "Fatal error: Access to undeclared static property: DboSource:: $methodCache in /var/www/html/myapp/lib/Cake/Model/Datasource/ DboSource.php on li

Re: Convert UTF-8 Problem , but i don't know how to do .

2011-11-04 Thread AD7six
On Nov 4, 9:53 am, Điển vũ wrote: > Convert UTF-8 Problem with php , but i don't know how to do . > I want to ask cakephp  about this because i use cakephp . > > In cakePHP 1.3 i use 'encoding' => 'UTF-8', it is my mistake. Now i known > it must be 'encoding'=>'uft8' when update to update to cak

Cakephp 1.3 not logging when debug set to 1 or 2 Options

2011-11-04 Thread WebbedIT
@Serkan: post your new question in a new thread please On Nov 3, 3:59 pm, Serkan Sipahi wrote: > hi Cake Community, > > CakePHP 2.0.2 > OS: Windows7 > Configure::write('debug', 2); > > Problem: > My Auth Component is not working and i dont know why. Need Help. > > User Controller: > > > class Us

Re: how can i protect my code from the duplicaters

2011-11-04 Thread WebbedIT
@Ryan: If you could not raise a smile at Andy's response in this thread then you really could do with a weekend off. Your response is nicer than Andy's but they both mean the same thing ... "Why on earth do you need to protect your code?!?" @Rizki: I used to believe my code was golden and should

Re: How to get related username in view?

2011-11-04 Thread WebbedIT
We used to be able to rate posts, when did that dissapear? On Nov 3, 9:36 pm, Meroe Meroe wrote: > Wish I could +1 an email. > On Nov 2, 2011 12:11 AM, "Jeremy Burns | Class Outfit" < > > > > > > > > jeremybu...@classoutfit.com> wrote: > > This is basic stuff. > > > var $actsAs = array('Containab

Re: Convert UTF-8 Problem , but i don't know how to do .

2011-11-04 Thread euromark
well, it should have been utf8 in the first place (even in 1.3 - it shouldnt even work with utf-8). maybe this is the problem? is it possible that the encoding is already messed up in the database? take a look at some utf8 content is the text scrambled or visible? that would be my guess. try runni

Re: Rudeness

2011-11-04 Thread WebbedIT
Whilst I think the rudeness issue is interesting, and I am becoming more guilty of tinging a lot of my replies with a healthy dose of sarcasm (can equally be said that some questions are ridiculously rude and/or very provoking), we have dropped off the main subject here. @dave: I use radio without

Convert UTF-8 Problem , but i don't know how to do .

2011-11-04 Thread Điển vũ
Convert UTF-8 Problem with php , but i don't know how to do . I want to ask cakephp about this because i use cakephp . In cakePHP 1.3 i use 'encoding' => 'UTF-8', it is my mistake. Now i known it must be 'encoding'=>'uft8' when update to update to cakephp 2.0 But i end up submit a lot Japanese c

Re: Cake Bake Fatal Error

2011-11-04 Thread Brad Koch
My experience is that this issue is caused because you screwed up slightly with your naming conventions (ie, left a foreign key column pluralized). Try checking those. On Oct 21, 12:32 pm, mdunham wrote: > Me to: > > Brooksides-MacBook-Pro:app brooksidestudios$ cake bake model all > > Welcome to

Re: We need a Cake/PHP Expert for a Project

2011-11-04 Thread WTH
to the top On Oct 31, 10:18 pm, WTH wrote: > Hello, > > Are you a Cake/PHP expert?  Looking for a challenging project with a > great company? > > We have a penny auction site that we need help with.  The first > project will include helping us implement a caching solution > (memcached) that will

Re: Run a cron job in cakephp

2011-11-04 Thread Eric Blanpied
I think the best way to do it is with a queue. After doing several websites in which cron jobs were used for various not-so-cron things (cron job to wake up periodically and check for needed tasks? why not just spawn the tasks?), I came to the conclusion that a job queue was a much smarter answer.

Re: Run a cron job in cakephp

2011-11-04 Thread flo.kl...@googlemail.com
What about using javascript. It would only work while the user is on the site, but it would be able to call a function (also ajax if you want to trigger a php method) very x seconds. -flosky Ryan Schmidt schrieb: On Nov 4, 2011, at 00:17, zuha wrote: > is there anyway to run a process sep