Re: counting specific files in foldeR?

2012-11-15 Thread gremlin
Here is a link cleaning up the general idea and using some class methods to 
get, set the values and a member variable to store the results keyed by 
extension, valued by type. I whipped this up blind so it isn't tested *at 
all* but it should be pretty understandable.

https://gist.github.com/4081086

On Thursday, November 15, 2012 6:26:22 AM UTC-8, Shad Yueh wrote:
>
> Thanks A LOT!!!
> This saved my bacon! ;)
>
>
> Em terça-feira, 31 de agosto de 2010 04h59min32s UTC-4, Jeremy Burns 
> escreveu:
>>
>> OK - I haven't tested this so it's a bit guessy and you might need to 
>> trim/debug...
>>
>> $directory = "../images/team/harry/";
>>
>> $fileTypes = array('jpg', 'pdf', 'xls', 'doc', 'ppt');
>> $fileCount = 0;
>>
>> foreach $fileTypes as $fileType:
>> $fileCount += count(glob("" . $directory . "*." . 
>> $fileType));
>> endforeach;
>>
>> die(debug($fileCount));
>>
>> Someone else might know a way of placing all filetypes into a single 
>> count.
>>
>> Jeremy Burns
>> Class Outfit
>>
>> jerem...@classoutfit.com
>> http://www.classoutfit.com
>>
>> On 31 Aug 2010, at 09:50, Tomfox Wiranata wrote:
>>
>> > you mean i should fill the array with all the filetypes i want to
>> > count...?? or do you mean sth else?
>> > 
>> > i have no idea how to code this... :(
>> > 
>> > On 31 Aug., 10:39, Jeremy Burns | Class Outfit
>> >  wrote:
>> >> Have you tried looping through an array and incrementing a running 
>> total?
>> >> 
>> >> Jeremy Burns
>> >> Class Outfit
>> >> 
>> >> jeremybu...@classoutfit.comhttp://www.classoutfit.com
>> >> 
>> >> On 31 Aug 2010, at 09:33, Tomfox Wiranata wrote:
>> >> 
>> >>> yes...but then all the jpgs and png get counted too.
>> >> 
>> >>> On 31 Aug., 10:28, Jeremy Burns | Class Outfit
>> >>>  wrote:
>>  So have you tried *.*?
>> >> 
>>  Jeremy Burns
>>  Class Outfit
>> >> 
>>  jeremybu...@classoutfit.comhttp://www.classoutfit.com
>> >> 
>>  On 31 Aug 2010, at 09:18, Tomfox Wiranata wrote:
>> >> 
>> > hi jeremy,
>> >> 
>> > yes i wannt a count of all files with the filetypes i mentioned.
>> >> 
>> > On 31 Aug., 10:05, Jeremy Burns | Class Outfit
>> >  wrote:
>> >> Do you want a count of all files - would $filecount = 
>> count(glob("" . $directory . "*.*")); work? If you want a count of each 
>> file type then you could set up an array with the extensions and do a loop.
>> >> 
>> >> Jeremy Burns
>> >> Class Outfit
>> >> 
>> >> jeremybu...@classoutfit.comhttp://www.classoutfit.com
>> >> 
>> >> On 31 Aug 2010, at 08:49, Tomfox Wiranata wrote:
>> >> 
>> >>> hi,
>> >> 
>> >>> i want to count specific files in a folder and i found some code 
>> on
>> >>> the web:
>> >> 
>> >>> $directory = "../images/team/harry/";
>> >>> $filecount = count(glob("" . $directory . "*.jpg"));
>> >>> $filecount = THE TOTAL COUNT
>> >> 
>> >>> this is only counting jpgs. but how can i extend this code to 
>> several
>> >>> filetypes? i need to count pdf, xls, doc, and ppt
>> >> 
>> >>> big thx :)
>> >> 
>> >>> Check out the new CakePHP Questions 
>> sitehttp://cakeqs.organdhelpothers with their CakePHP related questions.
>> >> 
>> >>> 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 For more options, visit this 
>> group athttp://groups.google.com/group/cake-php?hl=en
>> >> 
>> > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp 
>> others with their CakePHP related questions.
>> >> 
>> > 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 For more options, visit this group 
>> athttp://groups.google.com/group/cake-php?hl=en
>> >> 
>> >>> Check out the new CakePHP Questions sitehttp://cakeqs.organd help 
>> others with their CakePHP related questions.
>> >> 
>> >>> 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 For more options, visit this group 
>> athttp://groups.google.com/group/cake-php?hl=en
>> > 
>> > Check out the new CakePHP Questions site http://cakeqs.org and help 
>> others with their CakePHP related questions.
>> > 
>> > 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 For more options, visit this group at 
>> http://groups.google.com/grou

Re: Fat CakePHP

2012-08-08 Thread gremlin
Even using the worst hosting in the world you still should only ever have 
to upload the core one time. If you have to wait 5 minutes for your isp to 
move the files to the remote server each time then you are uploading your 
app and a fresh copy of the core every time you update the site? That is an 
issue of bad workflow and sloppy development more than any bandwidth issue.

Second, if you care about being professional with your development you 
could perhaps invest in digital cable? Learn to keep your core as a 
submodule and use git on your hosting provider so that you can issue a pull 
request and update the core at the speed of their network instead of your 
own. It also helps with keeping your (small by comparison) app files 
separate and easily uploadable/git pullable as it's own package. Anyone who 
complains that they have to upload the whole cake package for every site 
update is advertising to the world that their development cycle is stuck 
using 90's methodologies.

-- 
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: Fast alternative to "contains"?

2012-07-17 Thread gremlin
I believe the docs have this working alongside contains already - if you 
convert your habtm to hasMany through associations and use contains for the 
hasMany to generate the in( id, id2 ,id3 ) conditions then you should have 
it down to a single query or at most a small handful.

Thanks for pointing out that I grabbed the wrong repo - I was trying to 
find it for you in a hurry from a computer I don't use often.


On Tuesday, July 17, 2012 3:40:17 PM UTC-7, Christian wrote:
>
> Also a good one to know for future, but only works for 'hasOne' or 
> 'belongsTo'. Doesn't throw an error for 'hasMany' or 'HABTM', but will not 
> fetch all related data sets (or did I just use it wrong?).
>
> $this->Productgroup->find('first', array('link' => array('Category',
>>
>>  'Product' => array('Productoption' => array('Color',
>>
>>  'Size',
>>
>>  'Material'
>>
>>  ),
>>
>> 'Productpresentation' => array('Productpresentationtype'
>>
>>),
>>
>>
>>> 'Vendor'
>>
>> ),
>>
>>  'Fee',
>>
>>  
>>
>>  ),
>>
>>  'conditions' => array('Productgroup.id' => $id
>>
>>)
>>
>>  )
>>
>>   );
>>
>>
> Productgroup -> Product: HABTM
> Productgroup -> Fee: HABTM 
> Productgroup -> Category: HABTM  
> Product -> Productoption: hasMany
> Productoption -> Color/Size/Material: belongsTo
>
> Cheers
>
> Am Dienstag, 17. Juli 2012 01:11:31 UTC+2 schrieb gremlin:
>>
>> Try this - 
>>
>> https://github.com/sams/linkable
>>
>> It is a newer version of the old linkable behavior - uses relationships 
>> to create joins as well as allows you to create joins on non-default keys. 
>> This might be a fairly straightforward drop in replacement for containable 
>> in your case. It might not, but generating logical joins is a good start 
>> towards reducing the number of small queries usually generated by 
>> containable.
>> Good luck.
>>
>

-- 
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: Fast alternative to "contains"?

2012-07-16 Thread gremlin
Try this - 

https://github.com/sams/linkable

It is a newer version of the old linkable behavior - uses relationships to 
create joins as well as allows you to create joins on non-default keys. 
This might be a fairly straightforward drop in replacement for containable 
in your case. It might not, but generating logical joins is a good start 
towards reducing the number of small queries usually generated by 
containable.
Good luck.

-- 
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: Session unstable?

2012-05-10 Thread gremlin
Try this:  
http://stackoverflow.com/questions/3594823/mime-type-for-woff-fonts 
Also didn't HTML5BoilerPlate have something in their (rather long) htaccess 
file that handled this issue? Might check there.

On Thursday, May 10, 2012 3:16:23 AM UTC-7, phpMagpie wrote:
>
>
> On Monday, 9 April 2012 09:26:49 UTC+1, AD7six wrote:
>>
>>
>> The absolute classic reason for this is because of a missing css/js/image 
>> file hitting your app which invalidate the session.
>>
>> *ALWAYS *look for and correct requests for things that don't exist.
>>
>> AD
>>
>
> Interesting, do you think this be caused by the following error I am 
> having with WOFF fonts?
>
> Resource interpreted as Font but transferred with MIME type text/html: "
> http://firstaidneas.co.uk/theme/Neas/css/font/ubuntu-r-webfont.woff";.
>
> I am getting this error on all pages, yet the session dropout is 
> intermittent and seems to be worse with multiple users logged in.
>
> Not finding a clear answer as to how I resolve my WOFF problem, will keep 
> trying and fingers crossed this may ease the session issues.
>
> Thanks, Paul. 
>

-- 
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: Paginating cached data

2012-05-01 Thread gremlin
Use the 1.3 ArrayDatasource and set the $records member variable to the 
part of the array you need to use as if it came from a DB in the 
constructor. Then you can do whatever you want with it. It should be pretty 
straightforward.


On Saturday, April 28, 2012 5:49:30 AM UTC-7, Jeremy Burns wrote:
>
> I have a function that does a whole bunch of complex finds and 
> calculations to produce an array, which is then cached. Some of the array 
> keys contain meta data about how the calculation was done and some high 
> level contents of the results. One of the array keys contains the actual 
> results that I want to display and paginate. How can I read that array key 
> from cache and paginate it in a view?

-- 
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: Digest for cake-php@googlegroups.com - 25 Messages in 14 Topics

2011-12-12 Thread gremlin
Oops bad reply

On Dec 9, 10:35 am, Abba Bryant  wrote:
> Elements included in the layout have known limitations in what they can add
> to the scripts_for_layout variable.
>
>
>
> On Fri, Dec 9, 2011 at 8:56 AM,  wrote:
> >   Today's Topic Summary
>
> > Group:http://groups.google.com/group/cake-php/topics
>
> >    - Strange updateCounterCache 
> > behavior<#13423c12231ff10c_group_thread_0>[6 Updates]
> >    - ACL RBAC <#13423c12231ff10c_group_thread_1> [2 Updates]
> >    - Multi-level Authorization? <#13423c12231ff10c_group_thread_2> [2
> >    Updates]

> >    - How to use AuthComponent to authorize using a password only rather
> >    than username/password? <#13423c12231ff10c_group_thread_3> [1 Update]
> >    - Store only month and date <#13423c12231ff10c_group_thread_4> [1
> >    Update]
> >    - Model Test Case SQL Error <#13423c12231ff10c_group_thread_5> [1
> >    Update]
> >    - Update field in associated 
> > model???<#13423c12231ff10c_group_thread_6>[1 Update]
> >    - meioupload sql error <#13423c12231ff10c_group_thread_7> [2 Updates]
> >    - Can a plugin component auto-load a 
> > helper<#13423c12231ff10c_group_thread_8>[2 Updates]
> >    - Flash in cakephp <#13423c12231ff10c_group_thread_9> [2 Updates]
> >    - Model: Query distinct values from a table then save those values to
> >    another table <#13423c12231ff10c_group_thread_10> [1 Update]
> >    - How to add a "read" button to a 
> > view.ctp?<#13423c12231ff10c_group_thread_11>[1 Update]
> >    - v2.0.4 Console error message on 
> > mkdir?<#13423c12231ff10c_group_thread_12>[1 Update]
> >    - Javascript Helper modification. Opinions, 
> > please.<#13423c12231ff10c_group_thread_13>[2 Updates]
>
> >   Strange updateCounterCache 
> > behavior
>
> >    avairet  Dec 09 08:07AM -0800
>
> >    Hi,
>
> >    I'm using Cake 1.3.13.
>
> >    I have an strange issue with counterCache, that I've never seen
> >    before.
>
> >    So, I have Personality belongsTo User and Personality belongsTo
> >    Category associations:
>
> >    public $belongsTo = array(
> >    'Category' => array(
> >    'className' => 'Category',
> >    'foreignKey' => 'category_id',
> >    'conditions' => '',
> >    'fields' => '',
> >    'order' => '',
> >    'counterCache' => true,
> >    'counterScope' => array('Personality.valid' => 1)
> >    ),
> >    'User' => array(
> >    'className' => 'User',
> >    'foreignKey' => 'user_id',
> >    'conditions' => '',
> >    'fields' => '',
> >    'order' => '',
> >    'counterCache' => true,
> >    'counterScope' => array('Personality.valid' => 1)
> >    )
> >    );
>
> >    In my personalities and categories tables, I have a
> >    "personality_count" field (TINYINT).
> >    When I add a Personality and I set "valid" to 1, all is right, the
> >    counters are updated.
>
> >    In my personality edit view, I have a checkbox to validate or
> >    invalidate the record (Personality.valid = 0 or 1).
> >    If I invalidate a personality, all is right, the counters are updated
> >    (- 1).
> >    But after that, if I validate the personality again, the counters
> >    don't change?!
>
> >    What's the mistake? Thank's fo any idea.
>
> >    By the way, why there is a "$created" param in
> >    Model::updateCounterCache() while it is never used inside the method??
>
> >    Avairet
>
> >    Jeremy Burns | Class Outfit  Dec 09
> >    04:11PM
>
> >    What's the data type and size of the counter fields?
>
> >    Jeremy Burns
> >    Class Outfit
>
> >    http://www.classoutfit.com
>
> >    On 9 Dec 2011, at 16:07:53, avairet wrote:
>
> >    avairet  Dec 09 08:15AM -0800
>
> >    Like I said : TINYINT(1)
>
> >    On 9 déc, 17:11, Jeremy Burns | Class Outfit
>
> >    avairet  Dec 09 08:17AM -0800
>
> >    Oh non sorry :)
> >    personality_count fields are INT(11)
>
> >    Jeremy Burns | Class Outfit  Dec 09
> >    04:28PM
>
> >    Your mail said:
>
> >    In my personalities and categories tables, I have a
> >    "personality_count" field (TINYINT).
>
> >    Are you sure?
>
> >    Jeremy Burns
> >    Class Outfit
>
> >    http://www.classoutfit.com
>
> >    On 9 Dec 2011, at 16:17:33, avairet wrote:
>
> >    avairet  Dec 09 08:37AM -0800
>
> >    No, it's an error. My fields are really INT(11).
> >    I'm using Cake since 4 years and using counterCache well.
>
> >    On 9 déc, 17:28, Jeremy Burns | Class Outfit
>
> >   ACL RBAC 
>
> >    RhythmicDevil  Dec 09 07:11AM -0800
>
> >    Hi all, I am working on implementing RBAC using ACL. I am really close
> >    but I am getting an error and I am hoping you can shed some light on
> >    it. I have pasted my entire ACO and ARO trees below for reference.
>
> >    When I run the following using the Cake console it works as expected:
>
> >    [swright@swright-dev app]$ cake acl check Group.4 controllers/
> >    Solidcores "*"
> >    Group.4 is allowed.
>
> >    
> > 

Re: Javascript Helper modification. Opinions, please.

2011-12-09 Thread gremlin
Or - load your jquery with the normal html tag and not the helper and
reserve your use of the helper to include scripts that are strictly on
a controller/action/view basis.
Then your jquery can be the very first thing loaded always - also you
could modify the helper by passing in a configurable list of script
names or regular expressions to check against so you could whitelist
or blacklist certain scripts from even being includable (if you
include jquery manually, and have a blacklist including a regex that
catches the jquery filename you can make the helper simply refuse to
output that script tag )

On Dec 8, 9:47 pm, Benjam Welker  wrote:
> It also seems that scripts added in the default layout or through elements
> that are included in the default layout don't have their scripts added to
> the queue at all.
>
> I was going to try adding all the default scripts in via an element, but
> they just get ignored.

-- 
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: meioupload sql error

2011-12-09 Thread gremlin
Is your form created with the form helper and did you remember to do
type=>'file' in the options? This error happens when the form isn't
set to multipart/form-data as the file field returns an array of keys
with info about the uploaded file.


On Dec 9, 2:45 am, Elizabeth Pardede 
wrote:
> is it in configuration???
>
> On Fri, Dec 9, 2011 at 7:16 AM, Paulo H3nrique Alves <
>
> paulohenriquea...@gmail.com> wrote:
> > I have the same error in CakePHP 2.0.3
>
> > --
> > 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
>
> --
> Elizabeth V. Pardede

-- 
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 a plugin component auto-load a helper

2011-12-09 Thread gremlin
Yeah, pay attention to what was shown above your reply - you are
setting the facebook helper's name to be the key of the array but the
code above your reply is very clearly not setting the key to the
helpers name but using a normal numeric index.


On Dec 9, 2:52 am, Toby G  wrote:
> Thanks for the reply, & yes, sorry, it is v1.3.
>
> This is what I'd done...
>
>     $this->controller->helpers['Facebook.Facebook'] = array(
>       #'config' => $this->config,
>     );
>
> ... but I am getting an error in my layout where I include...
>
> $this->Facebook->init();
>
> The error is "Undefined property: View::$Facebook".
>
> Any ideas why this might be happening?
>
> T
>
> On Dec 9, 9:23 am, euromark  wrote:
>
>
>
>
>
>
>
> > you should always mention the current cakephp version
> > I am assuming however that you use 1.3 (due to App::import)
>
> > yes, you can. quite easily as a matter of fact.
> > inside your component, all you have to do:
>
> > $this->controller->helpers[] = 'MyPluginName.MyHelperName';
> > or
> > $controller->helpers[] = 'MyPluginName.MyHelperName';
> > (depending on where you are)
>
> > dont pass the helpers in this set. bad idea :)
>
> > On 9 Dez., 00:51, Toby G  wrote:
>
> > > Hi there,
>
> > > I've been attempting to get a plugin component auto-load the plugin's
> > > helper file.  I have added it to the controller's helper array, but
> > > it's not loading the helper into view (under $this->Helper), so I
> > > think that the helpers have already been loaded prior to me adding the
> > > plugin helper to the array.
>
> > > Is there any way of doing this safely?  I did think I could
> > > App::import the helper in the plugin & then pass it using 
> > > $this->controller->set(), but it feels like too much of a hack, & does not
>
> > > conform to naming conventions.
>
> > > Any help welcome.
>
> > > Thanks,
>
> > > T

-- 
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: Student wanting your views on CakePHP

2011-11-22 Thread gremlin

I would first recommend that you use a list less than 4 years old.


On Nov 22, 12:16 pm, david mitchell 
wrote:
> Hi, Coders.
>
> I am currently studying Website Development at the University of
> Bolton and am doing my final dissertation on the features, usability
> and comparison of 3 of the top 5 PHP Frameworks taken from 
> (http://www.phpframeworks.com/top-10-php-frameworks/) (CodeIgniter, CakePHP,
> PHPDevShell) and would be very pleased if you could spent 2 minutes to
> fill in this short questionnaire which will help my investigation and
> research further into Frameworks.
>
> http://www.surveymonkey.com/s/KWFQ9DV
>
> Regards, David

-- 
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: redirect with # does not work in Opera and IE but in FF and Chrome?

2011-11-18 Thread gremlin
Looks as it you are using a named field syntax to pass the hash #
param.
Try this:

$this->redirect( array(
'controller' => 'pages',
'action' => 'display',
"#{$this->params['pass'][0]}"
));

Notice that I don't use quotes around the numeric array index - that
isn't needed and is actually wrong. You don't want the key named '0'
but the 0 indexed key. The following aren't the same array( '0' =>
'value' ) and array( 0=>'value' )
Second, since you aren't passing a named param (#:somevalue) but a
regular hash (#somevalue) you should simply pass the #somevalue as the
last item in the array you use to build the url.


On Nov 18, 5:49 am, heohni 
wrote:
> Hi,
>
> I am using this redirect:
> $this->redirect(array('controller' => 'pages', 'action' => 'display',
> '', '#'=>$this->params['pass']['0']));
>
> But it seams that IE and Opera can not handle this?
>
> in FF and Chrome I get redirected towww.domain.com/#12345
>
> But in IE and Opera I only havewww.domain.comin the address bar...?
>
> Does anyone had this before, too?
>
> Thanks for any 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


CakePHP 2.0.0-RC2 Conslole baking error

2011-09-21 Thread gremlin
I originally thought this error had to do with my path setup - I had
separated the core from the app so I could work more easily with git
submodules, so I ignored it. I just did a fresh checkout from the git
repo / a download of the RC2 source / and a cakeinit install of the
2.0 package (also uses git) and all 3 installs have the same issue I
had before.

My code seems to work fine via the browser.

The output of a ./cake bake Model from inside the local copy of the
core in the lib/Cake/Console folder is here
https://gist.github.com/1233884

This totally prevents me from using bake. Baking a project doesn't
work, baking a new database config doesn't work - it also doesn't
matter which of the datasources I try.

Can someone point me in the right direction here? I want to use some
of the bake tools and work on converting some shells for 2.0.

I am using XAMPP (latest version for OS X - I reinstalled it 20
minutes ago as a last ditch attempt)
OSX 10.5.8

The database.php I am working with is here with the passwords removed
but otherwise working
https://gist.github.com/1233891

I have tested it with and without the unix_socket setting and encoding
settings. All works fine from the browser but again not via the cli.

-- 
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 $this->set in view doesn't set the var

2011-09-13 Thread gremlin
Keep in mind - when you are doing $this->set from an element: You
aren't calling View::set - you are calling Element::set. Why would you
expect that to behave as if it was an instance of the View class when
it isn't? Also, the two pass rendering of CakePHP means that in order
for what you propose to work you would need a 3rd pass through the
stack of set variables and rendered elements before parsing the
combined view output. This isn't how Cake works and struggling this
much to force the framework to do something it isn't meant to is going
to simply be a waste of your time, either now - getting it to work -
or later when you have to support it.

On Sep 13, 6:36 am, Xoubaman  wrote:
> I think doc needs a correction then, as Var::set doesn't work exactly
> analogous to Controller::set.

-- 
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: joining strings in model

2011-09-09 Thread gremlin
You can't do that in *any* php class - you have to already have the
class constructed before $this->name is set - so how would your class
know how to set $this->name inside a property before instantiation?
You *can* do this in the __construct( ... ) function.


On Sep 9, 10:28 am, lyba  wrote:
> Any suggestions why it is not possible to join strings in a model
> file:
>
>         $foo = 'A'.'B';
>
> this produces error:
> Parse error: syntax error, unexpected T_VARIABLE, expecting T_FUNCTION
> in .\app\models\event.php on line 7
>
> A real life scenario:
> I have a model Event that has a self reference and is called under
> different aliases (Event, PreviousEvent, NextEvent).
> I need a virtual name for that model as an extract from the event
> description
>
> this works:
> public $virtualFields = array('name' => 'LEFT(description, 40)');
> but since model is called under different aliases in one request I get
> warning:
> Column 'description' in field list is ambiguous
>
> I thought this would work:
> public $virtualFields = array('name' => 'LEFT('. $this->name .'.description, 
> 40)');
>
> but then I discovered that joining strings in model does not work at
> 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


Re: calling Controller::render() from a model

2011-08-18 Thread gremlin
I think you are likely over-complicating the issue.

What you seem to really need is an event dispatching system that can
fire off events that your models, controllers, etc can simply respond
to.
Interestingly enough - there is a plugin for that.

https://github.com/m3nt0r/eventful-cakephp

This allows you to have an APP / events folder that can hold model or
controller events (or even a app/plugins/pluginName/events folder)
that simply hold listener functions and a pass by reference instance
of either the model or controller.
I even use it by passing an stdClass into the event lib at the
bootstrap level to fire events @ plugins to collect plugin routes.
There is literally near unlimited flexibility in the coupling of MVC
components using this plugin.

Good luck.

On Aug 18, 2:41 pm, Burningfuses  wrote:
> Hello,
> I know this looks weird, but I'll try to explain my reasons and hope
> some of you might be able to point me in the right direction.
>
> I'm building a quite complex system, with lots of inner connections.
> One thing that I need to do quite often is to notify users (by email)
> based on some system changes.
> At first I was doing pretty much everything in the controllers, but
> then I found out that I was having a lot of similar code in some of
> them. So my first thought was to access a controller's action from
> another controller. After searching this group I came to the
> conclusion that this was a bad thing to do and to access one
> controller from another is bad practice. So I decided to move this
> logic to a model. My reason was because models can pretty much be
> universally accessible very easily.
>
> Everything was working great, until I tried to get a view using the
> Controller::render() function. I wasn't planning on displaying the
> view from the model, of course. My idea was to send some variables
> that I just got from the database to the view ( using set() ) and then
> storing the render result to a variable. This variable is the body of
> the email that I would send to the user.
>
> I was trying to call render like this from my model:
> $emailBody = Controller::render('/elements/email/html/body', 'email/
> html/default' );
> but I got a warning, a notice and a fatal error:
>
> Warning (512): SQL Error: 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 'beforeRender' at line 1 [CORE/cake/libs/
> model/datasources/dbo_source.php, line 684]
> Query: beforeRender
> Notice (8): Undefined property: Conflict::$Component [CORE/cake/libs/
> controller/controller.php, line 864]
> Fatal error: Call to a member function triggerCallback() on a non-
> object in /Users/x/Documents/www/cake/libs/controller/controller.php
> on line 864
>
> I was wondering what would be the right way to do this.
> Please let me know if I was able to make myself clear.
>
> Thanks a lot,
> Burningfuses

-- 
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 specify a count(id) field for find method

2011-08-15 Thread gremlin
Or use a virtual field.

On Aug 15, 11:44 am, Roland Pish  wrote:
> Thanks Jeremy.
> I looked at the cookbook with the link you provided and I realized
> that I'm having the same output as the example showed there, the
> 'MIN(Product.price) as price' field is returned in the array with 0 as
> its index but not 'Product' as its index.
> Now I know that I'm doing it the right way :) and I will have to deal
> with the 0 index, but no problem at all.
>
> Thanks!
>
> On 14 ago, 22:26, Jeremy Burns | Class Outfit
>
>
>
>  wrote:
> > From the cookbook 
> > (http://book.cakephp.org/view/1030/Complex-Find-Conditions):
>
> >         • array('fields'=>array('Product.type','MIN(Product.price) as 
> > price'), 'group' => 'Product.type');
>
> > Jeremy Burns
> > Class Outfit
>
> >http://www.classoutfit.com
>
> > On 14 Aug 2011, at 22:54, Roland Pish wrote:
>
> > > Thanks for your reply euromark.
> > > I tried the find->('count' but it just returns a number, not the
> > > records grouped by 'status' field.
>
> > > On 14 ago, 15:09, euromark  wrote:
> > >> $this->Member->find('count', ...)
> > >> it should be in the cookbook, the documentation of cakephp
>
> > >> On 14 Aug., 22:29, Roland Pish  wrote:
>
> > >>> Hello.
> > >>> I need to issue a query like:
>
> > >>> select count(id) as total,status from members group by status
>
> > >>> When specifying the fields for the model find method I do this:
>
> > >>> $fields = array('count(Member.id) as total','Member.status');
> > >>> $members = $this->Member->find('all',array('fields'=>
> > >>> $fields,'group'=>'Member.status'));
>
> > >>> But the resulting array doesn't put 'total' field within
> > >>> $members['Member'] but in $members[0]. How should I write the 'total'
> > >>> field in order to be pushed into $members['Member']?
>
> > >>> Thanks in advance
>
> > > --
> > > Our newest site for the community: CakePHP Video 
> > > Tutorialshttp://tv.cakephp.org
> > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organdhelp 
> > > 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


Re: Ordering images that belong to a product

2011-07-21 Thread gremlin
First, passing 'product.id' to the parent_id param isn't going to work
unless you have a field literally named "parent.id" in your images
table.
Second, unless you are going to relate images to each other using a
parent->child structure you do not need a tree - and using the tree
behavior for sequencing is silly when you can find a number of
sequencing behaviors on github if you bother looking.

https://github.com/guavadesign/CakePHP-Orderable-Behaviour/blob/master/models/behaviors/orderable.php
https://github.com/neilcrookes/sequence


On Jul 20, 10:38 pm, adamn318  wrote:
> Hi all,
>
> I have tried my hardest to search the web in reference to this
> particular topic, but have unfortunately gotten no where. Basically
> what I would like to do is have a similar behaviour to a tree, with
> the left and right reference columns to control the position of an
> image entry in a table. Now for each image it is linked to a
> product_id which is obviously in another table, which is effectively
> the parent_id. Is there a way to use a tree an trick it into
> performing this behaviour behind the scenes? If not, or if it isn't
> recommended, could someone please point me in the direction of how I
> can set up this ordered behaviour.
>
> One method I did try was to do the following:
>
>         var $actAs = array('Tree' => array('parent_id' => 'product.id'));
>
> which allows me to add images, but the lft and rght field don't
> update.
>
> In short, what im trying to do is be able to have a list of images on
> the admin side, that I can reorder simply. If I'm completely off
> target with how I am going about this, please let me know.
>
> Any help would be much appreciated.
>
> Adam

-- 
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: Model relations beginner question..

2011-07-21 Thread gremlin
If your UserType table has some a name or title field cake will
automatically use it when populating drop down lists created with
Model::find( 'list' ).

If you have a field that you use as a group name or title - which it
seems you do - that isn't called name or title you have to set the
displayField property in the model and perhaps empty the cake model
caches. I think simply setting debug in core.php to 1 and refreshing
should work.

http://book.cakephp.org/view/1062/displayField explains it better and
has sample code.


On Jul 20, 11:12 pm, sathyashrayan  wrote:
> Dear group,
>  I am a beginner in cakePHP. I have a users table with normal users
> filed and one filed pointing to a user type table's PK(FK). When
> filling the user form, the user type is shown as select,option. I have
> bake the user type model. And used "hasOne" association when i do the
> user model. What i am getting is the list of user type IDs rather than
> "user type" itself. But in a tute of cake cookbook which has the same
> kind of code for ACL, has the “select/option” correctly with values. I
> have supplied the pastebin of the code. But i am not able to
> understand how the list is getting displayed rather than IDs.  Please
> help me.
> Code:
>  http://pastebin.com/Un0WtsgJ

-- 
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: HABTM again!

2011-07-21 Thread gremlin
What is being said is that you have some conventions you didn't
follow. As a result, you are writing overly-complicated code to handle
what should be automatic within the framework.

Do this:

1) move / rename your users_links table and data to a links_users
table inside mysql.
2) remove completely the model for your join table - the UsersLink
model.
3) define a normal habtm relationship between the User model and the
Link model.
4) read the manual before you start another project - all of this is
clearly explained in many translations.

On Jul 21, 10:45 am, Jeremy Burns | Class Outfit
 wrote:
> I think you are not following the conventions, are making life difficult for 
> yourself and should read the guide.
>
> Jeremy Burns
> Class Outfit
>
> http://www.classoutfit.com
>
> On 21 Jul 2011, at 17:05, localhost wrote:
>
>
>
>
>
>
>
> > Sorry I didn't understand your reply
>
> > I have defined the relationship
>
> > class UsersLink extends AppModel {
> >    var $belongsTo = array(
> >            'Link' => array(
> >                    'className' => 'Link',
> >                    'foreignKey' => 'link_id',
> >                    'conditions' => '',
> >                    'fields' => '',
> >                    'order' => ''
> >            ),
> >            'User' => array(
> >                    'className' => 'User',
> >                    'foreignKey' => 'user_id',
> >                    'conditions' => '',
> >                    'fields' => '',
> >                    'order' => ''
> >            )
> >    );
>
> > }
>
> > What do you mean by "joining table should be links_users (i.e. the
> > tables are in alphabetical order)"  ?
>
> > On Jul 21, 6:31 pm, Jeremy Burns | Class Outfit
> >  wrote:
> >> If you have defined a HABTM relationship your joining table should be 
> >> links_users (i.e. the tables are in alphabetical order).
>
> >> Jeremy Burns
> >> Class Outfit
>
> >>http://www.classoutfit.com
>
> >> On 21 Jul 2011, at 16:26, localhost wrote:
>
> >>> Hi everyone,
>
> >>> I have being trying to solve this for the last 4 hours with no luck.
>
> >>> basically I have the following tables
>
> >>> users
> >>> links
> >>> users_links
>
> >>> Basically I'm trying to get the below query to run using find('all')
> >>> and paginate (I'm running this inside UserController)
>
> >>> SELECT Links.id,Links.Title FROM users,links,users_links WHERE
> >>> user.id=1 AND user.id=users_links.user_id AND
> >>> users_links.link_id=links.id AND users_links.index=1
>
> >>> (see the above sql "users_links.index=1").
>
> >>> how to get this working ?
>
> >>> --
> >>> Our newest site for the community: CakePHP Video 
> >>> Tutorialshttp://tv.cakephp.org
> >>> Check out the new CakePHP Questions sitehttp://ask.cakephp.organdhelp 
> >>> 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 
> > Tutorialshttp://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


Re: How to display hasMany association in the view

2011-07-21 Thread gremlin
It also looks like in at least your sample code you were sending
$Practicioner to the view and trying to loop over $Practicioners
(notice one is plural - one is singular)

On Jul 21, 10:46 am, mthabisi mlunjwa  wrote:
> Thanks Jeremy!
>
> I used $practitioner['Practice'][0]['town'] and its now working.
> Thanks a lot man!
>
> On Jul 21, 4:17 pm, Jeremy Burns | Class Outfit
>
>
>
>
>
>
>
>  wrote:
> > I apologise;
>
> > $practitioner['Practice'][0]['town']
>
> > Not sure how you are generating that array...
>
> > Jeremy Burns
> > Class Outfit
>
> >http://www.classoutfit.com
>
> > On 21 Jul 2011, at 15:14, Jeremy Burns | Class Outfit wrote:
>
> > > So (assuming this array is called $practitioner) you can display the town 
> > > by $practitioner['Practice']['town'].
>
> > > Jeremy Burns
> > > Class Outfit
>
> > >http://www.classoutfit.com
>
> > > On 21 Jul 2011, at 15:02, mthabisi mlunjwa wrote:
>
> > >> Sorry its a typo. All field names are in lower case.
>
> > >> I'm failing to display the town. But when I use debug($Practitioner)
> > >> the practitioner fields and practice towns are all displayed as shown
> > >> below:
> > >> array
> > >> (
> > >>    [0] => Array
> > >>        (
> > >>            [Practitioner] => Array
> > >>                (
> > >>                    [id] => 233
> > >>                    [region_id] => 2
> > >>                    [country_id] => 5
> > >>                    [status_id] => 1
> > >>                    [role_id] => 2
> > >>                    [bsrno] => 241
> > >>                    [surname] => Bossley
> > >>                    [name] => Bronwyn
> > >>                    [cell] => 0215656765
> > >>                    [password] =>
> > >> dd4e8d1e0dfeb4ace2dda0fdfc8db83948109151
> > >>                    [created] => -00-00 00:00:00
> > >>                    [modified] => 2011-05-05 11:11:45
> > >>                )
>
> > >>            [Practice] => Array
> > >>                (
> > >>                    [0] => Array
> > >>                        (
> > >>                            [id] => 233
> > >>                            [practitioner_id] => 233
> > >>                            [region_id] => 2
> > >>                            [country_id] => 5
> > >>                            [name] => Main
> > >>                            [Telephone] => +61 411673912
> > >>                            [Address] => 15 Edna Street, Carrimundi,
> > >> Queensland, 4551, Australia
> > >>                            [town] => Carrimundi
> > >>                        )
>
> > >>                )
>
> > >>        )
>
> > >> From my own understanding I thought the containable behaviour helps to
> > >> filter out unwanted results so as to improve the overall response
> > >> time. At the moment I'm interested in displaying the practise town.
>
> > >> On Jul 21, 3:13 pm, Jeremy Burns | Class Outfit
> > >>  wrote:
> > >>> Not sure if it's a typo, but your field names should be lower case.
>
> > >>> Look at the Containable behaviour 
> > >>> (http://book.cakephp.org/view/1323/Containable).
>
> > >>> Jeremy Burns
> > >>> Class Outfit
>
> > >>>http://www.classoutfit.com
>
> > >>> On 21 Jul 2011, at 14:10, mthabisi mlunjwa wrote:
>
> >  I have two models: Practitioner and Practice
>
> >  Practitioner hasMany Practice and
> >  Practise Belongs to Practitioner
>
> >  The practise model has the following fields id,Practitioner_id, Name,
> >  Town etc.
> >  The Practitioner model has the following fields id,Surname, Name, Cell
> >  etc.
>
> >  In my controller I used a find function:
> >     $Practitioner = $this->Practitioner->find('all');
> >         $this->set(compact('Practitioner'));
>
> >  In my view I want to display the practitioner name, Surname, cell,
> >  practice name and practice town.
>
> >  I can display practitioner name, Surname and cell using code like this
> >  $Practitioners['Practitioner']['cell']
> >  But I'm failing to display  the corresponding practitioner's practice
> >  name and practice town. I've tried using: $Practitioners['Practice']
> >  ['town'];  to display town but it looks like nothing gets displayed.
>
> >  How can I display town? Please help thanks in advance
>
> >  --
> >  Our newest site for the community: CakePHP Video 
> >  Tutorialshttp://tv.cakephp.org
> >  Check out the new CakePHP Questions 
> >  sitehttp://ask.cakephp.organdhelpothers 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 
> > >> Tutorialshttp://tv.cakephp.org
> > >> Check out the new CakePHP Questions sitehttp://ask.cakephp.organdhelp 
> > >> others with their CakePHP related questions.
>
> > >> To unsubscribe from this group, send email to
> > >> ca

Re: Does this suggestion for core feature make any sense? Please let me know.

2011-07-21 Thread gremlin
Why not use a custom passed key => value pair in the original element
call and handle the logic in your element itself.
ie

echo $this->element( 'element_name', array( 'birds' => $birds,
'controller' => $this->controller ));



On Jul 21, 1:53 am, OldWest  wrote:
> I was recently hacking around trying to avoid using the requestAction()
> method to call in an array.
>
> I have an element which I use in several views.
>
> I wanted to be able to pull in a set('value_to_pass') array to my element,
> so I could untilize an existing actions values.
>
> I could not find a way to make this work within a reasonable amount of time
> (and maybe there is a way!).
>
> But my suggestion is the element should support another parameter for an
> action name so the action can be called and the value can be passed to it
> for use in the element output.
>
> Here is an example of what I propose:
>
> echo $this->element('element_name', *'controller.action_name'*,
> array("birds" => $birds));
>
> Does this make any sense at all? Or should I be looking elsewhere for a
> solution?

-- 
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: validation is not working properly and generating "Notice (8): Undefined property" error

2011-07-20 Thread gremlin
There is no set function in the Model class so the line $this->Contact-
>set( $this->data) is obviously not going to work.
The controller has a Controller::set function for sending data to the
views. If you want to load the Contact model and prefill it with data
use $this->Contact->read( $this->data[ 'Contact' ][ 'id' ] ) or
similar.

On Jul 20, 11:31 am, leafchild  wrote:
> Thanks euromark!!!
>
> I added code these code to my controller then its start working as I
> expected!!
>
> ===
>         function beforeFilter() {
>           parent::beforeFilter();
>                 $this->Contact = ClassRegistry::init('Contact');
>         }
> ===
>
> Actually I changed file name(model, controller, view) to all something
> else to test because
> I thought Cake didn't like "contact" but I got same error so still not
> sure why
> I had these error. If I end up find the error I will post it again.
>
> Thank you for your help!
>
> lc
>
> On Jul 20, 4:55 am, euromark  wrote:
>
>
>
>
>
>
>
> > seems like Contacts does not inflect to Contact as singular form
> > have you overridden the inflections with custom settings? maybe you
> > put "Contact=>Contact" in there
> > otherwise I don't know whats wrong. your code looks good.
>
> > taking a closer look..
> > for some reason $this->Contact does not exist
> > this has nothing to do withvalidation. the model simply isn't loaded.
> > try to debug $this->Contact
> > at what point it is missing
>
> > you could manually load it:
> > $this->Contact = ClassRegistry::init('Contact')
>
> > but I would suggest you try to find the source for this problem.
> > maybe the file name of your model is incorrect? or the location
> > somewhere cake can't find it?
>
> > On 20 Jul., 01:51,leafchild wrote:
>
> > > Getting these error and I can not find a away to fix:
> > > --
> > > --
> > > Notice (8): Undefined property: ContactsController::$Contact [APP/
> > > controllers/contacts_controller.php, line 18]
>
> > > Fatal error: Call to a member function set() on a non-object in /home/
> > > www/./cakephp_1.3.1/app/controllers/contacts_controller.php on
> > > line 18
> > > --
> > > -
>
> > > The erro is generated with this line - $this->Contact->set($this->data);
>
> > > and if I hide this section this line ( if( $this->Contact-
>
> > > >validates() ){ ) creates same error
>
> > > I have FORM page that user can enter name, email and some comment and
> > > submit.
> > > I just send email and not using database (I want to use just
> > >validationat controller).
>
> > > It seems likevalidationis not working properly and I don't know why.
>
> > > I look at this 
> > > page:http://book.cakephp.org/view/1182/Validating-Data-from-the-Controller
>
> > > contact.php
> > > 
> > >  > > class Contact extends AppModel {
> > >         var $name = 'Contact';
> > >         var $useTable = false;
>
> > >         var $validate = array(
> > >                 'name'=>array(
> > >                         'no_empty'=>array(
> > >                                 'rule'=>VALID_NOT_EMPTY,
> > >                                 'message'=>'Please enter name')
> > >                 )
> > >                 'email'=>array(
> > >                         'no_empty'=>array(
> > >                                 'rule'=>VALID_NOT_EMPTY,
> > >                                 'message'=>'Please enter email'
> > >                         ),
> > >                         'emailchk'=>array(
> > >                                 'rule'=>VALID_EMAIL,
> > >                                 'message'=>'Please enter valid email 
> > > address'
> > >                         )
> > >                 )
> > >         );}
>
> > > ?>
> > > 
>
> > > controller file- contacts_controller.php
> > > 
> > >  > > class ContactsController extends AppController {
> > >         var $name = "Contacts";
> > >         var $helpers = array('Form', "Session");
> > >         var $components = array("Email");
>
> > >         function index(){
> > >                  if(!empty($this->data)){
> > >                        $this->Contact->set($this->data);
>
> > >                         if( $this->Contact->validates() ){
> > >                                 //   sending email code here
> > >                                 $this->redirect(array('controller' => 
> > > 'contacts', 'action'
> > > => 'thank_you'));
> > >                         }
> > >                    }
> > >         }
>
> > >         function thank_you(){}}
>
> > > ?>
> > > 
>
> > > view - index.ctp
> > > 

Re: advice on refactoring beforeFilter in app_controller

2011-07-12 Thread gremlin
Start with breaking the chunks out into smaller private functions. See
if that helps.

On Jul 5, 1:59 pm, Zeu5  wrote:
> Hi there,
>
> the beforeFilter function in my app_controller over time has grown
> into a monstrous 300 line code.
>
> in that beforeFilter, i do things like
>
> $this->set for non admin pages
> $this->Cookie->write
> $this->Auth->fields = array('username' => 'email', 'password' =>
> 'password');
> $this->Auth->authorize = 'actions';
>
> and many others.
>
> Can i break up the code in beforeFilter into several private functions
> inside app_controller?
>
> Is there a better way?
>
> 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


Re: Auth redirect problem

2011-07-12 Thread gremlin
Try setting the loginRedirect to the Controller::referer( ) function
i.e. 'loginRedirect' => $this->referer( )

On Jul 12, 6:09 am, pushpa  wrote:
> I am having trouble getting the Auth component redirect.
>
> I have a login form and I want to keep the user on the page he logs in
> on. For example, if he is viewing contact us page, I want to keep him
> there after logging in.I have made loginaction page as my login page
> to validation purpose.Otherwise i can't validate for password blank
> field. Here is my user's controller code :
>
> function beforeFilter(){
>
>     $this->Auth->allow('register');
>          $this->Auth->autoRedirect = false;
>     parent::beforeFilter();
>
> }
>
> function loginaction(){
>
>      if($this->data){
>     if($this->data['User']['email']=='')
>            $this->Session->setflash('E-Mail cannot be blank');
>     elseif ($this->data['User']['ppassword']=='')
>         $this->Session->setflash('Password cannot be blank');
>     else {
>                  
> $this->data['User']['password']=$this->Auth->password($this->data['User']['ppassword']);
>
>          if($this->User->validateUser($this->data)){
>          $this->Auth->login($this->data);
>          $this->redirect($this->Auth->redirect());
>
> } }
>
> and following is my app_controller code:
>
> function beforeFilter(){
>
>         $this->Auth->fields = array(
>         'username' => 'email',
>         'password' => 'password'
>         );
>         $this->Auth->loginAction=array('controller'=>'users',
> 'action'=>'loginaction');
>     }
>
> This will redirecting to the page from where user logged out.But i
> want redirection should happen to the page from where user clicks the
> login button. I am not getting where i am wrong.

-- 
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: count(*) how to retrieve?

2011-07-09 Thread gremlin
You can also use a virtualField in the DepartmentBook model. The
virtualFields end up indexed into the correct array as if they were
real fields - this means you don't have to shuffle your results around
before using the data.

I put together a little gist showing what I mean.

https://gist.github.com/1073889

Hope this helps.

On Jul 8, 8:48 am, Dominik Gajewski 
wrote:
> Thanks for your reply
>
> 2011/7/8 Dr. Loboto :
>
>
>
>
>
>
>
>
>
> > In case of
> > $res = $this->DepartmentBook->find('all', array(
>
> > 'fields' => array(
>
> > 'count(*) AS kl',
>
> > 'DepartmentBook.department_id'
> >                                                                ),
>
> > 'conditions' =>      array(
>
> > 'DepartmentBook.extract_date' => null,
> >                                                                ),
>
> > 'order' => array(
>
> > 'DepartmentBook.department_id'
> >                                                                ),
>
> > 'group' => array(
>
> > 'DepartmentBook.department_id'
> >                                                                )
> >                ));
> > You'll have your count under $res[$i][0]['kl'] - NOT $res[$i]
> > ['DepartmentBook']['kl']. Result of aggregate function does not belong
> > to source table and resides under "unknown" index.
>
> > All such problems can be solved by simple output of array to look into
> > its structure.
>
> > --
> > Our newest site for the community: CakePHP Video 
> > Tutorialshttp://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
>
> --
> Pozdrawiam
> Dominik Gajewski

-- 
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: FPDF or PDFlib with Cake

2011-06-29 Thread gremlin
If the fpdf libraries are at all recent you shouldn't have to use the
goofy php4 constructor. I think if you add your custom pdf class to
your vendors folder and instantiate it from a custom helper as a
member variable you could do a lot more, much more easily.

I actually enjoyed this question so I whipped up a quick example for
you - https://gist.github.com/1055702
I make no guarantees that any of the code works right out of the 'box'
seeing as how I just wrote it and it hasn't been tested or even really
checked for consistency or errors but it should get you well on your
way to doing this the right way.

On Jun 29, 3:17 pm, Dominik Gajewski 
wrote:
> Sam thanks for your patience and help
>
> 2011/6/30 Dominik Gajewski :
>
>
>
>
>
>
>
>
>
> > Ok I solved all problems and it works
>
> > To last problem I added an extra argument to core function infpdf.php
>
> > functionFPDF($ww=null, $orientation='P', $unit='mm', $size='A4')
>
> > but if someone knows how to solve this without this trick i will
> > listen to suggestions
>
> > 2011/6/29 Dominik Gajewski :
> >> in TestController i added this
>
> >> var $helpers = array('Pdf'=> array('orientation' => 'P','unit' => 'mm'
> >> , 'format'=> 'A4') );
>
> >> and got this error
>
> >> Notice (8): Array to string conversion [APP\vendors\fpdf\fpdf.php, line 
> >> 135]
> >> Code | Context
> >> $orientation    =       array(
> >>        "orientation" => "P",
> >>        "unit" => "mm",
> >>        "format" => "A4"
> >> )
> >> $unit   =       "mm"
> >> $size   =       array(
> >>        210.00156,
> >>        297.8
> >> )
> >> strtolower - [internal], line ??
> >>FPDF::FPDF() - APP\vendors\fpdf\fpdf.php, line 135
> >> View::_loadHelpers() - CORE\cake\libs\view\view.php, line 808
> >> View::_render() - CORE\cake\libs\view\view.php, line 709
> >> View::render() - CORE\cake\libs\view\view.php, line 426
> >> Controller::render() - CORE\cake\libs\controller\controller.php, line 909
> >> TestsController::indexPdf() - APP\controllers\tests_controller.php, line 12
> >> Dispatcher::_invoke() - CORE\cake\dispatcher.php, line 204
> >> Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 171
> >> [main] - APP\webroot\index.php, line 83
> >>FPDFerror: Incorrect orientation: array
>
> >> So i put only var var $helpers = array('Pdf'=> 'P'));
>
> >> Notice (8): Undefined property: PdfHelper::$helpers
> >> [CORE\cake\libs\view\view.php, line 819]
>
> >> What is another way to launch constructor of PdfHelper
>
> >> 2011/6/29 Sam Sherlock :
> >>> two things
>
> >>> 1) orienation error is due to you not setting the page as either landscape
> >>> or portrait.
> >>> it seems that it should default to portrait but that message suggests
> >>> something is wrong - its afpdferror and you should read the docs forfpdf
>
> >>> 2) $this->Fpdf->AddPage() for helpers in cake  1.3 (future proof I think 
> >>> it
> >>> still works $fpdf->AddPage() but 1.3 migration mentions changing this)
>
> >>> I am not sure which pdf tool I used back then I do know that I tried them
> >>> all before deciding on the one I used.  That feature of the site has since
> >>> been removed for other reasons
>
> >>>  - S
>
> >>> On 29 June 2011 20:44, Dominik Gajewski  
> >>> wrote:
>
>         $fpdf->AddPage();
>     $fpdf->SetFont('Arial','B',16);
>     $fpdf->Cell(40,10,$data);
>     echo $fpdf->fpdfOutput();
>
> >>> --
> >>> 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 
> >>> at
> >>>http://groups.google.com/group/cake-php
>
> >> --
> >> Pozdrawiam
> >> Dominik Gajewski
>
> > --
> > Pozdrawiam
> > Dominik Gajewski
>
> --
> Pozdrawiam
> Dominik Gajewski

-- 
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: web music player for cake php 1.3

2011-06-08 Thread gremlin
Also - the frontend (player) has nothing at all to do with your
backend (cakephp)

On Jun 8, 3:40 am, mi...@brightstorm.co.uk wrote:
> > Hi guys,
>
> > I wanna know abt good music player for my new web site, it should be
> > worked
> > with cake php 1.38 and it should be capable of playing list of song names
> > from DB and those are saved in different directories. its better easy
> > loading simple player and it should be view play list!
>
> > any suggestions
>
> http://www.jplayer.org/
>
> btw google is very useful for this sort of thing.
>
>
>
>
>
>
>
>
>
> > --
> > Ganganath Hettiarachchi
>
> > --
> > 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


Re: binary (36), is changed by Blob (36) in testing.

2011-06-06 Thread gremlin
I answered your other thread also - Binary(36) does nothing to
generate UUID - try char(36) instead. Why would you want your UUID to
be only 0's and 1's? The correct column type is in the documentation -
maybe try reading it.

On Jun 3, 10:03 am, adgranados  wrote:
>  I am driving a model called the channel, and a primary key, I'm
> using, as the data type, binary (36), to generate a UUID cakephp. The
> problem is that when I try to run the test, cake generates sql with
> the wrong data type, placing blob (36) and this generates an error in
> mysql. The fixtures file for this model, the id, is the data type,
> binary (36).
>
> please help with this, 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


Re: binary(36), es cambiado por blob(36) en las pruebas.

2011-06-06 Thread gremlin
UUID is char(36) not BINARY(36)


On Jun 3, 10:11 am, adgranados  wrote:
> Estoy manejando un modelo llamado canal, y para la llave primaria,
> estoy utilizando, como tipo de dato, binary(36), para que cakephp
> genere un UUID. el problema, es que cuando, intento correr el test,
> cake genera el sql con el tipo de dato equivocado, colocando blob(36)
> y esto genera un error en mysql. ya revice el archivo de fixtures para
> este modelo y el campo id, tiene como tipo de dato, binary(36).
>
> por favor ayudenme con esto, gracias

-- 
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: FormHelper custom label overriding inputDefaults

2011-05-24 Thread gremlin
You could create a custom helper that extends the formhelper and write
an input function that merges the keys you need instead of resetting
them. Use the helper's existing input function as a starting place.
The portions handling the use of options is pretty clear.

On May 24, 1:42 pm, Tomek Mazur  wrote:
> Hi, I have a form started like this:
>
> Form->create('Transaction',array(
>
> 'url'=>array('controller'=>'transactions','action'=>'data')
>             ,'inputDefaults'=>array(
>                 'label'=>array(
>                     'class'=>'bd-label'
>                 ),'div'=>array(
>                     'class'=>'bd-div'
>                 ),'class'=>'bd-input'
>             )
>         )); ?>
>
> Each label, div and input is given a custom class. However i want to
> change the label of one of the inputs. I have tried two options:
>
> echo $this->Form->input('name',array('label'=>'not really a name'));
>
> and
>
> echo $this->Form->input('name',array('label'=>array('text'=>'not
> really a name')));
>
> Each of these however results in a a label without the bd-label class.
> Doing this will obviously solve the problem:
>
> echo $this->Form->input('name',array('label'=>array('text'=>'not
> really a name','class'=>'bd-label')));
>
> but perhaps there is a cleaner solution? I have a lot of inputs with
> custom labels in this form. 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


Re: Am I Violating MVC?

2011-05-20 Thread gremlin
@Jeremy:

I think you misunderstood me. My point was that both the array-source
and a db-table are good solutions to the problem and that you don't
*need* to have your unique key be meaningless in either. You can use a
'slug' type of key in the array source or a unique key constraint on
the data in the table in such a way that you never have to deal with a
meaningless foreign_key.

Also - if you were doing an iphone app why wouldn't you just REST
enable your Cake app and build it out using something like Sencha
Touch or jQuery mobile? Which frontend doesn't dictate your backend
unless you were talking about native apps? Also - there is a million
reasons a model might not have a table. That might be the only thing I
*disagree* with you about.

On May 20, 4:16 am, djogo  wrote:
> > "What does '3' mean? Let's go and look in the code - oops, I don't know how 
> > to."
>
> not only this. Suppose you need to add the #4 record - or maybe change
> something on the #3.
>
> the array datasource is, IMO, the right answer for this problem. It
> allows to keep the data where it belongs, in the M of MVC. however, as
> jeremy pointed out, if your data is going to live outside cakephp,
> problems arise.
>
> Sometimes, for this kind of problem, I use varchar keys, so instead of
> having autoincremental ids, I have readable things. InnoDB is ok with
> that, and performance in a 500Mb database is good. Don't mentioning
> the code - it's SO much better to write
>
> $data = $this->Model->find('all', array( 'conditions' =>
> array( 'type_id' => 'unconfirmed' ) ) );
>
> than 'type_id' => 1.

-- 
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: user signup auth component stopped working

2011-05-19 Thread gremlin
Is there a plugin / controller action doing some sort of resizing of a
profile image or something? If there is do you have auth set to allow
un-authorized users to hit that action?


On May 18, 5:54 am, Foroct  wrote:
> It appears that the problem is related to David Persson's media
> plugin.https://github.com/davidpersson/media
>
> In my model I commented out the call to his plugin and I can again add
> a user
> Previous code
> var $actsAs = array('Containable','Media.Transfer',
> 'Media.Coupler','Media.Generator');
> New code
> var $actsAs = array('Containable' /* ,'Media.Transfer',
> 'Media.Coupler','Media.Generator'*/);
>
> I am using the same plugin successfully on  different model and my
> $actAs array is exactly the same in both models. Does anyone know a
> reason why this plugin would work on one model and not another?
>
> 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


Re: Am I Violating MVC?

2011-05-19 Thread gremlin
Yeah but one side effect of the array datasource is that there is no
constraint on your 'id' column. You can make it a text string - as
long as it is unique in the $records for each records id field there
is no reason to use an integer. The array datasource doesn't auto-
increment or care about uuids or column types.

Second, the question was specifically about the right way to do this
in MVC - CakePHP specifically. Worrying about how to do something
outside of cake with this data isn't in the scope of his question.
Also, any system that uses db storage for the genders is going to have
this issue. If you care you can easily enough do a structure similar
to ( id => auto increment int, slug => male/female/etc, key => 'M/F/
etc', value=>'Male/Female/etc' ) and simply do a key / value lookup to
generate options and the slug field for lookups based on gender. Easy.
I think the hardest part of the above solution would be overriding the
Gender:find( ) for generating list type finds. That might even be
overkill since you can pass options to the find( 'list' ) call.

I still think the configure method would be the easiest - plus you can
store form helper defaults in there, field defaults for field types
and then all of the other little options sets and messages that get
used could be in one place.


On May 19, 7:22 am, Jeremy Burns | Class Outfit
 wrote:
> When you later do an extrapolation of this data (possibly outside of Cake) 
> there is a disconnect between the id and the value, making it hard to 
> interpret:
>
> "What does '3' mean? Let's go and look in the code - oops, I don't know how 
> to."
>
> Jeremy Burns
> Class Outfit
>
> jeremybu...@classoutfit.comhttp://www.classoutfit.com
>
> On 19 May 2011, at 15:19, gremlin wrote:
>
>
>
>
>
>
>
> > Personally I dislike all the methods mentioned.
>
> > This is configuration data - load it from a config file. In your
> > bootstap.php do a Configure::load( 'forms' ); somewhere near the
> > bottom.
>
> > Then in /app/config/forms.php
>
> > put the configuration information for the select options.
>
> > $config[ 'Forms' ][ 'genderSelectOptions' ] = array( 'M' => 'Male',
> > 'F' => 'Female' );
>
> > and load them in your views with
> > Configure::read( 'Forms.genderSelectOptions' ) when you need the
> > options loaded into the form helper.
>
> >http://book.cakephp.org/view/924/The-Configuration-Class
>
> > Another option - more robust than the method above and similar to the
> > Model options mentioned above is to use an ArrayDatasource and have a
> > Gender model that relates to the User (or whatever model has the need
> > to select a gender)
>
> >https://github.com/cakephp/datasources
>
> > On May 19, 4:50 am, Jeremy Burns | Class Outfit
> >  wrote:
> >> I think this is the best advice (I always advocate storing everything in 
> >> the database) but there might just be the odd exception.
>
> >> Jeremy Burns
> >> Class Outfit
>
> >> jeremybu...@classoutfit.comhttp://www.classoutfit.com
>
> >> On 19 May 2011, at 12:39, djogo wrote:
>
> >>> I think it depends whether you store this value in the database or
> >>> not.
>
> >>> If you do, the right thing is to create a table and then accessing it
> >>> by a model. For a very good reason, in big projects you don't want to
> >>> lose time thinking "is it a table or a array within a controller? in
> >>> which controller is it?".
>
> >>> Also, if this value is used in the database, later you may want to
> >>> write a single query to retrieve this data, and run this query on the
> >>> console (or a backup script, e.g.) and suddenly you realized that that
> >>> tied you to cakephp.
>
> >>> If you think that's the best solution (to keep this data as an array),
> >>> the ideal solution (in my mind) would be to have a Model which access
> >>> this array instead of a database table. If you only need it for drop
> >>> boxes, maybe this:
>
> >>> app/models/gender.php
>
> >>> class Gender // extends nothing
> >>> {
> >>>  var $data = array( 'M' => 'Male', 'F' => 'Female' );
>
> >>>  function find($type,$opt=null)
> >>>  {
> >>>    if ( $type='list' ) return $data;
> >>>    throw new exception(" find('$type') in bogu

Re: Am I Violating MVC?

2011-05-19 Thread gremlin
Personally I dislike all the methods mentioned.

This is configuration data - load it from a config file. In your
bootstap.php do a Configure::load( 'forms' ); somewhere near the
bottom.

Then in /app/config/forms.php

put the configuration information for the select options.

$config[ 'Forms' ][ 'genderSelectOptions' ] = array( 'M' => 'Male',
'F' => 'Female' );

and load them in your views with
Configure::read( 'Forms.genderSelectOptions' ) when you need the
options loaded into the form helper.

http://book.cakephp.org/view/924/The-Configuration-Class

Another option - more robust than the method above and similar to the
Model options mentioned above is to use an ArrayDatasource and have a
Gender model that relates to the User (or whatever model has the need
to select a gender)

https://github.com/cakephp/datasources

On May 19, 4:50 am, Jeremy Burns | Class Outfit
 wrote:
> I think this is the best advice (I always advocate storing everything in the 
> database) but there might just be the odd exception.
>
> Jeremy Burns
> Class Outfit
>
> jeremybu...@classoutfit.comhttp://www.classoutfit.com
>
> On 19 May 2011, at 12:39, djogo wrote:
>
>
>
>
>
>
>
> > I think it depends whether you store this value in the database or
> > not.
>
> > If you do, the right thing is to create a table and then accessing it
> > by a model. For a very good reason, in big projects you don't want to
> > lose time thinking "is it a table or a array within a controller? in
> > which controller is it?".
>
> > Also, if this value is used in the database, later you may want to
> > write a single query to retrieve this data, and run this query on the
> > console (or a backup script, e.g.) and suddenly you realized that that
> > tied you to cakephp.
>
> > If you think that's the best solution (to keep this data as an array),
> > the ideal solution (in my mind) would be to have a Model which access
> > this array instead of a database table. If you only need it for drop
> > boxes, maybe this:
>
> > app/models/gender.php
>
> > class Gender // extends nothing
> > {
> >  var $data = array( 'M' => 'Male', 'F' => 'Female' );
>
> >  function find($type,$opt=null)
> >  {
> >    if ( $type='list' ) return $data;
> >    throw new exception(" find('$type') in bogus model isn't supported
> > - maybe it's time to use a real table." );
> >  }
>
> > }
>
> > I know, it's ugly, but what's the upside of all this coding? All data
> > in accessible by models, and you didn't wrote a lot of database tables
> > that will never change.
>
> > I would love proper support of "virtual" models that access data on a
> > CSV, static array, etc.
>
> > dfcp
>
> > On 18 maio, 15:46, Jason Mitchell  wrote:
> >> I have in a controller an array containing data used on the view to 
> >> populate
> >> a drop down. I put it on the controller, so the array could be used by
> >> multiple views associated with that controller (create, edit). 
> >> Additionally,
> >> it means that if I do ever have to change it, I just have to change it once
> >> (yup, lazy).
>
> >> Because the data is relatively static, and is used in only isolated
> >> instances, it didn't seem to be worth the effort of creating a model for
> >> that data, and establishing a relationship between models. And, putting it
> >> on the controller, worked.
>
> >> Admittedly, I'm new to MVC, but this really doesn't seem to jive 
> >> definition.
> >> Am I doing something wrong?  If so, how would one but this on the model,
> >> short of some sort of association with another model?
>
> >> --
> >> J. Mitchell
>
> > --
> > Our newest site for the community: CakePHP Video 
> > Tutorialshttp://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


Re: Ajax helper Error

2011-05-16 Thread gremlin
var $helpers = array( ); // Notice it is plural - you have $helper

On May 16, 7:10 am, Carachi  wrote:
> Hi,
> I try to use the Ajax Helper to receive data for an html select and to
> send the form to a page, but I have this problem, in the view compare:
> Notice (8): Undefined variable: Ajax [APP/views/control/index.ctp,
> line 34]
> or
> Notice (8): Undefined property: View::$Ajax [APP/views/control/
> index.ctp, line 34]
>
> In my controller I add
>         var $helper = array('Html','Xml','Ajax','Javascript');
> and in the view of this page I add
>
>         $ajax->submit(
> or
>         $this->ajax->submit(
>
> Someone can help me??
> 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


Re: Problem with the CakePHP Search Plugin

2011-05-16 Thread gremlin
You didn't follow the instructions correctly.

You have to attach a behavior to the Post model. From the very
beginning of the documentation you linked :

public $actsAs = array('Search.Searchable');

On May 16, 10:19 am, Alonso  wrote:
> Hi, folks.
>
> I've trying to use the CakePHP Search Plugin(http://cakedc.com/eng/
> downloads/view/cakephp_search_plugin) along with the Blog
> tutorial(http://book.cakephp.org/view/1528/Blog) available in the
> Cookbook and even though I followed the instruction to the letter I
> keep getting this error message :Warning (512): SQL Error: 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
> 'parseCriteria' at line 1 .
>
> This is what I've done:
>
> **Model:*
>
> class Post extends AppModel {
>     var $name = 'Post';
>     var $displayField = 'title';
>
>     public $filterArgs = array(
>             array('name' => 'title','type' => 'string'),
>     );
>
> }
>
> *Controller:***
>
> class PostsController extends AppController {
>
>    var $name = 'Posts';
>    public $components = array('Search.Prg');
>
>    public $presetVars = array(
>     array('field' => 'title', 'type' => 'value'),
>    );
>
>    function beforeFilter() {
>        parent::beforeFilter();
>    }
>
>    public function index() {
>     $this->Prg->commonProcess();
>     $this->paginate = array(
>       'conditions' => $this->Post->parseCriteria($this->passedArgs));
>     $this->paginate = array('limit' => 15);
>     $this->set('posts', $this->paginate());
>    }
>
> }
>
> *View:**
>
>     echo $this->Form->create('Post', array(
>        'url' => array_merge(array('action' => 'index'), $this->params['pass'])
>
>             ));
>    echo $this->Form->input('title', array('div' => false, 'empty' =>
> true));
>    echo $this->Form->submit(__('Search', true), array('div' =>
> false));
>    echo $this->Form->end();
> ?>
>
> Do you have any idea why this is happening? Am I missing something?
> Any suggestion will be appreciated.

-- 
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: Set::extract on an array containing one element

2011-05-03 Thread gremlin
@Otavio - that has nothing to do with the question.

On May 2, 7:51 pm, Otavio Martins Salomao 
wrote:
> u try this!
> foreach($test as $element)
>      $result = $element['Deep1']['Deep2']['extract'];
>
> 2011/5/2 Gluckens 
>
>
>
>
>
>
>
> > Hi everyone,
>
> > I'm trying to extract data from an array containing only one element
> > and it doesn't seem to work properly.
> > Here's an example :
>
> > Starting array
> > $test = array(4 => array('Deep1' => array('data1' => 'nothing',
> > 'Deep2' => array('extract' => 1;
> > Array
> > (
> >    [4] => Array
> >        (
> >            [Deep1] => Array
> >                (
> >                    [data1] => nothing
> >                    [Deep2] => Array
> >                        (
> >                            [extract] => 1
> >                        )
> >                )
> >        )
> > )
>
> > Set::extract('/Deep1/Deep2[extract=1]', $test);
> > NOT CORRECT
> > Array
> > (
> > )
>
> > But, when I add another element, let's say
> > $test[12] = array();
> > It works fine
> > Set::extract('/Deep1/Deep2[extract=1]', $test);
> > CORRECT
> > Array
> > (
> >    [0] => Array
> >        (
> >            [Deep2] => Array
> >                (
> >                    [extract] => 1
> >                )
> >        )
> > )
>
> > Am I using it properly?
> > Thanks in advance for any help.
>
> > --
> > 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


Re: My warning and eror

2011-05-03 Thread gremlin
You need to read the manual:

Try the following - it seems you are confusing the $name property with
the $uses property of the controller.



On May 2, 1:50 pm, Ryan Schmidt  wrote:
> On May 1, 2011, at 12:22, euromark wrote:
>
> > var $name = array('Members','Myprofiles'); ?
> > seriously? where did you get that from?^^
>
> What euromark means is: $name is a string, not an array. It needs to be:
>
> var $name = 'Members';

-- 
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: hasMany problem !!

2011-04-25 Thread gremlin
You need to edit your view file. You can do a debug( $variableName )
on the data you are sending to the view. You will notice a different
array structure for hasMany as compared to hasOne.


On Apr 24, 9:34 am, taq  wrote:
> databasehttp://upic.me/i/v4/database.jpg
> book modelhttp://upic.me/i/qp/modelbook.jpg
> book catagorie modelhttp://upic.me/i/an/model.jpg
> view eror messagehttp://upic.me/i/ov/xview.jpg
> i test hasOne and belongsTo between books and bookcats it's no eror
> but i test hasMany i got error in view error message
>
> On Apr 24, 1:55 pm, Jens Dittrich  wrote:
>
>
>
>
>
>
>
> > if you expect help, then you shoul consider sharing more information
> > about what you have done.
>
> > On 24 Apr., 07:42, taq  wrote:
>
> > > I set up a table and try to do hasmany Ee Long says can not find.
> > > But when put into the back hasone found it simple tight

-- 
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: Security component and HTTP Basic Authentication

2011-04-06 Thread gremlin
Actually - he asked for http basic digest authentication. Meaning all
of his "protected" pages will pop up the browser credential window
instead of the html form based login that auth promotes. Before you
criticize the poster for "making zero sense" and not having "read your
own question" maybe you should re-read the question once prior to
inserting your foot into your mouth..

On Apr 6, 6:41 am, "Krissy Masters" 
wrote:
> Are you talking actions or pages?
>
> If you do not want something accessed then you can _preUnderscoreTheName so
> not accessable via url.
>
> Your building a site that has many pages but only 1 page you can visit
> publically but no login to the other pages so they are never accessable by
> anyone makes zero sense...have you read your own question?
>
> -Original Message-
> From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf
>
> Of Mariano C.
> Sent: Wednesday, April 06, 2011 7:17 AM
> To: CakePHP
> Subject: Re: Security component and HTTP Basic Authentication
>
> I don't need a complete mechanism of authentication.
> I just want to protect every action with http basic and leave just one
> action unprotected.
>
> As soon add Auth component I should create users table and so on, and
> I would avoid this.
>
> On 6 Apr, 10:01, "Mariano C."  wrote:
> > So I need in couple Auth and Security component?
>
> > On 6 Apr, 09:54, "Krissy Masters"  wrote:
>
> > > $this->Auth->allowedActions = array(); //will allow nothing
>
> > > $this->Auth->allowedActions = array('login'); //only allow the action in
> the
> > > array
>
> > > These are set in the controller itself so you could specify just the 1
> > > allowed action for that controller.
>
> > > K
>
> > > -Original Message-
> > > From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On
> Behalf
>
> > > Of Mariano C.
> > > Sent: Wednesday, April 06, 2011 5:13 AM
> > > To: CakePHP
> > > Subject: Security component and HTTP Basic Authentication
>
> > > I've read this
> articlehttp://book.cakephp.org/view/1309/Basic-HTTP-Authentication
>
> > > Now I've a lot of controller with many actions to protect, so I could
> > > consider the idea to insert that beforeFilter directly inside
> > > AppController (and not in the single controller), so every action will
> > > be protected. Am I right?
>
> > > Now I have just one action that doesn't need authentication, what
> > > should I write inside that action to avoid auth
>
> > > --
> > > Our newest site for the community: CakePHP Video
> Tutorialshttp://tv.cakephp.org
> > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organdhelp
> > > 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 
> Tutorialshttp://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


Re: User/Admin definable forms (schemaless forms)

2011-04-04 Thread gremlin
Look into EAV structures. Basically you build tables that map data
types (field types) to their values and the owning model by name and
id. A polymorphic behavior would do most of the work. There are a few
of on github that google finds pretty easily.

This of course doesn't do the form building work, or decide how to map
value types to input types etc. But it should give you something to
play with.
http://debuggable.com/posts/unlimited-model-fields-expandable-behavior:48428c2e-9a88-47ec-ae8e-77a64834cda3

On Apr 4, 7:52 pm, Greg Skerman  wrote:
> Hi,
>
> I'm currently toying with the idea of a user definable form. This would
> allow a site administrator to create new forms to capture various data, and
> report on the data in the admin section.
>
> I've got the basic data structure, being a forms table, having many
> form_fields, each having one form_field_type, and storing information into
> form_field_responses
>
> There are 2 approaches I'm playing with to do this.
>
> Approach 1 would be a simple helper which can be used to autogenerate the
> form. This would require the data for the form structure to be passed to the
> view in each method.
>
> Approach 2 is to use a behavior with a generateForm method that overwrites
> $_schema (based on form_fields and form_field_type) to facilitate auto-form
> generation leveraging the form helper's inputs() method.
>
> anyone got any thoughts on the best approach for this sort of thing?

-- 
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: Validate HABTM Multiple

2011-04-04 Thread gremlin
Are you using the 'with' key in the model relationship? Are you doing
it in both directions? I don't know if it will help but I vaguely
remember something along these lines.

On Apr 3, 11:41 am, "Krissy Masters" 
wrote:
> Nothing. I simply want to first make sure no more than 5 are selected so I
> select 6 and submit.
>
> Debug data see 6
> Category Category array(
>         0 => 3
>         1 => 5
>         so on.)
>
> But no validation errors for Category. Just the Post...missing title,
> missing comment what not
>
> $this->Post->set($this->data);
>
> //Debug($this->Post->saveAll( $this->data, array('validate' => 'only')));
> $this->Post->saveAll( $this->data, array('validate' => 'only') )
>
> If I manually set data to the Category I get the messages saying too many
> selected so the validation in Category is set correct.
>
> I was just hoping saveAll would take care of this for me.
>
> I can wite validation anywhere set it to any model but figured why should I
> have to since all should be all :) Not some.
>
> K
>
>
>
>
>
>
>
> -Original Message-
> From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf
> Of euromark
> Sent: Sunday, April 03, 2011 9:07 AM
> To: CakePHP
> Subject: Re: Validate HABTM Multiple
>
> "but I never get any validation errors for the HABTM model "
>
> what does $this->Post->saveAll() return?
> boolean or array?
>
> pr() it pretty quick - I had similar issues I think
>
> On 1 Apr., 05:37, "Krissy Masters"  wrote:
> > I can, but why should I have to validate the Category in the Post model?
>
> > I was just under the assumption cake would handle that with saveAll since
> > there is nothing mentioning that it can't validate HABTM models. The "ALL"
> > in saveAll makes it sounds like it would save all related data.
>
> > $this->Post->saveAll( $this->data, array('validate' => 'only') ) to me
> > sounds like " if all of this data were to validate it could all be saved".
> > Post is related to Category HABTM relation and the book says save related
> > data in 1 call (db supports that is) if it validates.
>
> > Not being an ass but that sounds like saveSome() if your validating it
> > first.no?
>
> > -Original Message-
> > From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On
> Behalf
>
> > Of Jeremy Burns | Class Outfit
> > Sent: Friday, April 01, 2011 12:53 AM
> > To: cake-php@googlegroups.com
> > Subject: Re: Validate HABTM Multiple
>
> > Couldn't you write a custom validation rule in the Post model that
> examines
> > the count of the Category key of the data array passed in?
>
> > Jeremy Burns
> > Class Outfit
>
> > jeremybu...@classoutfit.comhttp://www.classoutfit.com
>
> > On 1 Apr 2011, at 01:18, Krissy Masters wrote:
>
> > > How can you validate the number of "multiple" selected?
>
> > > I have a Post which hasMany, and HABTM relations so saving with :
>
> > > if ( $this->Post->saveAll( $this->data, array('validate' => 'only') ) )
> > > {//only testing to get errors
>
> > > but I never get any validation errors for the HABTM model
>
> > > Category:
> > > public $validate = array(
>
> > >            'Category' => array(
> > >                    'multiple' => array(
> > >                            'required' => false,
> > >                            'allowEmpty' => true,
> > >                            'rule' => array(
> > >                                    'multiple', array('max' => 3),
> > >                            'message' => 'Please select one, two or
> > > three options';
>
> > > Post HABTM Category
>
> > > Ideas?
>
> > > Thanks
>
> > > K
>
> > > --
> > > Our newest site for the community: CakePHP Video
> Tutorialshttp://tv.cakephp.org
> > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organdhelp
> > 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
> Tutorialshttp://tv.cakephp.org
> > Check out the new CakePHP Questions sitehttp://ask.cakephp.organdhelp
> > 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 
> Tutorialshttp://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 unsu

Re: CakeDC users plugin

2011-03-22 Thread gremlin
Just a guess - is there a routes file in the plugin that you didn't
copy over to your config/routes.php? A route mapped from /users/add
to /users/register would make sense for this sort of error.


On Mar 22, 10:15 am, Ryan Schmidt  wrote:
> Perhaps I should be asking: is there a tutorial somewhere that will show me 
> how to use the users plugin -- starting from creating a new empty CakePHP app 
> ending with a working example? The readme says it's simple to use, but I am 
> not finding it so, and I don't seem to be the only one having trouble:
>
> http://www.webmastertalkforums.com/cakephp/18874-there-demo-app-anywh...

-- 
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: cache action not working

2011-03-22 Thread gremlin
Do you have debug set to 0? If you are seeing the query log then you
likely don't and with a setting of anything higher than 0 the cache is
cleared on each call to the action.


On Mar 22, 2:27 pm, "André von Arx"  wrote:
> I've tried to cache a controller action without success.
>
> Here are the settings I've used for cakephp 1.3.7:
>
> === core.php:
>
> Cache::config('default', array(
>         'engine' => 'File',  // required
>         'duration'=> 3600,   // optional
>         'probability'=> 100, // opt
>         'path' => '/usr/local/www/locavores.co/www/dev/app/tmp/cache/',
>         'prefix' => 'cake_',  // optional
>         'lock' => false,      // optional
>         'serialize' => true   // optional
>         ));
>
> // path direcotory is writable
>
> Configure::write('Cache.check', true);
> Configure::write('Cache.disable', false);
>
> === controller
>
> var $helpers = array('Form','Formhint','Time','Cache');
>
> var $cacheAction = array(
>    'getRandomImagesG24' => '48000'
> );
>
> function getRandomImagesG24() {
>    $this->cacheAction = true;
>    return $this->Image->getRandomImagesG24();
>
> }
>
> According to the SQL-Log the Image->getRandomImagesG24 being called
> for each controller action call (getRandomInagesG24).
>
> Any hints or suggestions?
> --
> Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir
> belohnen Sie mit bis zu 50,- Euro!https://freundschaftswerbung.gmx.de

-- 
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: Pretty URLs and Lighttpd

2011-03-21 Thread gremlin
More important - why are you trying to use lua scripts for lighthttpd
when you seem to be working on a MAMP install? (apache)


On Mar 21, 4:08 am, AD7six  wrote:
> On Mar 21, 1:27 am, axel9641  wrote:
>
> > Hi Folks
> >  I am new to CakePHP. I am going through the 
> > manual:http://book.cakephp.org/view/918/Pretty-URLs-and-Lighttpd
> > where is explained that in order to use Pretty URLs in cakephp, we
> > have to place a lua script in /
> > etc/lighttpd/cake.
> > But the big question is : Whereabouts in my project am I supposed to
> > place it???
>
> lua scripts are not part of your project - they are part of your
> lighttpd config.
>
>     magnet.attract-physical-path-to = ( "/etc/lighttpd/cake.lua" )
>
> That says "load this lua script" and tells you an example of where it
> is supposed to be - you can put it anywhere you like but I repeat: it
> is part of your lighttpd config, not part of _a_ project.
>
> 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


Re: How to properly use "conditions" in model associations

2011-03-02 Thread gremlin
I tend to define conditions in associations on very few occasions. One
good use is for polymorphic models (you need to define the field =>
modelName mapping) and for models that have a enum field (or similar)
that determines some behavior of the model. IE log models and for
defining self referencing tables where I tend to use an relationship
alias (ParentNode, ChildNode)

This isn't the only time you might define conditions in the
relationship but these are the only ones that pop to mind.

On Mar 2, 11:43 am, "Krissy Masters" 
wrote:
> Personaly I never set any conditions in the relations (hasOne, hasMany )
>
> all conditions are defined in the function since depending on why I am
> getting the data and for who conditions constantly change.
>
> You can say conditions Posts => 1 //active so you only by default display
> all active Post.
>
> but then when its time to get all users posts so they can edit their data
> you need to set condition where Post.id => $user_id. If you kept the regular
> condition you would only pull that users active posts not all.
>
> But I just developed from day 1 like this so also would be curious to see
> what others are doing in regards to the other params available for
> relations.
>
> Good question :)
>
> K
>
> -Original Message-
> From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf
>
> Of Eric Anderson
> Sent: Wednesday, March 02, 2011 3:57 PM
> To: CakePHP
> Subject: How to properly use "conditions" in model associations
>
> Hi everyone,
>
> I'm wondering what is the 'proper' or 'suggested' way of using
> "conditions" in model associations. I'm using an Activity model to log
> activities performed throughout my app. I then use this table to
> output activity feed / notifications style sections to users. The
> problem I'm having is that Cake throws a "column not found" error (I
> guess technically it's MySQL throwing the error). When running a
> query, Cake for some reason formulates the query so that MySQL is
> looking for columns from my Activity table inside of other tables. Do
> I need to specify "conditions" in both my User and Activity model, as
> shown below? When I remove the conditions from the Activity model,
> everything runs fine.
>
> 
> class Activity extends AppModel {
>
>     var $name = 'Activity';
>     var $actsAs = array('Containable');
>
>         var $belongsTo = array(
>
>                 // Doers
>                 'User' => array(
>                 'className' => 'User',
>                 'foreignKey' => 'doer_id',
>                         'conditions' => array('Activity.doer_table' =>
> 'users')
>         )
> }
> ?>
>
> 
> class User extends AppModel {
>
>     var $name = 'User';
>     var $actsAs = array('Containable');
>
>     var $hasMany = array(
>                 'Activity' => array(
>                 'className' => 'Activity',
>                 'foreignKey' => 'doer_id',
>                         'conditions' => array(
>                                 'Activity.doer_table' => 'users'
>                         ),
>                 'dependent' => true
>         );
> }
> ?>
>
> --
> Our newest site for the community: CakePHP Video 
> Tutorialshttp://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


Re: On the road to Da Vinci 2.0

2011-03-02 Thread gremlin
Oh, and it is raining here - has been for weeks. Except for a few
hours when it snowed.

On Mar 2, 1:44 pm, "Krissy Masters" 
wrote:
> No that's wrong. It not raining here!
>
> I took out my Little Orphan Annie decoder pin and it says "Be Sure to Drink
> Your Ovaltine" J

-- 
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: On the road to Da Vinci 2.0

2011-03-02 Thread gremlin
The awful thing is I read it all and I think I may have actually
understood what he was saying..

Please don't ever post an esoteric rant again - this is a list for
asking questions about how things work, not to brag about how long you
have been in the DaVinci fan club while blaming developers for not
bringing you a damned ladder.

On Mar 2, 1:44 pm, "Krissy Masters" 
wrote:
> No that's wrong. It not raining here!
>
> I took out my Little Orphan Annie decoder pin and it says "Be Sure to Drink
> Your Ovaltine" J

-- 
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: views = "1234..." numbers

2011-02-25 Thread gremlin
Speaking of moot points, it's "moot" not "mute"

On Feb 11, 3:09 am, Sam Sherlock  wrote:
> FWIW the suggestions made by Ryan & Jeremy are better than using the Model
> Query method
> as you lose out on the cake auto magic with the method
>
> $this->Video->doIncrement($id);
> vs
> $this->Video->query('UPDATE fociki_videos' . ' SET views = views +
> 1' .  ' WHERE id = ' . $video['Video']['id']);
>
> this point might be mute in this case but its worth knowing;
> any how the first option is
>
> a) less code
> b) clearer
> c) does not tie your app to using a table name with prefix
>
>  - S
>
> On 11 February 2011 04:55, chris...@yahoo.com  wrote:
>
> > Thank You Jeremy,
> > I got another approch to it...
> > here is what works in my case:
>
> >  $this->Video->query('UPDATE fociki_videos' . ' SET views = views +
> > 1' .  ' WHERE id = ' . $video['Video']['id']);
>
> > Thank You for Your Help guys,...
> > I love you with all my heart... LoL
>
> > I'm sorry to bother you with all these questions,... I learn on the
> > way,... With little or no knowllege of CAKE and PHP I have gone so
> > far... Check me out if you what,... and hire me for your next project
> > help... LOL Just kidding guys, don't take it siriously...
>
> > Thank you All !!
> > chris
>
> > On Feb 10, 8:39 pm, Jeremy Burns | Class Outfit
> >  wrote:
> > > Sounds like you need to have a line of code in the controller's view
> > method that calls a simple model function:
>
> > > $this->Model->increment($id);
>
> > > In the model:
>
> > > function increment($id) {
> > >         $this->updateAll(array('Model.view_count' =>
> > 'Model.view_count+1'), array('Model.id' => $id));
>
> > > }
>
> > > Or you could just call it directly from the view method in the
> > controller:
>
> > > $this->Model->updateAll(array('Model.view_count' =>
> > 'Model.view_count+1'), array('Model.id' => $id));
>
> > > This way, whenever the view method is called (in other words, each time
> > the page is rendered) you increment the view_count field by one.
>
> > > Jeremy Burns
> > > Class Outfit
>
> > > jeremybu...@classoutfit.comhttp://www.classoutfit.com
>
> > > On 11 Feb 2011, at 03:31, chris...@yahoo.com wrote:
>
> > > > Hi Jeremy,
> > > > What I'm looking for is to set the data,... say to set field views in
> > > > Video table increment by 1 every time page accessed. To set data,...
> > > > NOT to retrive.
>
> > > > Thanks
> > > > chris
>
> > > > On Feb 10, 1:11 pm, Jeremy Burns | Class Outfit
> > > >  wrote:
> > > >> RTFM.http://book.cakephp.org/
>
> > > >> Jeremy Burns
> > > >> Class Outfit
>
> > > >> jeremybu...@classoutfit.comhttp://www.classoutfit.com
>
> > > >> On 10 Feb 2011, at 20:57, chris...@yahoo.com wrote:
>
> > > >>> Hi Mike,
> > > >>> Yes, I know that I have to read from table,...
> > > >>> But I don't know how... LOL
> > > >>> the code... anyone can help...?
>
> > > >>> Thanks
> > > >>> chris
>
> > > >>> On Feb 10, 11:59 am, mike karthauser 
> > wrote:
> > >  On 10 Feb 2011, at 17:30, "chris...@yahoo.com" 
> > wrote:
>
> > > > Hi All,
> > > > How u All Doinnn...?!
>
> > > > Can anyone teach me how to setup views,... so when page is
> > > > accessed ... it will set field views="increment numbers" like Video
> > > > views=906, Group views=489, etc.. like how many time page has been
> > > > accessed.
>
> > >  You won't be doing any counts in the view, rather updating the count
> > when the action is called and passing that value to the view.
>
> > >  All you'll need to do is to get a count value from your table and
> > then resave it after you have added 1. You may also want to do this as an
> > ajax call in JavaScript when you have played say half of the video as then
> > it won't be affected if bots hit the page or people refresh loads
>
> > > > Thanks
> > > > chris
>
> > > > --
> > > > Our newest site for the community: CakePHP Video Tutorialshttp://
> > tv.cakephp.org
> > > > Check out the new CakePHP Questions
> > sitehttp://ask.cakephp.organdhelpotherswith 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 Tutorialshttp://
> > tv.cakephp.org
> > > >>> Check out the new CakePHP Questions sitehttp://ask.cakephp.organdhelp
> > 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 Tutorialshttp://
> > tv.cakephp.org
> > > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organdhelp
> > others with their CakePHP related questions.
>
> > > > To unsubscribe from this group, send email to
> > > > cake-php+unsu

Re: Possible Memory Leak

2011-02-21 Thread gremlin
Maybe write it as a console script? Or find some way to batch through
the requests using multiple http requests.

On Feb 21, 7:30 pm, "Dr. Tarique Sani"  wrote:
> Web servers are simply not designed to have such long single requests
>
> The best would be to use shell with short php scripts and some sort of a
> queue system, which allows you to stop and resume your task, you should also
> look at parallelizing the task
>
> Being a bit presumptive here your simulation looks like a perfect candidate
> for using map-reduce
>
> HTH
> Tarique
>
>
>
> On Tue, Feb 22, 2011 at 5:37 AM, ProFire  wrote:
> > I use a single http request.
>
> > On Feb 21, 11:32 pm, Maurits van der Schee  wrote:
> > > Hi,
>
> > > Do you use a single http request or multiple invoked by a javascript
> > timer?
>
> > > Regards,
>
> > > Maurits
>
> > > On 02/21/2011 02:49 PM, ProFire wrote:
>
> > > > Hi fellowcakephpers,
>
> > > > I've been a long time user ofCakePHPand I've been satisfied since I
> > > > first tried it. In fact, there's no more turning back for me ever>
> > since I started it. No framework matchesCakePHPwhen it comes to ease
> > > > of development.
>
> > > > However, very recently, I've encountered a problem I can't figure out
> > > > the source. I'm dealing with Financial Data and being in finance, my
> > > > application often have to crunch huge sets of data. I've always been
> > > > very careful with how my application has handled the data as the data
> > > > involve is huge and I could run into a memory leak if I don't clear
> > > > those unused variables.
>
> > > > This year, I was tasked to run a very heavy simulation on the
> > > > financial data that involves possible 100 million mysql queries in a
> > > > single run. As such, I'm very prepared to let the simulation run over
> > > > a period of 1 month. However, within 2 days, the application threw a
> > > > memory exhausted error. What really puzzled me was I had been very
> > > > careful not to store any unused data in memory.
>
> > > > In my algorithm, after I query the data, I store them in a temporary
> > > > variable. At its final usage, I unset the variable despite knowing
> > > > that the next iteration the data will be overwritten. That's just to
> > > > be sure. After each round of simulation, the variables used are stored
> > > > in the database. After the last $model->save(), I clear every variable
> > > > used in the simulation, even if the data will be overwritten at the
> > > > next iteration.
>
> > > > All other persistent data throughout the iteration are either
> > > > integers, floats or unchanging arrays. As such, there's no way these
> > > > persistent data could be the cause of memory leak.
>
> > > > I've debugged as much as I could to pin point the source of the memory
> > > > leak in my controllers and models, but without any luck. I ran a
> > > > smaller simulation and monitor the memory size each iteration, I
> > > > noticed that the memory either stays the same or gets bigger.
>
> > > > I still put my faith inCakePHPand I need expert advise on where this
> > > > memory leak could be.
>
> > --
> > 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
>
> --
> =
> 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


Re: Possible Memory Leak

2011-02-21 Thread gremlin
Oops - Tarique beat me to it.

On Feb 21, 7:30 pm, "Dr. Tarique Sani"  wrote:
> Web servers are simply not designed to have such long single requests
>
> The best would be to use shell with short php scripts and some sort of a
> queue system, which allows you to stop and resume your task, you should also
> look at parallelizing the task
>
> Being a bit presumptive here your simulation looks like a perfect candidate
> for using map-reduce
>
> HTH
> Tarique
>
>
>
> On Tue, Feb 22, 2011 at 5:37 AM, ProFire  wrote:
> > I use a single http request.
>
> > On Feb 21, 11:32 pm, Maurits van der Schee  wrote:
> > > Hi,
>
> > > Do you use a single http request or multiple invoked by a javascript
> > timer?
>
> > > Regards,
>
> > > Maurits
>
> > > On 02/21/2011 02:49 PM, ProFire wrote:
>
> > > > Hi fellowcakephpers,
>
> > > > I've been a long time user ofCakePHPand I've been satisfied since I
> > > > first tried it. In fact, there's no more turning back for me ever>
> > since I started it. No framework matchesCakePHPwhen it comes to ease
> > > > of development.
>
> > > > However, very recently, I've encountered a problem I can't figure out
> > > > the source. I'm dealing with Financial Data and being in finance, my
> > > > application often have to crunch huge sets of data. I've always been
> > > > very careful with how my application has handled the data as the data
> > > > involve is huge and I could run into a memory leak if I don't clear
> > > > those unused variables.
>
> > > > This year, I was tasked to run a very heavy simulation on the
> > > > financial data that involves possible 100 million mysql queries in a
> > > > single run. As such, I'm very prepared to let the simulation run over
> > > > a period of 1 month. However, within 2 days, the application threw a
> > > > memory exhausted error. What really puzzled me was I had been very
> > > > careful not to store any unused data in memory.
>
> > > > In my algorithm, after I query the data, I store them in a temporary
> > > > variable. At its final usage, I unset the variable despite knowing
> > > > that the next iteration the data will be overwritten. That's just to
> > > > be sure. After each round of simulation, the variables used are stored
> > > > in the database. After the last $model->save(), I clear every variable
> > > > used in the simulation, even if the data will be overwritten at the
> > > > next iteration.
>
> > > > All other persistent data throughout the iteration are either
> > > > integers, floats or unchanging arrays. As such, there's no way these
> > > > persistent data could be the cause of memory leak.
>
> > > > I've debugged as much as I could to pin point the source of the memory
> > > > leak in my controllers and models, but without any luck. I ran a
> > > > smaller simulation and monitor the memory size each iteration, I
> > > > noticed that the memory either stays the same or gets bigger.
>
> > > > I still put my faith inCakePHPand I need expert advise on where this
> > > > memory leak could be.
>
> > --
> > 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
>
> --
> =
> 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


Re: extracting data within tags

2011-02-21 Thread gremlin
You should ask that question somewhere *NOT SPECIFIC TO CAKEPHP*


On Feb 21, 7:02 pm, johnlaw  wrote:
> Hi,,
>
> I'm a newbie in php..
> I have xml files from which i want to extract it into information
> in .txt file...
> can anyone show me how to convert this,
>
> north
> south
> west
> east
> 
> 
> whatever
>
> How do i able to convert that into such info below,
>
> sample1:north
> sample2:south
> sample3:west
> sample4:east
> sample7:whatever
>
> I would appreciate anyone helping me with this...i learn that somehow
> it is possible with str_replace, substr, and strpos...
> Thx so much 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


Re: Same code in controller, model and view

2011-02-17 Thread gremlin
I already answered this guy on StackOverflow telling him exactly this.
He didn't listen then and I doubt he will now...


On Feb 16, 8:16 pm, "Dr. Tarique Sani"  wrote:
> Just for day names and format you need helpers/behavior and components?
>
> Pray why?
>
> How you display a date is purely a View problem, rest of your code
> (controllers and models) should have to just deal with date values
> which are recognized by PHP and your database.
>
> Cheers
> Tarique
>
> On Wed, Feb 16, 2011 at 10:18 PM, Matthias
>
>
>
>  wrote:
> > I built my own helper for converting dates, because I need to deal
> > with german day names, and now I need the same helper in controllers,
> > models and views. I like the concept of helpers, components etc, but
> > how do I organize this "helper" so I don't need to repeat myself by
> > creating a DateFormatHelper, a DateFormatComponent and a
> > DateFormatBehaviour?
>
> > --
> > Our newest site for the community: CakePHP Video 
> > Tutorialshttp://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
>
> --
> =
> 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


Re: Server Preference?

2011-01-14 Thread gremlin
Use firebug / Safari inspector / Chrome inspector
View source is the tool of last resort - I honestly haven't hit view
source in a decent browser for years now.


On Jan 14, 12:05 pm, "Dave Maharaj"  wrote:
> Thanks Miles.
>
> I am sure any of the servers would work fine but each has its strengths,
> weaknesses and depending on the app and its functionality I figured there
> would be a better to go with one over another.
>
> The site is still being built so I am testing it on different server builds
> to test thing out. Currently on nginx fpm-php with APC and Memcache
> installed. I been testing the pages that would get the most hits repeatedly
> over and over and its slower than Apache. Im still playing / messing around
> so just seeing what others use. The plan is 25K+ a day but that’s
> hoping...reality could be more / lesswho knows.
>
> My biggest problem is caching the views. Data no problem but views are
> killing me. I need to come up with some way to save more data in cache /
> memory.
>
> Side note: Is there an output setting for code to be cleaned / properly
> lined up? My view code is well tabbed / structured yet in the browser view
> source it’s a complete mess. 5 or 6 empty lines before and after lists. Just
> weird ugly formatting.
>
> Thanks,
>
> Dave
>
> -Original Message-
> From: Miles J [mailto:mileswjohn...@gmail.com]
> Sent: Friday, January 14, 2011 2:53 PM
> To: CakePHP
> Subject: Re: Server Preference?
>
> Nginx is fast in general, who ever said it was for static content? I
> use Nginx with memcache/apc and get a good 10k hits a day with no
> speed penalty.
>
> Want kind of traffic are you expecting where none of these would
> suffice? Even the largest of sites use apache.
>
> On Jan 14, 2:29 am, "Dave Maharaj"  wrote:
> > I am trying to get the best suited server going for my app I am building
> and
> > so far
>
> > From what I read:
>
> > .         Apache seems to be the dead horse / big and clumsy
>
> > .         Lighttpd is not as supported / updated as it once was
>
> > .         Nginx is fast with static content
>
> > .         Cherokee leaves me wondering.
>
> > The site im working on has maybe 5 - 10 static nothing changing pages(just
> > welcome / register / login / contact)  but once you login everything is
> per
> > user since there are a lot of custom settings so caching pages / parts
> seems
> > like not the best solution for nginx (sure Apache backend but if 95% would
> > be processed thru Apache whats the point for nginx for the few pages
> > really?)
>
> > All my data / queries  are cached for dynamic pages since each users page
> > consists of various modules that constantly changing entire view caching
> is
> > impossible.
>
> > So that basically leaves me with Cherokee left to try. Anyone use it?
> > Reviews? Good bad?
>
> > I just installed nginx and tuned it up tried this and that, APC, Memcache
> > but its not much faster pushing out my the dynamic content over Apache so
> I
> > was thinking of giving Cherokee a go and just looking for opinions /
> > feedback?
>
> > Thanks,
>
> > Dave
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others
> with their CakePHP related questions.
>
> 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 For more options, visit this group 
> athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: a problem regarding "id" field in url

2011-01-10 Thread gremlin
The edit form should include either a hidden field for id, or pass the
current id in the url via the action param.

On Jan 9, 12:06 pm, manas gajare  wrote:
> I am facing an issue about 'id' field in the regular *
> localhost/project/comments/edit/5* structure.
>
> Let's say I have 5 fields for comment, all are validated as 'non empty'
> through model.
> While editing one comment I put one field blank.
> On submitting the form, naturally it gives me error (coming from model)
> saying 'nonempty'.
> Without entering anything in that field, I hit submit again, now I face the
> issue. What happens this time is that 'id' field from the url is now gone, (
> *localhost/project/comments/edit/*) and there is a new entry in database.
> (ideally it should update though).
>
> What might be the error?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Custom router question

2010-10-13 Thread gremlin
What about a custom routing prefix ( ie. admin routing ) - just add
'reports' to the prefix array and then in the sales controller do a
reports_index function and in the customers controller define a
reports_index function and cakes default routing will give you the 2
urls you used as an example.

On Oct 13, 2:22 am, Michael T  wrote:
> I have to do a similar thing in my Cake app, so I'm very interested to
> hear how you go about it in the end. For the time being I've taken
> your first approach of having a report-per-action in the one
> controller.
>
> I was thinking about defining each report in the Model layer however
> (similar to what cricket was saying) by parameterising each report
> into the necessary fields and then defining them in the app itself or
> in the database. Hadn't thought about the routing issues yet however.
>
> On Oct 13, 12:44 pm, cricket  wrote:
>
> > Why not just use a single controller that $uses each of the models in 
> > question?
>
> > Router::connect(
> >     '/reports/:type',
> >     array(
> >         'controller' => 'reports',
> >         'action' => 'view'
> >     ),
> >     array(
> >         'type' => '[a-z]+',
> >         'pass' => array('type')
> >     )
> > );
>
> > public function view($type = null)
> > {
> >     if (!$type)
> >     {
> >         // ...
> >     }
>
> >     $model = Inflector::modelize($type);
> >     // ...
>
> > }
> > On Tue, Oct 12, 2010 at 7:27 PM, Raisen  wrote:
> > > Assume that I have a reports page where there would be multiple sub-
> > > reports. I want the urls to look like:
>
> > > /reports/sales/
> > > /reports/customers/
>
> > > One way I managed to do that was to create actions inside the reports
> > > controller for each subreport, but I am trying to do something
> > > different. I want each subreport to have its own controller,view.
> > > Basically I would have a controller named:
>
> > > reports_sales_controller
>
> > > and views
>
> > > /reports/sales/index.ctp
>
> > > Is that possible?
>
> > > I was trying to do something like:
>
> > >        Router::connect('/reports/(.*)/*', array('controller'=>'$1',
> > > 'action'=>'index'));
>
> > > which probably it's way off what I want.
>
> > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others 
> > > with their CakePHP related questions.
>
> > > 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 For more options, visit this group 
> > > athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: FileUpload behavior and multiple models

2010-09-25 Thread gremlin
Don't wrap the DS with curly braces if you are going to use the
concatenation operator.
Just do 'uploadDir' => "img".DS."shirts"

On Sep 21, 9:05 pm, Wanna be baker  wrote:
> I have a Shirt which has many different images
> - shirt_image
> - thumb_on_image
> - thumb_off_image
> - price_banner_image
>
> The files get stored in separate places (or are supposed to be).  What
> I've found (using a model like what is show here:http://pastebin.com/gbnLpxN0)
> is that the value of uploadDir gets overwritten.  Net, the last
> declaration of it affects all of the other executions.  Couple this
> with the fact that I can't figure out how to get DS into the uploadDir
> declaration, has caused me some good sized headaches.
>
> At the moment, with the constructor call commented out and the .{DS}.
> in the actsAs, this blows up...  but it does work if I use  the
> constructor method; it's just that the files get stored in the wrong
> spots...
>
> The variable issue lead me to try using the constructor to affect that
> option.  However, even that has the same issues with the value being
> overridden.
>
> As a result, I have two questions...  One specific and one high level.
>
> Specific: how can I get this declaration of uploadDir set correctly so
> that different models can have different uploadDirs?
>
> High-level: How does this get instantiated (this plugin)?  Does it
> instantiate one instance of the behavior at run time or does it create
> one for each model?  If it's the latter, it's not working as I would
> expect.  Also, where's a good tutorial that would help me understand
> the OO nature and instantiation order in CakePHP?
>
> Thanks!

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Validation - Multiple attempts

2010-07-01 Thread gremlin
Make sure if you are passing id's for edit actions that the edit
action is in the forms action attribute ie
array( 'url'=>array( 'controller'=>'foo', 'action'=>'bar',$foo['Foo']
['id'] ))..

Also, if you use char(36) for id's then you get UUID's - and it would
be really unlikely that a user will guess a correct uuid, although
this isn't a reason not to check the action in the controller for
tampering (Security component etc)

On Jun 13, 11:19 pm, Ed Propsner  wrote:
> Thanks John,  I appreciate it.
>
> Every time an id becomes visible in the url I take precautions (extra code)
> to ensure any other record can't be altered or manipulated by changing the
> id
> through the url.
>
> I never thought about just writing the id temporarily to the session.
> Thanks for the tip, it should work just fine.
>
> - Ed
>
> On Mon, Jun 14, 2010 at 1:55 AM, John Andersen wrote:
>
> > I can't tell you why it happen, but I can tell you how I work with
> > editing an existing record.
>
> > When a record is chosen for editing, I store the record id in the
> > session. Upon saving the record I take the id from the session. I
> > don't rely on the record id being in the url. If I did that, then the
> > user could easily change it upon submitting the form, which would be a
> > bad thing :)
>
> > Hope this helps you on the way,
> >   John
>
> > On Jun 14, 3:34 am, Ed Propsner  wrote:
> > > I notice that when I submit a form to a url such as
>
> > >http://mysite.com/controller/action/25
>
> > > If validation fails on the first attempt the form reloads under the exact
> > > same url and retains all of $this->data
> > > but if the validation fails on subsequent attempts the form reloads
> > > but the record id gets dropped from the url and the only info left in
> > > $this->data is the value
> > > of the submitted form element and that's all.
>
> > > What causes this? Is there a way around it?
>
> > > - Ed
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd help others
> > with their CakePHP related questions.
>
> > 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.comFor
> >  more options, visit this group at
> >http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Breadcrumbs

2010-06-24 Thread gremlin
I think something similar to the form input syntax would be good. Have
it return nothing but links, all in one string and allow some options
i.e. : around, before, first, between, last as keys to input html
around, before the first item, between all items ( meaning between
consecutive links - not the first or last ), and after the last would
be enough to generate an xhtml correct unordered list. You could also
do like the tableRows function and pass more parameters for
controlling the html attributes of the ul, and li elements.

At this point I might just write the damned thing since I half specced
it already and have easy reference code =)

On Jun 24, 4:30 am, euromark  wrote:
> i guess you can handle it..^^
> so i will shut up now^^
>
> On 24 Jun., 13:27, Leszek Stachowski  wrote:
>
> > As John wrote:
> > > maybe as
> > > an option, so those who for some reason don't want a list can request
> > > that :)
>
> > and then I
>
> > > I will submit a ticket with a change (as option) then
>
> > There will be both outputs possible ;)
>
> > On Jun 24, 1:24 pm, euromark  wrote:
>
> > > maybe we should allow both outputs - depending on the case both might
> > > be useful
>
> > > with a param "type" for example:
> > > - string
> > > - list (default)
>
> > > On 24 Jun., 13:11, Leszek Stachowski  wrote:
>
> > > > I will submit a ticket with a change (as option) then. Thanks for your
> > > > replies :)
>
> > > > On Jun 24, 1:05 pm, John Andersen  wrote:
>
> > > > > I will agree - for accessibility reason - as a list it will be
> > > > > understood better!
> > > > > So as Mark (euromark) says, submit a ticket and the change, maybe as
> > > > > an option, so those who for some reason don't want a list can request
> > > > > that :)
> > > > > Thank you for bringing the accessibility issue into the picture, that
> > > > > clarifies a lot - also for me :)
> > > > > Enjoy,
> > > > >    John
>
> > > > > On Jun 24, 12:54 pm, Leszek Stachowski  wrote:> I 
> > > > > didn't write it is not correct (x)html, because syntax of current
> > > > > > result is, indeed, correct. Providing a  or  element for
> > > > > > something which is de facto a list of elements (links, it this case)
> > > > > > is semantically correct and is a accessibility feature. You can see 
> > > > > > it
> > > > > > is a list, but what about someone using a screen reader? Consider 
> > > > > > it.
>
> > > > > [snip]- Zitierten Text ausblenden -
>
> > > > - Zitierten Text anzeigen -- Zitierten Text ausblenden -
>
> > - Zitierten Text anzeigen -

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: I need full ORM example

2010-05-03 Thread gremlin
The point here is that you obviously haven't read the manual. Why
should we be helping someone who hasn't bothered to read the excellent
materials provided? Second, your question is answerable with a quick
google search. Google for "cakephp complete application tutorial" and
*READ THE ENTIRE MANUAL* then see if  you still need to post your
question on the support group.

On Apr 25, 5:05 am, zonery  wrote:
> thank you jacombe. I will try..
>
> and
> dear thatsthegreat2345 and walther,
> I am a newcomer, and ask a sipmle question. may be some body know...
> is this wrong? I did not want somebody to write my application for
> me?  and the book has not complete example. if I see this example, I
> can gain time. please dont judge my method.  read my question again.
> if you know, your answer will be only one clause. no need to polemic.
> you can be little gentle. if you dont know or you dont want to help
> please dont write any message. I blame you for your unrelated and
> priggish messages
>
> thank you
>
> On 25 Nisan, 14:00, jacmoe  wrote:
>
>
>
>
>
>
>
>
>
> > If you don't want scaffolding, use the cake bake console.
> > Then you'll get CRUD.
> > The database you have to do yourself.
> > Pick any design and make sure that you adhere to the CakePHP naming
> > conventions - the cake bake console will give you the rest.
> > Then just customize the baked models/controllers/views to your needs.
>
> > On Apr 25, 1:38 am, zonery  wrote:
>
> > > Hi everybody,
> > > I need full ORM crud example. (Not with scafolding). Manually created
> > > conroller, model and view including "one to many", "many to many" and
> > > "one to one" associations. including index, edit, add, delete
> > > functionalities.
>
> > > do you know any tutorial or good example..
>
> > > thank you for advices
>
> > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelpothers 
> > > with their CakePHP related questions.
>
> > > 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 For more options, visit this group 
> > > athttp://groups.google.com/group/cake-php?hl=en
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others 
> > with their CakePHP related questions.
>
> > 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 For more options, visit this group 
> > athttp://groups.google.com/group/cake-php?hl=en
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> 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 For more options, visit this group 
> athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: v1.3 App::Objects not finding controllers in app/controllers/subfolders

2010-05-01 Thread gremlin
Also *I* sometimes want my controllers in sub-folders as an easy way
to use the File / Folder classes and folder locations to act as a
quick way to generate a filtered list of controllers. I have one
project with simple controllers in a widgets folder that all inherit
from a different parent controller than usual. Some parts of that app
list only the controllers in that folder as menu items/options
(Folder, Inflector, and App::build and class introspection for the
win). When I add a new module and put it in the right place with the
right docblock I don't have to worry about those rather critical menus
or synching what isn't application data with any databases.

Also just because you were told something once by a cake dev in the
past doesn't mean a) that they were right, or interested in explaining
something to you at the time or b) that the framework doesn't *now*
support the feature - either way you were wrong and rude about it.

On Apr 30, 10:24 am, Miles J  wrote:
> When I asked about controllers in sub-folders, the Cake devs told me
> to just use plugins -.-
>
> Sure there are ways around it, but I am repeating what I was told.
>
> On Apr 30, 12:38 am, AD7six  wrote:
>
>
>
> > Matthew,
>
> > They aren't /supposed/ to be in subfolders - please run through (I.e.
> > don't just read) the blog tutorial and try with a browser.
>
> > On Apr 29, 7:12 pm, Miles J  wrote:
>
> > > Well its simple. You cant put controllers within subfolders. Cake
> > > doesn't support it.
>
> > Miles,
>
> > You're doing that my-assumptions = fact thing again.
>
> >http://book.cakephp.org/view/530/Importing-Core-Libs(it'sexactly the
> > same for any type).
>
> > If your intention is to learn by stating your opinion until someone
> > points out your wrong (which is exactly how I learn most things) -
> > please clarify.
>
> > AD
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others 
> > with their CakePHP related questions.
>
> > 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 For more options, visit this group 
> > athttp://groups.google.com/group/cake-php?hl=en
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> 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 For more options, visit this group 
> athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: v1.3 App::Objects not finding controllers in app/controllers/subfolders

2010-04-29 Thread gremlin
I was answering his question. I don't know what his actual situation
is - perhaps he simplified his scenario when he asked his question.
Also the answer is useful to someone else who might have a legit
reason for wanting an alternate folder structure.
Thanks though, for your useful input.

On Apr 29, 8:00 pm, Miles J  wrote:
> Yeah but if you are going to do that, you might as well just use
> plugins, lol.
>
> On Apr 29, 6:38 pm, gremlin  wrote:
>
>
>
> > App::build( array(
> >     'controllers' => array(
> >         DS . join( DS, array( 'parts', 'to', 'your', 'path' ) . DS,
> >         ... other paths for controller lookup
> >     ),
> > ));
>
> > should work for you. I am not sure if you need to set the "normal"
> > path as one of the array items or not. Play around and let us know.
>
> > On Apr 29, 10:12 am, Miles J  wrote:
>
> > > Well its simple. You cant put controllers within subfolders. Cake
> > > doesn't support it.
>
> > > If you want to put controllers within subfolders, you have to make it
> > > a plugin.
>
> > > On Apr 29, 7:38 am, Matthew  wrote:
>
> > > > Here is my basic file structure
>
> > > > app/controllers ->
> > > >                      /categories/categories_controller.php
> > > >                      /news/news_controller.php
> > > >                      /users/users_controller.php
>
> > > > First attempt (default controller paths):
> > > > $controllerClasses = App::objects('controller');
> > > > debug($controllerClasses);
>
> > > > Result:
> > > > Array
> > > > (
> > > >     [0] => Pages
> > > >     [1] => App
> > > > )
>
> > > > (These are found in cake/libs/controller)
>
> > > > Second attempt (passing controller paths):
>
> > > > $App =& App::getInstance();
> > > > $paths = $App->controllers;
> > > > debug($paths);
>
> > > > $controllerClasses = $App->objects('controller',$paths);
> > > > debug($controllerClasses);
>
> > > > Result:
> > > > Array
> > > > (
> > > >     [0] => /home/pokey/public_html/cakephp/app/controllers/
> > > >     [1] => /home/pokey/public_html/cakephp/app/
> > > >     [2] => /home/pokey/public_html/cakephp/cake/libs/controller/
> > > > )
>
> > > > Array
> > > > (
> > > >     [0] => Pages
> > > >     [1] => App
> > > > )
>
> > > > It doesn't appear to be finding controllers recursively which doesn't
> > > > make sense because they are supposed to be in sub-folders.
>
> > > > Check out the new CakePHP Questions 
> > > > sitehttp://cakeqs.organdhelpotherswith their CakePHP related questions.
>
> > > > 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 For more options, visit this 
> > > > group athttp://groups.google.com/group/cake-php?hl=en
>
> > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelpothers 
> > > with their CakePHP related questions.
>
> > > 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 For more options, visit this group 
> > > athttp://groups.google.com/group/cake-php?hl=en
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others 
> > with their CakePHP related questions.
>
> > 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 For more options, visit this group 
> > athttp://groups.google.com/group/cake-php?hl=en
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> 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 For more options, visit this group 
> athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: v1.3 App::Objects not finding controllers in app/controllers/subfolders

2010-04-29 Thread gremlin
App::build( array(
'controllers' => array(
DS . join( DS, array( 'parts', 'to', 'your', 'path' ) . DS,
... other paths for controller lookup
),
));

should work for you. I am not sure if you need to set the "normal"
path as one of the array items or not. Play around and let us know.

On Apr 29, 10:12 am, Miles J  wrote:
> Well its simple. You cant put controllers within subfolders. Cake
> doesn't support it.
>
> If you want to put controllers within subfolders, you have to make it
> a plugin.
>
> On Apr 29, 7:38 am, Matthew  wrote:
>
>
>
> > Here is my basic file structure
>
> > app/controllers ->
> >                      /categories/categories_controller.php
> >                      /news/news_controller.php
> >                      /users/users_controller.php
>
> > First attempt (default controller paths):
> > $controllerClasses = App::objects('controller');
> > debug($controllerClasses);
>
> > Result:
> > Array
> > (
> >     [0] => Pages
> >     [1] => App
> > )
>
> > (These are found in cake/libs/controller)
>
> > Second attempt (passing controller paths):
>
> > $App =& App::getInstance();
> > $paths = $App->controllers;
> > debug($paths);
>
> > $controllerClasses = $App->objects('controller',$paths);
> > debug($controllerClasses);
>
> > Result:
> > Array
> > (
> >     [0] => /home/pokey/public_html/cakephp/app/controllers/
> >     [1] => /home/pokey/public_html/cakephp/app/
> >     [2] => /home/pokey/public_html/cakephp/cake/libs/controller/
> > )
>
> > Array
> > (
> >     [0] => Pages
> >     [1] => App
> > )
>
> > It doesn't appear to be finding controllers recursively which doesn't
> > make sense because they are supposed to be in sub-folders.
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others 
> > with their CakePHP related questions.
>
> > 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 For more options, visit this group 
> > athttp://groups.google.com/group/cake-php?hl=en
>
> Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with 
> their CakePHP related questions.
>
> 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 For more options, visit this group 
> athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: CakeFest IV - America - Help us pick a location!

2010-01-11 Thread gremlin
Portland OR, San Francisco CA, Sacramento CA, San Jose CA so that some
of us West Coasters can get some love. Corporate travel is expensive
and difficult to get approved these days so something for us Left
Coasters would be appreciated this time around.


On Jan 7, 7:18 pm, Chris Roush  wrote:
> New York, NY!
>
> On Nov 13 2009, 11:19 pm, BrendonKoz  wrote:
>
> > Although I live east coast, I'd be more apt to go if it was some place
> > warm/tropical.  Once you're in DC, it's not bad, but getting there if
> > you don't fly is a pain.  Chicago's airport's pretty cool, but I've
> > never been outside of it.  How is Texas's night life?  Safe?
>
> > Anyway, nice of the Cake team to ask!  Thanks!
>
> > On Nov 13, 11:02 pm, Miles J  wrote:
>
> > > Chicago seems cheap and cold, also one of the worse major cities in
> > > the US, why there?
>
> > > I vote for New York, or Seattle, or Boston, or something.
>
> > > On Nov 13, 7:36 pm, Renan Gonçalves  wrote:
>
> > > > Looks like Chicago is a nice place to host.
>
> > > > On Fri, Nov 13, 2009 at 1:43 AM, Graham Weldon 
> > > > wrote:
>
> > > > > Hi all,
>
> > > > > The CakePHP team has been considering the location for the next 
> > > > > upcoming
> > > > > CakeFest.
> > > > > We've decided to bring it back home to the United Sates of America.
> > > > > Thus far we haven't chosen a location for the event, but to ensure we 
> > > > > reach
> > > > > as many people as possible, we'd like your opinion on where we should 
> > > > > host
> > > > > the event.
>
> > > > > Essentially, our choices are:
> > > > > - USA East Coast
> > > > > - USA West Coast
> > > > > - USA Central
>
> > > > > If I have missed another location that you feel might be more popular 
> > > > > or
> > > > > accessible to interested attendees, feel free to suggest it.
> > > > > We're keen to hear peoples thoughts on it.
>
> > > > > Cheers,
>
> > > > > Graham Weldon (AKA: Predominant)
>
> > > > > e. gra...@grahamweldon.com
> > > > > w.http://grahamweldon.com
>
> > > > >  --
> > > > > 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+unsubscr...@googlegroups.com
> > > > > .
> > > > > For more options, visit this group at
> > > > >http://groups.google.com/group/cake-php?hl=.
>
> > > > --
> > > > Renan Gonçalves aka renan.saddam
> > > > CakeDC Software Engineer
> > > > CakePHP Core Developer
> > > > Website: renangoncalves dot com
> > > > Extrema, MG, Brazil- Hide quoted text -
>
> > > - Show quoted text -
Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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 For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Blueprint CSS + Cakephp

2008-10-15 Thread gremlin

you need to include screen, then print, then ie *in conditional
comments* then the fancytype.


On Sep 27, 6:30 pm, "Sam Sherlock" <[EMAIL PROTECTED]> wrote:
> no reason why it should not work unless your css is not found blueprint has
> a llib directory and plugins (perhaps not any more) which I suppose your
> storeing inside app/webroot/css/
>
> on that assumption
> echo $html->css(array('root', 'screen', 'fancy-type'), null,
> array('media' => 'screen, projection'), false);
>
> fancy type may be in either lib or plugin.  I think you supposed to custom
> the screen file, thine it may be better for you to put fancy type before
> screen - but then I know not what is in root
>
> 2008/9/27 Rudolf <[EMAIL PROTECTED]>
>
>
>
> > Dear All,
>
> > Have anyone tried using Blueprint CSS or other CSS resets/frameworks
> > with CakePHP? I am trying to do so, but the typography does not follow
> > what I defined in CSS: I want to use Lucida Grande but Helvetica (the
> > default font) was used instead. Anyway,
> > here is my code:
>
> > views/layouts/default.ctp
> > --
> > http://www.w3.org/
> > TR/html4/strict.dtd ">
> > http://www.w3.org/1999/xhtml";>
> > 
> >  
> >  
> >  
> > 
> > --
>
> > views/elements/scripts.ctp
> > --
> >  > echo $html->css(array('root', 'screen', 'fancy-type'), null,
> > array('media' => 'screen, projection'), false);
> > echo $html->css('print', null, array('media' => 'print'), false);
> > echo $javascript->link(array('sifr', 'jquery'), false);
> > ?>
> > --
>
> > views/projects/index.ctp
> > --
> > element('scripts'); ?>
> > 
> > --
>
> > Thanks
> > Rudolf
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Returning false from beforeValidate wont abort save

2008-09-23 Thread gremlin

beforeValidate runs before validation, but doesn't actually prevent
saving. If there is something you need to check that prevents saving a
record, you should put the logic in beforeSave

-Abba


On Sep 21, 8:34 am, "Novice Programmer" <[EMAIL PROTECTED]>
wrote:
> got that... Need to set soem field as invalid using Model::invalidate so
> that the save aborts..
>
> By I have another query now.. How do i fetch records saved to DB after
> saveAll.
>
> Thanks.
>
> On Sun, Sep 21, 2008 at 8:23 PM, Novice Programmer <[EMAIL PROTECTED]
>
> > wrote:
> > Hello guys,
>
> > in some cases i want to abort saving in beforeValidate callback. I have
> > returned false in that case, but i am not able to abort saving, it still
> > continues to save the record. Any ideas on what it can be?
>
> > --
> > Thanks & Regards,
> > Novice.
>
> --
> Thanks & Regards,
> Novice.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: DatePicker / Calendar popup

2008-09-23 Thread gremlin

I already answered your question Toby.
The datepicker class is added to the date input element. That is all
that cake has to do with it. After that it is purely javascript. The
javascript is then using the classname to attach a behavior to the
element. The javascript is not a part of the CakePHP core - there are
dozens you can choose from - learn to use google.


On Sep 23, 11:03 am, mark_story <[EMAIL PROTECTED]> wrote:
> The datepicker class just adds a CSS class called datepicker.  Look at
> the OvenCMS javascript to see how the datepicker is being added in.
>
> -Mark
>
> On Sep 23, 11:27 am, toby78 <[EMAIL PROTECTED]> wrote:
>
> > The OvenCMS uses this line for a calendar popup:
>
> > $form->input("Lawsuite/date_end", array("label" => false, "type" =>
> > "text", "class" => "datepicker"));
>
> > When I copy this into another project it does not work.
>
> > Where is this "plugin" located or where is it supposed to be ?
>
> > And how come a plugin can "overwrite" things like a text field if the
> > database field is a date field?
>
> > I would understand it if it was something like:
>
> > $form->input("Lawsuite/date_end", array("type" => "mycalendar");
>
> > and there was a directory called plugins/mycalendar with all the
> > necessary code.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Simply aligning form->input fields and labels nicely....

2008-09-23 Thread gremlin

Toby - you seem to be using the google groups as a source for all your
answers. Might I reccomend that you learn to use the api.cakephp.org
pages and the book.cakephp.org pages as a reference before posting
here?


On Sep 22, 7:17 am, RichardAtHome <[EMAIL PROTECTED]> wrote:
> Note:
>
> Something
> 
> Something2
> 
>
> ..will create an invalid form: You MUST have a label linked to every
> input element.
>
> Here's a snippet from my own cake.generic.css:
>
> /*
>  * forms
>  */
> #content form {
>         padding: 16px;
>         background-color: #DDD;
>         -moz-border-radius: 16px;}
>
> #content fieldset {
>         border: 0;}
>
> #content legend {
>         color: #06C;
>         font-size: 3em;
>         line-height: 1.2em; color : #06C;
>         font-weight: bold;}
>
> #content form div.input {
>         clear: both;
>         margin: 8px 0;
>         background-color: #EEE;
>         padding: 2px;
>         -moz-border-radius: 4px;
>         border: 1px solid #EEE;}
>
> #content form div.input.required {
>         font-weight: bold;}
>
> #content form div.input.error {
>         border-color: #900;
>         background-color: #FCC;
>         color: #900;}
>
> #content form div.input label {
>         float: left;
>         width: 14em;
>         margin-right: .5em;}
>
> #content form div.text input,
> #content form div.password input,
> #content form div.select select,
> #content form div.datetime select,
> #content form div.textarea textarea {
>         border: 1px solid #CCC;
>         padding: 2px;
>         font-size: 1.2em;
>         font-family: verdana, sans-serif;}
>
> #content form div.textarea textarea {
>         width: 40em;
>         height: 20em;}
>
> #content form option {
>         padding-right: .5em;}
>
> #content form div.input.error div.error-message {
>         margin-left: 14.5em;
>         padding: 2px 2px 2px 22px;
>         background: url(../img/icons/error.png) no-repeat 2px center;}
>
> #content form div.input input.form-error {
>         border-color: #C00;}
>
> #content form div.submit input {
>         margin-left: 7.25em;
>         border: 4px solid #FFF;
>         padding: 2px 4px;
>         background: #06C none no-repeat 4px center;
>         color: #FFF;
>         font-weight: bold;
>         font-size: 2em;
>         cursor: pointer;
>         -moz-border-radius: 8px;}
>
> #content form div.submit input:hover {
>         background-color: #9C9;
>         color: #333;
>         text-decoration: none;
>
> }
>
> I'm preparing an article for the Bakery about styling Cake layouts and
> views as we speak...
>
> On Sep 22, 2:57 pm, toby78 <[EMAIL PROTECTED]> wrote:
>
> > Thanks, this works.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Suggestion: Improving the cakephp homepage

2008-09-23 Thread gremlin

There is nothing in the core having to do with a Calendar. That might
explain why you failed to find one.

More importantly, you seem to be under the impression that because you
saw something somewhere having to do with a Calendar ( I assume you
mean a javascript date picking widget ) referenced somewhere while
reading about CakePHP, that you expect it to be findable through some
'official' channel. As something that isn't in the core, nor CakePHP
specific, your expectations aren't very realistic. Why would they
track / document / publish information that has absolutely nothing to
do with the framework itself on the website?

For user contributed extensions or tool for CakePHP ( of which a
datepicker certainly is ) you should look to the bakery ( 
http://bakery.cakephp.org
) or use google. If you want to specifically use a datepicker widget
in your application you should figure out how to use any one of the
dozens available through a quick google search. The process should be
fairly simple - include the javascript and css files and then call a
function from within a script tag or external script somewhere on your
page. This is the same process you would have to use whether or not
you were using CakePHP. If that is too complicated then perhaps you
should study up on some of the fundamentals. They are in chapters 1 &
2 of the book you don't want to read.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Re-saving user re-hashes password

2008-05-05 Thread gremlin

in the case of a password field - where the field should *always* be
cleared when the view loads - all of the clearing logic should be at
the view level.

Using the form helper

e( $form->input( 'User.password', array( 'type' => 'password', 'value'
=> '' ) ) );
I believe that should do the trick for views needing to have the hash
removed from the form field as well as allow validation to continue
working.



On May 5, 6:26 pm, drumdance <[EMAIL PROTECTED]> wrote:
> Ok, I've only been playing with CakePHP for a couple days, so go easy
> on me.
>
> I'm trying to create a simple user management system, similar to
> WordPress. I'm using Auth, and that seems to be at the core of the
> problem. I've seen this discussed on various blog posts and tutorials,
> but none seem to address the issue.
>
> Use case 1:
>
> Create a user - username, email, password, confirm password -
> reasonably straightforward except for the confirm password check. The
> problem is, what if password confirm passes valdation, but something
> else (like malformed email address) doesn't? The default behavior when
> reloading the page is fill the password field with the *encrypted*
> version of the password. I've seen some people suggest that the
> workaround is to null the password fields so they user gets a blank
> field and has to re-enter. I don't like this because there is no
> validation error - on a longer page this could be a PITA for the user
> - what if a field at the top failed validation and they don't notice
> that their password is blank.
>
> My workaround was, in the case of no pw validation errors but when
> other errors pop up, refill password and password_confirm with the
> values in the $_POST array. If there *are* password confirm errors,
> then I just unset both values and the validation error was correct
> (essentially "your passwords mismatch, so do them both again")
>
> I did this by overriding User::save() like so:
>
> function save(&$data,$validate=true,$fieldlist=array()){
> if(parent::save($data,$validate,$fieldlist)){
> return true;
> }
> //if save fails, reset passwords
> $password_error = 
> array_key_exists('password_match',$this->invalidFields()) || 
> array_key_exists('password',$this-
> >invalidFields());
>
> if($password_error){
> unset($data['password']);
> unset($data['password_match']);
> } else {
> $data['password'] = 
> htmlentities($_POST['data']['User']
> ['password']);
> $data['password_match'] = 
> htmlentities($_POST['data']['User']
> ['password_match']);
> }
>
> }
>
> This worked fine until I tried to edit an exiting user. The problem -
> the values loaded into the password field are the *encrypted* values
> in the db, So if the user doesn't change his password, then the
> encrypted version becomes encrypted itself, and the password will no
> longer work at login.
>
> The only workaround I can see is to remove password from the user form
> and make changing the password a separate form unto itself. Am I wrong?
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: FormHelper: unwanted "required" class

2008-04-09 Thread gremlin

Also
var $validate = array(
'fieldName1' => array(
'rule' => 'ruleName', // or: array('ruleName', 'param1',
'param2' ...)
'required' => true,
'allowEmpty' => false,
'on' => 'create', // or: 'update'
'message' => 'Your Error Message'
)
);

from the book - it is an example validation rule. The 'required' key
if set to false removes the required class name from the input.

On Apr 7, 3:23 pm, "b logica" <[EMAIL PROTECTED]> wrote:
> Ah, of course. I just realised, also, that I can add a CSS rule to
> remove the style inside the edit form.
>
> On Mon, Apr 7, 2008 at 6:14 PM, Dardo Sordi Bogado <[EMAIL PROTECTED]> wrote:
>
>
>
> >  $this->Business->validate = array();
>
> >  On Mon, Apr 7, 2008 at 3:22 PM, b logica <[EMAIL PROTECTED]> wrote:
>
> >  >  Does anyone know how to keep FormHelper from adding a "required" class
> >  >  to a form element? I have a model, Business, for which the "name"
> >  >  field is required to validate. On a search form I have the class is
> >  >  being added, causing the CSS style for "required" to be applied.
> >  >  However, the name field is not required for a search.
>
> >  >  FormHelper::input() doesn't appear to offer any way around it:
>
> >  >  if (in_array($this->field(), $this->fieldset['validates'])) {
> >  > $divOptions = $this->addClass($divOptions, 'required');
> >  >  }
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Weird problem with validation, bug?

2008-04-09 Thread gremlin

You should use add a field i.e 'change_password' to the model's
validation array. You can then use the Security::hash to hash that
value for saving in the action.
http://www.littlehart.net/atthekeyboard/2008/01/22/simple-user-registration-in-cakephp-12-part-ii/
should help you somewhat.

The article refers specifically to confirming passwords but the
premise is the same. You need to grab the new password and the old.
Check if the old is correct, if it is hash the new, move it to the
data array and save the appropriate model.



On Apr 8, 12:08 pm, Sebastian Veggiani <[EMAIL PROTECTED]> wrote:
> Does anyone have any idea?
>
> On 7 abr, 20:25, elHobbit <[EMAIL PROTECTED]> wrote:
>
> > Thanks b logica.
>
> > But, I really need to use the validation rules in the User model.
> > I'll try to overwrite the validation rules for the fields I'm not
> > using in this view.
> > Anyway, I think the problem isn't that, because with different fields
> > the form works ok.
>
> > Again, thanks for your help.  :)
>
> > On Apr 7, 7:31 pm, "b logica" <[EMAIL PROTECTED]> wrote:
>
> > > If the problem is that Cake is trying to validate User when
> > > unnecessary you could try what Dardo just suggested for a similar
> > > problem I was having. Put this in your edit() action:
>
> > > $this->User->validate = array();
>
> > > On Mon, Apr 7, 2008 at 4:42 PM, elHobbit <[EMAIL PROTECTED]> wrote:
>
> > > >  First, excuse me for my poor english.
>
> > > >  I'm using Cake 1.2.6311. I'm having a weird problem validating some
> > > >  fields from my model.
>
> > > >  The situation is like that:
>
> > > >  - One model "users" with validation rules.
> > > >  - "Users" controller with 2 basic actions: 'edit' & 'changepassword'.
> > > >  - The problem: in the action "changepassword" where I'm only showing
> > > >  the field "password" (and hidden ID field) when the form is submited
> > > >  I'm obtaining a connection reset.
>
> > > >  The weird thing is:
>
> > > >  - If I add this two lines, in which I set the value for the "email"
> > > >  into the ['data'] array the forms submits OK and the validation is
> > > >  triggered.
> > > >  --
> > > >  $pp = $this->User->read( null, $id );
> > > >  $this->data['User']['email'] = $pp['User']['email'];
> > > >  --
>
> > > >  - If the only showed field is "email" the form is submited OK and the
> > > >  validation triggered as expected without manually loading the
> > > >  "password" field to the "data" array. So I guess this is not a problem
> > > >  related with some requirement of having all "validated" fields in the
> > > >  form.
>
> > > >  My question is:
> > > >  Why if I only show the "email" field everything works fine. But with
> > > >  the field "password" I've to use the workaround from above?
> > > >  I'm very new with Cake so is VERY POSSIBLE I'm doing something vry
> > > >  wrong.
>
> > > >  Someone can help me with this issue? Thanks for your attention.
>
> > > >  PS: here is the code of my files:
>
> > > >  User Model:
> > > >  
> > > > -
> > > >   > > >  class User extends AppModel{
>
> > > > var $name = 'User';
> > > > var $belongsTo = array( 'Company', 'Group' );
>
> > > > var $validate = array(
>
> > > > 'email' => array(
> > > > 'required' => array(
> > > > 'rule' => 'email',
> > > > 'required' => true,
> > > > 'message' => 'Ingrese una dirección de 
> > > > e-mail válida'
> > > > )
> > > > ),
>
> > > > 'password' => array(
> > > > 'required' => array(
> > > > 'rule' => VALID_NOT_EMPTY,
> > > > 'message' => 'Debe indicar su 
> > > > contraseña'
> > > > )
> > > > ),
>
> > > > 'company_id' => array(
> > > > 'required' => array(
> > > > 'rule' => VALID_NOT_EMPTY,
> > > > 'message' => 'Seleccione una empresa'
> > > > )
> > > > ),
>
> > > > 'group_id' => array(
> > > > 'required' => array(
> > > > 'rule' => VALID_NOT_EMPTY,
> > > > 'message' => 'Seleccione el grupo al 
> > > > que pertenece el usuario'
> > > > )
> > > > ),
>
> > > > // campo adicional para confirmar la contraseña, no 
> > > > existe en la
> > > >  BBDD
> > > > 'password_conf' => array(
> > > > 'required' => array(
> > > > 

Re: Another Confused User on 1.2 Validation (field required)

2008-04-07 Thread gremlin

'rule' => VALID_NOT_EMPTY,
'required' => true

On Apr 7, 10:21 am, Duro <[EMAIL PROTECTED]> wrote:
> Furthermore...The solution I mentioned in my previous post does not
> quite work the way I'd hoped. It allows single words (ie. test123),
> but if you put spaces in the field (ie. test 123) it doesn't work,
> since it is no longer just letters and numbers. I tried removing the
> rule, but it throws a preg_match error.
>
> My questions is simple. How do I so a simple required field
> validation?
>
> Thanks for any help.
>
> Adam D.
>
> On Apr 7, 1:45 am, Duro <[EMAIL PROTECTED]> wrote:
>
> > So I've searched this group and other places on the web, and I still
> > can't seem to figure out why Validation rules don't work. It seems
> > others have had this problem, but only one solution works, and it is
> > totally contrary to what every other Manual, API, or Blog post has
> > said SHOULD work.
>
> > I am trying to get a field to simply be required. That's it. This is
> > the only piece of code I can get to work, and it seems like overkill
> > for this simple rule:
>
> > var $validate = array(
> > 'port_client' => array(
> > 'client_required' => array(
> >'rule'  => array('alphaNumeric'),
> >'required'  => true,
> >'allowEmpty'=> false,
> >'message'   => 'You must enter a client for this
> > item.'
> >)
> >)
> > )
>
> > I've tried the following (the first of which comes right out of the
> > cookbook), all to no avail:
>
> > var $validate = array(
> > 'port_client' => array(
> >  'rule' => 'alphaNumeric',
> >  'required' => true
> > )
> > );
>
> > -
>
> > var $validate = array(
> > 'port_client' => array(
> >  'required' => true
> > )
> > );
>
> > ---
>
> > When I use the latter two pieces of code and try inputting a value
> > into the field, it doesn't validate, it gives me the 'Required' or
> > 'This field can't be blank' message, even though there is clearly
> > something in the field.
>
> > Environment Stats:
> > - PHP 5.2
> > - CakePHP 1.2
> > - Database: MySQL 5.0
>
> > Any help is appreciated.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Form Helper

2008-04-03 Thread gremlin

As long as the field is a date field in the database you should be
able to simply use $form->input( 'Model.datefieldname' , ... ) as
usual. I believe it autocreates a number of select boxes.

Good luck._

On Mar 28, 3:53 pm, shabba <[EMAIL PROTECTED]> wrote:
> I'm trying to use the form helper to display drop down menu date
> fields. Now if I want to display datetime it works, but when I try and
> do the same thing for date I get this error:
>
> Warning (512): Method FormHelper::date does not exist [CORE/cake/libs/
> view/helper.php, line 148]
>
> The code from my view is
>
> Add Task
>  echo $form->create('Task');
> echo $form->input('title');
> echo $form->input('description', array('rows' => '3'));
> echo $form->input('context');
> echo $form->input('project');
> echo $form->date('due');
> echo $form->end('Save Task');
> ?>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: How to make a good use of Elements and DRY principe ?

2007-08-17 Thread gremlin

Somehow lost some of the post.

Also in views that dont have a $users variable set you can use the
element $this->renderElement( 'users_list' );
Using ajax to return html snippets would work as well. - jquery style
- $( '#element' ).load( Url/users/index ); would load the cached
element into the #element.

Remember you need to play with the RequestHandler component and either
extension parsing or request handling code to serve the ajax view in a
blank layout.

Again have fun with this stuff. Let us know what you come up with.


On Aug 17, 1:41 pm, gremlin <[EMAIL PROTECTED]> wrote:
> What you need to do is write an index action for your users_controller
> like you would if you were NOT using ajax or reusing that action at
> all.
> Once you have that done, modify that function to check isset( 
> $this->params['requested'] ) to see if the view action if being called via
>
> the requestAction function.
>
> ***
>
> function index( )
> $users = $this->User->findAll( );
> if( isset( $this->params['requested'] ) ){
> return $users;
> }
> $this->set( 'users', $users );
>
> }
>
> Then you create an element - users_list.ctp
>
> if( !isset( $_data ) ) {
>$_data = $this->requestAction( array( 'controller' => 'users',
> 'action' => 'index' ) );}
>
> 
> foreach( $_data as $row _) {
> echo use data}
>
> 
>
> You can then use the element in your users_controller index view file.
> $this->renderElement( 'users_list', array( '_data' => $users );
>
> For a good write up check out the bakery 
> articles..http://bakery.cakephp.org/articles/view/creating-reusable-elements-wi...http://bakery.cakephp.org/articles/view/cache-elements-individually-f...http://bakery.cakephp.org/articles/view/optimizing-your-cakephp-eleme...
>
> This will show you how to create these reusable elements as well as
> how to cache them based on the freshness of the model data, timestamps
> and on a per user / instance basis
>
> Enjoy.
>
> and in other view without the $users data $this->renderElement( 'users_list' 
> );
>
> On Aug 16, 2:42 pm, "Christophe C." <[EMAIL PROTECTED]> wrote:
>
> > up :(
> > Any suggestions ?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: How to make a good use of Elements and DRY principe ?

2007-08-17 Thread gremlin

What you need to do is write an index action for your users_controller
like you would if you were NOT using ajax or reusing that action at
all.
Once you have that done, modify that function to check isset( $this-
>params['requested'] ) to see if the view action if being called via
the requestAction function.

***

function index( )
$users = $this->User->findAll( );
if( isset( $this->params['requested'] ) ){
return $users;
}
$this->set( 'users', $users );
}

Then you create an element - users_list.ctp

if( !isset( $_data ) ) {
   $_data = $this->requestAction( array( 'controller' => 'users',
'action' => 'index' ) );
}

foreach( $_data as $row _) {
echo use data
}


You can then use the element in your users_controller index view file.
$this->renderElement( 'users_list', array( '_data' => $users );

For a good write up check out the bakery articles..
http://bakery.cakephp.org/articles/view/creating-reusable-elements-with-requestaction
http://bakery.cakephp.org/articles/view/cache-elements-individually-for-each-user
http://bakery.cakephp.org/articles/view/optimizing-your-cakephp-elements-and-views-with-caching

This will show you how to create these reusable elements as well as
how to cache them based on the freshness of the model data, timestamps
and on a per user / instance basis

Enjoy.


and in other view without the $users data $this-
>renderElement( 'users_list' );
On Aug 16, 2:42 pm, "Christophe C." <[EMAIL PROTECTED]> wrote:
> up :(
> Any suggestions ?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Siloing in cakephp?

2007-08-17 Thread gremlin

I have had good success by using a model function to generate a custom
query from the url. Search for other posts on nested categories for
some solutions. I generally resolve the id of the article/category -
whatever is nested - using a recursive function in the model and then
pass that along to a regular find call.

On Aug 17, 12:46 pm, "Chris Hartjes" <[EMAIL PROTECTED]> wrote:
> On 8/17/07, Mech7 <[EMAIL PROTECTED]> wrote:
>
>
>
> > Yes it is, but how to do it without knowing how deep it goes.. it
> > could be..
>
> > /animals
> > /animals/birds/
> > /animals/birds/hummingbird
>
> That is the trick, isn't it. :)
>
> Part of the problem is that you are trying to do pattern matching on a
> potentially open-ended pattern, right?
>
> You might have to break down into routes like
>
> /animals/birds/, and that sort of thing you can easily
> create a route for.
>
> --
> Chris Hartjes
> Senior Developer
> Cake Development Corporation
>
> My motto for 2007:  "Just build it, damnit!"
>
> @TheBallpark -http://www.littlehart.net/attheballpark
> @TheKeyboard -http://www.littlehart.net/atthekeyboard


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Workflow engine for cake

2007-07-24 Thread gremlin

All of the workflow issues are DOMAIN SPECIFIC PROBLEMS and should *
NOT * be in the framework. If you need a workflow solution you could
use CakePHP to * MAKE * one that did exactly what you needed - or even
better make a general workflow solution and release it as a Behavior /
Component / App_Controller / Plugin whatever to the Bakery.


On Jul 22, 6:07 am, Kunthar <[EMAIL PROTECTED]> wrote:
> Hello Jonathan,
>
> Thank you for response. I've worked before struts in Java world.
> Struts is not a workflow engine even
> Spring too. Spring helps for IOC and loosely coupling the parts of the
> code. Struts could be used
> as an action traffic police and could be extended for very usefull
> usage. But nor Struts neither Spring not covers all
> aspects of real workflow engines could achieve.
>
> As you can follow from those lists[1], there are too many workflow
> engines for Java. I really liked JBpm[2] and used Enhydra[3]
>
> The problem is i have to go with php for this project and i have to
> write php 4 and 5 compatible code. Do not ask me why :)
> If you could read the first message of this topic you can see that i
> already found some solutions for php but
> all of them for php5 not php4. Main problem is timeline, time is too
> short to convert this kind of engine from php5 to php4.
> Since i am not very familiar with php4 OO style.
>
> I'm looking for another solution which could be take place instead of
> workflow engine and compatible with cake.
> I think about rules engine as Micro$oft CRM[4] but open to any other
> suggestion.
>
> Hope i could express myself? Sorry for my English.
>
> Take care,
> Gokhan aka Kunthar
>
> [1] Java workflow engines 
> listhttp://java-source.net/open-source/workflow-engineshttp://www.manageability.org/blog/stuff/workflow_in_java
> [2]http://www.jboss.com/products/jbpm
> [3]http://www.enhydra.org/workflow/index.html
> [4]http://blogs.msdn.com/benlec/pages/extending-logical-users-list-in-wo...
>
> On Jul 22, 11:59 am, "[EMAIL PROTECTED]"
>
> <[EMAIL PROTECTED]> wrote:
> > Hi all,
>
> > Just to add my little bit on this.  Workflow engines are a reasonably
> > new thing in terms of
> > web frameworks and it's not something that is done very well at the
> > moment.  I can't see
> > anything in CakePHP which resembles a workflow engine., it just seems
> > to have a simple
> > page/controller/function mapping.  Is there anything that resembles
> > interceptors?
>
> > Struts or Struts 2 do not have
> > a workflow engine, the closest thing to this is the struts-config.xml
> > file which allows you to
> > define mappings which point to actions, I guess we don't do this with
> > cake, it's a simple page
> > controller mapping.  With Struts you have the main front controller
> > and a number of delegate
> > actions.  You don't map to an action directly, you map to an action
> > mapping.
>
> > However, there are a number of workflow engines out there in the Java
> > world, Beehive is an
> > old one.  Spring workflow and Struts workflow are up and coming
> > workflow engines...
>
> > This isn't particularly beneficial when you only have a few components
> > but as your site grows
> > it becomes unmanageable very quickly in terms of workflow and
> > something like this definately
> > helps.
>
> > Cheers,
> > Jon.
>
> > On Jul 21, 1:25 pm, Kunthar <[EMAIL PROTECTED]> wrote:
>
> > > I would be really happy if you just talk about logic you've applied by
> > > using cake way.
> > > Maybe i've missed something on the way :)
>
> > > On Jul 21, 3:14 am, Felix Geisendörfer <[EMAIL PROTECTED]> wrote:
>
> > > > I'm developing such an engine right now. It allows the company to take
> > > > the items from their orders through different steps from order
> > > > processing, to production to shipment. All steps require different stuff
> > > > to be done to the items, certificates to be printed out, etc.. So yes
> > > > you can do this in cake but I've done more fun stuff in the past ... : 
> > > > p.
>
> > > > -- Felix
> > > > --
> > > > My Blog:http://www.thinkingphp.org
> > > > My Business:http://www.fg-webdesign.de
>
> > > > francky06l wrote:
> > > > > I am not good at example, but I'll try ...(In a business sector that I
> > > > > know a bit)..
>
> > > > > Let's say you are in a banking environnement, you have an application
> > > > > to capture loans and process them. In order to make decision, you
> > > > > would probably call external sources of data (risk estimation), some
> > > > > of them are very used such as Credit Bureau (ie : Equifax, Transunion,
> > > > > Experian) etc ...
> > > > > Now depending of the amount of loan and/or your zip code, you are
> > > > > going to call 1, 2 or the 3 of this sources .. If one  does not you
> > > > > might wait for a while or called the 2 others instead etc ... You want
> > > > > to let the manager of this sector being able to change this flow
> > > > > without changing code. He would need an "admin" interface where he
> > > > 

Re: Using jquery's Ajax functions in tandem with CakePHP...

2007-07-03 Thread gremlin

You need an ajax view for the action that either prints out just the
snippet of html ( HIJAX or AJAH method ) and renders that by itself
without a layout.
Or..
You can return a javascript array in your view. ( JSON method )
Or..
You can return a well formed XML document ( AJAX method ) with an xml
layout that sets the content type headers correctly for you.

With the first one the $( "selector" ).html( returnedHtml ) will put
the markup into the the element selector ( usually a container div )
With the second two you need to parse and transform the JSON or XML
into html using jquery ( or even better, any one of the jquery dom
creation tools on the jquery plugins page ) and insert the content
into the document. Usually this would happen in one of jquery's ajax
method callbacks. There are a few good tutorials on the jquery
tutorial page.

If the appended elements need to have even handler applied to them you
can do so in the callbacks as well. There is an excellent tutorial
linked from the jquery site named something along the lines of
"Correctly using callbacks" or some such listed under the Ajax heading
that explains this very well.

Good luck.

On Jul 3, 7:26 am, Jim Newfer <[EMAIL PROTECTED]> wrote:
> Gremlin, thank you so much for your reply! So far it isn't working but
> in the top of my javascript I have arequestAction, and in my
> controller I set something like this
>
> if(isset($this->params['requested'])) {
> return  array('stories' => $getstories, 'school' => 
> $schoolname);
>
> That is all I should need to do to have jquery be able to access my
> models right ?
>
> Thanks for any more advice from anyone.
>
> On Jul 2, 10:24 pm, gremlin <[EMAIL PROTECTED]> wrote:
>
> > You can call a script the same way, just use $( "#quote p" ).load( "/
> > contoller/action" );
>
> > Make sure your controller handlesajaxrequests. If you don't know
> > what that means look uprequestActionor parseExtensions in the
> > groups.
>
> > On Jul 2, 10:12 pm, Jim Newfer <[EMAIL PROTECTED]> wrote:
>
> > > I have been usingjquery, which is great btw, with cakephp for a
> > > couple of weeks now. I love it to say the least. I haven't really
> > > dealt withajaxvery much, but I have done some basic things with it,
> > > and PHP outside of cake. Needless to say, when it comes time to use
> > >jquery'sajaxfunctionality with cake, I am completely and totally
> > > lost.
>
> > > I trying to get this EXTREMELY simple tutorial to work with cakephp
> > > for about the past 3 hours, and just cannot seem to figure it out.
>
> > >http://www.sitepoint.com/article/ajax-jquery
>
> > > I think it make have something to do with this line injquery, where
> > > it calls for an outside script.
>
> > >  $("#quote p").load("script.php");
>
> > > I was wondering is there some way to instead, call upon a specific
> > > controller? Or passjqueryinformation?
>
> > > Obviously I do not want to include a separate script because that
> > > would be an unnecessary hassle. I am just looking for pointers/tips on
> > > how to useajax'sfunctionality with cake, because I cannot seem to
> > > find any good tutorials anywhere on incorporatingjqueryinto cake.
>
> > > Any guidance is GREATLY appreciated.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Using jquery's Ajax functions in tandem with CakePHP...

2007-07-02 Thread gremlin

You can call a script the same way, just use $( "#quote p" ).load( "/
contoller/action" );

Make sure your controller handles ajax requests. If you don't know
what that means look up requestAction or parseExtensions in the
groups.


On Jul 2, 10:12 pm, Jim Newfer <[EMAIL PROTECTED]> wrote:
> I have been using jquery, which is great btw, with cakephp for a
> couple of weeks now. I love it to say the least. I haven't really
> dealt with ajax very much, but I have done some basic things with it,
> and PHP outside of cake. Needless to say, when it comes time to use
> jquery's ajax functionality with cake, I am completely and totally
> lost.
>
> I trying to get this EXTREMELY simple tutorial to work with cakephp
> for about the past 3 hours, and just cannot seem to figure it out.
>
> http://www.sitepoint.com/article/ajax-jquery
>
> I think it make have something to do with this line in jquery, where
> it calls for an outside script.
>
>  $("#quote p").load("script.php");
>
> I was wondering is there some way to instead, call upon a specific
> controller? Or pass jquery information?
>
> Obviously I do not want to include a separate script because that
> would be an unnecessary hassle. I am just looking for pointers/tips on
> how to use ajax's functionality with cake, because I cannot seem to
> find any good tutorials anywhere on incorporating jquery into cake.
>
> Any guidance is GREATLY appreciated.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: searching for a newsletter component

2007-05-07 Thread gremlin

Both are capable of internationalizing your email campaigns I believe.
As for european solution, I don't know of any of the top of my head.
Both services are quite cheap. I think campaignmonitor is $5.00 U.S. +
$0.05 U.S. for each email recipient beyond the first 5 ( they let you
set up a 5 person test list for each send for free )


On May 6, 11:20 pm, jyrgen <[EMAIL PROTECTED]> wrote:
> hey abba,
>
> thanks for pointing me to this. Are these services free ? Is there
> anything comparable in Europe/Germany ?
> If this causes additional costs for my customer, i guess it's not
> for me. I'd rather implement my own system (or phplist) then.
> Regarding the load, well i heavily doubt that the community will grow
> far beyond 1000 Users. The mailer will of course not send 1000 emails
> at once.
>
> thanks, jyrgen


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Reverse recursive findAllThreaded queries?

2007-01-01 Thread gremlin


gwoo that is the model I used. Nothing I have found works to lookup the
id of a category  when the category tree is passed via the url as
params. The function crazylegs wrote is logically sound but why would I
execute N queries to get to the id only to use it to do lookups against
other tables?

Just to clarify the logic is all in the model. The controller is only
calling the model function and passing the params in.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Nested categories controller and routing

2006-12-27 Thread gremlin


I solved this differently than suggested.
This thread has my solution for those interested.
http://groups.google.com/group/cake-php/browse_thread/thread/6c7cdd0cc5160a19/ac0466a2764df27f?lnk=gst&q=gremlin&rnum=2#ac0466a2764df27f


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Reverse recursive findAllThreaded queries?

2006-12-27 Thread gremlin


Not sure if it helps you at all but I once needed to know the ID of the
current category in a tree structure where the 'token' of the category
was the url param and not the id.

IE. http://server.com/categories/art/painting/van_gogh
and I needed to resolve the id of the category 'van_gogh' in order to
look up related records in other tables.

I used this in my category model.

function setCategory( $c = null )
{
if( is_array( $c ) )
{
$this->id = 1;
if( count( $c ) > 0 )
{
$d = array_values( $c );
$t = array_pop( $d );

$query = "SELECT parent_0.id FROM categories as parent_0 
";
$where = "WHERE parent_0.token = '" . $t . "' ";
$loop = 1;
while( count( $d ) > 0 )
{
$t = array_pop( $d );
$query = $query . "LEFT JOIN categories as parent_" 
. $loop . " ON
parent_" . ($loop-1) . ".parent_id = parent_" . $loop . ".id ";
$where = $where . "AND parent_" . $loop . ".token = '" . 
$t . "' ";
$loop++;
}

$category_id = $this->query( $query . $where );
if( $category_id )
{
$this->id = $category_id[0]['parent_0']['id'];
}
else
{
$this->id = -1;
}
}
}
}

Where the category had id, token, created, modified, description, and
parent_id fields.

In my controller I look up the category params like so.

function index( $path = null )
{
$this->Category->setCategory( $function_args );
$this->set( 'category_data', $this->Category->findAll(
"Category.id = $this->{Category->id}", null, null, 0 )  );
}


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Nested categories controller and routing

2006-11-01 Thread gremlin

> this shouldn't be a problem. you just need to split the args in the
> categories index () function. You then build you complexity in there,
> perhaps limiting your depth to 4 /cat/subcat/subsubcat/id

The limit is absolutely not an option. I think perhaps a arg count on
the parameters could be used to set the recursive depth for the findall
query on the parent category relationship though.

Anyone tell me if I am on the right track?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Nested categories controller and routing

2006-10-31 Thread gremlin

I have thought of all of this before and none of these solutions quite
seems to solve my problem.

I need to be able to recover the id for the category entry in order to
reference various related models to generate the content.

The number of parameters in the url needs to be dynamic and must
control a mysql self join. The results of this self join need to
populate the category model.

I can not pass the id into the controller in this case. I also can't
use a findall or findallbyname since the names of a category might not
be unique. I need to be able to handle an url like the following
examples. All of them.

domain.ext/categories/books/
domain.ext/categories/books/programming
domain.ext/categories/programming/
domain.ext/categories/software/
domain.ext/categories/software/product/
domain.ext/categories/software/product/downloads
domain.ext/categories/software/product/reviews

where the parameters passed to the categories controller will determine
what else happens. I can control the rest but I can't seem to get
around populating the category model with the information it needs. I
can get the param count and construct the query manually - is there a
trick to approaching this problem from such an angle? Am I missing
something entirely.

I cant split the controllers up. I need this to work from a single
categories_controller and I need to get the id of the category from the
nested url in a single query if at all possible. A self join will do
this. I can manage the sql generation easily enough.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Nested categories controller and routing

2006-10-30 Thread gremlin

If I create a model with a relationship to itself ie a nested
categories model with a belongs to and has many relationship I can
easily enough get a set of nested categories data.

The problem for me is that if I wish to reference the content related
to that category I must either reference it directly or set a nesting
depth limit on the parameters I pass via the url. More clearly I can't
figure out how I could set a controller to read category information
from an url that might have no parameters or 5 or 13 or any other
number.

Is there a way to take a structure like so :
Categories
__
id   -   parent_id   -   value
__
0   -   null-   null
1   -  0-   articles
2   -  0-   files
3   -  1-   programming
4   -  3-   php

etc..

and represent the actual hierarchy in the url as parameters?
domain.ext/
domain.ext/articles
domain.ext/articles/php

particulary in the case where in the future I might want to add a
sub-category to "php" thus making the url into
domain.ext/articles/php/cake or similiar?


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Mutually exclusive associations

2006-10-12 Thread gremlin


Martin Schapendonk wrote:
> On 10/11/06, AD7six <[EMAIL PROTECTED]> wrote:
> > >However, strictly speaking it does not provide any way to prevent an
> > Address to belong to a Person and an Organization at the same time.
> >
> > ?
> >
> > If on the address table there are 2 fields 'class' and 'foreign_id'
> > which are used to define to which class and object the address relates
> > it is not possible for the same address to point to more than one
> > person/org. If you are defining in the person/org class which is their
> > address by setting a field named address_id the foreign key is in the
> > wrong table.
>
> In that case, you're right.
>
> I was thinking about an addresses table with two columns "person_id"
> and "organization_id". This does not prevent an address from belonging
> to an organization and a person at the same time.
>
> I think the "foreign_id" column pointing to either persons or
> organizations is not such a nice solution, since it removes the
> possibility of having a foreign key relation in the database.
>
> In the database (in my case, usually Oracle) I would implement things
> with an optional foreign key relation and a check constraint that
> specifies that only one of the two columns may be filled. I was
> looking for some similar functionality in CakePHP.
>
> Regards,
>
> Martin
>
> --
>   Martin Schapendonk, [EMAIL PROTECTED]

Just my 2 cents.
Keep addresses in an address table.
A join table could connect contacts to addresses   -  likewise for
companies and addresses.
Disallowing a company to have the same address as a contact is going to
eventually bite you in the ass. I for one do private contract work from
my home. My own companies address is my home address. I could be a
contact REQIURING a company address identical to my personal one.

Abba Bryant


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Association help for an internal table hierarchy

2006-06-23 Thread gremlin

I use even shorter keys id and pid since I like short names. I was
writing out long names to make them obvious in the source as to what
they are.

Use whatever names you want. Just make sure to use cake conventions or
make sure you set the table and all of the keynames in the model


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Association help for an internal table hierarchy

2006-06-23 Thread gremlin

also this assumes you have your categories table with a name field.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Association help for an internal table hierarchy

2006-06-23 Thread gremlin

Try being more verbose with your association declarations.
Assign one for both the parent and the child. I will post an example.

[snip]
class DownloadCategory extends AppModel
{
var $name = 'DownloadCategory';
var $displayField = 'download_category_name';

var $hasMany = array(
'Child Download Category' => array(
'className' => 'DownloadCategory',
'foreignKey' => 'download_category_parent_id' )
);

var $belongsTo = array(
'Parent Download Category' => array(
'className' => 'DownloadCategoryCategory',
'foreignKey' => 'download_category_parent_id' )
);
[/snip]

I used long table names here. I might be doing this incorrectly as when
I scaffold this I get some interesting menu items in the scaffold view
method for a category. It has list category ( from the belongs to ) and
list categories ( from the has many ) displayed as options. If there is
a better way to do this I am unaware of it.

Hope I helped and that someone can help both of us beyond this point.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Re: Cancel Button on Form

2006-06-19 Thread gremlin

also just using the html in the view and giving the button the onclick
or assigning the onclick via id or class with js would work.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---