Cakephp blog tutorial, SQL error when INSERTING into posts.

2013-08-05 Thread Greg Sarpy
Hi guys, this is my first attempt at CakePHP and so far it seems amazing. 
I'm not a PHP/DB pro but I am learning. 

Anyway, I'm familiarizing myself with the framework by creating the blog in 
the tutorial. So far I've successfully created the table, now I am trying 
to *INSERT INTO POSTS* exactly as it is in the manual:


INSERT INTO posts (title,body,created)
> VALUES ('The title', 'This is the post body.', NOW());
> INSERT INTO posts (title,body,created)
> VALUES ('A title once again', 'And the post body follows.', NOW());
> INSERT INTO posts (title,body,created)
> VALUES ('Title strikes back', 'This is really exciting! Not.', NOW());


It immediately outputs the following error:

Error
> *SQL query:
> *INSERT
>  INTO posts( title, body, created ) 
> VALUES (
> ’The title’, ’This 
> IS
>  the post body.’, 
> NOW
> ( )
> );
> *MySQL said: *[image: Documentation]
>
> #1064
>  
> - You have an error in your SQL syntax; check the manual that corresponds 
> to your MySQL server version for the right syntax to use near 'title’, 
> ’This is the post body.’, NOW())' at line 2 



I am now stuck because I do not see what's wrong here. While my SQL is 
limited, it looks correct.. can anyone see what could be causing this 
error? 


Here's the database info:

Apache/2.2.22
Database client version: libmysql - 5.1.66


Thank you for any help!!

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.




what is the best way to test beforeSave that requests data from the current model

2013-06-07 Thread Greg Skerman
Biting the bullet and doing some playing around with model unit testing.

As a bit of a trial, I've got a beforeSave which searches $this for the max
of a field and increments it by 1.

code:

public function beforeSave($options = array()) {if
(!isset($this->data['number'])) {$lastNumber =
$this->find('first', ['fields' => ['id', 'max_number'],
'conditions' => ['Issue.project_id' =>
$this->data['project_id']]]);$this->data['number'] =
++$lastNumber['Issue']['max_number'];}return true;}



max_number is a virtual field described by

public $virtualFields = array('max_number' => 'MAX(number)');



My test asserts that the $this->Issue->beforeSave() returns true, and that
$this->Issue->data['number'] is a predictable result:

public function testBeforeSaveShouldIncrementNewIssueNumber() {
$this->loadFixtures('Issue', 'Project', 'IssueType');
$this->Issue->data = ['project_id' => 1,'type_id' =>
1,'short_description' => 'lorem ipsum','description'
=> 'Lorem ipsum dolor sit amet','created' => '2013-06-07
13:34:20','modified' => '2013-06-07 13:34:20',];
$this->assertTrue($this->Issue->beforeSave());// assumes the
fixture has 10 records for project 1$this->assertEquals(11,
$this->Issue->data['number']);}


I feel that using fixtures here is a little bit dirty - is there a way to
pass mocked data to beforeSave in this instance and remove the need for the
database/fixtures in this instance given all beforeSave() is doing is
adding incrementing the max_number for a Project?

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Research about frameworks

2013-05-15 Thread Greg Skerman
I feel you are coming at this from the wrong angle.You should analyze your
requirements and come up with the framework which best suits the problem
you are trying to solve. Sometimes the answer will be "no framework at
all", other times you may find something is needed but the likes of cakephp
are to big so you might go with something like a micro framework.

The decision to go with a framework is typically made because it solves a
particular problem, or you have a great deal of knowledge and understanding
of the framework, or you are working on legacy code, or you have a business
reason to use it - not for its all encompassing feature set or any
particular missing features.






On Wed, May 15, 2013 at 11:28 AM, Fabio Schunig wrote:

> Hello!
>
> I'm doing a research about frameworks for PHP.
> Currently, I'm researching the frameworks Zend, CakePHP, CodeIgniter, Yii
> and Symfony.
>
> I'm new in the subject, and I'm reading a lot of tutorials and manuals.
> The materials are good, and I could learn a lot of what these frameworks
> can do.
>
> But, in the moment, I came here trying to know what CakePHP **can't do**.
> In other words, those features that we miss after working some time with
> the framework.
>
> Can you please tell me some features that you miss in CakePHP for the
> improvement of my research?
>
> Thank you!
> Fabio Schunig
>
> --
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to cake-php+unsubscr...@googlegroups.com.
> To post to this group, send email to cake-php@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Cake 3.0

2013-05-13 Thread Greg Skerman
Nothing is forcing you to upgrade. When 3.x lands, you don't need to take
your legacy site and make it 3.x compatible. Just run a legacy site on a
legacy version of cake. I really hope that the Cake devs don't hold back on
cool new stuff in the name of backwards compatibility - that would be a
shame.


On Tue, May 14, 2013 at 10:36 AM, Advantage+  wrote:

> Its always easier said than done….
>
> ** **
>
> Dry it you just baked a cake site but all sites are unique. Not just add
> edit save and delete you have custom functions pulling out data from the
> models contain all that stuff. Migration will not touch that! 
>
> ** **
>
> *From:* cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] *On
> Behalf Of *euromark
> *Sent:* Monday, May 13, 2013 8:27 PM
>
> *To:* cake-php@googlegroups.com
> *Subject:* Re: Cake 3.0
>
> ** **
>
> Upgrading from 1.x to any 2.x is doable and really not that big of a deal.
> 
>
> Mostly preg_replacing which can be automated, and some other stuff like
> renaming/folderstructure which also can also be automated.
>
> I use an extended upgrade shell for this - and it takes me less than 10%
> of the time it needed otherwise.
>
> Only some things need to be adjusted manually. But the migration guides
> help you here.
>
> So I dont really see the issue if you got a few days (for larger projects)
> - they will be worth it (think about all the improvements).
>
> You just can't expect it to work within 1 hour.
>
> ** **
>
> Upgrading to 3.x might be a little bit more difficult.
>
> Most upgrades will also be doable with the same approaches above.
>
> Some might not. But 3.x will be a complete rewrite of model layer for
> example. So what would one expect?
>
> Lets just wait until it becomes clearer - and less theoretical
>
> ** **
>
> Also, keeping in mind what will be deprecated, and what features will
> persist and be improved helps to code apps future-proof
>
> One aspect that came up in the past: query strings instead of named
> params. I wrote about it a few days back.
>
> If you - like me - start writing new apps with the 3.x way of how its done
> - the potential upgrade will be far less complicated.
>
> And there is usually a good reason why some things change over time and
> will be more important/correct in future versions.
>
> No need to cling to stuff that will not be supported or is already clear
> to be dropped.
>
> ** **
>
> So you can write clean and DRY code. You can also stay up to date and use
> best practice approaches and switch from deprecated to new ways of doing it.
> 
>
> Then, upgrading will be kinda quick, easy and fun. Having to recode a
> whole mess of code at once isn't, though.
>
>
>
> Am Montag, 13. Mai 2013 19:11:35 UTC+2 schrieb Jamie:
>
> I personally didn't bother to upgrade any production sites from 1.3 to 2 -
> I just started over. I found that it took just as long to convert my
> existing custom code than just to do it over again. I will likely do the
> same when 3 comes out: develop future projects in 3, maintain current ones
> with the current version.
>
> On Sunday, May 12, 2013 12:44:48 PM UTC-7, advantage+ wrote:
>
> Yes I would have to agree with you. Rather harsh but ohh well.
>
>  
>
> It will be fun upgrading to 3.
>
>  
>
> All I wanted to know was if they have 3.x in development maybe there was a
> way to get a jump on the change over. 
>
> Something that might be backwards compatible. Still works in 2.x but in
> 3.x it will be this way just to get a jump start rather than waiting till
> the release and saying ohh wow now I need to re-do everything again.
>
>  
>
> *From:* cake...@googlegroups.com [mailto:cake...@googlegroups.com] *On
> Behalf Of *Jamie
> *Sent:* Sunday, May 12, 2013 3:33 AM
> *To:* cake...@googlegroups.com
> *Subject:* Re: Cake 3.0
>
>  
>
> "If not it's your code that sucks" - that's a little harsh, don't you
> think? Sure doesn't reflect well on the professionalism of CakeDC.
>
>  
>
> Upgrading from 1.3 to 2.0 is time consuming and tedious, especially for
> large projects. The upgrade shell helps but by no means does all the work.
> Going from 2 to 3 will likely be difficult as well given that the model
> layer is being re-written.
>
>
> On Saturday, May 11, 2013 5:10:30 AM UTC-7, Florian Krämer wrote:
>
> Write clean code, follow the CakePHP coding standards and use the API
> correcty and upgrading will be easy as it ever was in the past. CakePHP was
> always easy to upgrade, if not it's your code that sucks and needs a
> refactor anyways.
>
> On Saturday, May 11, 2013 5:37:02 AM UTC+2, advantage+ wrote:
>
> Is there any date set / expected?
>
>  
>
> Is there anything we can do to current sites to anticipate the new release
> to get ahead of the changes?
>
>  
>
> Thanks,
>
>  
>
> Dave
>
>  
>
> This email may contain material that is confid

Re: How can I keep a user logged in longer?

2013-03-31 Thread Greg Skerman
if its just keeping people logged in (via a "remember me" checkbox), then
writing a simple bit of cookie code which encrypts the user/pass in a
cookie and decrypts and attempts to login before the auth component takes
over would be one way.

There are such plugins available - heres one:
http://milesj.me/code/cakephp/auto-login


On Mon, Apr 1, 2013 at 12:57 PM, Shahruk Khan wrote:

> Right now users get logged out on a daily basis. I am using the table
> cake_sessions to store user sessions. How can I increase the logout time to
> say a month or so?
>
> --
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to cake-php+unsubscr...@googlegroups.com.
> To post to this group, send email to cake-php@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: What's the best way to get Twitter Bootstrap into Cake?

2012-12-16 Thread Greg Skerman
1) throw out the default cake css file...you wont need it
2) load up the twitter bootstrap CSS files
3) modify the layout and the views to comply with twitter bootstrap's way
of doing things.

There are a number of things which help you out with respect to this. Here
are a couple which spring to mind

* Pagination helper - currentClass (2.1) and currentTag (2.3) options
* FormHelper::inputDefaults (2.2) to globablly set form helper defaults

You can also go away and hack the skeleton files so that baked code works
properly with bs out of the box.


On Wed, Dec 12, 2012 at 2:36 AM, Devario Johnson wrote:

> Ive used this in the past and it worked well
>
> http://blog.loadsys.com/2012/02/14/cakephp-20-and-twitter-bootstrap/
>
> https://github.com/loadsys/twitter-bootstrap-helper
>
>
> On Thursday, December 6, 2012 3:17:53 AM UTC-5, Lourenzo Ferreira wrote:
>>
>> I've seen several Plugins and even forks to use Twitter's Bootstrap CSS
>> Framework with Cake.
>>
>> Which you would say it's the best?
>>
>>
>> Thank you
>>
>> --
>> Lourenzo Ferreira
>>
>  --
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> 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, send email to
> cake-php+unsubscr...@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>
>
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
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, send email to 
cake-php+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




executing tests from Netbeans IDE

2012-12-10 Thread Greg Skerman
Hi,

Not strictly a cakephp issue, more of a netbeans one. I want to execute my
application tests from within the IDE. Netbeans seems to dislike this (the
unit test runner has to be an absolute path without args, so pointing it at
cake.bat with the test shell in params doesn't work)

it then goes on to fail if the PHPUnit.bat runner is used because obviously
the cakephp dependencies are not available.

Anyone out there using Netbeans and running unit tests from the IDE care to
share how they got it working?

working with
Netbeans 7.2
Cakephp 2.3 beta
Windows 7

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
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, send email to 
cake-php+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Re: Cake php

2012-11-18 Thread Greg Skerman
write the stored proceedure, use $this->model->query() to invoke it?



On Mon, Nov 19, 2012 at 1:11 AM, John james  wrote:

> i want to use storedprocedure in cake php can any body tell me how to do
> it ?
>
> --
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> 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, send email to
> cake-php+unsubscr...@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>
>
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
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, send email to 
cake-php+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Re: Helo. Please help me

2012-11-15 Thread Greg Skerman
1. The model is defined as id by CONVENTION only. If you want to use
something else, public $primaryKey = 'my_fields';, refer to the
documentation:
http://book.cakephp.org/2.0/en/models/model-attributes.html#primarykey
2. associations handle joins automatically - so when you get the value of
one model you also get its associated data back as well. You can also save
associated data using the reverse (set associated data in the model and
then save the model and its associated data). If you don't like the way a
join is happening for a particular query you can dynamically bind and
unbind models:
http://book.cakephp.org/2.0/en/models/associations-linking-models-together.html#creating-and-destroying-associations-on-the-fly
You can also control what is returned by using the Containable behavior:
http://book.cakephp.org/2.0/en/core-libraries/behaviors/containable.html
Finally, if you need to craft your own joins, the find method accepts an
key in its options array for a joins array where you can define complex
joins.
3. CakePHP is flexible - and it is not difficult to build a cakephp model.
Follow the conventions and be happy.




On Thu, Nov 15, 2012 at 10:45 PM, Andre Sutarko wrote:

> Hello, Cakephp team. I'm new member of your Cakephp Groups. I have trouble
> of using cakephp framework. I'm using Cakephp 2.2.3. I have some question
> about this cakephp as
>
>1. Why cakephp model always use id of table as primary key? Why don't
>cakephp model use others as primary key?
>2. using method of cakephp model (hasOne, hasMany, Belongto etc) is
>difficult. itable t won't suitable if we will join some table. if
>cakephp model can join some table. please you give sample.
>3. Please cakephp is be build flexible. I will build cakephp model
>difficult.
>
> Your cakephp build so well but build model for joining some table mistake
> and difficult
>
> Trims
>
> Andre
>
> --
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> 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, send email to
> cake-php+unsubscr...@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>
>
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
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, send email to 
cake-php+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Re: How to use KoolPHP with CakePHP

2012-11-13 Thread Greg Skerman
I've not used KoolPHP or KoolGrid - however:
1) The grid itself (and rendering thereof) is probably best suited to
living in a view, not a controller. The controller manages application flow
and business logic, not presentation.
2) Yes, its a vendor thing, it belongs in the Vendor folder (the PHP that
is, the javascript will have to go in the webroot or else the browser will
never be able to get access to it). If you plan to reuse it in cakephp it
might be handy to wrap it up in a component and/or helper to do the heavy
lifting for you so that you can use it in a more cakephp way..
3) You shouldn't *ever* use the query method. I have yet to really ever see
a valid use for this method. Even complex joins and so forth where it might
be easier to use query can be got around by using a proper find() call.
Query is nasty.

KoolGrid seems to have an array data adapter, which may be able to be
pressed into service (accepts an associative array, I'm assuming it returns
JSON to the grid... CakePHP returns associative arrays..I'd try and
investigate down these lines).

where does your "form" markup live? please tell me its not in a controller?
You should also really be using the form helper to build a form

As an alternative, I use the following for grids in my apps:
http://trirand.com/blog/jqgrid/jqgrid.html

Its pure javascript (there is no PHP thing behind it that you have to use)
and you can map json objects to the grid quite easilly - build a nice REST
api that returns the data in an appropriate format to the grid and then do
all of the grid logic in javascript inside of the view. It is a very large
grid control and has a tonne of features - it is theme compatable with
JQueryUI which is also quite handy.





On Wed, Nov 14, 2012 at 8:16 AM, Russell Brown wrote:

> Anyone have good documentation or examples about how to use the KoolPHP
> controls with CakePHP 2.X?
>
> I have figured some very minor things out:
>
> 1) How to load in Controller:
>
> App::import('Vendor', 'KoolControls/KoolGrid/koolgrid');
>
> $Koolgrid = new koolgrid($_il6n);
>
> 2) Copy KoolControls folder to the Vendor folder
> 3) How to use SQL commands directly in CakePHP:
> $this->Post->query("select id,user_id,title,body from posts");
>
> Post = Model name
> Posts = Table name
>
> But haven't been able to get any further than this.
>
> KoolPHP documentation for the KoolGrid shows using this but it doesn't
> work:
>
>  $grid = new KoolGrid("grid");
>   $grid->scriptFolder = "Vendor/KoolControls/KoolGrid";
>   $grid->styleFolder="default";
>   $grid->DataSource = $ds;
>   $grid->Width = "655px";
>   $grid->RowAlternative = true;
>   $grid->AutoGenerateColumns = true;
>   $grid->MasterTable->Pager = new GridPrevNextAndNumericPager();
>
>   $grid->Process();
> ?>
>
> 
>   Render();?>
> 
>
>  --
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> 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, send email to
> cake-php+unsubscr...@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>
>
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
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, send email to 
cake-php+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Re: Dealing with mysql views in schema generation

2012-11-07 Thread Greg Skerman
Schema introspects the "tables" but mysql provides views as if they were
tables.
the schema shell therefore sees the view as a table and creates a record
for it in schema.php, which must then be manually removed.

If they are not removed, when the schema is updated, tables are created
when they shouldn't be.



On Tue, Nov 6, 2012 at 4:24 PM, polutan  wrote:

> is not schema just to generate tables? i think schema just focusing
> himself to create tables. schema is not a SQL SELECT command.
>
>
> 2012/11/6 Greg Skerman 
>
>> Hi,
>>
>> For one of my projects, I need to join up against some static data in
>> another database. The data in this database will never be written to by my
>> application, and the schema does not comply with cake's conventions. I am
>> not able to change the schema to comply with cake's conventions because
>> other non-cake applications depend on and have been written to take
>> advantage of this schema.
>>
>> As such, I've turned to mysql views - a simple select query massages the
>> format into something cake is comfortable with and this works fine for
>> feeding the static data/lookups on static data into my application.
>>
>> The problem comes when I try and generate a schema with the schema shell.
>> It generates fine but the schema creates entries for the views as if they
>> were tables, so there is a manual task after the fact to go back in and
>> remove the entries for the views, and then a manual SQL script to create
>> the views.. which is prone to user error (if schemas are run but views are
>> not updated, or views are not removed from schema.php etc).
>>
>> Does anyone have a nice elegant way of dealing with views in schema
>> generation?
>>
>>  --
>> Like Us on FaceBook https://www.facebook.com/CakePHP
>> Find us on Twitter http://twitter.com/CakePHP
>>
>> ---
>> 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, send email to
>> cake-php+unsubscr...@googlegroups.com.
>> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>>
>>
>>
>
>
>
> --
> *Coklat Stroberi -- Web Dev Training Centre*
> http://www.facebook.com/pages/Coklat-Stroberi/249514251728226  (info
> lebih lanjut)
> http://coklatstroberi.net
> Jl. Raya Padang Luwih (Dalung) No.141 - Telp. (0361) 9006118 atau
> 08174128301 - Badung, Bali. Sebelah timur traffic light pertigaan
> perumahan dalung permai.
>
>
>  --
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> 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, send email to
> cake-php+unsubscr...@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>
>
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
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, send email to 
cake-php+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Dealing with mysql views in schema generation

2012-11-05 Thread Greg Skerman
Hi,

For one of my projects, I need to join up against some static data in
another database. The data in this database will never be written to by my
application, and the schema does not comply with cake's conventions. I am
not able to change the schema to comply with cake's conventions because
other non-cake applications depend on and have been written to take
advantage of this schema.

As such, I've turned to mysql views - a simple select query massages the
format into something cake is comfortable with and this works fine for
feeding the static data/lookups on static data into my application.

The problem comes when I try and generate a schema with the schema shell.
It generates fine but the schema creates entries for the views as if they
were tables, so there is a manual task after the fact to go back in and
remove the entries for the views, and then a manual SQL script to create
the views.. which is prone to user error (if schemas are run but views are
not updated, or views are not removed from schema.php etc).

Does anyone have a nice elegant way of dealing with views in schema
generation?

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
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, send email to 
cake-php+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Re: is it possible create schedule post with cakephp?

2012-10-27 Thread Greg Skerman
Look at how to write cakephp consoles.

Then if you are using linux google "cron"...windows google "scheduled tasks"

the process would be simply to have a console that searches for items that
are due to trigger at a certain date, and take action on those.

the cron job or scheduled task will execute that console script every X
minutes.

Not really all that hard to do :S



On Mon, Oct 22, 2012 at 5:47 PM, ecko usil  wrote:

> This is my case: I create some task with date time > now(), it means
> scheduled task. When task time is coming that task will run another task.
> ex: Create some email message now but scheduled for sent next week to
> multiple accounts.
>
> thanks all for your reply. Any code sample will help me a lot :D
>
>
> On Monday, October 22, 2012 2:26:48 PM UTC+7, Vanja Dizdarević wrote:
>>
>> ...you mean published < NOW() ...
>>
>> That typo cost me 5 minutes of thinking. :D
>>
>  --
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> 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, send email to
> cake-php+unsubscr...@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>
>
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
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, send email to 
cake-php+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Re: modifying cache times based on API call

2012-10-16 Thread Greg Skerman
ok so one idea I had was to call GC before every read, and then read
everything with an obnoxiously long expiry time via set...

which seems terrible to me but might work - anyone got any better ideas?


On Mon, Oct 15, 2012 at 1:18 AM, Greg Skerman  wrote:

> Hi,
>
> I am connecting an API which provides values that are intended to instruct
> the consumer on how long to cache a result for. Different API calls have
> different cache times (and these cache times may be variable, so setting up
> a config for each possible outcome is out of the question).
>
> Essentially there is a callTime and a cacheTime value in the response -
> callTime is the server timestamp that the data was retrieved, and cacheTime
> is the server timestamp that I am expected to wait until I make the next
> call.
>
> Now, I can easily perform some date math here to figure out the cache time
> and plug it into cache::set before writing my local cache - but whilst
> reading the caching documentation on the subject I discovered this:
>
> *If you use Cache::set() to change the settings for a write, you should
> also use Cache::set() before reading the data back in. If you fail to do
> so, the default settings will be used when the cache key is read.:*
>
> How does one get around this? I cannot "know" the cache duration until
> *after* I have read the value - and if the default is used there is a good
> chance that the value will be prematurely garbage collected. If I set the
> default value to an obscenely long time (upwards of 24 hours), then I run
> the risk that the cache will *never* be garbage collected.
>
> Do I need to store a "key map" somewhere that describes the cache time
> values so I can look them up? or is there a way to inspect the cache time
> before reading the value?
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
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, send email to 
cake-php+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




modifying cache times based on API call

2012-10-14 Thread Greg Skerman
Hi,

I am connecting an API which provides values that are intended to instruct
the consumer on how long to cache a result for. Different API calls have
different cache times (and these cache times may be variable, so setting up
a config for each possible outcome is out of the question).

Essentially there is a callTime and a cacheTime value in the response -
callTime is the server timestamp that the data was retrieved, and cacheTime
is the server timestamp that I am expected to wait until I make the next
call.

Now, I can easily perform some date math here to figure out the cache time
and plug it into cache::set before writing my local cache - but whilst
reading the caching documentation on the subject I discovered this:

*If you use Cache::set() to change the settings for a write, you should
also use Cache::set() before reading the data back in. If you fail to do
so, the default settings will be used when the cache key is read.:*

How does one get around this? I cannot "know" the cache duration until
*after* I have read the value - and if the default is used there is a good
chance that the value will be prematurely garbage collected. If I set the
default value to an obscenely long time (upwards of 24 hours), then I run
the risk that the cache will *never* be garbage collected.

Do I need to store a "key map" somewhere that describes the cache time
values so I can look them up? or is there a way to inspect the cache time
before reading the value?

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
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, send email to 
cake-php+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Re: Themed bootstrap

2012-10-10 Thread Greg Skerman
i've not worked with themes before - but surely you could iterate your
themes folder from within the application bootstrap.php and look for a
bootstrap file for the loaded theme - and if it exists include it at that
point?

I do a similar thing with some settings stored as YAML for plugins
(hooks/dependencies/menu items are described in yml files for each plugin,
a helper finds and merges them everytime the menu is called from outside
cache)



On Wed, Oct 10, 2012 at 4:14 PM, Lucky1968  wrote:

> Does anyone know how to integrate a bootstrap.php in a theme and how to
> open it dynamically?
>
> In my bootstrap.php I have certain settings which should change according
> to the selected theme so I would like to put a bootstrap.php file into the
> theme folder which should be called dynamically according to the selected
> theme.
>
> But how to do this?
>
> --
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> 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, send email to
> cake-php+unsubscr...@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>
>
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
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, send email to 
cake-php+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Re: struggling with containable - containing the same model twice

2012-10-09 Thread Greg Skerman
thanks for your help

On Wed, Oct 10, 2012 at 2:58 AM, Dave M.  wrote:

> Ha. I was JUST going to ask about that!
>
>
> On Tuesday, October 9, 2012 9:31:29 AM UTC-4, Greg wrote:
>
>> solved it.
>>
>> RTFM basically :(
>>
>>
>> If you need to reference a model within your plugin, you need to include
>> the plugin name with the model name, separated with a dot.
>>
>> which seems to go for if you are referencing a model within the same
>> plugin...even though the associations don't bake like that.
>>
>> working now..
>>
>>
>> On Tue, Oct 9, 2012 at 11:19 PM, Greg Skerman  wrote:
>>
>>> oddly, if i pr($this->Operation->User) I get the structure for the User
>>> model, but if I dump out $this->Operation->**OperationParticipant I get
>>> the structure for AppModel.. its almost as though OperationParticipant is
>>> not initializing?
>>>
>>>
>>>
>>> On Tue, Oct 9, 2012 at 10:44 PM, Greg Skerman  wrote:
>>>
>>>> Dave
>>>>
>>>> heres the exact OperationParticipant model:
>>>>
>>>> class OperationParticipant extends OperationAppModel {
>>>> /**
>>>>  * Validation rules
>>>>
>>>>  *
>>>>  * @var array
>>>>  */
>>>> public $validate = array(
>>>> 'user_id' => array(
>>>> 'numeric' => array(
>>>> 'rule' => array('numeric'),
>>>> //'message' => 'Your custom message here',
>>>> //'allowEmpty' => false,
>>>> //'required' => false,
>>>> //'last' => false, // Stop validation after this rule
>>>> //'on' => 'create', // Limit validation to 'create' or
>>>> 'update' operations
>>>> ),
>>>> ),
>>>> 'operation_id' => array(
>>>> 'numeric' => array(
>>>> 'rule' => array('numeric'),
>>>> //'message' => 'Your custom message here',
>>>> //'allowEmpty' => false,
>>>> //'required' => false,
>>>> //'last' => false, // Stop validation after this rule
>>>> //'on' => 'create', // Limit validation to 'create' or
>>>> 'update' operations
>>>> ),
>>>> ),
>>>> );
>>>>
>>>> //The Associations below have been created with all possible keys,
>>>> those that are not needed can be removed
>>>>
>>>>
>>>> /**
>>>>  * belongsTo associations
>>>>  *
>>>>  * @var array
>>>>  */
>>>> public $belongsTo = array(
>>>> 'User' => array(
>>>> 'className' => 'User',
>>>> 'foreignKey' => 'user_id',
>>>> 'conditions' => '',
>>>> 'fields' => '',
>>>> 'order' => ''
>>>> ),
>>>> 'Operation' => array(
>>>> 'className' => 'Operation',
>>>>     'foreignKey' => 'operation_id',
>>>> 'conditions' => '',
>>>> 'fields' => '',
>>>> 'order' => '',
>>>> 'counterCache' => true
>>>> )
>>>> );
>>>> }
>>>>
>>>> and the Operation controller method doing the work:
>>>>
>>>> /**
>>>>  * view method
>>>>  *
>>>>  * View an operation
>>>>  *
>>>>  * @param string $id
>>>>  * @return void
>>>>  */
>>>> public function view($id = null) {
>>>> $this->Operation->id = $id;
>>>> if (!$this->Operation->exists()) {

Re: struggling with containable - containing the same model twice

2012-10-09 Thread Greg Skerman
solved it.

RTFM basically :(


If you need to reference a model within your plugin, you need to include
the plugin name with the model name, separated with a dot.

which seems to go for if you are referencing a model within the same
plugin...even though the associations don't bake like that.

working now..


On Tue, Oct 9, 2012 at 11:19 PM, Greg Skerman  wrote:

> oddly, if i pr($this->Operation->User) I get the structure for the User
> model, but if I dump out $this->Operation->OperationParticipant I get the
> structure for AppModel.. its almost as though OperationParticipant is not
> initializing?
>
>
>
> On Tue, Oct 9, 2012 at 10:44 PM, Greg Skerman  wrote:
>
>> Dave
>>
>> heres the exact OperationParticipant model:
>>
>> class OperationParticipant extends OperationAppModel {
>> /**
>>  * Validation rules
>>
>>  *
>>  * @var array
>>  */
>> public $validate = array(
>> 'user_id' => array(
>> 'numeric' => array(
>> 'rule' => array('numeric'),
>> //'message' => 'Your custom message here',
>> //'allowEmpty' => false,
>> //'required' => false,
>> //'last' => false, // Stop validation after this rule
>> //'on' => 'create', // Limit validation to 'create' or
>> 'update' operations
>> ),
>> ),
>> 'operation_id' => array(
>> 'numeric' => array(
>> 'rule' => array('numeric'),
>> //'message' => 'Your custom message here',
>> //'allowEmpty' => false,
>> //'required' => false,
>> //'last' => false, // Stop validation after this rule
>> //'on' => 'create', // Limit validation to 'create' or
>> 'update' operations
>> ),
>> ),
>> );
>>
>> //The Associations below have been created with all possible keys,
>> those that are not needed can be removed
>>
>>
>> /**
>>  * belongsTo associations
>>  *
>>  * @var array
>>  */
>> public $belongsTo = array(
>> 'User' => array(
>> 'className' => 'User',
>> 'foreignKey' => 'user_id',
>> 'conditions' => '',
>> 'fields' => '',
>> 'order' => ''
>> ),
>> 'Operation' => array(
>> 'className' => 'Operation',
>> 'foreignKey' => 'operation_id',
>> 'conditions' => '',
>> 'fields' => '',
>> 'order' => '',
>> 'counterCache' => true
>> )
>> );
>> }
>>
>> and the Operation controller method doing the work:
>>
>> /**
>>  * view method
>>  *
>>  * View an operation
>>  *
>>  * @param string $id
>>  * @return void
>>  */
>> public function view($id = null) {
>> $this->Operation->id = $id;
>> if (!$this->Operation->exists()) {
>>throw new NotFoundException(__('Invalid operation'));
>> }
>> $this->Operation->Behaviors->attach('Containable');
>> $this->set('operation', $this->Operation->find('first', array(
>>
>> 'contain' => array(
>> 'User',
>> 'OperationType',
>> 'OperationParticipant' => array('User')
>>),
>> 'conditions' => array(
>> 'Operation.id' => $id
>> )
>> )
>> ));
>> }
>>
>>
>> and still getting the error described...using cake 2.1.5 if that helps?
>>
>>
>>
>> On Tue, Oct 9, 2012 at 9:14 AM, Greg Skerman  wro

Re: struggling with containable - containing the same model twice

2012-10-09 Thread Greg Skerman
oddly, if i pr($this->Operation->User) I get the structure for the User
model, but if I dump out $this->Operation->OperationParticipant I get the
structure for AppModel.. its almost as though OperationParticipant is not
initializing?


On Tue, Oct 9, 2012 at 10:44 PM, Greg Skerman  wrote:

> Dave
>
> heres the exact OperationParticipant model:
>
> class OperationParticipant extends OperationAppModel {
> /**
>  * Validation rules
>
>  *
>  * @var array
>  */
> public $validate = array(
> 'user_id' => array(
> 'numeric' => array(
> 'rule' => array('numeric'),
> //'message' => 'Your custom message here',
> //'allowEmpty' => false,
> //'required' => false,
> //'last' => false, // Stop validation after this rule
> //'on' => 'create', // Limit validation to 'create' or
> 'update' operations
> ),
> ),
> 'operation_id' => array(
> 'numeric' => array(
> 'rule' => array('numeric'),
> //'message' => 'Your custom message here',
> //'allowEmpty' => false,
> //'required' => false,
> //'last' => false, // Stop validation after this rule
> //'on' => 'create', // Limit validation to 'create' or
> 'update' operations
> ),
> ),
> );
>
> //The Associations below have been created with all possible keys,
> those that are not needed can be removed
>
>
> /**
>  * belongsTo associations
>  *
>  * @var array
>  */
> public $belongsTo = array(
> 'User' => array(
> 'className' => 'User',
> 'foreignKey' => 'user_id',
> 'conditions' => '',
> 'fields' => '',
> 'order' => ''
> ),
> 'Operation' => array(
> 'className' => 'Operation',
> 'foreignKey' => 'operation_id',
> 'conditions' => '',
> 'fields' => '',
> 'order' => '',
> 'counterCache' => true
> )
> );
> }
>
> and the Operation controller method doing the work:
>
> /**
>  * view method
>  *
>  * View an operation
>  *
>  * @param string $id
>  * @return void
>  */
> public function view($id = null) {
> $this->Operation->id = $id;
> if (!$this->Operation->exists()) {
>throw new NotFoundException(__('Invalid operation'));
> }
> $this->Operation->Behaviors->attach('Containable');
> $this->set('operation', $this->Operation->find('first', array(
>
> 'contain' => array(
> 'User',
> 'OperationType',
> 'OperationParticipant' => array('User')
>),
> 'conditions' => array(
> 'Operation.id' => $id
> )
> )
> ));
> }
>
>
> and still getting the error described...using cake 2.1.5 if that helps?
>
>
>
> On Tue, Oct 9, 2012 at 9:14 AM, Greg Skerman  wrote:
>
>> The only thing I can think of is that User doesn't have an association
>> (baking the app would make it do so).
>>
>> Because Operation is a plugin which may or may not be there, User doesn't
>> have the association. But given i don't need to query it from the user
>> side, I don't need the association there, do i?
>>
>>
>>
>> On Mon, Oct 8, 2012 at 10:52 PM, Dave M.  wrote:
>>
>>> I suspect there is something else going on specific to your setup.
>>>
>>> I baked up a quick test app and had no problems at all. I didn't alias
>>> the association at all.
>>>
>>> My model names and associations were the same as yours.
>>>
>>> $this-&

Re: struggling with containable - containing the same model twice

2012-10-09 Thread Greg Skerman
Dave

heres the exact OperationParticipant model:

class OperationParticipant extends OperationAppModel {
/**
 * Validation rules
 *
 * @var array
 */
public $validate = array(
'user_id' => array(
'numeric' => array(
'rule' => array('numeric'),
//'message' => 'Your custom message here',
//'allowEmpty' => false,
//'required' => false,
//'last' => false, // Stop validation after this rule
//'on' => 'create', // Limit validation to 'create' or
'update' operations
),
),
'operation_id' => array(
'numeric' => array(
'rule' => array('numeric'),
//'message' => 'Your custom message here',
//'allowEmpty' => false,
//'required' => false,
//'last' => false, // Stop validation after this rule
//'on' => 'create', // Limit validation to 'create' or
'update' operations
),
),
);

//The Associations below have been created with all possible keys,
those that are not needed can be removed

/**
 * belongsTo associations
 *
 * @var array
 */
public $belongsTo = array(
'User' => array(
'className' => 'User',
'foreignKey' => 'user_id',
'conditions' => '',
'fields' => '',
'order' => ''
),
'Operation' => array(
'className' => 'Operation',
'foreignKey' => 'operation_id',
'conditions' => '',
'fields' => '',
'order' => '',
'counterCache' => true
)
);
}

and the Operation controller method doing the work:

/**
 * view method
 *
 * View an operation
 *
 * @param string $id
 * @return void
 */
public function view($id = null) {
$this->Operation->id = $id;
if (!$this->Operation->exists()) {
   throw new NotFoundException(__('Invalid operation'));
}
$this->Operation->Behaviors->attach('Containable');
$this->set('operation', $this->Operation->find('first', array(
'contain' => array(
'User',
'OperationType',
'OperationParticipant' => array('User')
   ),
'conditions' => array(
'Operation.id' => $id
)
)
));
}


and still getting the error described...using cake 2.1.5 if that helps?


On Tue, Oct 9, 2012 at 9:14 AM, Greg Skerman  wrote:

> The only thing I can think of is that User doesn't have an association
> (baking the app would make it do so).
>
> Because Operation is a plugin which may or may not be there, User doesn't
> have the association. But given i don't need to query it from the user
> side, I don't need the association there, do i?
>
>
>
> On Mon, Oct 8, 2012 at 10:52 PM, Dave M.  wrote:
>
>> I suspect there is something else going on specific to your setup.
>>
>> I baked up a quick test app and had no problems at all. I didn't alias
>> the association at all.
>>
>> My model names and associations were the same as yours.
>>
>> $this->Operation->find('all', array(
>> 'contain' => array(
>> 'User',
>>  'OperationType',
>> 'OperationParticipant' => array('User')
>> )
>> );
>>
>> Yielded this result:
>>
>> array(
>> (int) 0 => array(
>> 'Operation' => array(
>>  'id' => '1',
>> 'user_id' => '1',
>> 'descr' => 'fooo',
>>  'operation_type_id' => '1'
>> ),
>> 'User' => array(
>>  'id' => '1',
>> 'username' => 'aaa'
>> ),
>>  'OperationType' => array(
>> 'id' => '1',
>> 'descr' =&

Re: struggling with containable - containing the same model twice

2012-10-08 Thread Greg Skerman
The only thing I can think of is that User doesn't have an association
(baking the app would make it do so).

Because Operation is a plugin which may or may not be there, User doesn't
have the association. But given i don't need to query it from the user
side, I don't need the association there, do i?


On Mon, Oct 8, 2012 at 10:52 PM, Dave M.  wrote:

> I suspect there is something else going on specific to your setup.
>
> I baked up a quick test app and had no problems at all. I didn't alias the
> association at all.
>
> My model names and associations were the same as yours.
>
> $this->Operation->find('all', array(
> 'contain' => array(
> 'User',
> 'OperationType',
> 'OperationParticipant' => array('User')
> )
> );
>
> Yielded this result:
>
> array(
> (int) 0 => array(
> 'Operation' => array(
> 'id' => '1',
> 'user_id' => '1',
> 'descr' => 'fooo',
> 'operation_type_id' => '1'
> ),
> 'User' => array(
> 'id' => '1',
> 'username' => 'aaa'
> ),
> 'OperationType' => array(
> 'id' => '1',
> 'descr' => 'Foo'
> ),
> 'OperationParticipant' => array(
> (int) 0 => array(
> 'id' => '1',
> 'user_id' => '1',
> 'operation_id' => '1',
> 'User' => array(
> 'id' => '1',
> 'username' => 'aaa'
> )
> ),
> (int) 1 => array(
> 'id' => '2',
> 'user_id' => '2',
> 'operation_id' => '1',
> 'User' => array(
> 'id' => '2',
> 'username' => 'bbb'
> )
> )
> )
> )
> )
>
> I'm still thinking about this.
>
> On Monday, October 8, 2012 7:45:39 AM UTC-4, José Lorenzo wrote:
>>
>> You need the alias as cricket said and in your find you need 'contain' =>
>> array('OpUser', 'User')
>>
>> El lunes, 8 de octubre de 2012 01:50:05 UTC+2, Greg escribió:
>>>
>>> Sure have. Its containable that i'm suspecting is the problem.. Its
>>> almost as though it binds the model on the first level of contain, but then
>>> fails to rebind it after. If i turn containable off I can query the model
>>> with ->find();, but with containable on ->find() throws a non-existant
>>> method/non-existant object error.
>>>
>>>
>>> On Mon, Oct 8, 2012 at 2:17 AM, Dave M.  wrote:
>>>
>>>> another wild guess: have you attached the Containable behavior?
>>>>
>>>> In your AppModel:
>>>> public $actsAs = array('Containable');
>>>>
>>>> -dave
>>>>
>>>> On Saturday, October 6, 2012 2:58:54 AM UTC-4, Greg wrote:
>>>>
>>>>> Sorry to keep bumping, but this is really doing my head in...
>>>>>
>>>>> The only "solution" i have is to load the data without the contained
>>>>> users, and then call the users with ajax after the page has loaded - which
>>>>> seems a bit daft to me.
>>>>>
>>>>> On Tue, Oct 2, 2012 at 10:37 PM, Greg Skerman wrote:
>>>>>
>>>>>>  So even after aliasing everything, the User model appears to become
>>>>>> unbound from the OperationParticipant model and doesn't get rebound by
>>>>>> containable...
>>>>>>
>>>>>> anybody got any clue?
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Tue, Oct 2, 2012 at 7:54 AM, Greg Skerman wrote:
>>>>>>
>>>>>>> Yeah no dice :( had tried something similar to that before.
>>>>>>>
>>>>>>> * Model "OperationParticipant" is not associated with model "OPUser"
>>>>>>> *
>>>>>>>
>>>>>>>
>>>>>>> On Tue, Oct 2, 2012 at 4:05 AM, lowpass  wrote:
>>>>>>>
>>>>>>>> Just a wild guess: in the OperationParticipant model, try changing
>>>>>>>> the
>>>>>>>> alias for User. Something like:
>>>>>>>>
>>>>>>>> publi

Re: How to use blocks?

2012-10-07 Thread Greg Skerman
I use them mainly for injecting little bits of javascript... but
essentially you:

1) create a view or an element
2) stick the "block" code in that view or element
3) echo that "block" in a view or element which is currently being loaded.

e.g.

default.ctp

element('sidebar'); ?>

sidebar.ctp

start('sidebar.block');
// block code...
$this->end();

// other code for the side bar

echo $this->fetch('sidebar.block');

?>

or you could fetch the sidebar in the layout..

there is no magic "blocks" folder which stores all the blocks - thats what
elements are for.


On Mon, Oct 8, 2012 at 10:42 AM, Advantage+  wrote:

> If I place fetch('sidebar'); ?> in a view or layout where
> is sidebar?
> In View? Element? Tried both and still nothing shows up.
>
> In a Block folder?
>
> Book does not say what sidebar is or where its saved?
>
> Any insight?
>
> -Original Message-
> From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On
> Behalf
> Of Dr. Tarique Sani
> Sent: Sunday, October 07, 2012 4:49 AM
> To: cake-php@googlegroups.com
> Subject: Re: How to use blocks?
>
> Have you actually tried writing some code as explained in the book?
>
> If yes then show us the code
>
> Tarique
>
> On Sun, Oct 7, 2012 at 11:26 AM, Advantage+  wrote:
> > I cannot seem to figure this out.
>
> --
> =
> The Conference Schedule Creator : http://shdlr.com
>
> PHP for E-Biz : http://sanisoft.com
> =
>
> --
> Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter
> http://twitter.com/CakePHP
>
> ---
> 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, send email to
> cake-php+unsubscr...@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>
>
>
> --
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> 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, send email to
> cake-php+unsubscr...@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>
>
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
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, send email to 
cake-php+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Re: struggling with containable - containing the same model twice

2012-10-07 Thread Greg Skerman
Sure have. Its containable that i'm suspecting is the problem.. Its almost
as though it binds the model on the first level of contain, but then fails
to rebind it after. If i turn containable off I can query the model with
->find();, but with containable on ->find() throws a non-existant
method/non-existant object error.


On Mon, Oct 8, 2012 at 2:17 AM, Dave M.  wrote:

> another wild guess: have you attached the Containable behavior?
>
> In your AppModel:
> public $actsAs = array('Containable');
>
> -dave
>
> On Saturday, October 6, 2012 2:58:54 AM UTC-4, Greg wrote:
>
>> Sorry to keep bumping, but this is really doing my head in...
>>
>> The only "solution" i have is to load the data without the contained
>> users, and then call the users with ajax after the page has loaded - which
>> seems a bit daft to me.
>>
>> On Tue, Oct 2, 2012 at 10:37 PM, Greg Skerman  wrote:
>>
>>> So even after aliasing everything, the User model appears to become
>>> unbound from the OperationParticipant model and doesn't get rebound by
>>> containable...
>>>
>>> anybody got any clue?
>>>
>>>
>>>
>>> On Tue, Oct 2, 2012 at 7:54 AM, Greg Skerman  wrote:
>>>
>>>> Yeah no dice :( had tried something similar to that before.
>>>>
>>>> * Model "OperationParticipant" is not associated with model "OPUser"*
>>>>
>>>>
>>>> On Tue, Oct 2, 2012 at 4:05 AM, lowpass  wrote:
>>>>
>>>>> Just a wild guess: in the OperationParticipant model, try changing the
>>>>> alias for User. Something like:
>>>>>
>>>>> public $belongsTo = array(
>>>>> 'OPUser' => array(
>>>>> 'className' => 'User',
>>>>> ...
>>>>>
>>>>> And then change the contain block to have  'OperationParticipant' =>
>>>>> array('OPUser')
>>>>>
>>>>> On Mon, Oct 1, 2012 at 3:05 AM, Greg Skerman 
>>>>> wrote:
>>>>> > I've been wracking my brain over this for a few hours and its doing
>>>>> my head
>>>>> > in.
>>>>> >
>>>>> > Consider the following models and associations:
>>>>> >
>>>>> > Operation belongsTo User, OperationType and hasMany
>>>>> OperationParticipant
>>>>> > OperationType hasMany Operation
>>>>> > OperationParticipant belongsTo User, Operation
>>>>> >
>>>>> > if I dump out the contents of OperationParticipant in the
>>>>> > OperationParticipants controller, I get exactly what I would expect
>>>>> - a list
>>>>> > of OperationParticipants and the associated list of Users. Obviously
>>>>> User is
>>>>> > correctly associated with OperationParticipant
>>>>> >
>>>>> > The problem comes when I want to call up an Operation and list the
>>>>> users who
>>>>> > are participating.
>>>>> >
>>>>> > $this->Operation->find('all', array(
>>>>> >'contain' => array(
>>>>> >   'OperationType', 'User', 'OperationParticipant' =>
>>>>> array('User')
>>>>> >   )
>>>>> >)
>>>>> > );
>>>>> >
>>>>> > I get
>>>>> >
>>>>> > Model "OperationParticipant" is not associated with model "User"
>>>>> >
>>>>> > If, from within the context of the Operations controller I do
>>>>> > pr($this->Operation->**OperationParticipants->find('**all'))); I
>>>>> get no
>>>>> > associated data back for OperationParticipants.
>>>>> >
>>>>> > Adding OperationParticipants to the $uses property yields the same
>>>>> result,
>>>>> > no associated data.
>>>>> >
>>>>> > I've done deep contains before, and I cannot for the life of me
>>>>> understand
>>>>> > why this is acting up.
>>>>> >
>>>>> >
>>>>> > Here are the associations:
>>>>> >
>>>>> 

Re: struggling with containable - containing the same model twice

2012-10-05 Thread Greg Skerman
Sorry to keep bumping, but this is really doing my head in...

The only "solution" i have is to load the data without the contained users,
and then call the users with ajax after the page has loaded - which seems a
bit daft to me.

On Tue, Oct 2, 2012 at 10:37 PM, Greg Skerman  wrote:

> So even after aliasing everything, the User model appears to become
> unbound from the OperationParticipant model and doesn't get rebound by
> containable...
>
> anybody got any clue?
>
>
>
> On Tue, Oct 2, 2012 at 7:54 AM, Greg Skerman  wrote:
>
>> Yeah no dice :( had tried something similar to that before.
>>
>> * Model "OperationParticipant" is not associated with model "OPUser"*
>>
>>
>> On Tue, Oct 2, 2012 at 4:05 AM, lowpass  wrote:
>>
>>> Just a wild guess: in the OperationParticipant model, try changing the
>>> alias for User. Something like:
>>>
>>> public $belongsTo = array(
>>> 'OPUser' => array(
>>>     'className' => 'User',
>>> ...
>>>
>>> And then change the contain block to have  'OperationParticipant' =>
>>> array('OPUser')
>>>
>>> On Mon, Oct 1, 2012 at 3:05 AM, Greg Skerman  wrote:
>>> > I've been wracking my brain over this for a few hours and its doing my
>>> head
>>> > in.
>>> >
>>> > Consider the following models and associations:
>>> >
>>> > Operation belongsTo User, OperationType and hasMany
>>> OperationParticipant
>>> > OperationType hasMany Operation
>>> > OperationParticipant belongsTo User, Operation
>>> >
>>> > if I dump out the contents of OperationParticipant in the
>>> > OperationParticipants controller, I get exactly what I would expect -
>>> a list
>>> > of OperationParticipants and the associated list of Users. Obviously
>>> User is
>>> > correctly associated with OperationParticipant
>>> >
>>> > The problem comes when I want to call up an Operation and list the
>>> users who
>>> > are participating.
>>> >
>>> > $this->Operation->find('all', array(
>>> >'contain' => array(
>>> >   'OperationType', 'User', 'OperationParticipant' => array('User')
>>> >   )
>>> >)
>>> > );
>>> >
>>> > I get
>>> >
>>> > Model "OperationParticipant" is not associated with model "User"
>>> >
>>> > If, from within the context of the Operations controller I do
>>> > pr($this->Operation->OperationParticipants->find('all'))); I get no
>>> > associated data back for OperationParticipants.
>>> >
>>> > Adding OperationParticipants to the $uses property yields the same
>>> result,
>>> > no associated data.
>>> >
>>> > I've done deep contains before, and I cannot for the life of me
>>> understand
>>> > why this is acting up.
>>> >
>>> >
>>> > Here are the associations:
>>> >
>>> >
>>> > OperationParticipant.php
>>> >
>>> > /**
>>> >  * belongsTo associations
>>> >  *
>>> >  * @var array
>>> >  */
>>> > public $belongsTo = array(
>>> > 'User' => array(
>>> > 'className' => 'User',
>>> > 'foreignKey' => 'user_id',
>>> > 'conditions' => '',
>>> > 'fields' => '',
>>> > 'order' => ''
>>> > ),
>>> > 'Operation' => array(
>>> > 'className' => 'Operation',
>>> > 'foreignKey' => 'operation_id',
>>> > 'conditions' => '',
>>> > 'fields' => '',
>>> > 'order' => '',
>>> > 'counterCache' => true
>>> > )
>>> > );
>>> >
>>> >
>>> > Operation.php
>>> >
>>> > /**
>&g

Re: CakePHP 2.x implement edit form in ajax in a popup

2012-10-03 Thread Greg Skerman
jquery, and $.load() will be your friend here.

You can just "load" the html view of the edit form into a div and show it.

not the only way to do it, but certainly the most straight forward. (then
just trap the submit, serialize the form, fire off a post in jquery and
close the popup, refresh the content)


On Thu, Oct 4, 2012 at 12:00 AM, Kiran  wrote:

> I have read other posts and searched google before posting this here.
>
> I have a jquery popup in a view where I intend to show EDIT form and then
> submit using ajax.
>
> Further Details
>
> There is a reservation controller. reservations on a particular date are
> shown in the index ctp in a table . When user clicks on edit button a div
> pops up. Now I need to show Edit form and submit it via Ajax.
>
> Please can somebody point me in the right direction , may be some help or
> some tutorial.
>
> Thanks in advance,
> Kiran
>
> --
> Like Us on FacekBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> 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, send email to
> cake-php+unsubscr...@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>
>
>

-- 
Like Us on FacekBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
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, send email to 
cake-php+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Re: struggling with containable - containing the same model twice

2012-10-02 Thread Greg Skerman
So even after aliasing everything, the User model appears to become unbound
from the OperationParticipant model and doesn't get rebound by
containable...

anybody got any clue?


On Tue, Oct 2, 2012 at 7:54 AM, Greg Skerman  wrote:

> Yeah no dice :( had tried something similar to that before.
>
> * Model "OperationParticipant" is not associated with model "OPUser"*
>
>
> On Tue, Oct 2, 2012 at 4:05 AM, lowpass  wrote:
>
>> Just a wild guess: in the OperationParticipant model, try changing the
>> alias for User. Something like:
>>
>> public $belongsTo = array(
>> 'OPUser' => array(
>> 'className' => 'User',
>> ...
>>
>> And then change the contain block to have  'OperationParticipant' =>
>> array('OPUser')
>>
>> On Mon, Oct 1, 2012 at 3:05 AM, Greg Skerman  wrote:
>> > I've been wracking my brain over this for a few hours and its doing my
>> head
>> > in.
>> >
>> > Consider the following models and associations:
>> >
>> > Operation belongsTo User, OperationType and hasMany OperationParticipant
>> > OperationType hasMany Operation
>> > OperationParticipant belongsTo User, Operation
>> >
>> > if I dump out the contents of OperationParticipant in the
>> > OperationParticipants controller, I get exactly what I would expect - a
>> list
>> > of OperationParticipants and the associated list of Users. Obviously
>> User is
>> > correctly associated with OperationParticipant
>> >
>> > The problem comes when I want to call up an Operation and list the
>> users who
>> > are participating.
>> >
>> > $this->Operation->find('all', array(
>> >'contain' => array(
>> >   'OperationType', 'User', 'OperationParticipant' => array('User')
>> >   )
>> >)
>> > );
>> >
>> > I get
>> >
>> > Model "OperationParticipant" is not associated with model "User"
>> >
>> > If, from within the context of the Operations controller I do
>> > pr($this->Operation->OperationParticipants->find('all'))); I get no
>> > associated data back for OperationParticipants.
>> >
>> > Adding OperationParticipants to the $uses property yields the same
>> result,
>> > no associated data.
>> >
>> > I've done deep contains before, and I cannot for the life of me
>> understand
>> > why this is acting up.
>> >
>> >
>> > Here are the associations:
>> >
>> >
>> > OperationParticipant.php
>> >
>> > /**
>> >  * belongsTo associations
>> >  *
>> >  * @var array
>> >  */
>> > public $belongsTo = array(
>> > 'User' => array(
>> > 'className' => 'User',
>> > 'foreignKey' => 'user_id',
>> > 'conditions' => '',
>> > 'fields' => '',
>> > 'order' => ''
>> > ),
>> > 'Operation' => array(
>> > 'className' => 'Operation',
>> > 'foreignKey' => 'operation_id',
>> > 'conditions' => '',
>> > 'fields' => '',
>> > 'order' => '',
>> > 'counterCache' => true
>> > )
>> > );
>> >
>> >
>> > Operation.php
>> >
>> > /**
>> >  * belongsTo associations
>> >  *
>> >  * @var array
>> >  */
>> > public $belongsTo = array(
>> > 'OperationType' => array(
>> > 'className' => 'OperationType',
>> > 'foreignKey' => 'operation_type_id',
>> > 'conditions' => '',
>> > 'fields' => '',
>> > 'order' => ''
>> > ),
>> > 'User' => array(
>> > 'className' => 'User',
>> >  

Re: struggling with containable - containing the same model twice

2012-10-01 Thread Greg Skerman
Yeah no dice :( had tried something similar to that before.

* Model "OperationParticipant" is not associated with model "OPUser"*

On Tue, Oct 2, 2012 at 4:05 AM, lowpass  wrote:

> Just a wild guess: in the OperationParticipant model, try changing the
> alias for User. Something like:
>
> public $belongsTo = array(
> 'OPUser' => array(
> 'className' => 'User',
> ...
>
> And then change the contain block to have  'OperationParticipant' =>
> array('OPUser')
>
> On Mon, Oct 1, 2012 at 3:05 AM, Greg Skerman  wrote:
> > I've been wracking my brain over this for a few hours and its doing my
> head
> > in.
> >
> > Consider the following models and associations:
> >
> > Operation belongsTo User, OperationType and hasMany OperationParticipant
> > OperationType hasMany Operation
> > OperationParticipant belongsTo User, Operation
> >
> > if I dump out the contents of OperationParticipant in the
> > OperationParticipants controller, I get exactly what I would expect - a
> list
> > of OperationParticipants and the associated list of Users. Obviously
> User is
> > correctly associated with OperationParticipant
> >
> > The problem comes when I want to call up an Operation and list the users
> who
> > are participating.
> >
> > $this->Operation->find('all', array(
> >'contain' => array(
> >   'OperationType', 'User', 'OperationParticipant' => array('User')
> >   )
> >)
> > );
> >
> > I get
> >
> > Model "OperationParticipant" is not associated with model "User"
> >
> > If, from within the context of the Operations controller I do
> > pr($this->Operation->OperationParticipants->find('all'))); I get no
> > associated data back for OperationParticipants.
> >
> > Adding OperationParticipants to the $uses property yields the same
> result,
> > no associated data.
> >
> > I've done deep contains before, and I cannot for the life of me
> understand
> > why this is acting up.
> >
> >
> > Here are the associations:
> >
> >
> > OperationParticipant.php
> >
> > /**
> >  * belongsTo associations
> >  *
> >  * @var array
> >  */
> > public $belongsTo = array(
> > 'User' => array(
> > 'className' => 'User',
> > 'foreignKey' => 'user_id',
> > 'conditions' => '',
> > 'fields' => '',
> > 'order' => ''
> > ),
> > 'Operation' => array(
> > 'className' => 'Operation',
> > 'foreignKey' => 'operation_id',
> > 'conditions' => '',
> > 'fields' => '',
> > 'order' => '',
> > 'counterCache' => true
> > )
> > );
> >
> >
> > Operation.php
> >
> > /**
> >  * belongsTo associations
> >  *
> >  * @var array
> >  */
> > public $belongsTo = array(
> > 'OperationType' => array(
> > 'className' => 'OperationType',
> > 'foreignKey' => 'operation_type_id',
> > 'conditions' => '',
> > 'fields' => '',
> > 'order' => ''
> > ),
> > 'User' => array(
> > 'className' => 'User',
> > 'foreignKey' => 'user_id',
> > 'conditions' => '',
> > 'fields' => '',
> > 'order' => ''
> > )
> > );
> >
> > /**
> >  * hasMany associations
> >  *
> >  * @var array
> >  */
> > public $hasMany = array(
> > 'OperationParticipant' => array(
> > 'className' => 'OperationParticipant',
> > 'foreignKey' => 'operation_id',
> > 'dependent&#x

struggling with containable - containing the same model twice

2012-10-01 Thread Greg Skerman
I've been wracking my brain over this for a few hours and its doing my head
in.

Consider the following models and associations:

Operation belongsTo User, OperationType and hasMany OperationParticipant
OperationType hasMany Operation
OperationParticipant belongsTo User, Operation

if I dump out the contents of OperationParticipant in the
OperationParticipants controller, I get exactly what I would expect - a
list of OperationParticipants and the associated list of Users. Obviously
User is correctly associated with OperationParticipant

The problem comes when I want to call up an Operation and list the users
who are participating.

$this->Operation->find('all', array(
   'contain' => array(
  'OperationType', 'User', 'OperationParticipant' => array('User')
  )
   )
);

I get

*Model "OperationParticipant" is not associated with model "User"
*
If, from within the context of the Operations controller I do
pr($this->Operation->OperationParticipants->find('all'))); I get no
associated data back for OperationParticipants.

Adding OperationParticipants to the $uses property yields the same result,
no associated data.

I've done deep contains before, and I cannot for the life of me understand
why this is acting up.


Here are the associations:


OperationParticipant.php

/**
 * belongsTo associations
 *
 * @var array
 */
public $belongsTo = array(
'User' => array(
'className' => 'User',
'foreignKey' => 'user_id',
'conditions' => '',
'fields' => '',
'order' => ''
),
'Operation' => array(
'className' => 'Operation',
'foreignKey' => 'operation_id',
'conditions' => '',
'fields' => '',
'order' => '',
'counterCache' => true
)
);


Operation.php

/**
 * belongsTo associations
 *
 * @var array
 */
public $belongsTo = array(
'OperationType' => array(
'className' => 'OperationType',
'foreignKey' => 'operation_type_id',
'conditions' => '',
'fields' => '',
'order' => ''
),
'User' => array(
'className' => 'User',
'foreignKey' => 'user_id',
'conditions' => '',
'fields' => '',
'order' => ''
)
);

/**
 * hasMany associations
 *
 * @var array
 */
public $hasMany = array(
'OperationParticipant' => array(
'className' => 'OperationParticipant',
'foreignKey' => 'operation_id',
'dependent' => false,
'conditions' => '',
'fields' => '',
'order' => '',
'limit' => '',
'offset' => '',
'exclusive' => '',
'finderQuery' => '',
'counterQuery' => ''
)
);


OperationType.php

/**
 * hasMany associations
 *
 * @var array
 */
public $hasMany = array(
'Operation' => array(
'className' => 'Operation',
'foreignKey' => 'operation_type_id',
'dependent' => false,
'conditions' => '',
'fields' => '',
'order' => '',
'limit' => '',
'offset' => '',
'exclusive' => '',
'finderQuery' => '',
'counterQuery' => ''
)
);



The users model does not have the association included, Operations is a
plugin which may not always be there so I've not included the hasMany (and
there is no reason to read the data back the other way, i.e. I have no
requirement to get a list of Users and find their associated Operations -
only Operations, and find their associated users.

Can anyone shed any light?

-- 
Like Us on FacekBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
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, send email to 
cake-php+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Re: getting cousin data

2012-09-21 Thread Greg Skerman
use the containable behavior

On Sat, Sep 22, 2012 at 6:13 AM, Michael Bryant  wrote:

> I am new to CakePHP. I am trying to understand the models.
>
> I have Accounts that BelongsTo Contacts and Phones.
>
> the Contacts also  BelongsTo Phones
>
> Phones BelongsTo PhoneType
>
> PhoneType hasMany Phones
>
> What I want to do is View an Account and get the list of Phones and the *name
> of the Phone type*
> *
> *
> I get the list of Phones, but not the associated PhoneType info.
>
>
> Thanks for your help.
>
> --
> Like Us on FacekBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> 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, send email to
> cake-php+unsubscr...@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>
>
>

-- 
Like Us on FacekBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
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, send email to 
cake-php+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Re: How can I know if someone is directly accessing my public img directory?

2012-09-13 Thread Greg Skerman
it wont pick up actions for the webroot because the webroot isn't subject
to any controller action - the .htaccess is rewriting the URL and directing
the request at a physical location etc etc.

One way you could do it is to create a media view for your images and force
all your images through a controller. It may be slower than serving up
static content.

Of course, if all you want to know is IF someone is accessing your images
under webroot (but you don't care whether they do or when they did) you can
always inspect your httpd logs after the fact.


On Fri, Sep 14, 2012 at 9:54 AM, andrewperk  wrote:

> Hello,
>
> I'd like to be able to know if someone is directly accessing images from
> my /webroot/img directory. Is this possible?
>
> For instance if they type in: http://mydomain/img/picture.jpg
>
> I should be able to check for this in my beforeFilter like I can for my
> actions, but it doesn't seem to pick up requests from webroot.
>
> Thanks,
>
> Andrew
>
> --
> 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, send email to
> cake-php+unsubscr...@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
>
>
>

-- 
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, send email to 
cake-php+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.




Re: How to use two view(controller) in a page??

2012-09-09 Thread Greg Skerman
You can implement Auth yourself, but the auth component does alot of the
heavy lifting for you - unless you have a specific reason for implementing
it yourself I would recommend using the component shipped with the
framework.

As an experiment, try *removing* the security component from the users
controller and see if your login form then starts to work.

The homepage will likely be driven by the PagesController shipped with the
framework (if you are using home.ctp under /View/Pages/)


On Mon, Sep 10, 2012 at 11:33 AM, shyandsy  wrote:

> May I implement Auth by myself?
>
> Actually,I do not know how to write a controller for the homepage.
>
> I used three components in the UsersController.php:
>   public $components = array('Session','Security', 'Cookie');
>
>
> 在 2012年9月9日星期日UTC-5下午8时25分37秒,Greg写道:
>>
>> Why are you doing it that way and not just using the Auth component?
>> Auth component basically magics up all of that stuff for you
>>
>> http://book.cakephp.org/2.0/**en/core-libraries/components/**
>> authentication.html<http://book.cakephp.org/2.0/en/core-libraries/components/authentication.html>
>>
>> point that at a table with a username and password field and you're set
>> (more or less).
>>
>> I'd suggest perhaps that the security component isn't being turned on by
>> the controller generating the home page - where it looks like it is on the
>> users controller... users controller is expecting the security bits which
>> are not available at the time the form is being generated.
>>
>>
>>
>> On Mon, Sep 10, 2012 at 11:11 AM, shyandsy  wrote:
>>
>>> Pretty sure!
>>>
>>> home.ctp
>>> 
>>> >> echo $this->element('LoginForm');
>>> ?>
>>> .
>>>
>>> element/LoginForm.ctp
>>> >> echo $this->Form->create('User', array('url' => array('controller' =>
>>> 'users', 'action' => 'login')));
>>> echo $this->Form->input('username')**;
>>> echo $this->Form->input('password')**;
>>> echo $this->Form->end('登录系统');
>>> ?>
>>>
>>>
>>> UsersController.php
>>>
>>> public function login()
>>> {
>>> if($this->request->is('post'))
>>>  {
>>> $result = $this->User->**findByUsernameAndPassword(
>>> $this->data['User']['username'**],
>>>  $this->data['User']['password'**]);
>>> if($result)
>>> {
>>>  $credential = Security::generateAuthKey();
>>>  //将凭据更新到数据库
>>>  $this->request->data['User']['**credential'] = $credential;
>>> $this->User->id = $result['User']['id'];
>>>  $this->User->save($this->**request->data);
>>>  $this->Session->setFlash('**登录认证成功');
>>>  //设置cookie
>>> $this->Cookie->write('Users.**username', $this->data['User']['username'*
>>> *]);
>>>  $this->Cookie->write('Users.**credential', $credential);
>>> $this->redirect(array('action'**=>'index'));
>>>  }
>>> else
>>> {
>>> $this->Session->setFlash('**登录认证失败');
>>>  }
>>> }
>>>  }
>>>
>>> 在 2012年9月9日星期日UTC-5下午6时40分34秒,**Greg写道:
>>>>
>>>> can you post the code?
>>>>
>>>>
>>>> On Mon, Sep 10, 2012 at 1:45 AM, shyandsy  wrote:
>>>>
>>>>> It doesn't work.
>>>>> The submit can not find the controller.
>>>>>
>>>>> I compared the different between 127.0.0.1/user/login and  127.0.0.1 .
>>>>>
>>>>> This is the login form in the login page:
>>>>> >>>> accept-charset="utf-8">
>>>>>  
>>>>> 
>>>>>  
>>>>>  
>>>>> 
>>>>>  Username
>>>>>  
>>>>>  
>>>>> 
>>>>>  Password
>>>>>  
>>>>>  
>>>>> 
>>>>>  
>>>>>  
>>>>>  
>>>>> 
>>>>>  
>>>>>  
>>>>> 
>>>>>
>>>>> This is the login form element in 

Re: How to use two view(controller) in a page??

2012-09-09 Thread Greg Skerman
Why are you doing it that way and not just using the Auth component?
Auth component basically magics up all of that stuff for you

http://book.cakephp.org/2.0/en/core-libraries/components/authentication.html

point that at a table with a username and password field and you're set
(more or less).

I'd suggest perhaps that the security component isn't being turned on by
the controller generating the home page - where it looks like it is on the
users controller... users controller is expecting the security bits which
are not available at the time the form is being generated.



On Mon, Sep 10, 2012 at 11:11 AM, shyandsy  wrote:

> Pretty sure!
>
> home.ctp
> 
>  echo $this->element('LoginForm');
> ?>
> .
>
> element/LoginForm.ctp
>  echo $this->Form->create('User', array('url' => array('controller' =>
> 'users', 'action' => 'login')));
> echo $this->Form->input('username');
> echo $this->Form->input('password');
> echo $this->Form->end('登录系统');
> ?>
>
>
> UsersController.php
>
> public function login()
> {
> if($this->request->is('post'))
> {
> $result = $this->User->findByUsernameAndPassword(
> $this->data['User']['username'],
> $this->data['User']['password']);
> if($result)
> {
> $credential = Security::generateAuthKey();
>  //将凭据更新到数据库
> $this->request->data['User']['credential'] = $credential;
> $this->User->id = $result['User']['id'];
> $this->User->save($this->request->data);
>  $this->Session->setFlash('登录认证成功');
>  //设置cookie
> $this->Cookie->write('Users.username', $this->data['User']['username']);
> $this->Cookie->write('Users.credential', $credential);
> $this->redirect(array('action'=>'index'));
> }
> else
> {
> $this->Session->setFlash('登录认证失败');
> }
> }
>  }
>
> 在 2012年9月9日星期日UTC-5下午6时40分34秒,Greg写道:
>>
>> can you post the code?
>>
>>
>> On Mon, Sep 10, 2012 at 1:45 AM, shyandsy  wrote:
>>
>>> It doesn't work.
>>> The submit can not find the controller.
>>>
>>> I compared the different between 127.0.0.1/user/login and  127.0.0.1 .
>>>
>>> This is the login form in the login page:
>>> >> accept-charset="utf-8">
>>>  
>>> 
>>>  
>>>  
>>> 
>>>  Username
>>>  
>>>  
>>> 
>>>  Password
>>>  
>>>  
>>> 
>>>  
>>> 
>>>  
>>> 
>>>  
>>>  
>>> 
>>>
>>> This is the login form element in the homepage
>>> >> accept-charset="utf-8">
>>>  
>>> 
>>>  
>>> 
>>>  Username
>>>  
>>>  
>>> 
>>>  Password
>>>  
>>>  
>>> 
>>>  
>>>  
>>> 
>>>
>>> Obviously, The login form in user/login page has been assign some staff
>>> like token, but element is not.
>>>
>>> 在 2012年9月6日星期四UTC-5下午7时10分03秒,**Greg写道:
>>>>
>>>> Thats fine.
>>>>
>>>> The solution for using elements is fairly straight forward. Build your
>>>> Controller and your model *as normal* - so your Users controller has a
>>>> login method.
>>>>
>>>> Next, create a new element under View/Elements called "LoginForm.ctp".
>>>>
>>>> The login form would look something like this:
>>>>
>>>> >>>
>>>> echo $this->Form->create(null, array('url' => array('controller' =>
>>>> 'Users', 'action' => 'login')));
>>>> // ... rest of the form
>>>> echo $this->Form->end('login');
>>>> ?>
>>>>
>>>> back over in your home.ctp file you put this where you want the login
>>>> form to be visible:
>>>>
>>>> >>> echo $this->element('LoginForm');
>>>> ?>
>>>>
>>>> and you're done - the home page will now have the content from
>>>> LoginForm.ctp which will correctly submit the form data to the login action
>>>> on the Users controller.
>

Re: How to use two view(controller) in a page??

2012-09-09 Thread Greg Skerman
can you post the code?


On Mon, Sep 10, 2012 at 1:45 AM, shyandsy  wrote:

> It doesn't work.
> The submit can not find the controller.
>
> I compared the different between 127.0.0.1/user/login and  127.0.0.1 .
>
> This is the login form in the login page:
>  accept-charset="utf-8">
> 
> 
> 
> 
> 
> Username
> 
> 
> 
> Password
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
>
> This is the login form element in the homepage
>  ="utf-8">
> 
> 
> 
> 
> Username
> 
> 
> 
> Password
> 
> 
> 
> 
> 
> 
>
> Obviously, The login form in user/login page has been assign some staff
> like token, but element is not.
>
> 在 2012年9月6日星期四UTC-5下午7时10分03秒,Greg写道:
>>
>> Thats fine.
>>
>> The solution for using elements is fairly straight forward. Build your
>> Controller and your model *as normal* - so your Users controller has a
>> login method.
>>
>> Next, create a new element under View/Elements called "LoginForm.ctp".
>>
>> The login form would look something like this:
>>
>> >
>> echo $this->Form->create(null, array('url' => array('controller' =>
>> 'Users', 'action' => 'login')));
>> // ... rest of the form
>> echo $this->Form->end('login');
>> ?>
>>
>> back over in your home.ctp file you put this where you want the login
>> form to be visible:
>>
>> > echo $this->element('LoginForm');
>> ?>
>>
>> and you're done - the home page will now have the content from
>> LoginForm.ctp which will correctly submit the form data to the login action
>> on the Users controller.
>>
>> You can of course then reuse the LoginForm element anywhere you like -
>> say the user navigates directly to /Users/login you could dump the login
>> form element on that page. Or say you wanted it in the header for every
>> page, modify the layout to include the element.
>>
>> You don't *have* to associate every action with a specific view for that
>> controller/action combination - it is often quite beneficial to drop
>> reusable forms into elements so that you can reuse them over and over
>> again. It helps with maintenance as well because if you modify the form
>> element, you are modifying it in all places in your site at once instead of
>> having to go and modify every template/view that contains it.
>>
>>
>> On Fri, Sep 7, 2012 at 8:08 AM, shyandsy  wrote:
>>
>>> Got it, I already know the difference between reply on here and reply to
>>> your mailbox.
>>>
>>>
>>> 在 2012年9月5日星期三UTC-5上午2时45分34秒,**Greg写道:
>>>
>>>> You don't use a view. Make an element to start with under
>>>> views/elements.
>>>> Call it loginForm.ctp or something.
>>>>
>>>> Then define an action in the form helper create call to point it at the
>>>> right controller/action
>>>>
>>>> On Wednesday, September 5, 2012, shyandsy wrote:
>>>>
>>>>> Hi,  thanks for your anwser firstly.
>>>>>
>>>>> I have tried the method of element.
>>>>> I can load the login view that were written in the
>>>>> view/users/login.ctp,
>>>>> but I do not know how to process the POST request by
>>>>> UsersController.login()?
>>>>>
>>>>> I can not find the detail description on the cookbook 2.0.
>>>>>
>>>>>
>>>>> 在 2012年9月4日星期二UTC-5下午7时09分33秒,**Gr**eg写道:
>>>>>>
>>>>>> I'd do it with an element personally. Have the home page retrieve the
>>>>>> data from the models in question then pass the resulting data to 
>>>>>> individual
>>>>>> elements...
>>>>>>
>>>>>> requestAction is a major performance hit, especially if you are not
>>>>>> caching the results...and on the home page as described here you are
>>>>>> looking at subjecting your users to 3 calls to the dispatcher (one for
>>>>>> pages, one for news, one for users).
>>>>>>
>>>>>> You *can* use requestAction and elements together, then cache the
>>>>>> element to reduce the hit if you wish.
>>>>>>
>>>>>>
>>>>>> On Wed, Sep 5, 2012 at 5:06 AM, Mark Wratten wrote:
>>>>>>
&g

Re: Events - how do I attach additional callbacks to the HelperCollection

2012-09-08 Thread Greg Skerman
Ahh thanks for the example.. got it all working now :)


On Sat, Sep 8, 2012 at 3:09 PM, rchavik  wrote:

>
> On Friday, September 7, 2012 10:23:06 PM UTC+7, Greg wrote:
>>
>> Hi,
>>
>> I've got a case where I want one helper to raise events on other helpers.
>> The concept is that plugins can manipulate the output of a MenuHelper by
>> returning additional menu items at runtime.
>>
>> Is there a way that I can access an instance of the helper collection and
>> attach additional callbacks that can be listed to? sorry no code samples at
>> the moment, I'm a little bit lost on the way this is implemented, just need
>> a nudge in the right direction.
>>
>
> There's something similar in Croogo:
>
> Trigger events:
> https://github.com/croogo/croogo/blob/1.5/View/Helper/LayoutHelper.php#L313
>
> Setup another helper to listen for that event:
>
> https://github.com/croogo/croogo/blob/1.5/Plugin/Menus/View/Helper/MenusHelper.php#L32
>
>
>
> --
> 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, send email to
> cake-php+unsubscr...@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
>
>
>

-- 
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, send email to 
cake-php+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.




Events - how do I attach additional callbacks to the HelperCollection

2012-09-07 Thread Greg Skerman
Hi,

I've got a case where I want one helper to raise events on other helpers.
The concept is that plugins can manipulate the output of a MenuHelper by
returning additional menu items at runtime.

Is there a way that I can access an instance of the helper collection and
attach additional callbacks that can be listed to? sorry no code samples at
the moment, I'm a little bit lost on the way this is implemented, just need
a nudge in the right direction.

-- 
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, send email to 
cake-php+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.




Re: How to use two view(controller) in a page??

2012-09-06 Thread Greg Skerman
Thats fine.

The solution for using elements is fairly straight forward. Build your
Controller and your model *as normal* - so your Users controller has a
login method.

Next, create a new element under View/Elements called "LoginForm.ctp".

The login form would look something like this:

Form->create(null, array('url' => array('controller' =>
'Users', 'action' => 'login')));
// ... rest of the form
echo $this->Form->end('login');
?>

back over in your home.ctp file you put this where you want the login form
to be visible:

element('LoginForm');
?>

and you're done - the home page will now have the content from
LoginForm.ctp which will correctly submit the form data to the login action
on the Users controller.

You can of course then reuse the LoginForm element anywhere you like - say
the user navigates directly to /Users/login you could dump the login form
element on that page. Or say you wanted it in the header for every page,
modify the layout to include the element.

You don't *have* to associate every action with a specific view for that
controller/action combination - it is often quite beneficial to drop
reusable forms into elements so that you can reuse them over and over
again. It helps with maintenance as well because if you modify the form
element, you are modifying it in all places in your site at once instead of
having to go and modify every template/view that contains it.


On Fri, Sep 7, 2012 at 8:08 AM, shyandsy  wrote:

> Got it, I already know the difference between reply on here and reply to
> your mailbox.
>
>
> 在 2012年9月5日星期三UTC-5上午2时45分34秒,Greg写道:
>
>> You don't use a view. Make an element to start with under views/elements.
>> Call it loginForm.ctp or something.
>>
>> Then define an action in the form helper create call to point it at the
>> right controller/action
>>
>> On Wednesday, September 5, 2012, shyandsy wrote:
>>
>>> Hi,  thanks for your anwser firstly.
>>>
>>> I have tried the method of element.
>>> I can load the login view that were written in the view/users/login.ctp,
>>> but I do not know how to process the POST request by
>>> UsersController.login()?
>>>
>>> I can not find the detail description on the cookbook 2.0.
>>>
>>>
>>> 在 2012年9月4日星期二UTC-5下午7时09分33秒,**Greg写道:
>>>>
>>>> I'd do it with an element personally. Have the home page retrieve the
>>>> data from the models in question then pass the resulting data to individual
>>>> elements...
>>>>
>>>> requestAction is a major performance hit, especially if you are not
>>>> caching the results...and on the home page as described here you are
>>>> looking at subjecting your users to 3 calls to the dispatcher (one for
>>>> pages, one for news, one for users).
>>>>
>>>> You *can* use requestAction and elements together, then cache the
>>>> element to reduce the hit if you wish.
>>>>
>>>>
>>>> On Wed, Sep 5, 2012 at 5:06 AM, Mark Wratten  wrote:
>>>>
>>>>> I am assuming you have a route that routes to a specific
>>>>> controller/action, e.g. pages controller, index action.
>>>>> Then in you home page view View/Pages/index.ctp -
>>>>>
>>>>> Welcome to my home page.
>>>>>
>>>>> 
>>>>>   News Summary>
>>>>>   requestAction('/news/**su**mmary'); ?>
>>>>> 
>>>>>
>>>>> 
>>>>>   requestAction('users/**lo**gin'); ?>
>>>>> 
>>>>>
>>>>> Then, in your News controller, create and action - summary, and a view
>>>>> file summary.ctp.
>>>>> In your Users controller create action login (which should also handle
>>>>> the POST request when the user logs in) and a login.ctp view file.
>>>>>
>>>>> Then when the home page is rendered, the news summary and login forms
>>>>> will be displayed.
>>>>>
>>>>> Mark
>>>>>
>>>>>
>>>>> On Monday, September 3, 2012 8:04:34 PM UTC-4, shyandsy wrote:
>>>>>>
>>>>>> could you put some details on, thanks a lot!
>>>>>> Making a home page that includes login and news list.
>>>>>>
>>>>>> I can write a view and controller for that job login or news list,
>>>>>> but I don't know how t

Re: How to use two view(controller) in a page??

2012-09-05 Thread Greg Skerman
You don't use a view. Make an element to start with under views/elements.
Call it loginForm.ctp or something.

Then define an action in the form helper create call to point it at the
right controller/action

On Wednesday, September 5, 2012, shyandsy wrote:

> Hi,  thanks for your anwser firstly.
>
> I have tried the method of element.
> I can load the login view that were written in the view/users/login.ctp,
> but I do not know how to process the POST request by
> UsersController.login()?
>
> I can not find the detail description on the cookbook 2.0.
>
>
> 在 2012年9月4日星期二UTC-5下午7时09分33秒,Greg写道:
>>
>> I'd do it with an element personally. Have the home page retrieve the
>> data from the models in question then pass the resulting data to individual
>> elements...
>>
>> requestAction is a major performance hit, especially if you are not
>> caching the results...and on the home page as described here you are
>> looking at subjecting your users to 3 calls to the dispatcher (one for
>> pages, one for news, one for users).
>>
>> You *can* use requestAction and elements together, then cache the element
>> to reduce the hit if you wish.
>>
>>
>> On Wed, Sep 5, 2012 at 5:06 AM, Mark Wratten  wrote:
>>
>>> I am assuming you have a route that routes to a specific
>>> controller/action, e.g. pages controller, index action.
>>> Then in you home page view View/Pages/index.ctp -
>>>
>>> Welcome to my home page.
>>>
>>> 
>>>   News Summary>
>>>   requestAction('/news/**summary'); ?>
>>> 
>>>
>>> 
>>>   requestAction('users/**login'); ?>
>>> 
>>>
>>> Then, in your News controller, create and action - summary, and a view
>>> file summary.ctp.
>>> In your Users controller create action login (which should also handle
>>> the POST request when the user logs in) and a login.ctp view file.
>>>
>>> Then when the home page is rendered, the news summary and login forms
>>> will be displayed.
>>>
>>> Mark
>>>
>>>
>>> On Monday, September 3, 2012 8:04:34 PM UTC-4, shyandsy wrote:
>>>>
>>>> could you put some details on, thanks a lot!
>>>> Making a home page that includes login and news list.
>>>>
>>>> I can write a view and controller for that job login or news list, but
>>>> I don't know how to make that things togerther!!
>>>>
>>>>
>>>> 在 2012年9月3日星期一UTC-5上午12时22分41秒,**M**ark Wratten写道:
>>>>>
>>>>> Easiest is to use requestAction() in the homepage view.
>>>>>
>>>>> On Thursday, August 30, 2012 4:26:12 PM UTC-4, shyandsy wrote:
>>>>>>
>>>>>> I am kind of new guy on cakePhp. So the description as below:
>>>>>>
>>>>>> I hope to provide two function to users in the homepage, login and
>>>>>> news.
>>>>>> The login uses the view login and the controller loginController, and
>>>>>> the news uses the news view and newscontroller.
>>>>>> The problem is how to put the two view in the home page.
>>>>>>
>>>>>> (apologize, my first language is not English, if you meet some
>>>>>> problem about grammar, I will try to fix it)
>>>>>>
>>>>>  --
>>> You received this message because you are subscribed to the Google
>>> Groups "CakePHP" group.
>>> To post to this group, send email to cake...@googlegroups.com.
>>> To unsubscribe from this group, send email to cake-php+u...@**
>>> googlegroups.com.
>>> Visit this group at 
>>> http://groups.google.com/**group/cake-php?hl=en-US<http://groups.google.com/group/cake-php?hl=en-US>
>>> .
>>>
>>>
>>>
>>
>>  --
> 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 'cake-php@googlegroups.com');>
> .
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com  'cake-php%2bunsubscr...@googlegroups.com');>.
> Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
>
>
>

-- 
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, send email to 
cake-php+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.




Re: How to use two view(controller) in a page??

2012-09-04 Thread Greg Skerman
I'd do it with an element personally. Have the home page retrieve the data
from the models in question then pass the resulting data to individual
elements...

requestAction is a major performance hit, especially if you are not caching
the results...and on the home page as described here you are looking at
subjecting your users to 3 calls to the dispatcher (one for pages, one for
news, one for users).

You *can* use requestAction and elements together, then cache the element
to reduce the hit if you wish.


On Wed, Sep 5, 2012 at 5:06 AM, Mark Wratten  wrote:

> I am assuming you have a route that routes to a specific
> controller/action, e.g. pages controller, index action.
> Then in you home page view View/Pages/index.ctp -
>
> Welcome to my home page.
>
> 
>   News Summary>
>   requestAction('/news/summary'); ?>
> 
>
> 
>   requestAction('users/login'); ?>
> 
>
> Then, in your News controller, create and action - summary, and a view
> file summary.ctp.
> In your Users controller create action login (which should also handle the
> POST request when the user logs in) and a login.ctp view file.
>
> Then when the home page is rendered, the news summary and login forms will
> be displayed.
>
> Mark
>
>
> On Monday, September 3, 2012 8:04:34 PM UTC-4, shyandsy wrote:
>>
>> could you put some details on, thanks a lot!
>> Making a home page that includes login and news list.
>>
>> I can write a view and controller for that job login or news list, but I
>> don't know how to make that things togerther!!
>>
>>
>> 在 2012年9月3日星期一UTC-5上午12时22分41秒,**Mark Wratten写道:
>>>
>>> Easiest is to use requestAction() in the homepage view.
>>>
>>> On Thursday, August 30, 2012 4:26:12 PM UTC-4, shyandsy wrote:

 I am kind of new guy on cakePhp. So the description as below:

 I hope to provide two function to users in the homepage, login and
 news.
 The login uses the view login and the controller loginController, and
 the news uses the news view and newscontroller.
 The problem is how to put the two view in the home page.

 (apologize, my first language is not English, if you meet some problem
 about grammar, I will try to fix it)

>>>  --
> 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, send email to
> cake-php+unsubscr...@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
>
>
>

-- 
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, send email to 
cake-php+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.




Re: netbeans cake support

2012-09-04 Thread Greg Skerman
The comments are just good practice - and the payoff for code completion is
well worth it.

I searched for a plugin for a long while and then resigned myself to using
the comments.

Its worth noting that when you use the bake console the generated models
and controllers already have comments which allow netbeans to complete code
properly.


On Tue, Sep 4, 2012 at 5:35 AM, Mohammad Naghavi  wrote:

> Hi everybody,
> I'm searching for a netbeans plugin which adds cakephp support. I know
> about the way of adding comments to enable some code completion in netbeans
> but what I need is to have it all with much less work. I searched a little
> bit but most of what I found was outdated and not continued. So I wanted to
> ask if anybody knows about a good way of adding cake support to netbeans?
> I love this editor and use it for Java development too much. I don't want
> to learn all the key shortcuts of another new editor, so please help me if
> you know any way.
>
> regards,
> Mohammad
>
> --
> 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, send email to
> cake-php+unsubscr...@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
>
>
>

-- 
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, send email to 
cake-php+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.




Re: Form validation and business logic

2012-08-27 Thread Greg Skerman
Not sure I follow.. "form validation" is data validation - it rightly
belongs in the model.

The concept of "fat models" suggests that business logic should be pushed
back closer to the business objects (i.e. put business logic in the model),
and leave controllers to manage flow.

The authentication component doesn't deal with business logic, it deals
with program flow (whether or not something is accessible, and what happens
if it is or isn't).

On Tue, Aug 28, 2012 at 3:43 AM, sanjay.pal  wrote:

> Hi all,
>
> As per my knowledge, Business Logic is the part of Model in MVC
> architecture.
> Please help me with my doubts of form validation, is form validation a part
> of business logic?
>  if yes, then why we put this in Controller?
> if no, then what is actually a business logic in a authentication module.
>
> Please guys...
>
> Thanks a ton in advance...
>
>
>
> --
> View this message in context:
> http://cakephp.1045679.n5.nabble.com/Form-validation-and-business-logic-tp5710722.html
> Sent from the CakePHP mailing list archive at Nabble.com.
>
> --
> 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, send email to
> cake-php+unsubscr...@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
>
>
>

-- 
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, send email to 
cake-php+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.




Re: login

2012-08-21 Thread Greg Skerman
no real need for ACL, or 2 seperate tables that I can see.

Add a field to users called "role"

then use isAuthorized() to allow access to the admin sections if role ==
admin

ACL would be useful if you had LOTS of roles and wanted a way to manage
them in a hierarchy - but if you just want to discriminate between a couple
of distinct classes of users, role + isAuthorized is easier...


On Tue, Aug 21, 2012 at 6:05 PM, Tilen Majerle wrote:

> i think, you need this (
> http://book.cakephp.org/2.0/en/tutorials-and-examples/simple-acl-controlled-application/simple-acl-controlled-application.html
>  )
> and not 2 tables and all..
> --
> Lep pozdrav, Tilen Majerle
> http://majerle.eu
>
>
>
> 2012/8/21 raj kumar Pustela 
>
>> hi to all,
>> i have created two tables one is users, two is admin_users.
>> these tables have taken same fields like(username,password,email).
>> when i hit the url like http://localhost//admin_users/login.am struggled
>> dis one. i did not login through url. if anyone know please help me.
>>
>> thanks,
>> rajakumar.
>>
>>   my code is :
>> App controller:
>>
>> public $components = array(
>> 'Session',
>> 'Auth' => array(
>> 'loginRedirect' => array('controller' => 'adminusers', 'action' => 
>> 'index'),
>> 'logoutRedirect' => array('controller' => 'pages', 'action' => 
>> 'display', 'home'),
>> 'authorize' => array('Controller') // Added this line
>> ));
>>
>> admin_users controller:
>>
>>  public function beforeFilter() {
>> parent::beforeFilter();
>> $this->Auth->allow( 'add');
>>
>>
>> public function login() {
>>  if($this->request->is('post')){
>>  if($this->Auth->login()){
>>  $this->redirect(array ("controller" => "adminusers", 
>> "action" => "index"));
>>  } else {
>>  if($this->request->is('post')){
>>  $this->Session->setFlash(__('Invalid username 
>> or password, try again'));
>>  }
>>  }
>>  }
>> }
>>
>> public function logout() {
>> $this->redirect($this->Auth->logout());
>> }
>>
>> login.ctp
>>
>> 
>> Session->flash('auth'); ?>
>>
>> Form->create('AdminUSer'); ?>
>> 
>> > ?>
>> > echo $this->Form->input('username');
>> echo $this->Form->input('password');
>> ?>
>> 
>> Form->end(__('Login')); ?>
>> 
>>
>>
>>
>>
>>  --
>> 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, send email to
>> cake-php+unsubscr...@googlegroups.com.
>> Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
>>
>>
>>
>
>  --
> 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, send email to
> cake-php+unsubscr...@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
>
>
>

-- 
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, send email to 
cake-php+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.




Re: Formatting Checkbox in formhelper

2012-08-19 Thread Greg Skerman
do you want to filter the select based on some other user input? Or do you
just want a filtered list?

I filter based on user input by using the "search" plugin (see cakeDC) to
provide a nice way to get reusable searches, and a spot of ajax.

To just filter the list once (without accounting for user input on the
filtering), just condition $users back in the model.


On Mon, Aug 20, 2012 at 9:53 AM, mohit kumar  wrote:

> Hi Folks,
>
> I am using the following code to display all the users in the my form.
>
> echo $this->Form->input('User',array(
>> 'label' => __('Users',true),
>> 'type' => 'select',
>> 'multiple' => 'checkbox',
>> 'options' => $users,
>> ));
>
>
>
>
>>  Which essentially gives me all the users from that model. What if I
> need to display the users based on some criteria. Like sorting them on one
> criteria,
>

> *With Best Regards,
> Mohit Kumar *
> *+91-9582894570*
>
>  --
> 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, send email to
> cake-php+unsubscr...@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
>
>
>

-- 
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, send email to 
cake-php+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.




Re: shopping cart

2012-08-08 Thread Greg Skerman
a typical 'simple' shopping cart will have a model arrangement something
like this

Product
Order
Customer

Customer HasMany Order (a customer can make more than one order)
Order HasMany Products (an order contains many products)

Customer signs up then looks at a list of products - on selection of the
products the products are added to the order
on check out the total order value is calculated by multiplying the price
of an individual product by the quanitity, and then summing the total for
each row in the order.

Dead simple and wont deal with stuff like shipping, payment gateways, tax
and what not but that should get you started (your requirements are
very vague so I have no idea if this will suffice for your study exam)

On Thu, Aug 9, 2012 at 2:34 AM, anfuet  wrote:

> Hello everybody.
> I need a very simple shopping cart, but i don't know how i can create a
> shopping cart.
> I know there are some plugins but it is for my study exam.
>
> Can you help me, please?
>
> Here you can find my post in cakephpforum.net: 
> link
>
> --
> 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, send email to
> cake-php+unsubscr...@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
>
>
>

-- 
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, send email to 
cake-php+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.




Re: Fine tuning of json formatting

2012-08-06 Thread Greg Skerman
Take a look at the Set class. There are some very useful array mangling
functions in there.

set::combine() might be a good place to start :)



On Sun, Aug 5, 2012 at 6:00 PM, Mariano C. wrote:

> I have this model:
>
>
> public function getPeopleByName($name){
>> $this->unbindModel(array('hasMany' => array('OfficePersonTask')));
>>
>> $options['fields'] = array("Person.id", "Person.full_name");
>> $options['conditions'] = array("UPPER(CONCAT(Person.last_name, ' ',
>> Person.first_name)) LIKE UPPER('".$name."%')");
>>
>> return $this->find('all', $options);
>> }
>
>
> and related controller:
>
> public function getPeopleByName(){
>> $people = $this->Person->getPeopleByName($_GET['name']);
>> $this->set(array(
>> 'People' => $people,
>> '_serialize' => array('People')
>> ));
>> }
>
>
> this get me the following json:
>
>
> {
>> "People": [
>> {
>> "Person": {
>> "id": "1",
>> "full_name": "Ringo Star"
>> }
>> },
>> {
>> "Person": {
>> "id": "2",
>> "full_name": "Jim Morrison"
>> }
>> }
>> ]
>> }
>
>
> This is correct but I would remove the Person subgroup. So, every id and
> full_name should be member of People group. How can I do that?
>
> --
> 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 email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group
> at http://groups.google.com/group/cake-php
>

-- 
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 email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Autocomplete example for cakephp 2.2

2012-07-25 Thread Greg Skerman
I use a jQuery autocomplete control
and write a method in the desired controller which returns JSON and must be
requested as XHR ($this->request->is('ajax');)

pretty straight forward to implement this way. Json views make it
ridiculously straight forward (just a bit of config really)

if you are still stuck i'll grab an example from work tomorrow and dump it
for you.



On Wed, Jul 25, 2012 at 11:27 PM, euromark wrote:

> Although the description might be german, the example itself should be
> understandable:
>
> http://www.cakephp-forum.de/tutorials-und-snippets/autocomplete-mit-jquery-t1211.html
>
>
>
> Am Mittwoch, 25. Juli 2012 14:48:37 UTC+2 schrieb Dr. Tarique Sani:
>
>> Keep your js separate from the php and any solution will work.
>>
>> Tell us what specifically is not working
>>
>> Cheers
>> Tarique
>>
>> On Wed, Jul 25, 2012 at 6:40 AM, Christopher von Hessert
>>  wrote:
>> > Hi, I'm looking all over google for a way to implement a Autocomplete
>> input
>> > field with no luck. All examples I have found are for cakephp < 1.3
>> >
>> > Does anyone have a working example for cakephp 2.2?
>> >
>> > Thanks.
>> >
>> > --
>> > 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 email to
>> > cake-php+unsubscribe@**googlegroups.comFor
>> >  more options, visit this group at
>> > http://groups.google.com/**group/cake-php
>>
>>
>>
>> --
>> ==**==**=
>> PHP for E-Biz: http://sanisoft.com
>> ==**==**=
>>
>  --
> 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 email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group
> at http://groups.google.com/group/cake-php
>

-- 
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 email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


how to display two different views on a single layout?

2012-07-16 Thread Greg
Hello, someone could tell me
how to display two different views on a single layout?

-- 
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 email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Admin / Prefix When Baking

2012-07-15 Thread Greg Skerman
Well, my setup is pretty crude, but works well.

I basically have the following structure:

User hasAndBelongsToMany Group
Group hasMany Permission

a permission is essentially a wildcard string...

id, group_id, permission, allow

1, 1, '/*', true

a component does a beforeFilter check on the requested URL and checks that
the user is in a group which 'allows' them to see that URL...(this isn't my
idea, I saw an implementation of it a couple of years back and rolled my
own flavour of it)

I then have a permissions helper which allows the view to detect whether or
not a given user is a member of a given group (implementation is an
exercise for the author).

so the permissions work 2 fold, firstly whether or not they can actually
get to the resource to begin with, and secondly check whether or not the
user is a member of a specific group.

You can then do things in your view like...

if($this->Permission->is('admin')) {
echo $this->element('admin.widget');
} else {
echo $this->element('user.widget');
}

ACL can be used to achieve a simillar result, however the one weakness I
found in ACL is you can't have a user belonging to multiple groups. So you
can't have a user who is a member of the Authors group, and also a member
of the Moderators group - unless all Authors are also Moderators in the ACL
tree.

The result is that an Author, or an Admin both go to the same resource
(/posts/view) but the content of the view is different depending on their
role(s).



On Mon, Jul 16, 2012 at 10:17 AM, Advantage+  wrote:

> Thanks Greg,
>
> ** **
>
> Could you tell me a bit more about your idea? I never have heard about
> that idea / approach so any details as to how exactly it would work. 
>
> ** **
>
> Dave
>
> ** **
>
> ** **
>
> *From:* cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] *On
> Behalf Of *Greg Skerman
> *Sent:* Sunday, July 15, 2012 9:38 PM
>
> *To:* cake-php@googlegroups.com
> *Subject:* Re: Admin / Prefix When Baking
>
> ** **
>
> with 60 controllers I wouldn't use admin routing.
>
> I'd probably skip ACL (because it doesn't support users belonging to
> multiple groups), but a simple structure of User HasAndBelongsToMany Group,
> then a component which allows you do to something like
> $this->Permission->is('admin') etc to restrict access/conditionally load
> elements and so forth will be far easier to work with.
>
> 
>
> On Mon, Jul 16, 2012 at 9:52 AM, romel javier gomez herrera <
> bmxquiksilver7...@gmail.com> wrote:
>
> hi.
>
> ** **
>
> imagine that your system grows exponentially and has a complex
> organizational structure
>
> ** **
>
> is more simple to define the role model and decorate the url with routes**
> **
>
> ** **
>
> bye
>
> ** **
>
> ** **
>
> 2012/7/15 Advantage+ 
>
> Yes they will be modified / removed for each where needed. 
>
> But with 60 controllers that a lot of copy and paste. Just curious if
> there was a do all at once to save time. 
>
> Easier to remove them where not needed rather than copy and paste for each
> J
>
>  
>
> Thanks all the same.
>
>  
>
> Dave
>
>  
>
> *From:* cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] *On
> Behalf Of *Greg Skerman
> *Sent:* Sunday, July 15, 2012 9:13 PM
> *To:* cake-php@googlegroups.com
> *Subject:* Re: Admin / Prefix When Baking
>
>  
>
> not sure, however you should be able to (basically) copy/paste the actions
> for admin_ and rename manager_ and editor_  - its not exactly 'dry'
> though...and I'd assume you are intending on modifying the logic for each
> anyway.
>
> 
>
> On Sun, Jul 15, 2012 at 3:45 PM, Advantage+  wrote:*
> ***
>
> I have 3 different Admin routing defined in core.php
>
> Configure::write('Routing.prefixes', array('admin', 'manager' , 'editor'));
> 
>
>  
>
> so when baking it asks would you like to add the routing in controller
> 1/2/3 but it only bake's  one set and doing it again will overwrite the
> original controller, is there a way to bake all views and controller
> actions for all admin routings at 1 time?
>
>  
>
> Thanks 
>
> A+
>
> --
> 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 email to
> cake-php+unsubscr...@googlegroups

Re: Admin / Prefix When Baking

2012-07-15 Thread Greg Skerman
with 60 controllers I wouldn't use admin routing.

I'd probably skip ACL (because it doesn't support users belonging to
multiple groups), but a simple structure of User HasAndBelongsToMany Group,
then a component which allows you do to something like
$this->Permission->is('admin') etc to restrict access/conditionally load
elements and so forth will be far easier to work with.


On Mon, Jul 16, 2012 at 9:52 AM, romel javier gomez herrera <
bmxquiksilver7...@gmail.com> wrote:

> hi.
>
> imagine that your system grows exponentially and has a complex
> organizational structure
>
> is more simple to define the role model and decorate the url with routes
>
> bye
>
>
>
> 2012/7/15 Advantage+ 
>
>> Yes they will be modified / removed for each where needed. 
>>
>> But with 60 controllers that a lot of copy and paste. Just curious if
>> there was a do all at once to save time. 
>>
>> Easier to remove them where not needed rather than copy and paste for
>> each J
>>
>> ** **
>>
>> Thanks all the same.
>>
>> ** **
>>
>> Dave
>>
>> ** **
>>
>> *From:* cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] *On
>> Behalf Of *Greg Skerman
>> *Sent:* Sunday, July 15, 2012 9:13 PM
>> *To:* cake-php@googlegroups.com
>> *Subject:* Re: Admin / Prefix When Baking
>>
>> ** **
>>
>> not sure, however you should be able to (basically) copy/paste the
>> actions for admin_ and rename manager_ and editor_  - its not exactly 'dry'
>> though...and I'd assume you are intending on modifying the logic for each
>> anyway.
>>
>>
>> 
>>
>> On Sun, Jul 15, 2012 at 3:45 PM, Advantage+  wrote:
>> 
>>
>> I have 3 different Admin routing defined in core.php
>>
>> Configure::write('Routing.prefixes', array('admin', 'manager' ,
>> 'editor'));
>>
>>  
>>
>> so when baking it asks would you like to add the routing in controller
>> 1/2/3 but it only bake's  one set and doing it again will overwrite the
>> original controller, is there a way to bake all views and controller
>> actions for all admin routings at 1 time?
>>
>>  
>>
>> Thanks 
>>
>> A+
>>
>> --
>> 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 email to
>> cake-php+unsubscr...@googlegroups.com For more options, visit this group
>> at http://groups.google.com/group/cake-php
>>
>> ** **
>>
>> --
>> 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 email to
>> cake-php+unsubscr...@googlegroups.com For more options, visit this group
>> at http://groups.google.com/group/cake-php
>>
>> --
>> 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 email to
>> cake-php+unsubscr...@googlegroups.com For more options, visit this group
>> at http://groups.google.com/group/cake-php
>>
>
>  --
> 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 email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group
> at http://groups.google.com/group/cake-php
>

-- 
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 email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Admin / Prefix When Baking

2012-07-15 Thread Greg Skerman
not sure, however you should be able to (basically) copy/paste the actions
for admin_ and rename manager_ and editor_  - its not exactly 'dry'
though...and I'd assume you are intending on modifying the logic for each
anyway.



On Sun, Jul 15, 2012 at 3:45 PM, Advantage+  wrote:

> I have 3 different Admin routing defined in core.php
>
> Configure::write('Routing.prefixes', array('admin', 'manager' , 'editor'));
> 
>
> ** **
>
> so when baking it asks would you like to add the routing in controller
> 1/2/3 but it only bake's  one set and doing it again will overwrite the
> original controller, is there a way to bake all views and controller
> actions for all admin routings at 1 time?
>
> ** **
>
> Thanks 
>
> A+
>
> --
> 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 email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group
> at http://groups.google.com/group/cake-php
>

-- 
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 email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Naming Conventions

2012-07-13 Thread Greg Skerman
thats ... strange. Because when I do it, it works perfectly fine (read up a
couple of posts).

can we have some code so we don't have to keep guessing? I'd be keen to run
this up on my dev box and see whether or not I can replicate your problem.


On Fri, Jul 13, 2012 at 11:49 PM, Advantage+  wrote:

> LOL shirt is on.
>
> ** **
>
> Everything is baked 100% controllers /models / view.
>
> ** **
>
> It bakes all controller and models fine no issues. Only when it comes to
> the views, if the table is underscored_name, not a join or relationship
> table, just a multi_word_name_with_underscores it looks for joining models
> and I get the error saying Model not found.
>
> ** **
>
> *From:* cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] *On
> Behalf Of *Greg Skerman
> *Sent:* Friday, July 13, 2012 10:20 AM
>
> *To:* cake-php@googlegroups.com
> *Subject:* Re: Naming Conventions
>
> ** **
>
> keep your shirt on, we're trying to help. its a little hard without seeing
> the code.
>
> i.e. if we had the code we could try and bake it out on our machines and
> debug it at this end for you.
>
> did you use cake bake controller when you baked the controller? from
> memory, it'll build the controller as a scaffold if you do that (i.e. non
> interactive baking), and I think last time i did that it struggled to bake
> the views (i guess no controller methods to introspect)
>
> if so, try:
>
> cake bake controller --public FavoritePosts
>
> which will bake the concrete FavoritePosts methods... then try giving the
> view another go.
>
>
> 
>
> On Fri, Jul 13, 2012 at 10:20 PM, Advantage+  wrote:
> 
>
> It's the same db I used with  1.3.x and it baked everything fine.
> I am now trying to do the same site in 2.1.x but it will not bake the views
> for multi_word (single table) named, anything with an underscore cake is
> thinking joined relationship tables. (No double plural naming for joined
> names either) favorite_posts not favorites_posts
> ITS BAKES THE CONTROLLER AND MODEL IT'S ONLY THE VIEW IT SAYS IS MISSING
> THE
> MODEL.
>
>
>
>
> -Original Message-
> From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On
> Behalf
> Of Mike Griffin
>
> Sent: Friday, July 13, 2012 7:13 AM
> To: cake-php@googlegroups.com
> Subject: Re: Naming Conventions
>
> On Fri, Jul 13, 2012 at 10:24 AM, Greg Skerman  wrote:
> > yeah i'm an all bake, all the time kinda guy. For most of the tools I
> > write it works beautifully, because business systems tend to be based
> > around CRUD
> > - so maybe half my time is spent mapping a schema, then a bit of time
> > mucking around in the scaffold, then build concrete classes and spend
> > the rest of my time writing the small bits of business logic required
> > and making it look nice/doing javascript bits etc.
> >
> > I'm the stereotypical lazy programmer :P
>
> No harm in that  :)
>
> > Heres an example. Current tool is a job number application form. It
> > has 3 tables, applications, application_questions, application_answers
> >
> > running up the console right now, i get:
> >
> > Possible Models based on your current database:
> > 1. Application
> > 2. ApplicationQuestion
> > 3. ApplicationAnswer
> > Enter a number from the list above,
> > type in the name of another model, or 'q' to exit [q] >
> >
> > had to do it to prove it to myself (It is Friday afternoon afterall,
> > and I am liable to say stupid things) - but yeah, seems that it copes
> > with underscores correctly - the baked models are not join tables, and
> > the structure is Application hasMany ApplicationQuestion hasMany
> > ApplicationAnswer, which is precisely what I expect it to be (no HABTM
> > in sight).
>
> That's cleared that up for me. I had never tried it out, it was just a
> hunch
> that occured to me when I read it again.
>
> > so either theres a problem with OP's schema, or possibly a custom
> > inflection rule which is seeing "favorite" as plural, or I have no
> idea
>
> Kersacly.
>
> Mike.
>
> --
> 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 email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group**
> **
>
> cake-php+at http://groups.google.com/group/cake-php
>
>
> --
> O

Re: Naming Conventions

2012-07-13 Thread Greg Skerman
keep your shirt on, we're trying to help. its a little hard without seeing
the code.

i.e. if we had the code we could try and bake it out on our machines and
debug it at this end for you.

did you use cake bake controller when you baked the controller? from
memory, it'll build the controller as a scaffold if you do that (i.e. non
interactive baking), and I think last time i did that it struggled to bake
the views (i guess no controller methods to introspect)

if so, try:

cake bake controller --public FavoritePosts

which will bake the concrete FavoritePosts methods... then try giving the
view another go.



On Fri, Jul 13, 2012 at 10:20 PM, Advantage+  wrote:

> It's the same db I used with  1.3.x and it baked everything fine.
> I am now trying to do the same site in 2.1.x but it will not bake the views
> for multi_word (single table) named, anything with an underscore cake is
> thinking joined relationship tables. (No double plural naming for joined
> names either) favorite_posts not favorites_posts
> ITS BAKES THE CONTROLLER AND MODEL IT'S ONLY THE VIEW IT SAYS IS MISSING
> THE
> MODEL.
>
>
>
> -Original Message-
> From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On
> Behalf
> Of Mike Griffin
> Sent: Friday, July 13, 2012 7:13 AM
> To: cake-php@googlegroups.com
> Subject: Re: Naming Conventions
>
> On Fri, Jul 13, 2012 at 10:24 AM, Greg Skerman  wrote:
> > yeah i'm an all bake, all the time kinda guy. For most of the tools I
> > write it works beautifully, because business systems tend to be based
> > around CRUD
> > - so maybe half my time is spent mapping a schema, then a bit of time
> > mucking around in the scaffold, then build concrete classes and spend
> > the rest of my time writing the small bits of business logic required
> > and making it look nice/doing javascript bits etc.
> >
> > I'm the stereotypical lazy programmer :P
>
> No harm in that  :)
>
> > Heres an example. Current tool is a job number application form. It
> > has 3 tables, applications, application_questions, application_answers
> >
> > running up the console right now, i get:
> >
> > Possible Models based on your current database:
> > 1. Application
> > 2. ApplicationQuestion
> > 3. ApplicationAnswer
> > Enter a number from the list above,
> > type in the name of another model, or 'q' to exit [q] >
> >
> > had to do it to prove it to myself (It is Friday afternoon afterall,
> > and I am liable to say stupid things) - but yeah, seems that it copes
> > with underscores correctly - the baked models are not join tables, and
> > the structure is Application hasMany ApplicationQuestion hasMany
> > ApplicationAnswer, which is precisely what I expect it to be (no HABTM
> > in sight).
>
> That's cleared that up for me. I had never tried it out, it was just a
> hunch
> that occured to me when I read it again.
>
> > so either theres a problem with OP's schema, or possibly a custom
> > inflection rule which is seeing "favorite" as plural, or I have no
> idea
>
> Kersacly.
>
> Mike.
>
> --
> 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 email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group
> cake-php+at http://groups.google.com/group/cake-php
>
> --
> 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 email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group
> at http://groups.google.com/group/cake-php
>

-- 
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 email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Naming Conventions

2012-07-13 Thread Greg Skerman
yeah i'm an all bake, all the time kinda guy. For most of the tools I write
it works beautifully, because business systems tend to be based around CRUD
- so maybe half my time is spent mapping a schema, then a bit of time
mucking around in the scaffold, then build concrete classes and spend the
rest of my time writing the small bits of business logic required and
making it look nice/doing javascript bits etc.

I'm the stereotypical lazy programmer :P


Heres an example. Current tool is a job number application form. It has 3
tables, applications, application_questions, application_answers

running up the console right now, i get:

Possible Models based on your current database:
1. Application
2. ApplicationQuestion
3. ApplicationAnswer
Enter a number from the list above,
type in the name of another model, or 'q' to exit
[q] >

had to do it to prove it to myself (It is Friday afternoon afterall, and I
am liable to say stupid things) - but yeah, seems that it copes with
underscores correctly - the baked models are not join tables, and the
structure is Application hasMany ApplicationQuestion hasMany
ApplicationAnswer, which is precisely what I expect it to be (no HABTM in
sight).

so either theres a problem with OP's schema, or possibly a custom
inflection rule which is seeing "favorite" as plural, or I have no idea



On Fri, Jul 13, 2012 at 7:02 PM, Mike Griffin  wrote:

> On Fri, Jul 13, 2012 at 9:54 AM, Greg Skerman  wrote:
> > I don't think so - i tend to use underscores in tables a lot as I like
> > descriptive table namesand have never run into the problem.
>
> It just seemed too good to be true, I'll admit. Do you use bake to
> create your models when you use underscores?
>
> >
> > if the OP would drop their DB schema we might be able to get to the
> bottom
> > of it - but on the face of it is seems really strange to me
> >
>
> Yup, and run the SELECT statement I asked for before too.
>
> Mike.
>
> --
> 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 email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group
> at http://groups.google.com/group/cake-php
>

-- 
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 email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Naming Conventions

2012-07-13 Thread Greg Skerman
I don't think so - i tend to use underscores in tables a lot as I like
descriptive table namesand have never run into the problem.

if the OP would drop their DB schema we might be able to get to the bottom
of it - but on the face of it is seems really strange to me

On Fri, Jul 13, 2012 at 6:45 PM, Mike Griffin  wrote:

> On Fri, Jul 13, 2012 at 9:42 AM, Greg Skerman  wrote:
> > wouldn't the link table be "Favorites_Posts"
> > ?
> >
>
> Strictly speaking, yes, it should be. But I wonder does the bake
> script see the underscore and think it should have a table named (the
> bit before the underscore), hence looking for a Favourite table in the
> Advantage+'s first mail
>
> Mike.
>
> --
> 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 email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group
> at http://groups.google.com/group/cake-php
>

-- 
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 email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Naming Conventions

2012-07-13 Thread Greg Skerman
wouldn't the link table be "Favorites_Posts"
?


On Fri, Jul 13, 2012 at 6:34 PM, Mike Griffin  wrote:

> On Thu, Jul 12, 2012 at 2:32 AM, Advantage+  wrote:
> > I have Post model / PostController
> >
> >
> >
> > In the db I have favorite_posts but when I try to bake I get Favorite
> Table
> > not found. There is no favorite table so something is wrong with my table
> > name but what is it?
> >
> >
> >
> > Where am I going wrong here?
> >
>
> Does the bake script think that you are baking a link table to link
> favourites and posts? Maybe in a many to many relationship?
> If you had a Favourite model and a Posts model and you wanted to
> associate them together, you would use a Favourite_Posts table. Can
> you change the name of the Favourite_Posts table to remove the
> underscore?
>
> What happens if you create the Favourite_Posts model by hand?
>
> Mike.
>
> --
> 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 email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group
> at http://groups.google.com/group/cake-php
>

-- 
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 email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Naming Conventions

2012-07-12 Thread Greg Skerman
The fact that it's referring to the favorites table and not favorite_posts
leads me to believe there's something screwy in your schema.

Can you post your table struct?

On Friday, July 13, 2012, Advantage+ wrote:

> Yes that is correct but it will not bake the view. I get error saying
> Favorite Table cannot be found in the console.
>
> ** **
>
> *From:* cake-php@googlegroups.com  'cake-php@googlegroups.com');> 
> [mailto:cake-php@googlegroups.com 'cake-php@googlegroups.com');>]
> *On Behalf Of *Greg Skerman
> *Sent:* Thursday, July 12, 2012 3:12 AM
> *To:* cake-php@googlegroups.com  'cake-php@googlegroups.com');>
> *Subject:* Re: Naming Conventions
>
> ** **
>
> Post*s*Controller
>
> If you have a table called favorite_posts, cake's going to want to bake a
> "FavoritePost" model, and a "FavoritePostsController" controller.
>
>
> 
>
> On Thu, Jul 12, 2012 at 11:32 AM, Advantage+ 
> >
> wrote:
>
> I have Post model / PostController
>
>  
>
> In the db I have favorite_posts but when I try to bake I get Favorite
> Table not found. There is no favorite table so something is wrong with my
> table name but what is it?
>
>  
>
> Where am I going wrong here?
>
>  
>
> Thanks all.
>
> --
> 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 email to
> cake-php+unsubscr...@googlegroups.com  'cake-php%2bunsubscr...@googlegroups.com');> For more options, visit this
> group at http://groups.google.com/group/cake-php
>
> ** **
>
> --
> 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 email to
> cake-php+unsubscr...@googlegroups.com  'cake-php+unsubscr...@googlegroups.com');> For more options, visit this
> group at http://groups.google.com/group/cake-php
>
> --
> 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 email to
> cake-php+unsubscr...@googlegroups.com  'cake-php%2bunsubscr...@googlegroups.com');> For more options, visit this
> group at http://groups.google.com/group/cake-php
>

-- 
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 email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Looping through actions?

2012-07-11 Thread Greg Skerman
http://php.net/manual/en/function.get-class-methods.php

alternatively use reflection.


On Thu, Jul 12, 2012 at 3:59 PM, mohit kumar  wrote:

> Just a query..
> Is it possible to loop through all the actions of all the controllers.?
>
> Thanks and Regards,
> --
> Best Regards,
> Mohit Kumar
>
>
>  --
> 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 email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group
> at http://groups.google.com/group/cake-php
>

-- 
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 email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: home.ctp

2012-07-11 Thread Greg Skerman
routes.php instructs cake to direct the user to controller => pages, action
=> display, home if the request comes from "/"

pages controller tells cake to go looking for views under APP/pages

it then rewrites anything from pages/display/ to /pages/

pretty much as simple as that.


if you remove the route entirely, you can get to your home page by visiting
app/pages/display/home ...



On Thu, Jul 12, 2012 at 2:24 PM, Albert 'Tigr'  wrote:

> Actually, there is a PagesController:
> http://book.cakephp.org/2.0/en/controllers/pages-controller.html
>
>
> On Wednesday, 11 July 2012 18:15:45 UTC+2, Marsson wrote:
>>
>> Hi there!
>>
>>
>> I´m a beginner so I´ve looking the folder structure and files of the
>> 2.2.0 distro.
>>
>> I´ve noticed there is no action (and Controller) to call home.ctp . I
>> mean neither PagesController or AppController or even Controller.php have a
>> function called "home".
>>
>> So how does it get to be called ?
>>
>>Thanks!
>>
>>
>>  --
> 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 email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group
> at http://groups.google.com/group/cake-php
>

-- 
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 email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Naming Conventions

2012-07-11 Thread Greg Skerman
Post*s*Controller

If you have a table called favorite_posts, cake's going to want to bake a
"FavoritePost" model, and a "FavoritePostsController" controller.



On Thu, Jul 12, 2012 at 11:32 AM, Advantage+  wrote:

> I have Post model / PostController
>
> ** **
>
> In the db I have favorite_posts but when I try to bake I get Favorite
> Table not found. There is no favorite table so something is wrong with my
> table name but what is it?
>
> ** **
>
> Where am I going wrong here?
>
> ** **
>
> Thanks all.
>
> --
> 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 email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group
> at http://groups.google.com/group/cake-php
>

-- 
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 email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: 3.0: a peek into CakePHP's future

2012-07-08 Thread Greg Skerman
For mine, being able to deal with objects in the view would greatly improve
the readability of data (the whole $user['User']['email'] etc looks
incredibly difficult to read to me, compared with $user->email which would
be much nicer).

I've always felt dealing with arrays is a bit of a 'hack'. I understand the
choice, but I think the idea to move towards a more object oriented
approach is more than hype, and long overdue.


On Sat, Jul 7, 2012 at 7:35 PM, tigr  wrote:

> No, that is not "nice". The strength of the CakePHP design is in being
> very straightforward when it comes to working with the data. I have seen
> other frameworks and I think that object-oriented ways are not suitable for
> working with data. Well, of course, you can, but would you want to, given a
> choice? My answer was "no" and that is why I am using Cake. I am worried
> that the object-oriented hype will get the best of you and we will lose a
> perfectly sensible data processing framework to the object-oriented glory.
> For practical reasons, it would be great to leave the model layer
> principles as they are.
>
>  --
> 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 email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group
> at http://groups.google.com/group/cake-php
>

-- 
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 email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


What is the impact of returning true or false in a component startup method?

2012-07-07 Thread Greg Skerman
Hi,

I'm playing around with my own 'simple' ACL implementation, and building a
new component to handle it. Essentially the component is 'invisible' -
simply including it in the AppController will invoke its magic. Naturally
this means putting a bunch of logic inside of the startup method.

Whether or not you are or are not allowed to see something will be handled
by a ForbiddenException().

I'm  looking at the AuthComponent rolled with the core as there will be
some level of interaction between it and my component, and I've noticed the
startup method is returning a boolean, however the documentation doesn't
mention what the act of returning true, or false will do. The component
seems to load regardless.

is there any impact in returning a boolean on this function?

-- 
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 email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Basic algorithm for Reddit-like feed sorting?

2012-07-05 Thread Greg Skerman
I'd do it in the query...as a virtual field - you should be able to get
away with it as a pure expression. Probably much faster than getting
everything then looping through the results.

If you did end up having to do it programatically, a behavior might be the
right place if you wish to reuse the functionality later.

note my formula isn't perfect. Mess around with it in a spreadsheet with a
graph so you can see how the rating will behave. You'll probably need to do
considerable tuning to get it doing exactly what you want and it may be
open to abuse by your users.


On Fri, Jul 6, 2012 at 12:31 PM, 42startups  wrote:

> Cool thanks, I'll give that a go. Should I put that in the beforeRender()
> function?
>
> --
> 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 email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group
> at http://groups.google.com/group/cake-php
>

-- 
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 email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Basic algorithm for Reddit-like feed sorting?

2012-07-05 Thread Greg Skerman
The basic idea would be to "score" the items based on how old they are.
Simple division of votes by age in days would be a reasonable start. (10
votes and 1 days, score is 10, 10 votes and 2 days score is 5, etc etc)

You will probably want to throw some form of weighting into the score
though to get a nice curve (stays high for the first 5 days, then rapidly
falls off unless its up voting exponentially increases).

Of course a record starting with 0 votes will never appear at the top no
matter the age, so you might need a "base" score to give new items a
chance... something like (votes + 100)/age

On Thu, Jul 5, 2012 at 5:25 PM, 42startups  wrote:

> If I have a feed of content each with a vote count. Any ideas on a basic
> sort mechanism to display this?
>
> Like Reddit, I'd like:
>
> * the content with the most votes to be toward the top
> * but I also don't want old content to remain at the top (e.g. if only
> sorting by votes, the feed won't change often)
> * but I also want to give new content some airtime toward the top (I don't
> want a separate 'new' page like Reddit does)
>
>
> Here's what I'm working with:
>
> $this->paginate = array(
> 'limit'=>30,
> 'order'=>array(
> 'Story.created'=>'desc',
> 'Story.votes'=>'desc'
> ));
>
> Any ideas?
>
> --
> 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 email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group
> at http://groups.google.com/group/cake-php
>

-- 
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 email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: cakePhp showing menu or login form

2012-07-05 Thread Greg Skerman
you going to show us some code to help you with, or would you prefer us to
write something for you?


On Thu, Jul 5, 2012 at 6:07 AM, Peter Nassef  wrote:

> Hello cakephp team
>
> i need to make website with admin panel
>
> but ican't do that
>
> i need to know who can make admin panel ??
> with session and site and make admin in split section
>
> --
> 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 email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group
> at http://groups.google.com/group/cake-php
>

-- 
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 email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: CMS with cakephp

2012-07-03 Thread Greg Skerman
both have live demos, you can go try it and decide the answer to that
yourself.

For what its worth, even though WP is easy to use from a user/admin
perspective, I find authoring plugins and extending functionality on WP to
be an absolute headache...doesn't feel very developer friendly to me.


On Wed, Jul 4, 2012 at 10:59 AM, Marcelo Custódio  wrote:

> Well, in a certain way, I foresaw that answer. Thanks. The remaing
> question: are they as easy to use as WP ?
>
> Thanks again
>
> Abraços,
>
> MARCELO CUSTÓDIO
>
>
>
>
>
>
> On Tue, Jul 3, 2012 at 5:35 PM, lowpass  wrote:
>
>> Wordpress isn't CakePHP, which can be handy if the site requires more
>> than just simple CMS capabilities.
>>
>> On Tue, Jul 3, 2012 at 11:06 AM, Marcelo Custódio
>>  wrote:
>> > So what are the advantages of Croogo and QuickAppsCMS over Wordpress, an
>> > easy-to-use and very popular CMS ?
>> >
>> >
>> >
>> > Abraços,
>> >
>> > MARCELO CUSTÓDIO
>> >
>> >
>> >
>> >
>> >
>> > On Tue, Jul 3, 2012 at 5:29 AM, Mohammad Naghavi 
>> wrote:
>> >>
>> >> I wanted once to start working on a MODULE that can replace the static
>> >> pages but not more than that. I mean having a complete CMS is
>> sometimes not
>> >> the right solution because I just want to replace the static pages and
>> the
>> >> way they are edited statically with a dynamic online solution where
>> pages
>> >> could be edited online but leave other parts of the system intact. This
>> >> comes to me a much better solution when you are talking about a
>> framework.
>> >> However if you are talking about a CMS then you would better go with
>> already
>> >> done works like the ones mentioned above.
>> >>
>> >> MN
>> >>
>> >>
>> >> On Tue, Jul 3, 2012 at 9:42 AM, Davor Ilic  wrote:
>> >>>
>> >>> i also agree Tarique and Chetan Patel
>> >>>
>> >>> 2012/6/28 Chetan Patel 
>> 
>>  You have another option for CMS in cakephp
>> 
>>  http://www.quickappscms.org/
>> 
>>  Thanks
>>  Chetan
>> 
>> 
>>  On Thu, Jun 28, 2012 at 12:19 PM, Miles J 
>>  wrote:
>> >
>> > Just use Croogo
>> >
>> > http://croogo.org/
>> >
>> >
>> > On Wednesday, June 27, 2012 8:25:25 PM UTC-7, Mr. Manager wrote:
>> >>
>> >> Dear All,
>> >>
>> >> If everyone between cakephp 1.3 and cakephp 2x. which one is
>> better if
>> >> I want to make website with unlimited content management system.
>> >>
>> >> Please let me know if anyone know about this.
>> >>
>> >> Sincerely Yours,
>> >> Mr. Manager,
>> >
>> > --
>> > 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 email to
>> > cake-php+unsubscr...@googlegroups.com For more options, visit this
>> > group at http://groups.google.com/group/cake-php
>> 
>> 
>>  --
>>  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 email to
>>  cake-php+unsubscr...@googlegroups.com For more options, visit this
>> group
>>  at http://groups.google.com/group/cake-php
>> >>>
>> >>>
>> >>> --
>> >>> 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 email to
>> >>> cake-php+unsubscr...@googlegroups.com For more options, visit this
>> group
>> >>> at http://groups.google.com/group/cake-php
>> >>
>> >>
>> >> --
>> >> 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 email to
>> >> cake-php+unsubscr...@googlegroups.com For more options, visit this
>> group
>> >> at http://groups.google.com/group/cake-php
>> >
>> >
>> > --
>> > 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 email to
>> > cake-php+unsubscr...@googlegroups.com For more options, visit this
>> group at
>> > http://groups.google.com/group/cake-php
>>
>> --
>> 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 r

Re: re-skinned or plugin version or my site.. like an API but templated

2012-07-03 Thread Greg Skerman
cake pretty much provides an api out of the box for each of your
controllers.

Look at the relevant chapters on REST in the book. Essentially you
configure the request handler and turn on parse extensions and do some
minor tweaking in the controller logic..

so if someone hits http://yourwebsite.com/posts/ in a browser they get the
rendered html
if they hit http://yourwebsite.com/posts.json they get a json object
posts.xml they get an xml object etc etc.

writing a front end at the other side to deal with it would require either
some form of REST datasource to rehydrate the json as data inside models
for you to use, or some other solution to consume the services.



On Wed, Jul 4, 2012 at 7:23 AM, elogic  wrote:

> Thanks, I think it might need to be via an API seeing it needs to be apart
> of their actual website. Does anyone know of any tutorials online covering
> creating an API with cakephp so I can look into this further? It's all very
> new to me, I have used API's but never created one with or without cake.
>
>
> On Tuesday, 3 July 2012 14:07:37 UTC+10, Greg wrote:
>
>> So you want to have essentially 1 instance of your application running
>> (the model, and controllers), but different views (or perhaps, just a
>> different template) at the other end?
>>
>> There are many ways to do this i suppose. If you host everything yourself
>> you can probably use App::build to point at a central/reusable set of
>> models/controllers etc for a given domain.
>>
>> Or you could go the other way, and change the template view path based on
>> the request..
>>
>> if you want them to physically host the front end, then you probably need
>> to use an actual API - expose your "backend" as a restful api (which is a
>> snap in cake to do), and write a "front end" app which consumes that API -
>> customise the front end app with various styles etc. They can then install
>> your front end application on their servers and get at it from something
>> like http:///<**yourapplication>
>>
>>
>>
>>
>>
>>
>> Hi All,
>>>
>>> I am about to being a projest with cakePHP as the framework, my client
>>> has now asked me how we can go about setting up the site so other firms in
>>> the same industry
>>> could somehow use the same system (running on our database) from a front
>>> end point of view on their website as an addon product.
>>>
>>> So basically the front end of the site will be designed for us and then
>>> again for each of the other firms but the functionality and admin remain
>>> the same which they plugin to their site (nearly like using old school
>>> iframes).
>>>
>>> Any ideas on how this could best work and be setup initially? Almost
>>> like an API but the whole front end needs to be templated with their
>>> corporate colours and logo (I'm thinking custom header and footer then the
>>> content area remains quite neutral)
>>>
>>> Any tips or threads, posts etc online would be great.
>>> Thanks
>>>
>>> --
>>> 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 email to
>>> cake-php+unsubscribe@**googlegroups.comFor
>>>  more options, visit this group at
>>> http://groups.google.com/**group/cake-php<http://groups.google.com/group/cake-php>
>>>
>>
>>  --
> 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 email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group
> at http://groups.google.com/group/cake-php
>

-- 
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 email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Question

2012-06-05 Thread Greg Skerman
Good grief...

go and bake (using the console) a model/view/controller for any old
database table. Just any old database table, doesn't need to be anything in
particular.

then take a look at the view code generated for the index() method, and the
index method itself (particularly around $this->set). You will see how
tables can easily be made with a combination of plain old HTML, an array
and a foreach loop.




On Wed, Jun 6, 2012 at 12:01 PM, ying yang  wrote:

> what if there is a data ?
>
> On Wed, Jun 6, 2012 at 9:45 AM, John Hardy  wrote:
>
>>
>> http://www.webreference.com/html/tutorial1/index.html
>>
>> On Jun 5, 2012, at 6:42 PM, Michael Gaiser wrote:
>>
>> > 
>> >
>> > 
>> >
>> >
>> > Just like any other .html file.
>> >
>> >
>> > ~Michael
>> >
>> > On Tue, Jun 5, 2012 at 9:40 PM, ying yang 
>> wrote:
>> >> My question is how i can make a table in view.ctp?
>> >>
>> >> --
>> >> 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 email to
>> >> cake-php+unsubscr...@googlegroups.com For more options, visit this
>> group at
>> >> http://groups.google.com/group/cake-php
>> >
>> > --
>> > 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 email to
>> > cake-php+unsubscr...@googlegroups.com For more options, visit this
>> group at http://groups.google.com/group/cake-php
>>
>> --
>> 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 email to
>> cake-php+unsubscr...@googlegroups.com For more options, visit this group
>> at http://groups.google.com/group/cake-php
>>
>
>  --
> 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 email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group
> at http://groups.google.com/group/cake-php
>

-- 
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 email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: View

2012-05-31 Thread Greg Skerman
not really understanding the question... are you having trouble setting
values in the controller to expose them in the view?

really hard to help without code. Do you have some code you can share?


On Fri, Jun 1, 2012 at 10:07 AM, ying yang  wrote:

> I have a problem here, i have tableA and tableB in tableA i can view the
> information or data I input.
> but I want to know how i can view tableB information using tableA view?
> how i can do that in cakephp2.0?
> thank you in advance.
>
> --
> 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 email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group
> at http://groups.google.com/group/cake-php
>

-- 
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 email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Reporting in cake php

2012-05-30 Thread Greg Skerman
Cake doesn't have pdf reporting captability out of the box.

You are going to need to come up with a custom solution.

what have you tried? or do you just want a spoon fed answer?


On Wed, May 30, 2012 at 4:02 PM, DAHAN Mamdouh wrote:

> Hello
> I want to generate pdf reporting with cake php, please advise me
>
> --
> --
> Cordialement
> --
> Mamdouh DAHAN
> BCS Consultancy Services
> Tel: +212 5 35 94 09 56
> Mobile: +212 6 44 00 19 53
> Website: www.bcs-cs.net
> Email: dahan.mamd...@bcs-cs.net
>
>  --
> 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 email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group
> at http://groups.google.com/group/cake-php
>

-- 
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 email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Interacting with a cakephp rest service using jquery - problem with PUT

2012-04-28 Thread Greg Skerman
hmmm disregard.. JSON.stringify to the rescue :S


On Sat, Apr 28, 2012 at 6:25 PM, Greg Skerman  wrote:

> I will add, that POST and GET works fine... data is passed back and forth
> as expected and cakephp's "magic" takes care of saving of data perfectly
> fine.
>
>
> On Sat, Apr 28, 2012 at 6:24 PM, Greg Skerman  wrote:
>
>> Hi all,
>>
>> Building a simple tool which uses a cakephp rest service. The client
>> application is the webpage generated by the application, and it reacts to
>> user input such as dragging and dropping things around.
>>
>> I've extended the jquery ajax helper methods to include methods for PUT
>> and DELETE, and these are triggering just fine.
>>
>> The problem is I am unable to get the data back to cakephp to do anything
>> with it.
>>
>> heres the javascript which triggers everything off:
>>
>> $('div.content-block').droppable({
>>drop: function(event, ui)
>>{
>>   $(this).children('ul').append(ui.draggable);
>>   // perform the PUT on the db...
>>   var pilotID = ui.draggable.attr('id').split('-')[1]
>>   var squadID = $(this).attr('id').split('-')[1];
>>
>>   $.put('pilots/'+pilotID+'.json',
>>   {
>>  "squad_id" : squadID
>>   }, function() {
>>  alert('success');
>>   }).error(function(){
>>  alert('error');
>>   }, 'json');
>>
>>
>> as you can see, it is performing a PUT request on the pilots controller
>> which is setup up with default resource map, parse extensions and request
>> handler. Dragging and dropping a pilot from one squad to another correctly
>> triggers a HTTP PUT request, however inspecting $this->request->data and
>> $this->request->input('json_decode') both return empty arrays.
>>
>> I'd appreciate assistance from anyone who has successfully gotten jquery
>> to interact with a cakephp rest api.
>>
>> Cheers :)
>>
>>
>

-- 
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 email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Interacting with a cakephp rest service using jquery - problem with PUT

2012-04-28 Thread Greg Skerman
I will add, that POST and GET works fine... data is passed back and forth
as expected and cakephp's "magic" takes care of saving of data perfectly
fine.

On Sat, Apr 28, 2012 at 6:24 PM, Greg Skerman  wrote:

> Hi all,
>
> Building a simple tool which uses a cakephp rest service. The client
> application is the webpage generated by the application, and it reacts to
> user input such as dragging and dropping things around.
>
> I've extended the jquery ajax helper methods to include methods for PUT
> and DELETE, and these are triggering just fine.
>
> The problem is I am unable to get the data back to cakephp to do anything
> with it.
>
> heres the javascript which triggers everything off:
>
> $('div.content-block').droppable({
>drop: function(event, ui)
>{
>   $(this).children('ul').append(ui.draggable);
>   // perform the PUT on the db...
>   var pilotID = ui.draggable.attr('id').split('-')[1]
>   var squadID = $(this).attr('id').split('-')[1];
>
>   $.put('pilots/'+pilotID+'.json',
>   {
>  "squad_id" : squadID
>   }, function() {
>  alert('success');
>   }).error(function(){
>  alert('error');
>   }, 'json');
>
>
> as you can see, it is performing a PUT request on the pilots controller
> which is setup up with default resource map, parse extensions and request
> handler. Dragging and dropping a pilot from one squad to another correctly
> triggers a HTTP PUT request, however inspecting $this->request->data and
> $this->request->input('json_decode') both return empty arrays.
>
> I'd appreciate assistance from anyone who has successfully gotten jquery
> to interact with a cakephp rest api.
>
> Cheers :)
>
>

-- 
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 email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Interacting with a cakephp rest service using jquery - problem with PUT

2012-04-28 Thread Greg Skerman
Hi all,

Building a simple tool which uses a cakephp rest service. The client
application is the webpage generated by the application, and it reacts to
user input such as dragging and dropping things around.

I've extended the jquery ajax helper methods to include methods for PUT and
DELETE, and these are triggering just fine.

The problem is I am unable to get the data back to cakephp to do anything
with it.

heres the javascript which triggers everything off:

$('div.content-block').droppable({
   drop: function(event, ui)
   {
  $(this).children('ul').append(ui.draggable);
  // perform the PUT on the db...
  var pilotID = ui.draggable.attr('id').split('-')[1]
  var squadID = $(this).attr('id').split('-')[1];

  $.put('pilots/'+pilotID+'.json',
  {
 "squad_id" : squadID
  }, function() {
 alert('success');
  }).error(function(){
 alert('error');
  }, 'json');


as you can see, it is performing a PUT request on the pilots controller
which is setup up with default resource map, parse extensions and request
handler. Dragging and dropping a pilot from one squad to another correctly
triggers a HTTP PUT request, however inspecting $this->request->data and
$this->request->input('json_decode') both return empty arrays.

I'd appreciate assistance from anyone who has successfully gotten jquery to
interact with a cakephp rest api.

Cheers :)

-- 
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 email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Best IDE for CakePHP 2.1

2012-04-18 Thread Greg Skerman
Netbeans for me. There are a few tricks required to get the code completion
to work (especially in views) but nothing drastic.

Has nice integration with subversion, unit testing, jira, etc. Code
templates and code snippets are also nice. Free is a major bonus too.

Have tried others (eclipse, komodo, Codelobster) and they didn't do it for
me.

To get Netbeans to code complete for you:

1) right click the project in the project explorer tree and select
"properties"
2) go to PHP Include Path
3) add the cake folder to the include path and click OK
4) in all your models/controllers you need to add some helper properties to
the doc comments so that netbeans is aware of what is going on:
/**
 * Registration Model
 *
 * @property Location $Location
 * @property Status $Status
 */

This basically tells netbeans that when you go $this->Location to go
looking at the Location model (since Location isn't defined in the class).
Same goes for helpers/components/behaviors etc. The bake scripts actually
add all this for you which is great.

5) in your views it gets a tiny bit trickier... before you use the $this
variable in a view you need to place a comment immediately before it:

/* @var $this View */

After you do all that you get code completion/hints/suggestions everywhere.
The core cake source is well commented and you can mine down into the
entire class structure with ease.

As for integrated cake console... what's wrong with opening up putty and
having it running in the back ground all the time?





On Thu, Apr 12, 2012 at 3:23 PM, Reza Talamkhani
wrote:

> Hi,
> I Need an IDE for CakePHP 2.1 that integerated with cake console and
> suggestion...
> I test eclipse, netbeans & Codelobster but it did not meet any...
>
> Please help me to choose the best IDE.
>
> --
> 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 email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group
> at http://groups.google.com/group/cake-php
>

-- 
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 email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: How dynamic setup db config file?

2012-03-19 Thread Greg Skerman
persist the values from the form to an ini file or serialize an array and
chuck it in a file somewhere.

Read from that file into the db config (probably via bootstrap??)

I've never actually done it but this is how I'd start...

On Tue, Mar 20, 2012 at 9:18 AM, Salines  wrote:

> Hi there,
>
> need your help.
>
> I am working on a web page with multiple data sources, I need to enable 
> administrators
> to easily add, edit / change DATABASE_CONFIG value (password, token, ..)
> through HTML form.
>
> What is the best solution for this scenario?
>
> Thank you.
>
> --
> 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 email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group
> at http://groups.google.com/group/cake-php
>

-- 
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 email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Using char(36) as a uuid

2012-02-29 Thread Greg Skerman
There is some debate that keys should be meaningful, and I get that - but a
UUID is as meaningless as an auto incremented key.

With judicious use of routes, configuration, and other such bits you can
utterly hide your IDs from public scrunity if that is what you're worried
about... personally I find it much easier to navigate to posts/5 as opposed
to posts/aeasd12382nd2jujud3nx3juo3ehu9282 but maybe thats just me.


On Thu, Mar 1, 2012 at 7:26 AM, Miles J  wrote:

> Whats the reason for disliking auto-incrementing numbers? Its probably the
> best thing about databases.
>
>
> On Wednesday, February 29, 2012 6:53:38 AM UTC-8, Ighor Martins wrote:
>>
>> Hello,
>>
>> I was thinking about the use of integer as primary key of the table or
>> use a char(36) as UUID in the entire project,
>> What I dont like about the integer, is the auto increment number, So I
>> decided to use char(36) 'cause cake automatically fill it with an UUID, but
>> I dont know if this can slow down the search in DB.
>>
>> So, anyone who used this before, please tell me about that.
>> Is that right to use this in tables like: Users, Cars, Categories?
>>
>>
>> Thanks.
>>
>  --
> 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 email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group
> at http://groups.google.com/group/cake-php
>

-- 
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 email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: The Great Web Framework Shootout

2012-02-21 Thread Greg Skerman
@euromark
Its how any sensible developer should think about it. The only benchmark
I'd ever be interested in seeing would be one where 2 developers of
comparable skill showed down the building of a fully featured blog in
competing frameworks.

This isn't to say CakePHP is perfect, obviously improvements in the
performance department are welcomed. But take a guess at how many hours the
framework has already saved you on authoring just plain CRUD boilerplate
code in the last 12 months? No really, go do it... multiply by your hourly
rate... thats profit, or time with your family



On Wed, Feb 22, 2012 at 11:20 AM, euromark wrote:

> @greg
> right on - you express to 100% what I feel about this ;)
>
>
> On 22 Feb., 00:51, Greg Skerman  wrote:
> > Performance is often the very last thing I look at - Productivity is more
> > important.
> >
> > My clients care about seeing/touching/feeling a piece of software early
> and
> > often so they can inject changes and enhancements to the process. CakePHP
> > wins for me here because it is just so incredibly fast to develop with -
> > spend an hour on your DB schema, bake and scaffold everything and you've
> > got a piece of software which you can use to drive a discussion with your
> > clients.
> >
> > Pulling features off the scaffold into more concrete views and
> controllers
> > is trivial and if I like I can show enormous progress towards a client's
> > goals each and every day.
> >
> > This is the power of a RAD framework. If you want pure speed, you
> wouldn't
> > use a framework at all - but performance can be dealt with by purchasing
> > hardware, caching strategies, db indexing...all of which is comparatively
> > cheap when compared to development time.
> >
> > Have tried other frameworks, can't code as quickly in them as I can with
> > Cake that is all I need to know.
> >
> > On Tue, Feb 21, 2012 at 10:28 PM, Thiago Belem  >wrote:
> >
> >
> >
> >
> >
> >
> >
> > > It's like comparing toolboxes based on airplane turbine *specs*.
> >
> > > --
> > > Thiago Belem,
> > > Desenvolvedor WEB
> >
> > > Enviado do meu Android
> > > Em 21/02/2012 10:25, "Stephen" 
> escreveu:
> >
> > > Having the fastest lap time on the page load track doesn't interest me
> or
> > >> persuade me to use a framework, I care more about the tools in the
> toolkit,
> > >> the way it's built and how long it takes.
> >
> > >> --
> > >> Kind Regards
> > >>  Stephen
> >
> > >>  http://www.ninjacodermonkey.co.uk
> >
> > >>  --
> > >> Our newest site for the community: CakePHP Video Tutorials
> > >>http://tv.cakephp.org
> > >> Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help
> > >> others with their CakePHP related questions.
> >
> > >> To unsubscribe from this group, send email to
> > >> cake-php+unsubscr...@googlegroups.com For more options, visit this
> group
> > >> athttp://groups.google.com/group/cake-php
> >
> > >  --
> > > Our newest site for the community: CakePHP Video Tutorials
> > >http://tv.cakephp.org
> > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help
> > > others with their CakePHP related questions.
> >
> > > To unsubscribe from this group, send email to
> > > cake-php+unsubscr...@googlegroups.com For more options, visit this
> group
> > > athttp://groups.google.com/group/cake-php
>
> --
> 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 email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group
> at http://groups.google.com/group/cake-php
>

-- 
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 email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: The Great Web Framework Shootout

2012-02-21 Thread Greg Skerman
Performance is often the very last thing I look at - Productivity is more
important.

My clients care about seeing/touching/feeling a piece of software early and
often so they can inject changes and enhancements to the process. CakePHP
wins for me here because it is just so incredibly fast to develop with -
spend an hour on your DB schema, bake and scaffold everything and you've
got a piece of software which you can use to drive a discussion with your
clients.

Pulling features off the scaffold into more concrete views and controllers
is trivial and if I like I can show enormous progress towards a client's
goals each and every day.

This is the power of a RAD framework. If you want pure speed, you wouldn't
use a framework at all - but performance can be dealt with by purchasing
hardware, caching strategies, db indexing...all of which is comparatively
cheap when compared to development time.

Have tried other frameworks, can't code as quickly in them as I can with
Cake that is all I need to know.


On Tue, Feb 21, 2012 at 10:28 PM, Thiago Belem wrote:

> It's like comparing toolboxes based on airplane turbine *specs*.
>
> --
> Thiago Belem,
> Desenvolvedor WEB
>
> Enviado do meu Android
> Em 21/02/2012 10:25, "Stephen"  escreveu:
>
> Having the fastest lap time on the page load track doesn't interest me or
>> persuade me to use a framework, I care more about the tools in the toolkit,
>> the way it's built and how long it takes.
>>
>> --
>> Kind Regards
>>  Stephen
>>
>>  http://www.ninjacodermonkey.co.uk
>>
>>
>>  --
>> 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 email to
>> cake-php+unsubscr...@googlegroups.com For more options, visit this group
>> at http://groups.google.com/group/cake-php
>>
>  --
> 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 email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group
> at http://groups.google.com/group/cake-php
>

-- 
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 email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: HtmlHelper::div close tag?

2012-02-20 Thread Greg Skerman
I always find leaving the markup in its native language is beneficial,
except in cases where cake's pathing becomes an issue (image, anchors
etc)...

I'd go and write foo personally, but thats just me.

however, from the documentation:

HtmlHelper::div(*string $class*, *string $text*, *array $options*)
Parameters:

   - *$class* (*string*) – The classname for the div.
   - *$text* (*string*) – The content inside the div.
   - *$options* (*array*) – An array of *html
attributes*
   .

  Used for creating div-wrapped sections of markup. The first parameter
specifies a CSS class, and the second is used to supply the text to be
wrapped by div tags. If the last parameter has been set to true, $text will
be printed HTML-escaped.

If no text is specified, only an opening div tag is returned.:

Html->div('error', 'Please enter your credit card number.');
// OutputPlease enter your credit card number.

i.e. its going to wrap it up in a closing div for youbut you need to
pass a class to it as the first parameter... $this->Html->div('someClass',
'foo'); should do the trick.




On Tue, Feb 21, 2012 at 4:13 PM, Perry  wrote:

> Hi guys, I want to wrap some elements in a div, and I'm using
>
> $this->Html->div('foo')
>
>
> to generate the starting div tag, but I can't find a method to generate
> the closing tag
>
> how can I use the HtmlHelper to do this? I think write the ''
>  directly is ugly...
>
> --
> Perry | 彭琪
> http://pengqi.me
>
>  --
> 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 email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group
> at http://groups.google.com/group/cake-php
>

-- 
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 email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: David Persson Media Plugin - Batch Image Upload

2011-11-08 Thread Greg Skerman
to upload multiple files, there is a flash gadget which can be used called
SWFUpload

here is a demo showing a classic multi-select file browser:

http://demo.swfupload.org/v220/formsdemo/index.php

Its not a complete media plugin, you'll need to either write a back end or
massage an existing back end into service.





On Wed, Nov 9, 2011 at 5:10 AM, BigZee  wrote:

> I have been using the media plugin for quite some time on multiple
> sites. I absolutely love it and it has always worked well for any
> application I might need it on. However I have run into a situation
> and would like to use this plugin, but cannot seem to find any
> resources concerning this. I did find one post that said it was
> possible, but that was about all.
>
> So I'm working on an auction site and the user needs to be able to
> upload, say 50, images per auction. I'm sure given a single field
> upload you could see how big of a pain this would be. So what I would
> like to know, is there a way that the Media plugin can handle batch
> uploading of multiple images at once?
>
> Thx...
>
> --
> 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 email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group
> at http://groups.google.com/group/cake-php
>

-- 
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 email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Run a cron job in cakephp

2011-11-03 Thread Greg Skerman
I was reading recently about a deferred execution pluginwhich kind of
did that I thought (i've not actually used it..)

https://github.com/MSeven/cakephp_queue/wiki

Queues a job, which gets picked up periodically by a worker and doesn't
hold up the page load.

Might be worth a look.


On Fri, Nov 4, 2011 at 3:17 PM, zuha  wrote:

> While we're on the topic though... is there anyway to run a process
> separate from the page load.  I would love to run a pseudo cronjob on each
> page load if it could be done without negatively effecting performance in a
> serious way.  (I was thinking curl, and ajax, but they didn't really seem
> to fit the bill)   Any experts out there know how to start a cron task
> outside of the page load, but triggered by a page load?
>
> --
> 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 email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group
> at http://groups.google.com/group/cake-php
>

-- 
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 email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Rudeness (was: Re: Making radio button labels clickable)

2011-11-03 Thread Greg Skerman
Disagree.

For starters - rather than creating a new thread by changing the subject,
why didn't you just reply in the existing thread? I had to go back and take
a look at what you were talking about.

Secondly the responses in that thread don't look rude at all. Helpful
suggestions for getting helpful responses (keep it brief, use pastebin etc).

I've always gotten helpful, quick responses to questions - even when my
questions have been borderline moronic. That said people are volunteers,
and are busy - so they are entitled to be frustrated when people do silly
things (like respond directly to people via mail, repeat questions that
have been answered dozens of times etc).

I've been on far less helpful lists (lists which are moderated - asking a
simple question never even makes it to the list. Simple questions getting
asked because of poor documentation never ever get answered).

Don't confuse short, sharp, to the point responses as "rudeness". People
don't often have the time to reply to responses with essays...

On Fri, Nov 4, 2011 at 11:28 AM, Ryan Schmidt wrote:

>
> On Nov 3, 2011, at 11:51, Jeremy Burns | Class Outfit wrote:
>
> > This is one of the most friendly and responsive forums
>
> No, sorry. This is by far the rudest and least helpful list I've ever been
> on. The fact that that rudeness is often perpetrated by the administrators
> of the list means this is part of the culture of this list and is emulated
> by other list contributors. I've lost could of how many times I've seen
> someone post a question only to receive a dozen rude / unhelpful / snarky
> replies. Yes, people need to be educated about how to ask helpful questions
> that better enable people to help them. But it is possible to do that
> without insulting them.
>
> One of the authors of Subversion (a program I use, and whose mailing list
> I also participate in) wrote a book, Producing Open Source Software. You
> can read it online for free:
>
> http://producingoss.com/
>
> Not tolerating rudeness is one of the tenets of a good open source project
> that's talked about in the book:
>
> http://producingoss.com/en/setting-tone.html#prevent-rudeness
>
> Notably, this section is written from the perspective that a project
> administrator would be the one reigning in the rudeness of another list
> member. The idea that a project administrator could be the one perpetrating
> the rudeness is so outlandish that it does not appear to have occurred to
> the author.
>
> Clearly the people being rude on this list either do not realize that they
> are being rude, or do not see a problem with being rude to people who have
> come to seek help in a discussion group created specifically for that
> purpose; either problem is alarming.
>
> I suggest the administrators and contributors of this list and this
> project seriously reconsider their manner of interacting with their users
> if they want to stop alienating large portions of their userbase.
>
>
> --
> 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 email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group
> at http://groups.google.com/group/cake-php
>

-- 
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 email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Question about why components etc are added the way they are

2011-10-25 Thread Greg Skerman
I've been asked a question to which I don't immediately have a (good)
answer...

why is it in cake that this:

public $components = array('AuthComponent');

is preferred over

public $Auth;

public function __construct() {
   $this->Auth = new AuthComponent();
}

I actually really like the way its done in Cake, but have been told its
"less readable" (a point I disagree with)

wondering if there is any major technical reason for favoring one over the
other. Curiosity more than anything...Is it purely to reduce lines of code?
or to make code generation easier? or to facilitate testing?...

-- 
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 email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


How do you go about making a ReST service filterable (search via ReST)

2011-10-20 Thread Greg
Still a bit stuck here with ReST. I have the index displaying as XML,
and JSON - so its a good start...

however the list could end up being quite large, so I want to
condition it by fields.

Conceptually something like:

logs.xml?source=&class=&method=& etc, allowing the caller to pass
basic query parameters to the index action.

I don't want to use $_GET though, I'd prefer to use something like
named parameters, but unsure how to make this play nice.

Do i need to set up custom ReST routing instead of mapResources() to
achieve this?

-- 
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 email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Problem generating view for REST webservice in cakephp 2.0

2011-10-19 Thread Greg Skerman
Ok i sort of sorted it out... got rid of $xml->header, and instead of just
using $logs = $this->model->find('all'), i did $logs = array('Logs' =>
$this->model->find('all') to create a root element... that worked if logs
contained 1 items.. but if it contains more than 1 item, I got the same
error...

the only thing that would get it near enough to working was $logs =
array('logs' => array('item' => $this->model->find('all'))) - which seems to
me to be needless and ridiculous?

anyone got an example of cakephp 2.0 producing index as XML using
simpleXML/rest that I can have a peak at? duplicating exactly what is in the
documentation doesn't yield any usable results

On Wed, Oct 19, 2011 at 3:25 PM, zuha  wrote:

> I doubt its the right answer but figured I'd throw it out just in case.
>  Have you tried $this->Xml->header();  instead of $xml->header();  ?
> Ignore me if I'm steering you off track.
>
> --
> 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 email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group
> at http://groups.google.com/group/cake-php
>

-- 
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 email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Problem generating view for REST webservice in cakephp 2.0

2011-10-18 Thread Greg
Strange problems here.

Firstly, the default default.ctp for XML looked like this:

header(); ?>


which lead to:

Notice (8): Undefined variable: xml [APP/View/Layouts/xml/default.ctp,
line 1]

no problem, removed the first line of default.ctp

My /logs/xml/index.ctp view looks like this:

asXML();
?>

served up from this controller action:

public function index() {
$logs = $this->Log->find('all');
$this->set(compact('logs'));
}

and my routes contains:
   Router::mapResources('logs');
   Router::parseExtensions();


result is the following error:

The key of input must be alphanumeric

Error: An Internal Error Has Occurred.

Stack trace is:

#0 /exports/www/ErrorLogger/View/Logs/xml/index.ctp(2):
Xml::fromArray(Array)
#1 /usr/share/php/cakephp/lib/Cake/View/View.php(598): include('/
exports/www/Er...')
#2 /usr/share/php/cakephp/lib/Cake/View/View.php(365): View->_render('/
exports/www/Er...')
#3 /usr/share/php/cakephp/lib/Cake/Controller/Controller.php(898):
View->render(NULL, NULL)
#4 /usr/share/php/cakephp/lib/Cake/Routing/Dispatcher.php(114):
Controller->render()
#5 /usr/share/php/cakephp/lib/Cake/Routing/Dispatcher.php(89):
Dispatcher->_invoke(Object(LogsController), Object(CakeRequest),
Object(CakeResponse))
#6 /exports/www/ErrorLogger/webroot/index.php(96): Dispatcher-
>dispatch(Object(CakeRequest), Object(CakeResponse))
#7 {main}

Any ideas where this has gone wrong? help!

-- 
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 email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Problem with linking a pdf at a outside webroot folder

2011-09-29 Thread Greg Skerman
as a hack, couldn't you just create a symlink in the webroot folder to the
pdf folder? :)
i use symlinks inside the folder structure all the time for my
**development** environment.. not sure if its a clever idea in production
though...


On Fri, Sep 30, 2011 at 11:29 AM, Ryan Schmidt
wrote:

> On Sep 28, 2011, at 04:15, heohni wrote:
>
> > I have this structure:
> > controller
> > model
> > pdf <
> > webroot
> >
> > In this pdf folder are my files and I am not able to change this
> > folder location as it gets filled by and external CMS Service.
> >
> > I need now to link to these pdfs and my link outputs me something like
> > that:
> > http://localhost/pdf/8104-3-de.pdf
> >
> > Is there a way through the routes.php or maybe htaccess to get the
> > files properly opened?
>
>
> http://groups.google.com/group/cake-php/browse_thread/thread/d9d85da93ae29088
>
>
>
> --
> 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 email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group
> at http://groups.google.com/group/cake-php
>

-- 
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 email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: How to pagine a custom sql statement?

2011-09-28 Thread Greg Skerman
http://book.cakephp.org/view/1237/Custom-Query-Pagination explains how to
implement custom pagination logic.


On Thu, Sep 29, 2011 at 12:55 AM, heohni <
heidi.anselstet...@consultingteam.de> wrote:

> Hi,
>
> I have to use a own sql statement:
> $results = $this->Bookmark->query('
>SELECT
>DISTINCT OBJ_NUMMER
>FROM
>Gesamtobjekt
>WHERE obj_id IN ($variableIDs) AND eia_id IN (SELECT
> les_fkid_eia_id FROM Link_eia_static)
>');
>
> Is there any way, how to use the pagination function for this?
>
> --
> 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 email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group
> at http://groups.google.com/group/cake-php
>

-- 
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 email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Overriding cakephp core functions

2011-09-13 Thread Greg Skerman
As a serious aside...

if the Auth component/hashPasswords won't do it for you, could you not
subclass the auth component:

BcryptAuthComponent extends AuthComponent {
}

and replace the 'offending' bits of the code so it *does* work for you?
again, never tried (never saw the need) but if there is a pressing need to
do this for whatever reason, and the AuthComponent doesn't let you do it -
surely this is a way out?


On Wed, Sep 14, 2011 at 1:25 PM, Greg Skerman  wrote:

> I don't assume my system is invulnerable.. just as you should not assume
> bcrypt is invulnerable (its at least as vulnerable as everything else from
> the perspective of brute forcing/attacking at the login form).
>
> I do however take reasonable steps to reduce the risk of my system being
> attacked rather than finding some evangalistic link and regurgitating
> what is written by said evangelist as if its some kind of enormous threat to
> security if you don't follow what is said...your evidence is not backed up -
> you have not yet cracked the hashed password provided to you in under 8
> minutes despite how "easy" you claim it to be
>
> steps I take:
> 1) my production DB server is only accessible from the IP address of my
> application server
> 2) my production DB server and my production application server are 2
> separate physical machines
> 3) my production DB server and my production application server use
> different usernames and passwords (however, admitted weakness is the fact
> that the db username and password are revealed in the config file which is
> accessible if you have breached the prod app server)
> 4) login forms will force the user to pass a reCAPTCHA if the number of
> failed logon attempts is greater than 3. An attempted brute force at this
> point is far more likely than an attack directly at the database, and this
> will significantly slow down any attacker.
> 5) where possible, login forms use SSL, to mitigate MITM attacks
> 6) passwords are required to be a minimum of 8 characters long, contain
> both upper and lowercase letters, at least 1 number and at least 1 letter,
> as well as at least one symbol.
> 7) server logs are routinely checked for suspicious activity, and suspect
> IP ranges are blocked.
>
> all of this is what i would call REASONABLE - add that to randomly
> generated salt for each application, use of the security component, and I
> would say you've got a pretty solid defense
>
> and no, the overhead of 0.3 seconds at log-in time is not acceptable. an
> overhead of an additional 0.01 seconds is not acceptable. Nor is the
> increased computational overhead acceptable...nore are the risks of adding a
> security hole by hacking together a solution on the framework
> acceptableat least not to me or my clients/users.
>
>
>
>
>
> On Wed, Sep 14, 2011 at 12:24 PM, Chris Cinelli <
> chris.cine...@formativelearning.com> wrote:
>
>> Again, if you assume that your system is invulnerable, why complicating
>> your life using hashed passwords in the database, then? Put them in DB in
>> clear.
>> I understand that getting the DB and the salt may not be trivial. However
>> every once in a while vulnerabilities are discovered and bad guys can be
>> able to access your server. By the time a patch for the vulnerability is
>> applied, somebody may have your DB and code. If the passwords can be
>> inferred easily from it, the adversary has access to your data in your
>> system FOREVER. Probably nobody is interested in getting control of your
>> system, or at least nobody with the necessary skills. But I prefer not to
>> take a chance on mine.
>>
>> If you spent time to look how the bcrypt works and what I wrote in the
>> previous emails, you would have found that, because how bcrypt works, you
>> cannot just plug it in the hashPasswords. But thank you for the suggestion.
>>
>> We made it work in CakePHP 2.0RC1 but it required us to write something
>> "hacky". If we have time we will try to submit a patch to make it clean but
>> I am not sure we have enough knowledge of Cake to make it general enough.
>>
>> Best,
>>Chris
>>
>> On Tue, Sep 13, 2011 at 6:33 PM, Greg Skerman  wrote:
>>
>>> The inference is that every cake application is magically vulnerable to
>>> an attack predicated on ridiculously weak passwords and the highly unlikely
>>> occurance that the attacker has both the salt and unfettered access to the
>>> database.
>>>
>>> If you are so convinced, couldn't you override
>>> AuthComponent::hashPasswords() though?
>>>
>>> from the book:
>>&g

Re: Overriding cakephp core functions

2011-09-13 Thread Greg Skerman
I don't assume my system is invulnerable.. just as you should not assume
bcrypt is invulnerable (its at least as vulnerable as everything else from
the perspective of brute forcing/attacking at the login form).

I do however take reasonable steps to reduce the risk of my system being
attacked rather than finding some evangalistic link and regurgitating
what is written by said evangelist as if its some kind of enormous threat to
security if you don't follow what is said...your evidence is not backed up -
you have not yet cracked the hashed password provided to you in under 8
minutes despite how "easy" you claim it to be

steps I take:
1) my production DB server is only accessible from the IP address of my
application server
2) my production DB server and my production application server are 2
separate physical machines
3) my production DB server and my production application server use
different usernames and passwords (however, admitted weakness is the fact
that the db username and password are revealed in the config file which is
accessible if you have breached the prod app server)
4) login forms will force the user to pass a reCAPTCHA if the number of
failed logon attempts is greater than 3. An attempted brute force at this
point is far more likely than an attack directly at the database, and this
will significantly slow down any attacker.
5) where possible, login forms use SSL, to mitigate MITM attacks
6) passwords are required to be a minimum of 8 characters long, contain both
upper and lowercase letters, at least 1 number and at least 1 letter, as
well as at least one symbol.
7) server logs are routinely checked for suspicious activity, and suspect IP
ranges are blocked.

all of this is what i would call REASONABLE - add that to randomly generated
salt for each application, use of the security component, and I would say
you've got a pretty solid defense

and no, the overhead of 0.3 seconds at log-in time is not acceptable. an
overhead of an additional 0.01 seconds is not acceptable. Nor is the
increased computational overhead acceptable...nore are the risks of adding a
security hole by hacking together a solution on the framework
acceptableat least not to me or my clients/users.




On Wed, Sep 14, 2011 at 12:24 PM, Chris Cinelli <
chris.cine...@formativelearning.com> wrote:

> Again, if you assume that your system is invulnerable, why complicating
> your life using hashed passwords in the database, then? Put them in DB in
> clear.
> I understand that getting the DB and the salt may not be trivial. However
> every once in a while vulnerabilities are discovered and bad guys can be
> able to access your server. By the time a patch for the vulnerability is
> applied, somebody may have your DB and code. If the passwords can be
> inferred easily from it, the adversary has access to your data in your
> system FOREVER. Probably nobody is interested in getting control of your
> system, or at least nobody with the necessary skills. But I prefer not to
> take a chance on mine.
>
> If you spent time to look how the bcrypt works and what I wrote in the
> previous emails, you would have found that, because how bcrypt works, you
> cannot just plug it in the hashPasswords. But thank you for the suggestion.
>
> We made it work in CakePHP 2.0RC1 but it required us to write something
> "hacky". If we have time we will try to submit a patch to make it clean but
> I am not sure we have enough knowledge of Cake to make it general enough.
>
> Best,
>Chris
>
> On Tue, Sep 13, 2011 at 6:33 PM, Greg Skerman  wrote:
>
>> The inference is that every cake application is magically vulnerable to an
>> attack predicated on ridiculously weak passwords and the highly unlikely
>> occurance that the attacker has both the salt and unfettered access to the
>> database.
>>
>> If you are so convinced, couldn't you override
>> AuthComponent::hashPasswords() though?
>>
>> from the book:
>>
>> If you want to use different password hashing logic beyond md5/sha1 with
>> the application salt, you will need to override the standard hashPassword
>> mechanism - You may need to do this if for example you have an existing
>> database that previously used a hashing scheme without a salt. To do this,
>> create the method 
>> hashPasswords<http://book.cakephp.org/view/1259/hashPasswords>in the class 
>> you want to be responsible for hashing your passwords (usually
>> the User model) and set 
>> authenticate<http://book.cakephp.org/view/1278/authenticate>to the object 
>> you're authenticating against (usually this is User)
>>
>> I've never seen a need to do it, but it would appear it exists for exactly
>> this reason - for building hashing logic that diff

Re: Overriding cakephp core functions

2011-09-13 Thread Greg Skerman
The inference is that every cake application is magically vulnerable to an
attack predicated on ridiculously weak passwords and the highly unlikely
occurance that the attacker has both the salt and unfettered access to the
database.

If you are so convinced, couldn't you override
AuthComponent::hashPasswords() though?

from the book:

If you want to use different password hashing logic beyond md5/sha1 with the
application salt, you will need to override the standard hashPassword
mechanism - You may need to do this if for example you have an existing
database that previously used a hashing scheme without a salt. To do this,
create the method
hashPasswords<http://book.cakephp.org/view/1259/hashPasswords>in the
class you want to be responsible for hashing your passwords (usually
the User model) and set
authenticate<http://book.cakephp.org/view/1278/authenticate>to the
object you're authenticating against (usually this is User)

I've never seen a need to do it, but it would appear it exists for exactly
this reason - for building hashing logic that differs from the core logic
shipped with the auth component.



On Wed, Sep 14, 2011 at 10:47 AM, Chris Cinelli <
chris.cine...@formativelearning.com> wrote:

> Or maybe, Paypal is using bcrypt. :-P
>
> Yes, of course you need the user table in the DB, but if it is your
> argument and you feel strong on how difficult is to access you DB, why don't
> you store the passwords in clear in your DB?
> I am not saying that it is easy to do, but in case it happen (see RockYou
> story for example), the attacker can access any account on the system, and
> probably more than that since a few user reuse the same password on multiple
> websites.
>
> Regarding "your bcrypt is just as vulnerable to a plain jane dictionary
> attack as anything else." It is not mine, unfortunately. But actually the
> speed necessary to calculate an hash IS a factor against brute forcing.
> Because if it takes a microsecond or instead nearly one second to calculate
> the hash make a huge difference. While ,according to the link I posted, it
> takes 40 sec to crack a SHA1 hash of 6 letter password, it would take
> 40*1,000,000 sec to crack a bcrypt hash that is more than a year. In the
> case posted in my previous message is 8min with SHA1 vs more than 12 years
> with bcrypt.
> Another interesting property of bcrypt is that given the same password the
> hash generated is (practically) always different so you cannot
> pre-calculate  the hash values. Trying a dictionary attack checking hundred
> of millions of terms is just unpractical too.
> That is actually the point, if it takes 8 minutes or even a day, an
> attacker may actually do that. If it takes year, he will probably desist and
> try to get access of another system that use SHA1 like someone out there :-P
>
> This thread is going longer than necessary. The point is: if somebody wants
> to use SHA1 can freely do it. It would be nice that cake would not make the
> assumption that  the password is a traditional hash and insert the plug for
> a verify_password function instead of the current password() function that
> return an hash.
>
> Best,
> Chris
>
> On Tue, Sep 13, 2011 at 4:46 PM, Greg Skerman  wrote:
>
>>
>>
>> On Wed, Sep 14, 2011 at 8:33 AM, Chris Cinelli <
>> chris.cine...@formativelearning.com> wrote:
>>
>>>
>>>
>>> According to: http://research.microsoft.com/pubs/74164/www2007.pdf *~20%
>>> of Fidelity, ~20% of NY Times, ~15% of Paypal* have a password with bit
>>> strength of 30 or less. According to that study, this mean that If I know
>>> the hash and salt, you need to try just 2^30 total combinations to find the
>>> password of 45% of Paypal users.  Using a ATI HD 5970 (that you can find at
>>> $499 at Buy.com and http://www.golubev.com/hashgpu.htm you can try
>>> 2,300,000 SHA1 hashes a second.
>>>
>>>
>>>
>> No you can't - you'd need 45% of PayPal User's usernames... And the db
>> table of passwords to check against...neither of which is trivial to get.
>>
>> if it was this easy, everyone would have 45% of paypal user's
>> passwords
>>
>>  --
>> 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 email to
>> cake-php+unsubscr...@googlegroups.com For more options, visit this group
>> at http://groups.google.com/group/cake-php
>>
>
>  --
> Our newest site for the community: CakePHP Video Tutori

Re: Overriding cakephp core functions

2011-09-13 Thread Greg Skerman
On Wed, Sep 14, 2011 at 8:33 AM, Chris Cinelli <
chris.cine...@formativelearning.com> wrote:

>
>
> According to: http://research.microsoft.com/pubs/74164/www2007.pdf *~20%
> of Fidelity, ~20% of NY Times, ~15% of Paypal* have a password with bit
> strength of 30 or less. According to that study, this mean that If I know
> the hash and salt, you need to try just 2^30 total combinations to find the
> password of 45% of Paypal users.  Using a ATI HD 5970 (that you can find at
> $499 at Buy.com and http://www.golubev.com/hashgpu.htm you can try
> 2,300,000 SHA1 hashes a second.
>
>
>
No you can't - you'd need 45% of PayPal User's usernames... And the db table
of passwords to check against...neither of which is trivial to get.

if it was this easy, everyone would have 45% of paypal user's passwords

-- 
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 email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Overriding cakephp core functions

2011-09-13 Thread Greg Skerman
**nothing** absolutely protects you from brute force. your bcrypt is just as
vulnerable to a plain jane dictionary attack as anything else.

If you have generated all possible passwords, its just a case of
(painstakingly slow) trail and error to get you in. Changing the hashing
approach wont change this fact... ever.

And you wont have access to the salt - unless you completely fail at setting
up your production environment. My database and my application server are 2
completely different boxes, protected by 2 completely different passwords.
If you gain access to my db, or more likely expose the users table via SQL
injection, you don't get the salt. You could brute force them if you had the
patiencebut no matter the hashing method you are vulnerable to this.

A far more likely attack would be an attack at the authorization form itself
- automated form bot that tries multiple password combinations until it
successfully enters your site. You can mitigate this by using a "3 strikes"
rule, and forcing reCAPTCHA on the 4th attempt to slow a bot down

You've been offered a chance to prove your argument, AD7six has given you a
hash - find the password in less than 8 minutes..


On Wed, Sep 14, 2011 at 8:33 AM, Chris Cinelli <
chris.cine...@formativelearning.com> wrote:

> If you have the access to the DB, you have probably have the access to the
> salt too. Salts protect you against rainbow tables, not against brute
> forcing.
> While to brute force a 46 character password would take more than the life
> of our sun, you have to consider what is the bit strength of the average
> user.
>
> According to: http://research.microsoft.com/pubs/74164/www2007.pdf *~20%
> of Fidelity, ~20% of NY Times, ~15% of Paypal* have a password with bit
> strength of 30 or less. According to that study, this mean that If I know
> the hash and salt, you need to try just 2^30 total combinations to find the
> password of 45% of Paypal users.  Using a ATI HD 5970 (that you can find at
> $499 at Buy.com and http://www.golubev.com/hashgpu.htm you can try
> 2,300,000 SHA1 hashes a second.
>
> This mean that you can crack a password of one of that user in 2^30/230
> = a little less than 8 minute each.
> In reality using a smart dictionary attack and some memory you can
> massively reduce this time. Even more if you are willing to pay a little
> more for the hardware.
>
> You can control your own password but only marginally the password of your
> users (because it is not great user experience forcing a user to have a 46
> character password).
>
> bcrypt easily solves the problem and it is not a lot of work to add the
> option to use it in cakephp. And if 0.3 sec to login is too long for you you
> can reduce the working factor in the algorithm.
>
> Best,
>Chris
>
>
>
> On Tue, Sep 13, 2011 at 6:09 AM, AD7six  wrote:
>
>>
>>
>> On Sep 13, 3:02 pm, AD7six  wrote:
>> > On Sep 13, 3:21 am, Chris Cinelli
>> >
>> >  wrote:
>> > > Read the link I posted. 40 secs to bruteforce crack an hash
>> >
>> > How about: how long on average to brute force a sha1-ed 46 char a-zA-
>> > Z0-9 string?
>> >
>> > That's the default hash for cake 1.3, and the length of the salted
>> > string with a 6 char (weak) password. Quoting numbers for something
>> > that is irrelevant is .. irrelevant.
>> >
>> > AD
>>
>> Infact here you go:  1b5e8ecd7afdf8f97b5c4ed9793d3129f584
>>
>> that's the hash cake would store for a simple password - what was the
>> password?
>>
>> AD
>>
>> --
>> 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 email to
>> cake-php+unsubscr...@googlegroups.com For more options, visit this group
>> at http://groups.google.com/group/cake-php
>>
>
>  --
> 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 email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group
> at http://groups.google.com/group/cake-php
>

-- 
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 email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Overriding cakephp core functions

2011-09-12 Thread Greg Skerman
Except that we're not simply hashing a password
we're hashing a password, that is nonced with the salt string...

your 40 seconds also suggests pure alphanumeric passwords, all lowercase and
6 characters long, which is an incredibly weak password.

So yeah, assuming could generate every password of that length in 40
seconds, and generate the hash for each of those passwords, its not going to
do you much good unless you jam each of those passwords into the form (and
at that point, no matter *how* you are storing the password will protect
you).

If you have compromised the user table and have all of the hashed passwords,
your list of matches will not help because the stored passwords are nonced,
making your lookup completely worthless.

cake's means of dealing with passwords is plenty secure...



On Tue, Sep 13, 2011 at 11:21 AM, Chris Cinelli <
chris.cine...@formativelearning.com> wrote:

> Read the link I posted. 40 secs to bruteforce crack an hash
> On Sep 12, 2011 5:17 PM, "Ryan Schmidt" 
> wrote:
> >
> > On Sep 12, 2011, at 18:01, Chris Cinelli wrote:
> >
> >> Nowadays, normal hash functions like SHA1 are good for sessions and
> caching but not for storing passwords. Doing that is pretty much equivalent
> to having passwords in clear on the DB.
> >
> > Do you have documentation for this claim?
> >
> >
> > --
> > 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 email to
> > cake-php+unsubscr...@googlegroups.com For more options, visit this group
> at http://groups.google.com/group/cake-php
>
> --
> 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 email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group
> at http://groups.google.com/group/cake-php
>

-- 
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 email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Can I safely start a project on 2.0RC1?

2011-09-08 Thread Greg Skerman
RC1 indicates very close to "release"

If you're starting a new project from scratch, its entirely likely by the
time you get to production, it will be in the wild as a stable release.

I'd say go for it..

On Fri, Sep 9, 2011 at 8:20 AM, Lucho Molina  wrote:

> Hello, following the discussion started on
>
> http://groups.google.com/group/cake-php/browse_thread/thread/95529bf7c456f229/fc33ca0022e00332?lnk=gst&q=2.0#fc33ca0022e00332
> I would like to know what the current status is.
>
> I'm starting a project that should be out in production in mid
> november, so would you guys recommend using 2.0 now? I don't want to
> do it in 1.3 only to realize later that the migration is a PITA, and
> that I have to miss 2.0 functionalities.
>
> I can live with a couple of bugs here and there, I can even get my
> hands dirty and patch the core myself, but if there are loads of bugs,
> then it might not be very smart to go live with a too-patchy core.
>
> Thoughts?
>
> --
> 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 email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group
> at http://groups.google.com/group/cake-php
>

-- 
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 email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: tree_utility

2011-09-06 Thread Greg Skerman
Start by reading the book - you'll find most of what you need right there.

you create:
1) a database table which complies with what the tree behavior expects
2) a model for that table which acts as a tree
3) You surface that data in your view
4) you write some code in your view to convert the tree into an unordered
list or definition list or whatever you like/need (you may even like to
write this as a helper for reuse later on)
5) you use some javascript to convert that list into the menu that you want
(alternatively you could use a control, like jsTree or something if you want
an actual tree list - in this case your view is probably going to be an XML
view returning data to the tree control)

if you need further explanation, I'm going to need to know more about what
specifically you are trying to build.


On Wed, Sep 7, 2011 at 1:01 PM, Richardus Ari P
wrote:

> i need tutorial Mr.Greg
>
> On 7 Sep, 09:26, Greg Skerman  wrote:
> > using the tree behavior (core behavior, read the manual) , you can pull
> out
> > a nicely structured tree of data.
> >
> > you can then wrap some / tags around it to make a HTML list...
> >
> > most javascript/jquery menu's I've seen take these tags and build you a
> nice
> > menu based on data stored in your db...
> >
> > that what you need?
> >
> > On Wed, Sep 7, 2011 at 12:05 PM, Richardus Ari P
> > wrote:
> >
> >
> >
> >
> >
> >
> >
> > > please give me tutorial about helper tree_utility.
> > > i am make menus in web but i have not idea..
> >
> > > On 6 Sep, 18:58, AD7six  wrote:
> > > > On Sep 6, 11:52 am, Richardus Ari P 
> wrote:
> >
> > > > > can give me some example helper tree_utility in cakephp
> >
> > > > yes
> >
> > > --
> > > Our newest site for the community: CakePHP Video Tutorials
> > >http://tv.cakephp.org
> > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help
> > > others with their CakePHP related questions.
> >
> > > To unsubscribe from this group, send email to
> > > cake-php+unsubscr...@googlegroups.com For more options, visit this
> group
> > > athttp://groups.google.com/group/cake-php
>
> --
> 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 email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group
> at http://groups.google.com/group/cake-php
>

-- 
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 email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: tree_utility

2011-09-06 Thread Greg Skerman
using the tree behavior (core behavior, read the manual) , you can pull out
a nicely structured tree of data.

you can then wrap some / tags around it to make a HTML list...

most javascript/jquery menu's I've seen take these tags and build you a nice
menu based on data stored in your db...

that what you need?



On Wed, Sep 7, 2011 at 12:05 PM, Richardus Ari P
wrote:

> please give me tutorial about helper tree_utility.
> i am make menus in web but i have not idea..
>
>
> On 6 Sep, 18:58, AD7six  wrote:
> > On Sep 6, 11:52 am, Richardus Ari P  wrote:
> >
> > > can give me some example helper tree_utility in cakephp
> >
> > yes
>
> --
> 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 email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group
> at http://groups.google.com/group/cake-php
>

-- 
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 email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: How to retrieve data which is posted to secure page

2011-09-05 Thread Greg Skerman
Assuming you are using Auth, with all the defaults...

when the user goes to /controller/secureform, assuming its not in the
allowed list, the user will be automatically redirected to the login form...
on successful login it will redirect them back to the secure form with the
auth session filled in. You can of course do further checks if only a
specific class of user should access the secure form.

Much nicer than having somebody fill in a form, and then force them to
login.

If you absolutely must do it this way, have the form action on the secure
form store the data in a session, redirect to the login form, and on
successful login process the data from the session instead of from
$this->data


On Mon, Sep 5, 2011 at 9:10 PM, WebbedIT  wrote:

> beinng shown a form that you fill in only to be presented with a "you
> must login to submit this form" message.  H, no thanks.
>
> Also if the data is to eventually be secure (i.e. encrypted) how is it
> secure when sent from http?!?
>
> @phpMagpie
>
> On Sep 2, 10:50 am, euromark  wrote:
> > you should as a guideline always post a form to itself.
> > therefore the same action can work with the posted data and afterwards
> > redirect to the secure page
> >
> > On 1 Sep., 22:27, vinay  wrote:
> >
> >
> >
> >
> >
> >
> >
> > > Hi,
> > > Looking for help on implementing requirement where user will see a
> > > form even without logging in to the website. Once user submit the form
> > > the data is posted to secured page, that' s why user is redirected to
> > > login page.
> > > How do I get the data posted by user because based on that I need to
> > > show him next step once he logged in.
> >
> > > THanks,
> > > Vinay
>
> --
> 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 email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group
> at http://groups.google.com/group/cake-php
>

-- 
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 email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: CakePHP without naming convention. is it possible?

2011-09-05 Thread Greg Skerman
I told you how to do it :) its not impossible, you just risk it becoming an
unmaintainable mess.

There are many tables I use which come from other systems/are static dumps
of tables out of systems i need to use as reference data but don't want to
muck up the table definitions etc - and I routinely tell cake "this is this,
that is that"...and all is good

Its just something that needs to be dealt with carefully - if you have
hundreds of tables and nothing else depends on them, and you have the
time/budget to do it, it may be worth altering the tables to be more cake
friendlybut if not, just configure your models and document everything
carefully so the next developer who has to come along knows what it is
you've done to make it work.


On Mon, Sep 5, 2011 at 5:20 PM, Cruisine  wrote:

> to be honest,i don't really want this happen.but what am i supposed to
> do?i cant build new database since the current database have lots of
> datas inside. after i read ur reply i started to think like that as
> well.my work will be hard later. i have to define lots of things on
> the model and i don't have an idea about the unpreddicted issues which
> will follow later.
>
> do you have any idea to solve this problem?
>
>
> On Sep 5, 10:39 am, Greg Skerman  wrote:
> > http://book.cakephp.org/view/1057/Model-Attributesis a good place to
> start.
> >
> > you can configure in most circumstances cake to talk to any old database
> -
> > you just end up losing some of the magic and writing more code as a
> result.
> >
> > for a model which does not comply with the convention you will at least
> need
> > to:
> >
> > 1) define the table name ($useTable)
> > 2) define the primary key ($primaryKey)
> > 3) define the display name ($displayName)
> >
> > you'll also need to provide more verbose settings in the model
> associations
> > in order to get them to play nice...
> >
> > On Mon, Sep 5, 2011 at 9:34 AM, Cruisine  wrote:
> > > hi guys, i need to know something important about naming convention.
> > > yeah, i've been using naming convention while developing all my app
> > > all the time. but recently a problem appeared. let say  i've got a
> > > project to re-developing an app ( from non-cakephp to cakephp) which
> > > already had a database. and of course since the app hadn't been built
> > > by cakephp the database also didn't follow the cakephp naming
> > > convention rules.
> > > the question i have is, how do i make an application using cakephp
> > > with that database?is it still possible to  built a cakephp project
> > > without following naming convention rules?
> >
> > > need ur help soon.thank you.
> >
> > > --
> > > Our newest site for the community: CakePHP Video Tutorials
> > >http://tv.cakephp.org
> > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help
> > > others with their CakePHP related questions.
> >
> > > To unsubscribe from this group, send email to
> > > cake-php+unsubscr...@googlegroups.com For more options, visit this
> group
> > > athttp://groups.google.com/group/cake-php
>
> --
> 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 email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group
> at http://groups.google.com/group/cake-php
>

-- 
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 email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: CakePHP without naming convention. is it possible?

2011-09-04 Thread Greg Skerman
http://book.cakephp.org/view/1057/Model-Attributes is a good place to start.

you can configure in most circumstances cake to talk to any old database -
you just end up losing some of the magic and writing more code as a result.

for a model which does not comply with the convention you will at least need
to:

1) define the table name ($useTable)
2) define the primary key ($primaryKey)
3) define the display name ($displayName)

you'll also need to provide more verbose settings in the model associations
in order to get them to play nice...



On Mon, Sep 5, 2011 at 9:34 AM, Cruisine  wrote:

> hi guys, i need to know something important about naming convention.
> yeah, i've been using naming convention while developing all my app
> all the time. but recently a problem appeared. let say  i've got a
> project to re-developing an app ( from non-cakephp to cakephp) which
> already had a database. and of course since the app hadn't been built
> by cakephp the database also didn't follow the cakephp naming
> convention rules.
> the question i have is, how do i make an application using cakephp
> with that database?is it still possible to  built a cakephp project
> without following naming convention rules?
>
> need ur help soon.thank you.
>
> --
> 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 email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group
> at http://groups.google.com/group/cake-php
>

-- 
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 email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Saving multiple records to multiple models

2011-08-21 Thread Greg Skerman
found the problem...
EventComment had a validation rule on event_id being numeric... seemed to
work when the relationship was defined as hasMany but fell over when it was
hasOne.

removed the validation rule (input never entered into a user form anyway),
and it seems to be working fine now.

thanks for your help, the array structure works a treat.


On Sun, Aug 21, 2011 at 5:02 PM, WebbedIT  wrote:

> Difficult to call without seeing more of the source code.
>
> I assume you call a different function to save the EventComment as the
> one you've shown appears to be for saving EventTransaction, if this is
> a universal save method why does it's name reference Transactions?
>
> Does your debugger register that you are in fact looping through the
> full data array, do you have debug turned on in cake and is it
> attempting to run the save at all?
>
> HTH, Paul.
>
> On Aug 21, 3:58 am, Greg Skerman  wrote:
> > Ok that worked to a degree :)
> >
> > my array now looks like this:
> >
> > Array
> > (
> > [1] => Array
> > (
> > [Event] => Array
> > (
> > [event_type_id] => 2
> > )
> >
> > [EventTransaction] => Array
> > (
> > [inventory_type_id] => 2867
> > [amount] => 123123
> > )
> >
> > )
> >
> > [2] => Array
> > (
> > [Event] => Array
> > (
> > [event_type_id] => 3
> > )
> >
> > [EventComment] => Array
> > (
> > [comment] => asdasd
> > )
> >
> > )
> >
> > )
> >
> > And I'm throwing the whole thing against a function which does this:
> >
> > function saveTransactionEvent($data) {
> > foreach ($data as $row) {
> > Debugger::dump($row);
> > $this->saveAll($row);
> > }
> > }
> >
> > The first entry gets successfully saved, the second one doesn't even
> run..
> >
> > Both child models are bound to the Event model like this:
> > $this->Event->bindModel(
> > array('hasOne' => array('EventTransaction',
> > 'EventComment')), false
> > );
> >
> > So they should be bound for the remainder of the request - but the
> > EventComment, and its parent event never get saved
> >
> > I've scaffolded an EventComment controller, and that will write a
> > comment fine... any reason why its not working in this context?
> >
> >
> >
> >
> >
> >
> >
> > On Sun, Aug 21, 2011 at 4:09 AM, WebbedIT  wrote:
> > > A good related blog post from teknoid:
> >
> > >http://nuts-and-bolts-of-cakephp.com/2009/03/26/saveall-with-multiple.
> ..
> >
> > > --
> > > Our newest site for the community: CakePHP Video Tutorials
> > >http://tv.cakephp.org
> > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help
> > > others with their CakePHP related questions.
> >
> > > To unsubscribe from this group, send email to
> > > cake-php+unsubscr...@googlegroups.com For more options, visit this
> group
> > > athttp://groups.google.com/group/cake-php
>
> --
> 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 email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group
> at http://groups.google.com/group/cake-php
>

-- 
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 email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Saving multiple records to multiple models

2011-08-20 Thread Greg Skerman
Ok that worked to a degree :)

my array now looks like this:

Array
(
[1] => Array
(
[Event] => Array
(
[event_type_id] => 2
)

[EventTransaction] => Array
(
[inventory_type_id] => 2867
[amount] => 123123
)

)

[2] => Array
(
[Event] => Array
(
[event_type_id] => 3
)

[EventComment] => Array
(
[comment] => asdasd
)

)

)


And I'm throwing the whole thing against a function which does this:

function saveTransactionEvent($data) {
foreach ($data as $row) {
Debugger::dump($row);
$this->saveAll($row);
}
}

The first entry gets successfully saved, the second one doesn't even run..

Both child models are bound to the Event model like this:
$this->Event->bindModel(
array('hasOne' => array('EventTransaction',
'EventComment')), false
);

So they should be bound for the remainder of the request - but the
EventComment, and its parent event never get saved

I've scaffolded an EventComment controller, and that will write a
comment fine... any reason why its not working in this context?



On Sun, Aug 21, 2011 at 4:09 AM, WebbedIT  wrote:

> A good related blog post from teknoid:
>
> http://nuts-and-bolts-of-cakephp.com/2009/03/26/saveall-with-multiple-records-and-for-multiple-models/
>
> --
> 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 email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group
> at http://groups.google.com/group/cake-php
>

-- 
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 email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


  1   2   3   >