Re: Form Generation using form helper ..Form data not getting stored to DB.

2008-02-03 Thread MrTufty

You don't mention which version you're using, but I'm going to assume
1.2 because of the $form code.

Really, we need to see your controller code to figure this out, but it
should be something like this:

... in users_controller.php

function register() {
   if(!empty($this->data)) {
  if($this->User->create($this->data) && $this->User->save()) {
 // send success message
  } else {
 // send failure message
  }
   }
}

That should be all you need (formatting not preserved). Most of my
controller actions follow this pattern, and they work - so if yours
doesn't, the problem could be elsewhere.

Steve

On Feb 3, 8:32 am, swiftguy <[EMAIL PROTECTED]> wrote:
> Hello Experts,
>
> Im a newbie and trying to master cakephp through the IBM's 'Cook up
> Web sites fast with CakePHP'
>
> In this tutorial they have listed a form helper example ..following is
> the code snippet
>
> Please fill out the form below to register an account.
> create('User', array('action' => 'register'));?>
>  echo $form->input('first_name');
> echo $form->input('last_name');
> echo $form->input('username');
> echo $form->input('email');
> echo $form->input('password');
> ?>
> end('Register');?>
>
> if i submit this form no record is getting stored to the database, but
> if i submit the data using the manual html code (code snippet is
> listed below) it works (able to save records to the DB)
>
> 
> Please fill out the form below to register an account.
> Username:
> Password: size="40"
> />
> Email Address: maxlength="255" />
> First Name:
> Last Name:
> 
> 
>
> Im unable to troubleshoot  the problem... kindly help me out.
--~--~-~--~~~---~--~~
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: HTML Helper - flash support

2008-02-03 Thread MrTufty

Unlikely.

My theory on this, others may disagree, is that Flash is better added
by the theory of progressive enhancement. That's why I use jQuery plus
the jQuery Flash plugin to handle it at the client side. I'm pretty
sure other libraries have similar solutions.

Steve

On Feb 1, 11:00 pm, Ata Alqadi <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I needed to use flash files in my site, so i wrote the following
> function:
>
> function flash($path, $name, $width, $height, $scale = "exactfit",
> $wmode = "transparent"){
> if (is_array($path)) {
> $path = Router::url($path);
> } elseif ($path{0} === '/') {
> $path = $this->webroot($path);
> } elseif (strpos($path, '://') !== false) {
> $path = $path;
> } else {
> if (Configure::read('Asset.timestamp') == true && 
> Configure::read()> 0) {
>
> $path .= '?' . @filemtime(str_replace('/', DS, 
> WWW_ROOT .
> FLASHES_URL . $path));
> }
> $path = $this->webroot(FLASHES_URL . $path);
> }
>
> return '

Re: Quick Question about links

2008-02-01 Thread MrTufty

It's not a stupid question... makes perfect sense!

Try this:

link(__($post['Category']['title'], true),
array('controller' => 'posts', 'action' => 'category',
$post['Category']['id'])); ?>

The only difference from your method is that $post['Category']['id']
isn't getting appended directly to the action. In practice there's no
difference, but I think it looks a little cleaner.

Steve

On Feb 1, 5:13 pm, Neil <[EMAIL PROTECTED]> wrote:
> Aww sorry, I found  the answer. I should write my links with an array:
> link(__($post['Category']['title'], true),
> array('controller'=> 'posts', 'action'=>'category/'.$post['Category']
> ['id'])); ?>
>
> thanks for your tolerance of my stupid questions!
> Take care,
> Neil
>
> On Feb 1, 11:54 am, Neil <[EMAIL PROTECTED]> wrote:
>
> > So I have this code on every page(via an element) that holds links to
> > different categorys of my blog:
> > link(__($post['Category']['title'], true), '/posts/
> > category/'.$post['Category']['id']); ?
>
> > Now if I am at:http://localhost/cake/posts/, orhttp://localhost/cake/
> > ect.. it works fine. But if I click on the link, and then click on
> > another category link fromhttp://localhost/cake/posts/category/1I
> > get this:http://localhost/cake/posts/category/cake/posts/category/1
>
> > why does it do this?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Complete Account Management

2008-01-30 Thread MrTufty

Hi all,

I'm at the latter stages of a big-ish CakePHP 1.2 project now (it's an
online wine store with a bespoke shopping cart system, entirely
developed by myself - which probably means it's full of bugs since I
haven't had time to write full tests for the thing).

One of the requirements is for the customers to be able to log in, see
their account details and previous orders, and crucially, to be able
to amend their account details. This is the sticking point for me.

I have the login/logout/register combination all working fully. It
works very well, and even has the remember me cookie option working
this time (which I was very surprised at, given how much hassle I had
last time - I must have done something stupid).

However, the editing of the customer account gives me trouble. I
suspect it's something obvious, that I can't see because I'm too close
to the problem (PEBCAC, probably). The original plan was to have
separate screens where the user can change their email address, their
password, and their address details. I ran into problems with the
validation though. Because I have the password and email fields marked
as required, when saving the forms without those specified I got
errors. I know there's an option to only validate on update or create,
but there doesn't appear to be the ability to validate differently if
only a subset of the fields are being specified.

Am I doing something stupid? How do other people handle this?
Additionally, I think there could be some issues with having the
remember me cookie, because the standard code provided by Chris
Hartjes overwrites anything in $this->data['User']['email'] with the
cookie if it's present.

I'm tearing my hair out here, so any help is appreciated!

Steve
--~--~-~--~~~---~--~~
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: Routing Question how to use Router::connect('/') with session_id?

2008-01-28 Thread MrTufty

I might not be understanding this properly - but WHY would you want to
stick session IDs in the URL? It's just about the worst thing you
could ever do for SEO.

Steve

On Jan 28, 12:38 pm, sanemat <[EMAIL PROTECTED]> wrote:
> I am wordering how to get url to work:
> /?CAKEPHP=session_id
>
> Here is my route in app/config/routes.php:
> Router::connect('/', array('controller' => 'pages', 'action' =>
> 'display'));
>
> When I access '/', it call '/pages/display', As I expected.
> But when I set disable cookie and set use_trans_sid=1, I get problem.
> In my expectation, '/?CAKEPHP=session_id' call '/pages/display/?
> CAKEPHP=session_id'.
>
> Contrary my expectation, when I access '/?
> CAKEPHP=e233bd9c1facda8084d8ba2f2226eb60'
> I get this error:
> Error: CAKEPHPe233bd9c1facda8084d8ba2f2226eb60Controller could not be
> found.
>
> Please tell me how to get url to work '/?CAKEPHP=session_id'.
> I use CakePHP 1.2.x.x
>
> thanks
--~--~-~--~~~---~--~~
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: Redirect leaves old URL

2008-01-24 Thread MrTufty

Why does everyone keep beating the dead horse of a wiki? We had one
before, when I first got into Cake. Guess what? It wasn't very
effective. Outdated articles providing poor solutions to problems that
didn't need to be solved. I prefer the Bakery, these groups and the
various articles written on people's blogs. The tempdocs site helps a
lot too.

If you read around, you'll find that the dev team aren't interested in
having a wiki again.

Steve

On Jan 24, 6:48 am, Daniel Moore <[EMAIL PROTECTED]> wrote:
> I did some further testing and what was happening was that I was
> redirecting to a page that had a route assigned to it.
>
> Here's the situation:
>
> User goes tohttp://apps.face.../messages/post/
>
> //messages_controller.php
> function post() {
> // ... Some Stuff
>
> // Redirect back to McGriff messages
> $this->redirect("/");
>
> }
>
> // routes.php
> Router::connect('/', array('controller' => 'messages', 'action' =>
> 'index'));
>
> User gets routed to .../messages/index/
>
> Browser URL still says:http://apps.face.../messages/post/
>
> I'm not sure if this is the 'correct' behavior, or if it is poor form
> to redirect to a route, but this is what happens. I'm using 1.2 beta
> by the way.
>
> Also, I heard rumor of someone setting up a documentation wiki, and
> I'm strongly in favor. I've spent many many hours the past few days
> searching the existing documentation, and I think we need more
> extensible media.
>
> On Jan 23, 5:49 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
> wrote:
>
> > huh, that's really odd, it looks good to me. Maybe it's a facebook
> > thing. Have you tried it on a different server? Also, what happens if
> > you use $this->redirect("/messages/")? I think the url routing is all
> > handled in /webroot/index.php so maybe it doesn't like redirecting to
> > a shallower path?
>
> > Dave
>
> > On Jan 23, 4:52 pm, Daniel Moore <[EMAIL PROTECTED]> wrote:
>
> > > Hey,
> > >   I'm moderately new with CakePHP, but I have this issue where my
> > > redirect leaves the old URL in the browser.
>
> > > [code]
> > > //messages_controller.php
> > > function post() {
> > > // ... Some Stuff
>
> > > // Redirect back to McGriff messages
> > > $this->redirect("/");}
>
> > > [/code]
>
> > > Yet the browser still 
> > > shows:http://apps.facebook.com/mcgriff/messages/post/
> > > instead of:http://apps.facebook.com/mcgriff/
>
> > > 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: tutorial with picture please.!!

2008-01-23 Thread MrTufty

Why would a tutorial with pictures help? If Cake was actually a CMS or
something I could understand it, but it's not - it's a programming
framework. As such an illustrated tutorial wouldn't be all that
useful.

Check out the screencasts, that's probably as much of a step by step
illustrated tutorial as you're going to find.

Steve

On Jan 23, 5:12 am, DeFrag <[EMAIL PROTECTED]> wrote:
> can somebody help me step by step tutorial with picture...please...
> coz i want to make a project build with cakephp...
>
> by the way, i usually build my project with easyphp + pear...
> my friend told me..."U MUST USE THIS CAKEPHP"...
> So, can anyone give me step by step tutorial with picture
>
> Thanx 4 ur help, guys
--~--~-~--~~~---~--~~
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: Connecting Two HABTM Tables

2008-01-22 Thread MrTufty

It does, but you still need a model for the link. If I remember
correctly anyway.

I think Danielle is correct here though. Your database structure is
overcomplicated a little - you could achieve the same goal by having:

Size:-
id
size
shortCode

Colour:-
id
colour

Style:-
id
style
description

Stock:-
id
size_id
colour_id
style_id
quantity

With the Stock model being linked to the others via belongsTo. No real
need for a HABTM at all.

Steve


On Jan 22, 5:25 am, david_setwise <[EMAIL PROTECTED]> wrote:
> Doesn't CakePHP 1.2 support additional fields in a HABTM table?
>
> David
>
> On Jan 21, 6:15 pm, Ponderosa - Lists
>
> <[EMAIL PROTECTED]> wrote:
> > Your colors_shirts_sizes table should be a new table/model inventory.
>
> > Inventory
> > - id
> > - shirt_id
> > - size_id
> > - color_id
> > - inventory_qty
> > ... any other inventory information needed such as location etc.
>
> > As soon as you need more than just the cross reference id's in the table
> > (like your inventory quantity) it needs to be its own model.
>
> > Danielle
>
> > -Original Message-
> > From: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf
>
> > Of david_setwise
> > Sent: January 21, 2008 3:03 PM
> > To: Cake PHP
> > Subject: Connecting Two HABTM Tables
>
> > Here is a potential situation in which it seems like two HABTM tables
> > should be connected.  So, am I incorrect in my table structure.  If
> > not, can Cake handle connecting two HABTM tables?
>
> > The system in question deals with clothing.  So imagine shirts of
> > various types that can have multiple sizes and colors, with the
> > ability to track inventory.
>
> > The first HABTM is fairly straight forward: Colors > Colors_Shirts >
> > Shirts
>
> > But if I want to add in sizes, with an inventory for each combination
> > (Plain T-shirt, Green, Size Medium, inventory 20) it get complicated.
> > I envision the correct database structure/relationship as having the
> > Sizes table connected to the Colors_Shirts table with a HABTM
> > relationship, in which the inventory is stored.
>
> > Colors_Shirts > Colors_Shirts_Sizes (with field for inventory) > Sizes
>
> > So, is this the way you would structure the database?  If so, can Cake
> > handle such a relationship?  And if not, does anyone have a decent
> > alternative?
>
> > Colors
> >  - color_id
> >  - name
>
> > Shirts
> >  - shirt_id
> >  - name
> >  - description
>
> > Sizes
> >  - size_id
> >  - shortCode
>
> > Colors_Shirts
> >  - color_id
> >  - shirt_id
>
> > Colors_Shirts_Sizes
> >  - color_id
> >  - shirt_id
> >  - size_id
> >  - inventory
--~--~-~--~~~---~--~~
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: Auth Component encrypting password before validation.

2008-01-18 Thread MrTufty

djiize, thanks for the code sample. That's effectively what my own
code was doing, except (for some stupid reason) I'd neglected to load
the User model to get the hashPasswords function (in the theory that
it would be loaded by the Auth component anyway, I think).

I'm with nate on this one (not because he's a god of Cake or anything)
- there is no good reason why you should have to use plaintext
passwords, and many good reasons not to. I've come across several
websites and applications using plaintext passwords during the last 2
years I've spent as a professional web developer, and in every
instance it's been for stupid reasons (like, "our users often forget
their passwords and need them sent to remind them" - in which case 2-
way encryption is a far better solution).

Steve

On Jan 18, 9:36 pm, nate <[EMAIL PROTECTED]> wrote:
> Right, we make it so you have to use an annoying and silly workaround
> *for a reason*.  Because when it's annoying and silly, you have to
> stop and think about it, because whatever it is you're trying to do is
> probably wrong.  Whatever problem you are trying to solve by accessing
> a plaintext password can probably be solved some other way.  You're
> problem is not original.
>
> You are not special.
> You are not a beautiful and unique snowflake.
> You are the all-singing, all-dancing crap of the earth.
>
> On Jan 18, 3:32 pm, rtconner <[EMAIL PROTECTED]> wrote:
>
> > This particular issue is the framework trying to baby it's users.
> > Telling us that we can't implement our own security practices. It's
> > not even that you can turn it off if you don't want it, you just can't
> > turn it off. You literally have to "deal with it" with a little
> > workaround of some sort. Not that it's super hard to work around, but
> > it is a work around. It's just annoying, and silly.. like I said.
>
> > On Jan 18, 1:14 pm, Baz <[EMAIL PROTECTED]> wrote:
>
> > > Now it's comments like this that help me understand why the developers
> > > sometimes get frustrated with this mailing list. This statement serves
> > > absolutely no purpose. It is a blind criticism without any productive
> > > alternative.
>
> > > Frameworks are developed for the mass, not individuals. Meaning, what's
> > > there is going to serve 85% of the people just fine. If you have a 
> > > _better_
> > > alternative, then please suggest.
>
> > > Otherwise, quit whining. It's not compiled code; it's PHP. If you don't 
> > > like
> > > it, open up the bloody file and hit the delete key move on.
> > > --
> > > Baz L
> > > Web Development 2.0http://WebDevelopment2.com/
>
> > > On Jan 18, 2008 1:31 PM, rtconner <[EMAIL PROTECTED]> wrote:
>
> > > > I'll just say, I love any and all complaints about that auto hashing
> > > > thing. I think it's silly and annoying and shouldnt be part of cake.
--~--~-~--~~~---~--~~
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: Only one register within a given set can be flagged: possible?

2008-01-18 Thread MrTufty

Spot on, that's how I would do it. Avoids the expensive (and non-
scaling by table size) updateAll. This way when you change the default
image, you only have one field in one record to change, rather than 1
field in N records where N might possibly be a very big number.

Steve

On Jan 18, 7:13 pm, Goranche <[EMAIL PROTECTED]> wrote:
> One way of doing this is to add a "defaultPhotoID" field to the photo
> gallery record...
> (and of course removing the "default" flag from the photos)
>
> a nice side effect is that it allows you to share photos between
> galleries... maybe not something that one would do, but replace the
> gallery with group and photo with articles... or just about any other
> example :)
>
> I also like to ask questions like: default photo is an attribute of
> which entity? photo or gallery?
>
> Goran
>
> Jaime wrote:
> > is set in the Photo model. Of course one and only one photo within
> > that album should have the "default" bit set, because it's non-sense
> > to flag more than one for the same album.
--~--~-~--~~~---~--~~
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: i don't know why

2008-01-18 Thread MrTufty

Indeed AD.

I was just being picky, because we see so many requests for help here
which don't give us any clues at all (and in most cases are a _demand_
for help rather than a request).

Steve

On Jan 18, 9:08 am, AD7six <[EMAIL PROTECTED]> wrote:
> On Jan 18, 10:03 am, MrTufty <[EMAIL PROTECTED]> wrote:
>
> > You're not telling us anything about your specific situation, so it's
> > unlikely anyone is going to be particularly helpful.
>
> I feel like being a bit particular :).
>
> My powers are telling me that allenxie should remove cake/ from
> the url - you don't browse to the cake directory. you browse to the
> top folder of the download.
>
> hth,
>
> AD
--~--~-~--~~~---~--~~
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: Auth Component encrypting password before validation.

2008-01-18 Thread MrTufty

What he said ;)

I've been working with overriding hashPasswords to provide a randomly
salted sha256 implementation, but my brains leaked out of my ears
(that'll teach me to code at 3am).

Steve

On Jan 18, 11:30 am, djiize <[EMAIL PROTECTED]> wrote:
> You can already choose your hashing method, see in function
> Auth::hashPasswords
> If you define Auth->authenticate variable with the name of an object
> of your own that definse the function hashPasswords, this function
> will be called instead of the Auth default one
>
> If you just want md5 or sha256 instead of sha1, you can define
> Security->hashType (maybe in bootstrap)
>
> Thanks to code devs to permits that 2 things ;)
>
> On 18 jan, 11:47, phpjoy <[EMAIL PROTECTED]> wrote:
>
> > nate, someone could want to use other hashing methods and not the
> > default one.
> > i vote for enabling :)
>
> > and adding the last crypt component to cake :D
>
> > On Jan 18, 6:18 am, nate <[EMAIL PROTECTED]> wrote:
>
> > > No.  Disabling password hashing is Evil with a capital "E".  That's
> > > why I don't let you do it.
>
> > > On Jan 17, 11:03 am, dizz <[EMAIL PROTECTED]> wrote:
>
> > > > Thanks to both of you, I thought of this, but I thought it would be
> > > > easier to disable the AuthComponent::hashPasswords and then do what
> > > > Baz did above.
>
> > > > Anyways thanks again for the help.
>
> > > > -Andrew
>
> > > > On Jan 17, 10:45 pm, Baz <[EMAIL PROTECTED]> wrote:
>
> > > > > Yep,
>
> > > > > Use a different field, eg. new_password or something. (I'm assuming
> > > > > you're validating when creating a password. No need for login)
>
> > > > > Here's assuming you have a model called User:
>
> > > > > // needed for validation for some reason
> > > > > $this->User->set($this->data);
> > > > > if ($this->validates($this->data))
> > > > > {
> > > > > $this->data['User']['passwd'] =
> > > > > $this->Auth->password($this->data['User']['new_passwd'] )
>
> > > > > // all we did was hash passwords, no need to revalidate.
> > > > > if ($this->save($this->data, false))
> > > > > {
> > > > > //do stuff
> > > > > } else
> > > > > {
> > > > > // invalid
> > > > > }
>
> > > > > }
>
> > > > > Would be nice to stick this is beforeSave in the model, but you can't
> > > > > [easily] access the Auth component from the model.
>
> > > > > Hope this helps.
>
> > > > > On Jan 17, 2008 9:31 AM, dizz <[EMAIL PROTECTED]> wrote:
>
> > > > > > Hello,
>
> > > > > > I am using the auth component and before my model can validate the
> > > > > > password the auth component already encrypts the password so making 
> > > > > > it
> > > > > > impossible to use the between built in valid method.
>
> > > > > > Is there any work around for this?
--~--~-~--~~~---~--~~
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: i don't know why

2008-01-18 Thread MrTufty

You're not telling us anything about your specific situation, so it's
unlikely anyone is going to be particularly helpful.

Some things that would help:

What version of Cake are you using?
What environment are you running it in? Windows? Linux? Where do you
have it installed?

With that information we might actually be able to get started on
helping you.

Steve

On Jan 18, 1:48 am, allenxie <[EMAIL PROTECTED]> wrote:
> Missing controller
>
> You are seeing this error because controller CakeController could not
> be found.
>
> Notice: If you want to customize this error message, create app\views/
> errors/missing_controller.thtml.
>
> Fatal: Create the class below in file : app\controllers
> \cake_controller.php
--~--~-~--~~~---~--~~
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: Problem with Plugins > Controller Missing?

2008-01-17 Thread MrTufty

The problem here is the mismatch between the name of the plugin and
the default controller name.

For this to work, you need to rename contents_controller.php to
content_controller.php (and obviously amend the class name within
that). Additionally the views/contents/ folder needs to be renamed.

That should fix the problem.

Steve


On Jan 17, 11:42 am, NilsR <[EMAIL PROTECTED]> wrote:
> I can't access the default controller of my plugin. Cake tells me,
> that the controller is missing.
> My Structure looks like the following:
>
> app/
> plugins/
> content/
> content_app_controller.php
> content_app_model.php
> controllers/
> contents_controller.php
> models/
> content.php
> views/
> contents/
> admin_edit.ctp
> admin_new.ctp
>
> When i now try to access example.com/contents/index it tells me the
> controller is missing.
--~--~-~--~~~---~--~~
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 configuration file

2008-01-10 Thread MrTufty

It depends how many configuration settings you need to store.

Personally, I'm just adding to the bottom of app/config/core.php -
seems to work fairly effectively.

Others have used a model and component in order to store configuration
settings in the database. I haven't tried this yet.

Steve

On Jan 10, 8:09 pm, "Novice Programmer" <[EMAIL PROTECTED]>
wrote:
> Hello Guys,
>
> I have a legacy appliaiton that i am porting to cake to avoid the clutter of
> code in my php pages. That application is using configuration
> file(traditional config.php). I was wonderting that what is the best place
> where it would go when thinking of cake paradigm. Please Help.
>
> --
> Thanks & Regards,
> Novice (http://ishuonweb.wordpress.com/).
--~--~-~--~~~---~--~~
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 model objects in the controllers

2008-01-07 Thread MrTufty

Deane,

I have to disagree with your opinion that the business logic belongs
in the controllers. From my understanding of MVC best practices,
specifically "Fat models, skinny controllers" - the models should be
responsible for the business logic, not the controllers. The
controllers are pretty much only there in order to wire together
models and views.

But that said, it is only my opinion, and I'd be interested to know
why you think differently.

On Jan 7, 12:38 pm, Deane <[EMAIL PROTECTED]> wrote:
> A couple days ago, I lamented that Find* didn't return an array of
> model objects.  I posted about it here, and I was told that one of the
> reasons for this was that it would be "too tempting" to start
> inserting business logic in the views if you had objects available
> there.
>
> Fine.  I'll concede that point for now.
>
> But what about the controllers?  Shouldn't I be able to use models in
> the controllers?  If I do a Find* in a controller to retrieve some
> data (that I have no intention of sending to the view) , shouldn't I
> get model objects back and be able to use methods on those objects?
>
> Controllers are where the business logic *should* live, so there
> doesn't seem to be much argument against using model objects there.
> Yet I still have nothing but these big arrays to deal with.
>
> How does everyone else manage this?  Say you *need* to run some method
> on a model object in one of your controllers.  What is the accepted
> way of doing this?
--~--~-~--~~~---~--~~
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: Way to Store Subscribers to Post-Threads

2007-12-21 Thread MrTufty

An alternative way which might scale better would be to have your
posts table, your users table, and a posts_users table, joined using a
hasAndBelongsToMany association. That way you don't get those comma-
separated values, which are a complete bitch to deal with if you ever
want to access them using a JOIN condition.

Tufty

On Dec 21, 5:22 pm, steve <[EMAIL PROTECTED]> wrote:
> I have a discussion board (kind of like mini discussion board), where
> users can subscribe to a particular Post ( so that when there is a
> reply to this post, they get mailed a notification ).
>
> I'm deciding whether or not to store it this way:
>
> posts table
> post_id  users_subbed_to_post
> --  ---
> 4   2,15,23
> 7   11,8
> 34 8,12,16
> 234   1,2,6,10,15
>
>  --  or --
>
>   users table
> user_id  posts_subbed_to
> --  ---
> 1   234
> 2   4, 234
> 8   7, 34
> 11 7
>
> The first way, makes it a no-brainer whenever a new reply to that
> original post is created. You can easily get all of the subscribed
> users to that post and call mail() for each one.
>
> But the second way seems more logical somehow.
>
> I figured maybe one or more of you might have cakePHP website based on
> the blog tutorial and come across the same decision-point.
>
> Happy Holidays,
> Steve
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



RequestAction + Plugin = Apache Crash

2007-12-21 Thread MrTufty

Hi guys,

Found a strange issue in the current SVN (I'm using branches, so I'm
currently on r6179).

In my default layout I use 2 requestAction calls to pull in data for
elements. This works 100% fine, in the main part of the app.

I use a plugin to handle the backend administration of the site, but I
wasn't overriding the layout file, keeping it the same as the
frontend. That's fine, until I brought in the requestAction.

That caused it to crash Apache on my local dev server (running
Wampserver on Vista), and when uploaded also causes 1&1 to pump out
500 Errors.

A bit of investigation, and I've discovered that if I remove the
requestAction calls from my layout, it no longer crashes.

What could be causing this?

Tufty
--~--~-~--~~~---~--~~
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: want to call function in default ctp from app model

2007-12-18 Thread MrTufty

Manuj,

I'm not going to fall back to the standard RTFM response here... but
seriously, you do need to read the manual. All the information you
need to do this is there.

Tufty

On Dec 18, 5:03 am, manuj bansal <[EMAIL PROTECTED]> wrote:
> thanks for the idea
>
> plz help me how to use request action in view for calling function in
> app_controller
> and app_controller to model
> and my view file is default.ctp
>
> because for calling request action i need controller name
>
> and for calling function in app controller i need model name
>
> On Dec 17, 2:21 pm, MrTufty <[EMAIL PROTECTED]> wrote:
>
> > It looks like you haven't really studied the whole MVC, separation of
> > concerns thing. You shouldn't be calling functions in the model from
> > the view. You shouldn't even be calling controller functions from the
> > view. In short, the controller queries the model and then sends the
> > information on to the view to be displayed.
>
> > In this case though, if you're determined to make it work, create a
> > function in your controller that calls the function in your app_model
> > and sets a view variable with the result. That will then work fine
> > when called via requestAction. This will work, but it's not exactly
> > best practice.
>
> > Tufty
>
> > On Dec 17, 6:07 am, manuj bansal <[EMAIL PROTECTED]> wrote:
>
> > > i know the metod of calling functions from controller and settinng
> > > variable
>
> > > but i have to call it fron view file
>
> > > i found 1 method
>
> > > requestAction
>
> > > but i am not find way how to call function from app_model
>
> > > On Dec 17, 10:58 am, Grant Cox <[EMAIL PROTECTED]> wrote:
>
> > > > Please be more clear in your question.
>
> > > > You cannot call model functions from a view.  You must call the model
> > > > function from your controller, and set() the data for the view.
>
> > > > On Dec 17, 3:09 pm, manuj bansal <[EMAIL PROTECTED]> wrote:
>
> > > > > my code is as follows
> > > > > ***app_model.php
> > > > > (code)***
>
> > > > > function abc($y)
> > > > > {
> > > > > $v = $this->query(using $y);
> > > > > return $v;}
>
> > > > > *default.ctp
> > > > > (code)**
>
> > > > > i want to call above function frome here by passing some argument
>
> > > > > ***--**-
> > > > >  Hide quoted text -
>
> > > > - Show quoted text -- Hide quoted text -
>
> > - Show quoted text -
--~--~-~--~~~---~--~~
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: Got Cake installed ok but can't see any apps

2007-12-17 Thread MrTufty

9 times out of 10, if not 99 out of 100, just putting the Cake files
into your webroot will work perfectly, with the exception of
mod_rewrite issues. I don't really understand where the problem is
coming from in this case, but it's more likely to be an issue with
your Apache configuration than with Cake itself. I've never tried
hosting a website from the My Documents folder before, I know it's
possible but I've always had more success hosting in a separate folder
elsewhere on the drive. Perhaps this will work in your case also.

You will also find that the IBM Tutorials are out of date, and
depending on which version of the Blog tutorial you use, that may be
also. You didn't mention which version of Cake you're trying to use
but I definitely recommend the 1.2 pre-beta release.

Tufty

On Dec 17, 6:40 am, indy50 <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I am running Apache 2.2 on windows xp. I've been using php and perl on
> it for years with few problems. But I created the Blog Tutorial and
> the IBM Tutorial 1 and can never see the apps. I can see the main cake
> page at:
>
> http://localhost/cake
>
> And I had to follow the mod-rewrite solutions to get it to look right.
> There are many php Strict warnings. I found you can turn those off in
> the php.ini, but I've never seen those with any other php app.
>
> But I can't see any app. I installed cake in the Document Root as in
> my Apache config and I can see the cake page. I just get page not
> found. It said in the ibm tutorial to go to mysite/users/register.
> Nothing. The blog tutorial said to go to a page and I see nothing. I
> found I could change the "route" away from the cake page but when I
> try any new route I still get nothing. I tried changing the Paths in
> the cake config files and that didn't help.
>
> DocumentRoot = "C:\Documents and Settings\Owner\My Documents
> \public_html"
>
> This is the same as localhost on any other php or perl script. What is
> going on? It's really frustrating and not easy as stated in the
> minimal manual and documentation. I love scripts that really work in
> 15 minutes. I've spent hours on this already to get the 15 minute
> tutorial to work and nothing.
>
> Any expert help will be appreciated as I have to learn this for my new
> job.
>
> Thanks
--~--~-~--~~~---~--~~
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: want to call function in default ctp from app model

2007-12-17 Thread MrTufty

It looks like you haven't really studied the whole MVC, separation of
concerns thing. You shouldn't be calling functions in the model from
the view. You shouldn't even be calling controller functions from the
view. In short, the controller queries the model and then sends the
information on to the view to be displayed.

In this case though, if you're determined to make it work, create a
function in your controller that calls the function in your app_model
and sets a view variable with the result. That will then work fine
when called via requestAction. This will work, but it's not exactly
best practice.

Tufty

On Dec 17, 6:07 am, manuj bansal <[EMAIL PROTECTED]> wrote:
> i know the metod of calling functions from controller and settinng
> variable
>
> but i have to call it fron view file
>
> i found 1 method
>
> requestAction
>
> but i am not find way how to call function from app_model
>
> On Dec 17, 10:58 am, Grant Cox <[EMAIL PROTECTED]> wrote:
>
> > Please be more clear in your question.
>
> > You cannot call model functions from a view.  You must call the model
> > function from your controller, and set() the data for the view.
>
> > On Dec 17, 3:09 pm, manuj bansal <[EMAIL PROTECTED]> wrote:
>
> > > my code is as follows
> > > ***app_model.php
> > > (code)***
>
> > > function abc($y)
> > > {
> > > $v = $this->query(using $y);
> > > return $v;}
>
> > > *default.ctp
> > > (code)**
>
> > > i want to call above function frome here by passing some argument
>
> > > ***-**-
> > >  Hide quoted text -
>
> > - Show quoted text -
--~--~-~--~~~---~--~~
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->create() ::: how can use onSubmit in form->create()

2007-12-15 Thread MrTufty

It WAS a huge disaster. I got involved with Cake at that point, and I
almost gave it up because of the huge inaccuracies present in the
Wiki. At any given point there were 3 or 4 suggestions on how to do
each task, and 3 of them would be wrong somewhere along the line - but
of course you wouldn't know which.

The Bakery and the Manual (even in it's half-finished form) are of a
MUCH higher quality than any Wiki could ever be.

Chris, I didn't realise you weren't around at that point - I've gotten
so used to seeing your name on these groups, I figured you'd been
around forever!

Tufty

On Dec 14, 7:21 pm, "Chris Hartjes" <[EMAIL PROTECTED]> wrote:
> On Dec 14, 2007 1:06 PM, WordPress Guru <[EMAIL PROTECTED]> wrote:
>
>
>
> > Thanks Chris, and grigri
>
> > I understand the differnce between a manual and I think the purpose of
> > any good document is to at least inform the reader about the
> > parameters of any method. The api is so poorly documented that in most
> > case it does not tell in any detail about the parameters. For example
> > in one case, it tells that options array is just like form_remote_tag
>
> I'm sorry if you think I was implying that you didn't understand the
> difference between a manual and an API.  That wasn't my intent.
>
> I agree that parts of the API could be better documented, perhaps with
> an example of it's use.
>
>
>
> > Maybe a user editable wiki will do the job, or something like php.net
> > which has user contributions as part of the manual.
>
> This was done in the past (before I got involved with CakePHP) and
> apparently it was a huge disaster.
>
> --
> Chris Hartjes
>
> My motto for 2007:  "Just build it, damnit!"
>
> @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: RequestAction parameters

2007-12-15 Thread MrTufty

One tip to avoid error messages like this would be to change the
definition of your function to:

function index($username = null) {

That way if a username is not passed, it doesn't break.

BUT, that doesn't solve your problem, which appears to be that the
username isn't being set at all - have you tried outputting $username
in the view, to see if it actually contains anything?

Tufty

On Dec 14, 9:24 pm, Fabian <[EMAIL PROTECTED]> wrote:
> I did the following
>
> requestAction('archives/index/'.$username); ?
>
>
>
> and then in the controller
>
>  class ArchivesController extends AppController {
> var $name = 'archives';
>
> //echo $username;
> function index($username) {
> $archives = $this->Archive->findByUser($username);
> if(isset($this->params['requested'])) {
>  return $archives;
> }
> $this->set('archives', $archives);
> }}
>
> ?>
>
> And I get this error:
>
> Warning: Missing argument 1 for ArchivesController::index() in C:
> \Program Files\xampp\htdocs\cake\app\controllers
> \archives_controller.php on line 5
>
> Notice: Undefined variable: username in C:\Program Files\xampp\htdocs
> \cake\app\controllers\archives_controller.php on line 6
>
> On Dec 14, 2:17 pm, jarmstrong <[EMAIL PROTECTED]> wrote:
>
> > You can get away with just adding the arguments after the function name 
> > using
> > slashes to split each argument.
>
> > You can do something like this:
>
> > requestAction('archives/index/'.$i_love_Cake); ?>
>
> > --
> > View this message in 
> > context:http://www.nabble.com/RequestAction-parameters-tp14339603p14339776.html
> > Sent from the CakePHP mailing list archive at Nabble.com.
--~--~-~--~~~---~--~~
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: Selection jump function / menu

2007-12-13 Thread MrTufty

That's exactly how I'd do it too.

With the exception that I'd put the code in via a touch of jQuery in
the view instead, but that's a matter of style.

Tufty

On Dec 13, 9:02 am, francky06l <[EMAIL PROTECTED]> wrote:
> You could set your text field as an hidden field at first. Then
> handling "onChange" in the select box, with a small javascript you
> would show the text box when the is "other" and hide it otherwise.on
> Something like :
>
> $js = 'if(this.value == "other") $(\'inpbox\').show(); else $(\'inpbox
> \').hide();';
> echo $form->input('knowsfrom', array('type' => 'select', 'options' =>
> $options, 'onchange' => $js));
> echo $form->input('otherfrom', array('type' => 'text', 'id' =>
> 'inpbox'));
>
> I did write this code just straight here, so you might get some syntax
> errors, but that should give you a hint.
> hth
>
> On Dec 13, 7:32 am, rocky <[EMAIL PROTECTED]> wrote:
>
> > Hey,
>
> > I'm trying to use cakePHP to do a client's sign up form. I want to
> > know how did our clients find us so we have a selection box for them
> > to choose. Well, there's an option called "other", When they select
> > "Other" as option I want the web page throws an text field for them to
> > fill out.
>
> > If any of you could give me some hint on how to achieve this, I would
> > really appreciate it?
>
> > Blessings,
> > Rocky
--~--~-~--~~~---~--~~
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: 2 Models 1 Layout

2007-12-13 Thread MrTufty

At a guess, I'd say that your /posts/index action isn't returning the
data correctly.

This is roughly what it should look like: excuse the dodgy formatting.

class PostsController extends AppController {
   ... snipped ...
   function index() {
  $posts = $this->Post->findAll();
  if(isset($this->params['requested']) {
 return $posts;
  }
  $this->set('posts', $posts);
   }
}

This means the posts index will work both if you go to it directly and
if you use it in a requestAction.

Hope that helps!

Tufty

On Dec 13, 5:58 am, Fabian <[EMAIL PROTECTED]> wrote:
> Hi All,
>
> I'm trying to gather data from 2 different models (2 different tables)
> and I want to place them on my layout.
> I read something about using a  requestAction so I did the following:
>
>  function index()
> {
>$this->set('archives', $this->Archive->findAll());
>$this->set('posts', $this->requestAction('/posts/index'));
>
> }
>
> so on my layout I have
>
> 
> 
> 
>
> 
> 
> 
>
> the first one gets the archive user and that one works, but the second
> one , which I used the table posts created on the 15 min tutorial
> doesn't get the data. Can anyone tell me what I'm doing wrong?
--~--~-~--~~~---~--~~
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: Help please for ultra-beginner

2007-12-12 Thread MrTufty

Yes, you can do it that way too. But if you set up the associations,
you don't NEED to change $uses to include Ugroup, as it will
automatically be included based on it's association with the User
model.

On Dec 12, 9:22 am, avairet <[EMAIL PROTECTED]> wrote:
> Hello,
>
> My cake knowledge is limited too (2 months), but I think you must
> specify your 2 models in your controller.
>
> Something like that in PHP5 context:
>  class UsersController extends AppController
> {
>public $uses = array('User','Ugroup');}
>
> ?>
>
> And maybe you should specify the association in your 2 models...
>
> Something like that:
>  class User extends AppModel
> {
>public $belongsTo = array('Ugroup');}
>
> ?>
>
> and for the associated model:
>
>  class Ugroup extends AppModel
> {
>public $hasMany = array('User');}
>
> ?>
>
> And finally, you must indicate to your models, the primary key you are
> using, because by default Cake search for an "id" key to make
> associations.
>  class Ugroup extends AppModel
> {
>public $primaryKey = 'ugroup_id';}
>
> ?>
>
> I hope this helps you...
>
> BR
>
> Avairet
>
> On 12 déc, 08:37, Sanfly <[EMAIL PROTECTED]> wrote:
>
> > No good im afraid, same error, except ugroup_id is now ugroupid
>
> > 
> > Notice: Undefined property: UsersController::$Ugroup in C:\server\www
> > \cake\basic_site\plugins\users\controllers\users_controller.php on
> > line 34
>
> > Fatal error: Call to a member function findByUgroupid() on a non-
> > object in C:\server\www\cake\basic_site\plugins\users\controllers
> > \users_controller.php on line 34
> > 
>
> > On Dec 12, 7:31 pm, chad <[EMAIL PROTECTED]> wrote:
>
> > > try findByUgroupId
>
> > > On Dec 11, 10:08 pm, Sanfly <[EMAIL PROTECTED]> wrote:
>
> > > > Hi
>
> > > > Ive only just started mucking around with CakePHP, and am having a
> > > > little trouble getting my head around the controllers and models
> > > > thingees.  YES - I have tried looking in the manual!!
>
> > > > Im trying to make a cake website that will more or less mirror some
> > > > normal-non-framework php sites I have done.
>
> > > > There is a table called users where all normal user data is stored
> > > > (see below for table structure).  The ugroup table contains a
> > > > ugroup_name and a number of "permissions" that dictate what the user
> > > > will be able to access on the site.  The ugroup_id field in users
> > > > indicates which ugroup the user belongs to.
>
> > > > When the person logs in, I first want it to check that the user_name
> > > > and user_pass are valid, then access the ugroups table to set the
> > > > ugroup data (permissions) as sessions, which can then be called when I
> > > > like throughout the rest of the site.
>
> > > > users_controller.php
> > > > -
> > > >  > > > class UsersController extends AppController
> > > > {
>
> > > > function login()
> > > > {
> > > > $this->set('error', false);
>
> > > > if (!empty($this->data))
> > > > {
> > > > $someone = $this->User->findByUser_name($this->data['User']
> > > > ['user_name']);
>
> > > > if(!empty($someone['User']['user_pass']) &&
> > > > $someone['User']['user_pass'] == md5($this->data['User']
> > > > ['user_pass']))
> > > > {
> > > > $this->Session->write('User', $someone['User']);
>
> > > > // Here is the code that is giving me 
> > > > problems
> > > > $perms = 
> > > > $this->Ugroup->findByUgroup_id($someone['User']
> > > > ['user_group']);
>
> > > > if($perms['Ugroup']['perm_admin'] == 
> > > > "1"){
> > > > 
> > > > $this->redirect('/pages/admin/');
> > > > }
> > > > else{
> > > > $this->redirect('/');
> > > > }
> > > > // End Problem code
> > > > }
> > > > else
> > > > {
> > > >$this->set('error', true);
> > > > }
> > > > }
> > > > }
>
> > > > function logout()
> > > > {
> > > >$this->Session->delete('User');
>
> > > > $this->redirect('/');
> > > > }}
>
> > > > ?>
>
> > > > --
> > > > However, this code gives me an error:
>
> > > > --
> > > > Notice: Undefined property: UsersController::$Ugroup in C:\server\www
> > > > \cake\basic_site\plugins\users\controllers\users_controller.php on
> > > > line 34
>
> > > > Fatal error: Call to a member function findByUgroup_id() on a non-
> > > > object in C:\server\www\cake\basic_site\plugin

Re: Only able to view home page

2007-12-12 Thread MrTufty

This is almost certainly a .htaccess issue. I suspect by default
either mod_rewrite is not turned on, or the rule for it is
AllowOverride None.

In the first instance, turn mod_rewrite on (ask your host for
information on how to do that, as it will vary).
In the second instance, change AllowOverride None to AllowOverride
All. I can't remember if you can do that directly through a .htaccess
file though.

On Dec 12, 8:40 am, Unite <[EMAIL PROTECTED]> wrote:
> www.adslgamer.co.zaif you go here you will see the page loads
> perfectly. If you try click on one of the menu links the corresponding
> page does not show but I get this error.
>
> The requested URL /pages/about was not found on this server.
>
> Additionally, a 404 Not Found error was encountered while trying to
> use an ErrorDocument to handle the request.
>
> The page does exist and works on my local machine but not this server
> hosted in another country. Have I set anything wrong in cakephp? If
> you need anymore information etc just let me know.
--~--~-~--~~~---~--~~
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: Help please for ultra-beginner

2007-12-12 Thread MrTufty

The error message you're getting tells you what the problem is... on
line 34, you're referring to $this->Ugroup->findByUgroupid().

This would be fine, except that you haven't told cake to give you
access to Ugroup in this way. I'm assuming you have a model for
Ugroup, and that it's associated with User in the correct way (which
would appear to be User belongsTo Ugroup, Ugroup hasMany User). This
would allow you to use... $this->User->Ugroup->findByUgroupid() to
achieve what you want.

Except by the magic of associations, you don't need to make the second
query, as Cake's magic will bring in the information you're looking
for with the first query, using a join.

This should give you an array in your $someone, something like this:

$someone = array(
   'User' => array( ... user details ...),
   'Ugroup' => array( ... usergroup details ...)
);

So you'll be able to refer to the Ugroup like this - $someone['Ugroup']
['perm_admin'].

Hope that helps!

On Dec 12, 7:37 am, Sanfly <[EMAIL PROTECTED]> wrote:
> No good im afraid, same error, except ugroup_id is now ugroupid
>
> 
> Notice: Undefined property: UsersController::$Ugroup in C:\server\www
> \cake\basic_site\plugins\users\controllers\users_controller.php on
> line 34
>
> Fatal error: Call to a member function findByUgroupid() on a non-
> object in C:\server\www\cake\basic_site\plugins\users\controllers
> \users_controller.php on line 34
> 
>
> On Dec 12, 7:31 pm, chad <[EMAIL PROTECTED]> wrote:
>
> > try findByUgroupId
>
> > On Dec 11, 10:08 pm, Sanfly <[EMAIL PROTECTED]> wrote:
>
> > > Hi
>
> > > Ive only just started mucking around with CakePHP, and am having a
> > > little trouble getting my head around the controllers and models
> > > thingees.  YES - I have tried looking in the manual!!
>
> > > Im trying to make a cake website that will more or less mirror some
> > > normal-non-framework php sites I have done.
>
> > > There is a table called users where all normal user data is stored
> > > (see below for table structure).  The ugroup table contains a
> > > ugroup_name and a number of "permissions" that dictate what the user
> > > will be able to access on the site.  The ugroup_id field in users
> > > indicates which ugroup the user belongs to.
>
> > > When the person logs in, I first want it to check that the user_name
> > > and user_pass are valid, then access the ugroups table to set the
> > > ugroup data (permissions) as sessions, which can then be called when I
> > > like throughout the rest of the site.
>
> > > users_controller.php
> > > -
> > >  > > class UsersController extends AppController
> > > {
>
> > > function login()
> > > {
> > > $this->set('error', false);
>
> > > if (!empty($this->data))
> > > {
> > > $someone = $this->User->findByUser_name($this->data['User']
> > > ['user_name']);
>
> > > if(!empty($someone['User']['user_pass']) &&
> > > $someone['User']['user_pass'] == md5($this->data['User']
> > > ['user_pass']))
> > > {
> > > $this->Session->write('User', $someone['User']);
>
> > > // Here is the code that is giving me 
> > > problems
> > > $perms = 
> > > $this->Ugroup->findByUgroup_id($someone['User']
> > > ['user_group']);
>
> > > if($perms['Ugroup']['perm_admin'] == "1"){
> > > $this->redirect('/pages/admin/');
> > > }
> > > else{
> > > $this->redirect('/');
> > > }
> > > // End Problem code
> > > }
> > > else
> > > {
> > >$this->set('error', true);
> > > }
> > > }
> > > }
>
> > > function logout()
> > > {
> > >$this->Session->delete('User');
>
> > > $this->redirect('/');
> > > }}
>
> > > ?>
>
> > > --
> > > However, this code gives me an error:
>
> > > --
> > > Notice: Undefined property: UsersController::$Ugroup in C:\server\www
> > > \cake\basic_site\plugins\users\controllers\users_controller.php on
> > > line 34
>
> > > Fatal error: Call to a member function findByUgroup_id() on a non-
> > > object in C:\server\www\cake\basic_site\plugins\users\controllers
> > > \users_controller.php on line 34
> > > --
>
> > > Can anyone point me in the right direction to solve this?  Sorry, but
> > > my cake knowledge is very limited and Im having trouble finding "cake
> > > for dummies" tutorials :s
>
> > > Thanks 

Re: Cake 1.2 isUnique validation

2007-11-30 Thread MrTufty

Good solutions Richard, nice one.

You may want to look into specifying the 'on' part of the validation
rule, which allows you to set whether the validation is done on
creating a new record, or updating an existing one. I'm not sure how,
if at all, that would tie into the code you've provided here.

On Nov 30, 9:43 am, RichardAtHome <[EMAIL PROTECTED]> wrote:
> If anyone else is looking for some drop in code to handle unique
> validation, here's what I came up with.
>
> This is a generic function you can drop into your app_model:
>
> /**
>  * checks is the field value is unqiue in the table
>  * note: we are overriding the default cakephp isUnique test as the
> original appears to be broken
>  *
>  * @param string $data Unused ($this->data is used instead)
>  * @param mnixed $fields field name (or array of field names) to
> validate
>  * @return boolean true if combination of fields is unique
>  */
>
> function checkUnique($data, $fields) {
>
> if (!is_array($fields)) {
>
> $fields = array($fields);
>
> }
>
> foreach($fields as $key) {
>
> $tmp[$key] = $this->data[$this->name][$key];
>
> }
>
> if (isset($this->data[$this->name][$this->primaryKey])) {
>
> $tmp[$this->primaryKey] = 
> "<>".$this->data[$this->name][$this->primaryKey];
>
> }
>
> return $this->isUnique($tmp, false);
>
> }
>
> }
>
> and is used in your model validate:
>
> var $validate = array(
> "name"=>array(
> "unique"=>array(
> "rule"=>array("checkUnique", array("name", 
> "institution_id")),
> "message"=>"A contact with that name already 
> exists for that
> institution"
> )
>
> )
>);
>
> It will handle single or multiple fields. e.g. In the example above,
> the combination of name AND instution_id must be unique.
>
> It also handles the 'edit' gotcha too.
>
> Thanks for all your help :-)
>
> On Nov 30, 6:35 am, RichardAtHome <[EMAIL PROTECTED]> wrote:
>
> > Thanks for the additional feedback.
>
> > I'd already discovered the 'edit' gotcha and created a workaround
> > similar to Involution's.
--~--~-~--~~~---~--~~
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: Cake 1.2 isUnique validation

2007-11-29 Thread MrTufty

And is entirely wrong... well, no, it'll work, but it doesn't take
advantage of CakePHP 1.2 validation. The IBM tutorials are good, but
outdated now.

Richard, as you suspect, you're not supposed to be referencing
isUnique in a rule. But, you don't need to use it in the controller.
Here's how you're supposed to do it:

1. Create a new function "checkUnique" inside the model you want to
validate - or even in AppModel, if you're planning on using the
functionality across multiple models. (you can actually call the
function whatever you like)
2. In your validation rule, change "isUnique" to "checkUnique", or
whatever you called the function.
3. The checkUnique function should basically call the isUnique
function.

It takes a bit of figuring out, but stick with the 1.2 validation
method rather than the old fallback methods. It's well worth it in
terms of code clarity and ease of use.

Here's an example of how I use it to ensure an email address can only
be registered once:

function checkUnique($data) {
return $this->isUnique(array('email' => $this->data['User']
['email']));
}

It shouldn't take much to make that generic, I just went for the
simplest solution.

On Nov 29, 3:58 pm, sMAshdot <[EMAIL PROTECTED]> wrote:
> On 29 Nov., 13:40, RichardAtHome <[EMAIL PROTECTED]> wrote:
>
> > As a side note, I suspect isUnique might not meant to be referenced in
> > a rule and is meant to be referenced in the controller. If this is
> > true can someone point me towards some examples of how / where it
> > should be used?
>
> I'm quite new to CakePHP as well, but I check for uniqueness after
> validating
> the data.
>
> This example comes from the IBM CakePHP 
> tutorialshttp://www.ibm.com/developerworks/views/opensource/libraryview.jsp?se...
>
> if ( $this->User->validates($this->data) )
> {
>   if ( $this->User->findByname($this->data['User']['name']) )
>   {
> $this->User->invalidate('name');
> $this->set('name_error', 'User already exists.');
>   }
>
> }
--~--~-~--~~~---~--~~
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: Everyone's Favourite... Auth

2007-11-23 Thread MrTufty

Thanks Chris - I've been trying that, and so far not having any luck,
but perhaps I'm just being slow. Will give it another crack in the
morning, it's past midnight here now... and I need beauty sleep!

On Nov 23, 11:57 pm, "Chris Hartjes" <[EMAIL PROTECTED]> wrote:
> On Nov 23, 2007 6:50 PM, MrTufty <[EMAIL PROTECTED]> wrote:
>
>
>
> > I'm trying to implement a remember me function - I initially thought
> > Chris' most recent post on the subject would help me out, but perhaps
> > I'm just not understanding how the pieces fit together.
>
> MrTufty,
>
> Well, all you really need to do is put the code that looks for the
> cookie in your beforeFilter().  That's all I had to do to make it
> work.  However, you might want to put this in
> AppController::beforeFilter() if you need auth to be application wide.
>
> Hope that helps.
>
> --
> Chris Hartjes
>
> My motto for 2007:  "Just build it, damnit!"
>
> @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
-~--~~~~--~~--~--~---



Everyone's Favourite... Auth

2007-11-23 Thread MrTufty

Hi everyone,

I'm having problems... and I'm hoping that with the meeting of minds
we have going on here, someone can point out where I'm going wrong.

I'm using 1.2 to build several sites at the moment - it's definitely
my framework of choice, for pretty much every site I build, personal
and for work. The majority of these sites have a common need - they
need to enable users to login.

To achieve this I'm using the AuthComponent (it's the natural choice)
- and I can get basic login working, some of the time. I must be
having blank spots though, because for the life of me, even with Chris
Hartjes' handy tutorials, and Geoff's previous ones on Lemoncake, I
can't proceed beyond very basic.

I'm trying to implement a remember me function - I initially thought
Chris' most recent post on the subject would help me out, but perhaps
I'm just not understanding how the pieces fit together.

My understanding of the usual way a remember me system works is that,
if the user is not already logged in, the system should look for a
cookie. If the cookie is found, it should validate the details and, if
valid, log the user into the site. This should be checked for on every
page load, whether authentication is required for that page or not. If
the cookie is invalid, it should naturally be deleted - no point
keeping it around.

Where I come up short is getting Cake and the AuthComponent to work
together with this. I can probably figure it out myself, with time -
but a simple description of exactly what I'm doing would be extremely
helpful.

Thanks everyone in advance.
--~--~-~--~~~---~--~~
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: Disabling cake on a subdomain for Joomla

2007-11-12 Thread MrTufty

Install Joomla into a folder in app/webroot/, then point your
subdomain at that.

I've successfully done this for phpBB (although user database
integration is an entirely different beast).

On Nov 11, 4:26 pm, chogi <[EMAIL PROTECTED]> wrote:
> Hey all,
>
> Got a quick question. I got cake running on my root folder of my
> shared host. I made a subdomain and i want to run joomla on it. But
> when I try to access the subdomain address, it shows "missing
> controller"
>
> Is there anyway to bypass cake or htaccess so that it doesnt look for
> the controller when I try to access the subdomain?
>
> Thanks,
> Chogi


--~--~-~--~~~---~--~~
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: Clean Cake 1.1 sigfaults apache2

2007-11-07 Thread MrTufty

I've seen this happen myself - do you have anything like Zend
Accelerator installed? I can't think what was causing it on my test
system (it was months ago, before I migrated to the fertile grounds of
1.2 development).

On Nov 7, 2:22 pm, MaxDao <[EMAIL PROTECTED]> wrote:
> Ok, I tried, it. In model method (model_php4.php) when I put die() on
> the fist line of the __construct(); - it still gives segfault.
>
> However model extends object. On the object constructor object() I
> tried die string from first line to last - every time I have segfault,
> now I think I've stuck in that..
>
> On Nov 6, 4:54 pm, AD7six <[EMAIL PROTECTED]> wrote:
>
> > On Nov 6, 3:31 pm, MaxDao <[EMAIL PROTECTED]> wrote:
>
> > > AD, this example (test class) that IS the code is I'm debuggind, where
> > > can it be more deep?
>
> > The line of code you have stopped on is a call to a method. go into
> > it.
>
> > hth,
>
> > AD


--~--~-~--~~~---~--~~
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: Read M S Doc using php from linux and windows

2007-11-07 Thread MrTufty

I suggest you do some research on that thing commonly called the
internet...

On Nov 7, 10:27 am, "NAREN KUMAR" <[EMAIL PROTECTED]> wrote:
> hi,
>
> iam new to this group.
>
>  i need code to Read MS WORD document and stores in string from linux
> system as well as from windows
>
> thanking u in advance


--~--~-~--~~~---~--~~
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: banging my head for last two days to find the blank line in RSS output

2007-11-07 Thread MrTufty

Skipping the ?> is actually something the Zend Framework people
require if you submit code to them - it's in their coding style guide.
Seems to work, but I couldn't get the habit - I hated not having
balanced elements!

On Nov 7, 11:21 am, bingo <[EMAIL PROTECTED]> wrote:
> hi Richard,
>
> oh Cool, I didn't knew that :-p.
>
> Regards,
> Ritesh
>
> On Nov 7, 5:26 am, RichardAtHome <[EMAIL PROTECTED]> wrote:
>
> > Another useful tip to cut down on these kind of errors in future is:
> > The closing php tag '?>' is optional so if you omit it you will never
> > have any unwanted trailing spaces ;-)


--~--~-~--~~~---~--~~
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: Missing controller - naming error

2007-11-03 Thread MrTufty

For the var $name, as far as I'm aware, you can't have a space in it.
So var $name = 'Quick Notes' would be wrong.

It will (probably) fix your problem if you change the above to var
$name = 'QuickNotes';


On Nov 3, 2:14 pm, Sabot <[EMAIL PROTECTED]> wrote:
> Hello bakers, I'm new to cake and trying to build test app for
> training. I'm receiving 'missing controller' error due to some problem
> with naming, despite I've followed cake's naming convention.
>
> I have table called 'quick_notes'
>
> And model 'quick_note.php':
>
>  class QuickNote extends AppModel
> {
>  var $name = 'Quick Note';}
>
> ?>
>
> And controller 'quick_notes_controller.php';
>
>  class QuickNotesController extends AppController
> {
> var $name = 'Quick Notes';
> var $scaffold;}
>
> ?>
>
> Seems to be ok, yet:
>
> Missing controller
> You are seeing this error because controller QuicknotesController
> could not be found.
> Fatal: Create the class below in file: app\controllers
> \quicknotes_controller.php
>
>  class QuicknotesController extends AppController {
>var $name = 'Quicknotes';}
>
> ?>
>
> Why is this happening?
>
> Cheers


--~--~-~--~~~---~--~~
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: Can i have url like domain/username

2007-10-31 Thread MrTufty

All things are possible with CakePHP. Well, almost - it won't make
your dinner for you or anything.

You need to look into custom routes, which you can set up in /app/
config/routes.php - that's about as much as I can tell you, because
I'm not 100% experienced with that aspect of Cake myself yet. But as
far as I can see, this would be very much possible.

One thing you should be aware of though - if you set up the routing
for this, you should also block users from having names which would
conflict with your controllers. Otherwise, you're going to run into
some rather nasty issues.

Good luck!

On Oct 31, 11:25 am, "HostOnNet.com" <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I have a web site that have user url like
>
> http://domain/USERNAME
>
> I know Cake PHP can handle url like
>
> http://domain/controller/USERNAME
>
> I want with out a controller name, likehttp://domain/USERNAME
>
> Is this possible with Cake PHP ?
>
> Thanks,
>
> Yujin


--~--~-~--~~~---~--~~
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: Variable error

2007-10-30 Thread MrTufty

Pos,

Really, you shouldn't have posted this here as it's a general PHP
question, not related to CakePHP at all.

But the thing you're doing wrong here is simple. Where you have:

echo var1;
echo var2;

You should have:

echo $var1;
echo $var2;

Variables need to be prefixed with $ wherever they are used, not just
when they are initially created.

Hope that helps, and good luck with your learning.


On Oct 30, 8:15 pm, Pos Weyb <[EMAIL PROTECTED]> wrote:
> Hi, I am a newbie to PHP.  I am working my way through a PHP class on
> Lynda.com and have run into the following error when trying to define
> simple variables.  I searched the messages for this type of error and
> I suspect I have an error reporting setting too high???   But I still
> don't know what to do about it!
>
> Here is my code:
>
> 
> 
>
> Variables
> 
>
>  
>   $var1 = 10;
>$var2 = "Ye Hah";
>echo var1;
>echo var2;
>   ?>
>  
> 
>
> Here is the error  message I get when I try to view it in my
> browser.
>
> Notice: Use of undefined constant var1 - assumed 'var1' in C:\wamp\www
> \php_sandbox\Variables.php on line 11
> var1
> Notice: Use of undefined constant var2 - assumed 'var2' in C:\wamp\www
> \php_sandbox\Variables.php on line 12
> var2
>
> Can anyone see what I am not seeing?  What am I doing wrong?
>
> Thanks
>
> Pos Weyb


--~--~-~--~~~---~--~~
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: The forbidden hack? | An attempt to redesign Cake View handling

2007-09-11 Thread MrTufty

On first glance, it sounds like you're trying to accomplish something
similar to Django's templating system. Now, I like that system - with
blocks that may or may not be replaced, being able to extend blocks,
and putting content in multiple places. I've tried to implement
something similar myself, but I gave up - I'm just not that good at
the minute!

I would definitely like to see something like this in Cake, but I
doubt it'll go in core at this stage...

On Sep 11, 3:11 pm, DanielSun <[EMAIL PROTECTED]> wrote:
> Hi. I'll go straight to code and contemplate later.
>
> MY_CONTROLLER
> {
> var $layout_element1=null;
> var $layout_element2=null;
>
> function foo(){
>   $this->layout_element1=$this->render('element1view');
>   echo $this->__viewClass->renderLayout('nothing');
>
> }
>
> layout default.thtml
> {
> 
>  echo $this->controller->layout_element1;
> 
> 
>  echo $this->controller->layout_element2;
> 
>
> }
>
> For this to work I had to HACK CORE CakePHP View class:
> - line 300: comment out  $out = $this->renderLayout($out); which calls
> renderLayout (to be able to call it from my_controller)
> - line 306: comment out print $out;
> - line 312: return $out; instead return true;  to be able to pass the
> output to a variable inside controller instead of printing it out by
> default.
>
> Notes:
> - set() method now passes variables to View NOT to layout. Layout
> directly calls the controller variables.
> - elements can still be called from within layout, view or even
> controller.
> - one can develop as many elements on the same page and pass any view
> into them. views DONT render Layouts anymore, Controller does.
> - renderLayout() only renders layout. Anything that you pass will be
> passed to $content_for_layout in Layout.
>
> I believe that due to my poor understanding such a hack might terribly
> interfere with cake's view rendering. I would be checking especially
> the downside of calling the view instance (__viewClass) from within
> controller, which has been initiated in first render() call.
>
> The REASON for this hack is, that I still haven't found any viable way
> to implement "multi-$content_for_layout" template-driven app
> architecture, which seems to me as not optimal in cakePHP.
>
> A part of controller logic which is supposed to handle multiple page
> elements (left column contents, etc) is in original Cake pushed either
> into Views (since there is only one $content_for_layout) or to Layout
> with use of elements. Both is not optimal from the point of view of
> layout design separation and in complex page layouts produces a mess
> in views/elements folders.
> I rather see that all the controller actions are done inside a
> controller class, views are rendered and then referred back to
> controller where they are passed to respective variables later called
> from Layout.
> A solution with use of requestAction() has been proposed before, but I
> wouldn't see why the same controller would have to be called twice
> only to render two different html elements on the same page.
>
> I would strongly appreciate your comments on this hack.


--~--~-~--~~~---~--~~
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: AuthComponent - Alternate ways to hash passwords?

2007-09-07 Thread MrTufty

Thanks, it'll give me a starting point to look at!

I was thinking I could probably just extend the AuthComponent,
override a few functions and build it up that way. Will try that when
I get some dev time to sit down and try it.

On Sep 6, 12:46 pm, francky06l <[EMAIL PROTECTED]> wrote:
> I had the same problem, and some others ..I use the Auth components
> but made few changes in the application wihtout modifications to the
> core :
>
> - do not use the name "password" in the views (login or other user
> management views), but another "dummy" name. Handle this dummy name
> (hash or whatever and replace in your password field) prior to save.
> - do not use the login function of Auth component direct. Instead make
> your own "login" method and pass the id of your user record to the
> Auth component  => it will read the record using the id (not comparing
> password), ans store the User record in session.
>
> Hope this helps
>
> On Sep 6, 1:33 pm, MrTufty <[EMAIL PROTECTED]> wrote:
>
> > Hi all,
>
> > Just a quick question - I've searched, but found nothing definitive.
>
> > I'm building my site with Cake and I've decided to use the built-in
> > ACL/Auth stuff rather than write my own (mostly because I'm sure
> > you're all a lot smarter than I am, and if it works for you, then
> > it'll probably work for me).
>
> > However... I'm not a fan of the way that the passwords appear to be
> > getting hashed, using the CAKE_SESSION_STRING as a salt value. In
> > general I prefer to generate a random salt value for each user. Ok, it
> > means an extra DB query (to retrieve the user's salt value) for pretty
> > much every page request, but I think that it's worth it from the point
> > of view of security (I'm paranoid I guess).
>
> > I've just successfully built a site using a system like this (non-Cake
> > though - my employers balked at my previous Cake sites because my
> > colleagues couldn't understand the code - they said they needed to go
> > on a training course to figure it out!).
>
> > Is there a way to make my Cake site salt/hash the passwords in this
> > way? If so, where should I be making changes/overriding functions in
> > order to make it happen?
>
> > Thanks!
>
> > Steve


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



AuthComponent - Alternate ways to hash passwords?

2007-09-06 Thread MrTufty

Hi all,

Just a quick question - I've searched, but found nothing definitive.

I'm building my site with Cake and I've decided to use the built-in
ACL/Auth stuff rather than write my own (mostly because I'm sure
you're all a lot smarter than I am, and if it works for you, then
it'll probably work for me).

However... I'm not a fan of the way that the passwords appear to be
getting hashed, using the CAKE_SESSION_STRING as a salt value. In
general I prefer to generate a random salt value for each user. Ok, it
means an extra DB query (to retrieve the user's salt value) for pretty
much every page request, but I think that it's worth it from the point
of view of security (I'm paranoid I guess).

I've just successfully built a site using a system like this (non-Cake
though - my employers balked at my previous Cake sites because my
colleagues couldn't understand the code - they said they needed to go
on a training course to figure it out!).

Is there a way to make my Cake site salt/hash the passwords in this
way? If so, where should I be making changes/overriding functions in
order to make it happen?

Thanks!

Steve


--~--~-~--~~~---~--~~
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: Model Save bug? (CakePHP 1.2 & MySQL)

2007-09-04 Thread MrTufty

I doubt it's a bug with Cake... if you have fields specifically set to
be unique in the database, then nothing Cake can do should allow NON-
unique fields. Seems very strange. I would imagine that the records
that appear to be non-unique actually are unique, but probably with
hidden characters or something of that sort.

Do you have any more details?

On Sep 4, 1:17 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> In table I have two fields UNIQUE.
>
> When I set debug level = 1, after Model->save, I can see: "MySQL
> warning" & I get my own warning, which show, when Model->save fail.
>
> But, when I switch into debug level = 0 . I don't see any warning and
> get records in my table with non unique fields!
>
> It's bug?


--~--~-~--~~~---~--~~
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: wrong coding in layout variables from beforeRender function

2007-09-04 Thread MrTufty

Anna,

Do you also have the line:

echo $html->charset('UTF-8');

in your layout, as suggested above? The commands you say you have in
your layout don't get parsed by the browser, whereas the  tag which is
inserted by $html->charset(); does. This could account for your
problems, if not.

Hope this helps!

On Sep 4, 12:54 pm, Anna P <[EMAIL PROTECTED]> wrote:
> Yes it is:]. In fact, in the layout I use:
>  header('Content-Type: text/html; charset=utf-8');?>
> at the beggining, so the browser knows what the encoding is.


--~--~-~--~~~---~--~~
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: Newbie: Split form accross three views ?

2007-08-21 Thread MrTufty

It's possible to do anything with Cake that you can with standard PHP
and then some.

Depending on how you wanted it to work, you could use $_POST, or
$_SESSION as you say.

$_POST would just involve having a bunch of hidden fields that you
store the information from the earlier steps into.

I don't think you'll be able to bake it though, probably a manual job!

Tufty

On Aug 21, 8:59 am, _olsen <[EMAIL PROTECTED]> wrote:
> Hello,
>
> is it possible with cake 1.2 to split a form in three views,
>
> example:
>
> http://myurl.com/addhttp://myurl.com/add2http://myurl.com/add3
>
> I want that the last view records the stuff from the other views into
> the db,
> so I have to use session.
>
> I baked one view and the tried to splitt. but I lost the data from the
> two other views..
>
> Please give me a little kick,
>
> :)
>
> Thanks,
>
> olsen


--~--~-~--~~~---~--~~
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 can I updated table using checkboxes and button

2007-08-16 Thread MrTufty

Or, not.

You should be able to figure this one out for yourself with minimal
work. What, you want us to write your code for you now?

Steve

On Aug 16, 9:02 am, nirmal <[EMAIL PROTECTED]> wrote:
> Please give me an example with code.
> :)
>
> On Aug 14, 11:20 pm, Ketan Patel <[EMAIL PROTECTED]> wrote:
>
> > Do pr($this->data) in your controller action after you post the form,
> > this will give you all the information about what variables you have
> > available tosave. Start from there.
>
> > Cheers,
> > Ketanhttp://www.eclassifieds4u.com
>
> > nirmal wrote:
> > > Hi,
>
> > > I want to update a column in table using checkboxes andbutton.
> > > I have a template it showing me table data with checkboxes.
> > > When i will select checkbox and then i will click on abutton. I want
> > > to update all the values for selected checkboxes.
>
> > > Please help me its urgent.
>
> > > --
> > > Nirmal


--~--~-~--~~~---~--~~
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: One Install, Multiple Apps

2007-08-14 Thread MrTufty

Shawn,

As Ketan says, you've slightly misunderstood how Cake's URLs map to
controllers.

In your case:
/news/edit/1
would point to (unless using routing to achieve a different result):
News Controller > Edit Action > Parameter 1 (whether that's an
article, or an item, or whatever)

/poll/edit/1
would point to: Poll Controller > Edit Action > Parameter 1

There's more to it, but that's the core of URLs in Cake.

Steve

On Aug 14, 7:14 pm, Ketan Patel <[EMAIL PROTECTED]> wrote:
> Shawn,
>
> I think you have to read the manual first. Edit is not a controller,
> it is an action for the controller. So for your case, poll, news are
> the controller.
>
> Cheers,
> Ketan
>
> starkey wrote:
> > On Aug 14, 11:13 am, Joel Stein <[EMAIL PROTECTED]> wrote:
> > > Why not just make these all in one application, but with several
> > > controllers?  Then you can tie them together with AppController.
>
> > Thanks for your reply. I don't think I can because I need my URLs to
> > be similar to:
> >http://www.domain.edu/news/edit/1
> >http://www.domain.edu/poll/edit/1
>
> > Can I have two "edit" controllers/views if everything is in one
> > application?  Would you have a moment to explain how?  I sure would
> > appreciate it!  Keep in mind that there are about a dozen programs
> > planned so putting all "edit" logic in one controller would not be
> > practical.
>
> > Thanks!
> > Shawn


--~--~-~--~~~---~--~~
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: CakePHP+SMF (again?)

2007-08-08 Thread MrTufty

For the record, I think you've gone a very much more complicated way
around this than was necessary - I may be wrong, depending on exactly
what you're trying to achieve, but wouldn't it have been simpler to
hook into the SMF login/logout scripts from within your Cake apps?
That way you would still effectively have 2 sessions, which would
contain the same data (because you've written it to do that) but the 2
applications would be sharing information. I don't know what SMF's
support is for doing stuff like that, I know that some of the other
forum software allows it though.

I'm just very confused as to what you're trying to do...

Tufty

On Aug 8, 8:06 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> Hi,
>
> It looks like I have solved the problem. SMF stores the session ID as
> default in the PHPSESSID cookie. Since CakePHP is checking it's own
> cookie for the session ID and cannot find it, it creates another
> cookie. So I solved the problem (I think) by changing CakePHP to
> simply use the PHPSESSID cookie for it's session. This way, regardless
> of which creates the session first (Cake or SMF), they use the same
> session.
>
> Is there a compelling reason that Cake was built to store it in a
> different cookie apart from flexibility (for example--security)?
> Thanks again.
>
> - Sohum.
>
> On Aug 7, 2:58 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
> wrote:
>
> > Hi,
>
> > I had actually tried this solution earlier but it seems that CakePHP
> > only stores the session ID as a string in the cookie, whereas SMF
> > seems to store other data as well. There may be a way to change SMF to
> > have session-based data storage rather than cookie-based, which is
> > something I will check in the SMF documentation. It also seems as if
> > CakePHP rewrites that cookie on every pageload, because when I tried
> > manually setting the CakePHP cookie to point to a different session
> > ID, it got rewritten on page reload.
>
> > I'll see if I can figure out also from the SMF forum what exactly is
> > being stored in that cookie. Is it hard to completely disable the Cake
> > Session component? It seems like it could be a lot easier just for the
> > SMF session to be used for everything and CakePHP sessions not be
> > created.
>
> > I'll play around for a couple more hours to see if I can make any
> > progress.
>
> > - Sohum.
>
> > On Aug 7, 2:52 pm, Geoff Ford <[EMAIL PROTECTED]> wrote:
>
> > > The cookies need to be the same name.  They are looking for different
> > > cookies that tell what the session id is.
>
> > > Geoff
> > > --http://lemoncake.wordpress.com
>
> > > On Aug 7, 2:39 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
> > > wrote:
>
> > > > Hi,
>
> > > > Currently they are both using the database version of storing session
> > > > data. I am confused, then, why a new session is created when one goes
> > > > from one area of the site to another. For example, if I go into the
> > > > Cake portion first, then a CAKEPHP cookie is created with a new
> > > > session id that is added to the database. When I go to the SMF
> > > > section, another session is created and another cookie is created
> > > > (SMFCookie655). Is this because they have different cookie names? The
> > > > SMF path is "/" whereas the Cake cookie path is the cake application
> > > > directory. They will both be the same on the production server,
> > > > though.
>
> > > > - Sohum.
>
> > > > On Aug 7, 3:59 am, "Geoff Ford" <[EMAIL PROTECTED]> wrote:
>
> > > > > I don't know the details of the cake session component, or sessions in
> > > > > general, but I believe that the sessions work by creating a cookie 
> > > > > with a
> > > > > unique code.  This code points to the session file (or db record) 
> > > > > where the
> > > > > session data is stored.
>
> > > > > So from my understanding, as long as both smf and cakephp use the same
> > > > > cookie name, and that cookie has a path that is high enough in the 
> > > > > domain
> > > > > path to cover both applications, then they will share the session 
> > > > > data.
>
> > > > > If smf is using a custom session handler, such as a database or 
> > > > > similar, you
> > > > > will have to replicate that session handler for the cake stuff.  If 
> > > > > they are
> > > > > both using the built in php file based session there should be no 
> > > > > drama.
>
> > > > > Geoff
>
> > > > > On 8/7/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> > > > > > Hmm.
>
> > > > > > Maybe I should just ignore Cake sessions? Do sessions also have a 
> > > > > > path
> > > > > > defined, and would this path have to be set to the server root or 
> > > > > > the
> > > > > > cake root in SMF for that session data to transcend to the Cake
> > > > > > application? I cannot see why else Cake would create a new session
> > > > > > when there was already a session defined on that domain.
>
> > > > > > - Sohum.
>
> > > > > > On Aug 6, 7:38 pm, "Chris Hartjes" <[EMAIL PROTECTED]> wrote:
> > > > > > > On 8/6/07, [EMAIL

Re: html->submit() does not exists?

2007-06-15 Thread MrTufty

The link works fine here.

If you don't need the div wrappers, don't use the form helper. Simple
really.

To create a form Cake can work with without using the form helper,
specify the names of the input tags like data[Model][field] - that
will then work without having to restructure the input. There's other
ways to do it but I've not looked into them, I just use CSS to fix the
layouts.

On Jun 15, 5:46 pm, Mech7 <[EMAIL PROTECTED]> wrote:
> hmm i see but this link does not seem to work?
>
> http://bakery.cakephp.org/articles/view/multiple-rules-of-validation-...
>
> Also how do i use the form helper without it generating all sorts of
> html i don't need like div wrappers 0_o
>
> On 15 jun, 08:28, MrTufty <[EMAIL PROTECTED]> wrote:
>
> > Actually, your var $validate line there should go in your model.
> > Typo? :)
>
> > As for the other stuff, check the links provided :)
>
> > On Jun 14, 7:50 pm, Mech7 <[EMAIL PROTECTED]> wrote:
>
> > > Thanks i found what goes in my controller±
>
> > > // Validator
> > > var $validate = array('title' => array('rule' => array('between', 
> > > 3,
> > > 255)));
>
> > > But what else needs to go in my view and function..
>
> > > Btw all characters goes wrong only on this page with my keyboard, no
> > > other apps have this.
>
> > > On 14 jun, 18:11, francky06l <[EMAIL PROTECTED]> wrote:
>
> > > > very quick search in this groups gives a lot of threads: one of them :
>
> > > >http://groups.google.com/group/cake-php/browse_thread/thread/a40053f4...
>
> > > > On Jun 14, 5:58 pm, Mech7 <[EMAIL PROTECTED]> wrote:
>
> > > > > Ah found it thx, is there any example on how to use validators with
> > > > > the form class btw.
>
> > > > > On 14 jun, 17:52, francky06l <[EMAIL PROTECTED]> wrote:
>
> > > > > > Most of the html helper function concerning form have been moved to
> > > > > > the form helpers. Check the form.php into the cake core files (ie :
> > > > > > $form->submit)
>
> > > > > > On Jun 14, 5:34 pm, Mech7 <[EMAIL PROTECTED]> wrote:
>
> > > > > > > I get this error in 1.2 when i try the blog tut..
>
> > > > > > > Warning (512): Method HtmlHelper::submit does not exist 
> > > > > > > [CORE\cake\libs
> > > > > > > \view\helper.php, line 148]
>
> > > > > > > With code
>
> > > > > > > submit('Save') ?>
>
> > > > > > > It still is in the var of html.php though?
>
> > > > > > > 'submit' => '',
>
> > > > > > > only no function anymore ?


--~--~-~--~~~---~--~~
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: html->submit() does not exists?

2007-06-14 Thread MrTufty

Actually, your var $validate line there should go in your model.
Typo? :)

As for the other stuff, check the links provided :)

On Jun 14, 7:50 pm, Mech7 <[EMAIL PROTECTED]> wrote:
> Thanks i found what goes in my controller±
>
> // Validator
> var $validate = array('title' => array('rule' => array('between', 3,
> 255)));
>
> But what else needs to go in my view and function..
>
> Btw all characters goes wrong only on this page with my keyboard, no
> other apps have this.
>
> On 14 jun, 18:11, francky06l <[EMAIL PROTECTED]> wrote:
>
> > very quick search in this groups gives a lot of threads: one of them :
>
> >http://groups.google.com/group/cake-php/browse_thread/thread/a40053f4...
>
> > On Jun 14, 5:58 pm, Mech7 <[EMAIL PROTECTED]> wrote:
>
> > > Ah found it thx, is there any example on how to use validators with
> > > the form class btw.
>
> > > On 14 jun, 17:52, francky06l <[EMAIL PROTECTED]> wrote:
>
> > > > Most of the html helper function concerning form have been moved to
> > > > the form helpers. Check the form.php into the cake core files (ie :
> > > > $form->submit)
>
> > > > On Jun 14, 5:34 pm, Mech7 <[EMAIL PROTECTED]> wrote:
>
> > > > > I get this error in 1.2 when i try the blog tut..
>
> > > > > Warning (512): Method HtmlHelper::submit does not exist 
> > > > > [CORE\cake\libs
> > > > > \view\helper.php, line 148]
>
> > > > > With code
>
> > > > > submit('Save') ?>
>
> > > > > It still is in the var of html.php though?
>
> > > > > 'submit' => '',
>
> > > > > only no function anymore ?


--~--~-~--~~~---~--~~
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 display a session timeout message to the user

2007-06-06 Thread MrTufty

There's no way to do that with the built-in Session component in Cake.
At least, not directly. You'll find that your solution will involve a
User model, and probably some work with the beforeFilter in
AppController. The concept would be to store some form of timestamp in
the session, if it's older than (now - 20 minutes) you automatically
log the user out and display the message.

I can't be more helpful than this because I haven't implemented such a
system myself, and it may be more complex than I think.

On Jun 6, 3:03 pm, uk_maul <[EMAIL PROTECTED]> wrote:
> Hello
>
> I have been searching on the cakephp group and on the internet but I
> still haven't found a way to display a "You have been logged out due
> to X minutes due to inactivity" message to the user. Please let me
> know if anyone has done something similar in Cake. My Session security
> is set to low now meaning 60 minutes of inactivity before we logout
> the user.
>
> Regards
>
> -- Forwarded message --
> From: uk_maul <[EMAIL PROTECTED]>
> Date: Jun 2, 10:55 am
> Subject: How to display a session timeout message to the user
> To: Cake PHP
>
> Hi
>
> I see that my Cake session security default is set to MEDIUM - which
> logs out a user after 20 minutes of inactivity. I want to display an
> error message to the user saying that "You have been logged out due to
> sessiontimeout, please login again". Please let me know how I can do
> this in CakePHP.
>
> Regards


--~--~-~--~~~---~--~~
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: Member Methods in Views

2007-06-06 Thread MrTufty

To weigh in on this one, presumably this limitation will go away once
Cake starts returning objects instead of arrays, which (last I
checked) was still slated for 2.0? From my point of view it's not a
big deal, it's a nice-to-have rather than a must-have.

Chris is definitely correct - if you can't do it the way you want to,
you're probably pushing against the framework rather than working with
it.

On Jun 6, 2:27 pm, "Chris Hartjes" <[EMAIL PROTECTED]> wrote:
> On 6/6/07, unimatrixZxero <[EMAIL PROTECTED]> wrote:
>
>
>
> > He only wants to CALL the methods from the view, which is perfectly
> > fine. This does not contradict MVC in any way. In Ruby on Rails you
> > can do this. The reason this doesn't work in Cake PHP is simply one of
> > it's shortcomings. The ActiveRecord pattern is not done
> > 'correctly' (i.e. not all aspects are implemented). A row should
> > correspond to an object. (http://en.wikipedia.org/wiki/Active_record_pattern
>
> CakePHP has a set of rules, and one of those rules is "thou shalt not
> call models from your views".  Yes, that sucks when you want to do it.
>  I'm sure Craig is smart enough to figure it out using CakePHP's
> rules.  I've often found that when you can't do something a certain
> way in any given application framework, chances are you are probably
> taking the wrong approach.  Be flexible. :)
>
> --
> Chris Hartjes
>
> 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: dynamic connection according environment

2007-06-05 Thread MrTufty

The easiest technique I've seen used an additional to the database.php
in app/config, which sets the DB config based on the host. There's
some code floating around somewhere, but I can't remember where the
link was at the moment. Perhaps someone else knows what I'm talking
about!

On Jun 5, 3:34 am, LePetitNicolas <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I would use the AppModel as mentioned before.
>
> A simple approach (in Cake 1.1.x.x) :
>
> Define a constant in your app/bootstrap.php file
> 
> //...
> define('DEV_HTTP_HOST', 'example.dev');
> //...
> 
>
> and then set $useDbConfig in your AppModel
> 
> function __construct()
> {
> //...
> if ($_SERVER['HTTP_HOST'] == DEV_HTTP_HOST)
> {
> $this->useDbConfig = 'development_connection';}
>
> //...
> parent::__construct();}
>
> 
>
> Hope this helps!
>
> On Jun 4, 11:52 pm, PiLLo <[EMAIL PROTECTED]> wrote:
> ...


--~--~-~--~~~---~--~~
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: Dynamically Create a Model and Bind it to a Table?

2007-05-31 Thread MrTufty

>From everything I've picked up and learned over the years I've been
developing, the sort of solution you're suggesting is a definite OMG
what the hell are you doing? situation.

If you're having to deal with items that may have different
information specified, why not do something a little different...

Events>Event_Fields

In other words, you have an Events table that holds ID numbers and any
information that DOES get captured for every single event, and an
EventFields table which stores additional information, one item per
field. The rough schema would be something like this...

Events
-
id
name
start_date
end_date

EventFields
--
id
event_id
field_name
field_value

You could even set it up so you had another model containing available
fields which would specify the types of information you were wanting
to capture (just so you can control it a little bit - you could use
this model to populate a select box, for example). Then you'd tie that
in and add field_id to EventFields in place of field_name, or as well
as.

Please note that I've not actually developed the code behind this
idea, it should work though. I'd be interested to know what other
people think... I'm certain it's a better solution than dynamically
creating tables and models, but HOW much better?

On May 31, 10:17 pm, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:
> That would be an awful lot of tables in your database and it seems
> like it might lead to some potentially hairy code.  Have you
> considered saving the event information as arrays and then saving the
> serialized arrays into a single table?  I would think it would be a
> lot easier to extract varying properties from out of arrays then
> tables with different numbers of fields.
>
> On May 31, 1:05 pm, Wole <[EMAIL PROTECTED]> wrote:
>
> > I am developing an events registration Web application that collects
> > event specific information from registrants and stores the information
> > in a database table. The application works by assigning an id to each
> > new event then using this id as the name of the table that will hold
> > registrants' information.
>
> > The problem comes when I need to access the data for an event. I
> > cannot setup a model file ahead of time because the tables are created
> > dynamically . Also, I cannot combine all event data into one table
> > because the information collected from each event varies and hence so
> > will the number of columns and column data types in each table.
>
> > Is there a way to dynamically create a model and bind a table to that
> > model? In other words, is there a way for me to switch between tables
> > using a single model? Thanks.


--~--~-~--~~~---~--~~
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 scalable is this framework

2007-05-21 Thread MrTufty

Amen. I came from Symfony to CakePHP. Everything about Cake is so much
smoother than Symfony. From the lack of YAML to the lack of Propel,
everything fits so much better. For me it's the speed of development
that counts. I've recently finished a site for work using the 1.2
version which took less than 3 days working time. Including user
authentication which I built myself (until the docs for the Auth
component are finished ;))

On May 21, 3:47 pm, "Mariano Iglesias" <[EMAIL PROTECTED]>
wrote:
> There have been benchmarks that show that Symfony is much slower than
> CakePHP.
>
> If you want your application to go to hell just because you left an extra
> TAB on one of the hundred configuration files you need to set up, then
> Symfony is your choice.
>
> If you want old-school, vanilla-like, almost assembler style coding to query
> your models, then Symfony is your choice.
>
> If you want specific hardware necessities, instead of you having the liberty
> to choose what your environment will be like, then Symfony is your choice.
>
> If you want to use an open source project that has so many external
> dependencies that cannot really dictate where it is going in the future,
> then Symfony is your choice.
>
> Now if you want to actually build your application, using the best framework
> that is out there, as scalable and flexible as it can get without any loss
> on performance, then go with CakePHP.
>
> -MI
>
> ---
>
> Remember, smart coders answer ten questions for every question they ask.
> So be smart, be cool, and share your knowledge.
>
> BAKE ON!
>
> blog:http://www.MarianoIglesias.com.ar
>
> -Mensaje original-
> De: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] En nombre
> de Javier Eguiluz
> Enviado el: Lunes, 21 de Mayo de 2007 04:08 a.m.
> Para: Cake PHP
> Asunto: Re: how scalable is this framework
>
> For real world proven performance you can consider Symfony PHP
> framework (http://www.symfony-project.com/). Yahoo Bookmarks (20
> million users, 12 languages) is built with Symfony 
> (source:http://devzone.zend.com/node/view/id/1118).


--~--~-~--~~~---~--~~
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: session serialize handler

2007-05-15 Thread MrTufty

Jyrgen,

I still don't understand why you feel the need to override Cake's
internal session handling in favour of your own.

It's simple, ok. If you want to read the existing session just use
$this->Session->read('User.username'); or $session-
>read('User.username'); in the view. Obviously this would need
customising to exactly what you call your fields, but you should be
able to work with that to get the information you're looking for.

Stephen Orr

On May 15, 8:46 pm, "Chris Hartjes" <[EMAIL PROTECTED]> wrote:
> On 5/15/07, jyrgen <[EMAIL PROTECTED]> wrote:
>
>
>
> > thats it. no magic with " | " signs, or custom deserialization.
>
> The magic is the way PHP stores sessions itself.  Honest.  Again, go
> read up on custom session handlers because it does explain how PHP
> stores the session data if you go with the defaults.
>
> --
> Chris Hartjes
>
> 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: Advanced Installation

2007-05-11 Thread MrTufty

It's ok guys, I was being stupid. Fixed it now, I just needed to pay
more attention to the error output PHP was giving me - it was looking
in entirely the wrong folders for my config files!

On May 11, 7:33 am, MrTufty <[EMAIL PROTECTED]> wrote:
> Hi guys,
>
> I know I'm probably being really really thick, but I can't get my head
> around something. I've been using Cake for months now - on my own
> site, and also for sites at work.
>
> All the sites at work are set up as just standard installations, with
> the files unpacked inside htdocs. They work fine, no problems at all.
>
> My personal site is installed slightly differently, with htdocs being
> alongside the other folders (I originally followed the advanced
> installation tutorials on the Wiki, and wanted to keep the application
> files out of public access).
>
> Now though, I want to move things around. I've recently added a couple
> of extra domains to my server, so I've done some reorganisation to
> make them all easier to manage. That's fine, except Cake breaks. This
> is how I've got it set up at the minute, below that is how I want it
> to be.
>
> NOW:
> /
> /app
> /cake
> /htdocs
> /vendors
> /site_a
> ---/htdocs
> /site_b
> ---/htdocs
>
> FUTURE
> /
> /site_a/
> ---/app
> ---/cake
> ---/htdocs
> ---/vendors
> /site_b/
> ---/app
> ---/cake
> ---/htdocs
> ---/vendors
> /site_c/
> ---/app
> ---/cake
> ---/htdocs
> ---/vendors
>
> As you can see I'm intending on using Cake for all the sites. I'll
> probably at some point want to share the Cake files but I decided to
> keep them separate for now.
>
> What I get at the moment when I attempt to set up Cake in this
> structure is a whole load of Page Not Found errors. I'm guessing
> the .htaccess files are redirecting to the wrong places, but I've
> checked them and I'm not seeing the problem. I've also tried changing
> the index.php in htdocs (which SHOULD be the one that's getting
> called, and indeed from my tests it does seem to be). All I get in
> that case is errors about not being able to find config/core.php, or
> cake/bootstrap.php.
>
> I suspect I may not be changing the paths correctly, or making my
> changes to the wrong file, because everything I've done seems to be
> ok. Perhaps it's how my host is handling the redirections internally.
>
> Any advice 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
-~--~~~~--~~--~--~---



Advanced Installation

2007-05-10 Thread MrTufty

Hi guys,

I know I'm probably being really really thick, but I can't get my head
around something. I've been using Cake for months now - on my own
site, and also for sites at work.

All the sites at work are set up as just standard installations, with
the files unpacked inside htdocs. They work fine, no problems at all.

My personal site is installed slightly differently, with htdocs being
alongside the other folders (I originally followed the advanced
installation tutorials on the Wiki, and wanted to keep the application
files out of public access).

Now though, I want to move things around. I've recently added a couple
of extra domains to my server, so I've done some reorganisation to
make them all easier to manage. That's fine, except Cake breaks. This
is how I've got it set up at the minute, below that is how I want it
to be.

NOW:
/
/app
/cake
/htdocs
/vendors
/site_a
---/htdocs
/site_b
---/htdocs

FUTURE
/
/site_a/
---/app
---/cake
---/htdocs
---/vendors
/site_b/
---/app
---/cake
---/htdocs
---/vendors
/site_c/
---/app
---/cake
---/htdocs
---/vendors

As you can see I'm intending on using Cake for all the sites. I'll
probably at some point want to share the Cake files but I decided to
keep them separate for now.

What I get at the moment when I attempt to set up Cake in this
structure is a whole load of Page Not Found errors. I'm guessing
the .htaccess files are redirecting to the wrong places, but I've
checked them and I'm not seeing the problem. I've also tried changing
the index.php in htdocs (which SHOULD be the one that's getting
called, and indeed from my tests it does seem to be). All I get in
that case is errors about not being able to find config/core.php, or
cake/bootstrap.php.

I suspect I may not be changing the paths correctly, or making my
changes to the wrong file, because everything I've done seems to be
ok. Perhaps it's how my host is handling the redirections internally.

Any advice 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: Pagination - rendering the counter differently

2007-04-04 Thread MrTufty

Nope, that seems very simple! Thanks nate!

On Apr 3, 6:34 pm, "nate" <[EMAIL PROTECTED]> wrote:
> $params = $paginator->params();
>
> echo $paginator->prev('<< Previous') . ' | ';
> for ($i = 1; $i <= $params['pageCount']; $i++) {
> if ($i == $params['page']) {
> echo $i;
> } else {
> echo $paginator->link($i, array('page' => $i));
> }
> echo ' | ';
> }
> echo $paginator->next('Next >>');
>
> Any questions?
>
> On Apr 3, 10:21 am, "Frank P" <[EMAIL PROTECTED]> wrote:
>
> > I needed to do this too, but the current paginator helper doesn't
> > support it. But the work has been done for you. If you copy /cake/libs/
> > view/helpers/paginator.php to /app/views/helpers/paginator.php and
> > apply the patch from this ticket:https://trac.cakephp.org/ticket/2202
> > , then you can use the new pageNumbers function like so:
>
> > pageNumbers(array('maxPages'=>5), ' ');?>
>
> > Take a look at the pageNumbers function's comments. It works pretty
> > much like you would expect.
>
> > - Frank
>
> > On Apr 3, 9:31 am, "MrTufty" <[EMAIL PROTECTED]> wrote:
>
> > > Hi all,
>
> > > I've been developing a few sites in Cake for internal use, to
> > > demonstrate its power to my bosses.
>
> > > I'm using 1.2, and the Pagination helper quite a lot (for some reason
> > > they want all the content to fit on an 800x600 screen, so I have a LOT
> > > of multiple page sections).
>
> > > Currently, the helper renders my pagination links like this:
>
> > > << Previous | Page 1 of 5 | Next >>
>
> > > Which I thought was fine, it works well enough. But what they're
> > > asking for is something more like this:
>
> > > << Previous | 1 2 3 4 5 | Next >>
>
> > > Is it possible to do it this way with the pagination code as is, or do
> > > I have to look for an alternate way to get it working the way they
> > > want?
>
> > > Thanks in advance for any help :)


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Pagination - rendering the counter differently

2007-04-03 Thread MrTufty

Hi all,

I've been developing a few sites in Cake for internal use, to
demonstrate its power to my bosses.

I'm using 1.2, and the Pagination helper quite a lot (for some reason
they want all the content to fit on an 800x600 screen, so I have a LOT
of multiple page sections).

Currently, the helper renders my pagination links like this:

<< Previous | Page 1 of 5 | Next >>

Which I thought was fine, it works well enough. But what they're
asking for is something more like this:

<< Previous | 1 2 3 4 5 | Next >>

Is it possible to do it this way with the pagination code as is, or do
I have to look for an alternate way to get it working the way they
want?

Thanks in advance for any help :)


--~--~-~--~~~---~--~~
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: Newbie questions

2007-03-27 Thread MrTufty

If you're not sure how to manage the layout structure yet, the last
thing you need is medium/advanced tutorials.

Cake is very simple to learn the basics of, and extremely powerful
once you've gotten your head around the conventions.

To be able to help, you'll need to say which version you're presently
using: 1.1 is currently the stable release, but I use the 1.2 dev
release because I want the very latest features and I know enough to
be able to figure out what's going wrong when something does (which
isn't all that often :))

In any case, feelexit's advice is slightly inaccurate.

Under /app/views/layouts/, if you don't already have one, create a
file called either default.thtml (for 1.1) or default.ctp (for 1.2).
This is your basic layout file, whatever you put in this file will be
output every time. There's more advanced things you can do with
layouts, but for the moment I'd say don't worry about it, until you
get the basics down.

In this file you can indeed use the command feelexit mentions - but
his post was slightly wrong in one respect.

The command you want is renderElement('name_of_element'); ?>

That doesn't help you right now though because you have no elements
yet.

You need to create them, under /app/views/elements/ - the filenames
should all be something like name_of_element.thtml (for 1.1) or
name_of_element.ctp (for 1.2). The name_of_element part is what you
put in the renderElement command.

For more dynamic content you may want to look into requestAction and
components, but this is something I've barely scratched the surface of
myself yet, so I can't give you any help there.


--~--~-~--~~~---~--~~
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: CakePHP/SWFObject/Multiple Files

2007-03-12 Thread MrTufty

Hi Sam,

Thanks! You've saved my life, and our designer's hair (what's left of
it).

Worked 100% fine once I put that in.

:)

Steve

On Mar 9, 7:40 pm, "Sam Sherlock" <[EMAIL PROTECTED]> wrote:
> I would expect the base param to solve your issues.
>
> I have'nt had any and have always been setting the base param.
>
> I put my swf's inside a folder in webroot called 'flash'
>
> then I set a javascript variable with $this->webroot  eg
>
> var strBase = 'webroot); ?>';
>
> - S
>
> On 09/03/07, MrTufty <[EMAIL PROTECTED]> wrote:
>
>
>
> > Hi guys...
>
> > I'm having a few issues, and I was hoping one of the more experienced/
> > knowledgeable people here could help me out.
>
> > On the website I'm currently developing, we have a Flash-based
> > location map showing all our clients sites. This Flash file is made up
> > of multiple movies, which each get loaded as you click around. This
> > map is loaded with the SWFObject javascript library, which I've
> > previously used to great effect in other sites, Cake-based and
> > otherwise.
>
> > When I use this outside Cake, it works correctly - but bringing it
> > into the Cake site, none of the sub-movies load, at all. I have a
> > feeling this is something to do with mod_rewrite, or something else
> > meaning Flash is looking in the wrong place for all the files.
>
> > My solution is to make the Flash file accept a parameter of where the
> > files are stored, but given it loads something like 80 different
> > movies, doing so will take a fair bit of work, so I'd prefer to avoid
> > giving our designer all the hassle :)
>
> > Has anyone else got experience with using Flash in Cake in this way,
> > or any ideas of other ways I can solve my problem?
>
> > Thanks in advance :)
>
> > Steve


--~--~-~--~~~---~--~~
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: Fetching rows one by one

2007-03-09 Thread MrTufty

Nope, they definitely don't mean stored procedures. Cookxyz's answer
would seem to be the most appropriate for what you're trying to do, in
this case. It's how I'd do it, and it does avoid having several
thousand records in memory at once... it may not be the optimal way in
this case but we don't have a huge amount of detail on what you're
attempting to do.

Hope this helps anyway...

On Mar 9, 4:07 pm, "Adrian Maier" <[EMAIL PROTECTED]> wrote:
> On 3/9/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
>
>
> > As ad7six said, this should be handled in your db if at all possible.
>
> I guess that's what the two of you are thinking when you say "handle inside
> the db"  are stored procedures, right?  It's not possible because the database
> is  MySql...
>
>
>
> > Assuming thats not possible, use limit and page arguments to work on a
> > small subset of the data at one time.  First execute a count to find
> > out how many records your dealing with, then loop through each subset.
> > Something like this:
>
> > $count = findCount($conditions);
> > $page = 0;
> > $limit=20; //set limit to any size, even 1
> >//this is how many records you will have in memory at
> > any given time.
>
> > while(($page*$limit) < $count){
> > $page++;
> > $recs = findAll($conditions, $fields, $order, $limit, $page,
> > $recursive);
> > //now use a function call ror foreach to process your records
> > }
>
> Thanks.
>
> I am perfectly clarified :  it is not possible to do exactly how i
> hoped  ,  therefore i'll need to use a workaround.
>
> Thanks you all,
> Adrian Maier


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



CakePHP/SWFObject/Multiple Files

2007-03-09 Thread MrTufty

Hi guys...

I'm having a few issues, and I was hoping one of the more experienced/
knowledgeable people here could help me out.

On the website I'm currently developing, we have a Flash-based
location map showing all our clients sites. This Flash file is made up
of multiple movies, which each get loaded as you click around. This
map is loaded with the SWFObject javascript library, which I've
previously used to great effect in other sites, Cake-based and
otherwise.

When I use this outside Cake, it works correctly - but bringing it
into the Cake site, none of the sub-movies load, at all. I have a
feeling this is something to do with mod_rewrite, or something else
meaning Flash is looking in the wrong place for all the files.

My solution is to make the Flash file accept a parameter of where the
files are stored, but given it loads something like 80 different
movies, doing so will take a fair bit of work, so I'd prefer to avoid
giving our designer all the hassle :)

Has anyone else got experience with using Flash in Cake in this way,
or any ideas of other ways I can solve my problem?

Thanks in advance :)

Steve


--~--~-~--~~~---~--~~
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: 1.2 apache error (WAMP)

2007-02-19 Thread MrTufty

In this case, I reckon the problem is the same one I had with Vertrigo
- sounds like the Zend Accelerator problem that caused my Apache to
crash every time I tried to access a Cake 1.2 site. Simple solution,
just disable the Accelerator.

On Feb 19, 2:08 pm, "nate" <[EMAIL PROTECTED]> wrote:
> EasyPHP has a long history of having issues with Cake, so it wouldn't
> surprise me if it was that, but Cake also doesn't support 3.23.  You
> need to install 4 or higher.
>
> On Feb 19, 5:03 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
> wrote:
>
> > Let me just add, that I am having this problem only with cake1.2x
>
> > allmy other projects cake 1.1x and others works just fine...
>
> > the system is:
> > windows xp sp2
> > apache  1.3.33
> > PHP Version 4.3.10
> > mySQL 3.23.49
>
> > the package was installed with easyPHP 1.8


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Ajax form question

2007-02-09 Thread MrTufty

Hi guys, thought I'd throw this out here because I simply can't get my
head around it.

I currently have user authentication working on my site, after my
problems the other day with validation. I'm happy with the way that
works, except for one thing.

In the header of my site I have a couple of links - one points to the
login page, the other to the signup page. What I want to be able to do
is click on each of those, and pop up a modal Ajax dialog box (think
Greybox style), containing the form. The user should then be able to
submit that, if there's errors it'll show them in that box, if not,
the user will be created/logged in and then redirected back to where
they were.

The part I'm having trouble with is redirection from an Ajax form. The
way I understand it is if I do the redirection in the controller
actions the way I normally would, only the Ajax div will be getting
updated, which is not what I want.

Am I right about this? How could I make it work the way I want?

Any help is much appreciated, as always. My next job is to tackle ACL
and the like, that should be fun. :|


--~--~-~--~~~---~--~~
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: More 1.2 validation

2007-02-08 Thread MrTufty

Indeed Mariano, I'll do that. I'm certainly not looking to steal
Evan's limelight on this one, compared to what he's done, my stuff is
just minor tweaks :)

On Feb 8, 7:42 pm, "Mariano Iglesias" <[EMAIL PROTECTED]>
wrote:
> You may want to combine efforts with Evan who is the original developer:
>
> http://blog.evansagge.com
>
> Otherwise we would have two versions of the same library floating around.
> Not particularly DRY if you ask me ;)
>
> -MI
>
> ---
>
> Remember, smart coders answer ten questions for every question they ask.
> So be smart, be cool, and share your knowledge.
>
> BAKE ON!
>
> blog:http://www.MarianoIglesias.com.ar
>
> -Mensaje original-
> De: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] En nombre
> de MrTufty
> Enviado el: Jueves, 08 de Febrero de 2007 12:14 p.m.
> Para: Cake PHP
> Asunto: Re: More 1.2 validation
>
> When I get this sorted out and working in a way that makes sense to
> everyone, I'll post it up somewhere as a complete package to drop in.
> And probably stick it up on the Bakery or Trac, if enough people are
> interested in seeing it there.


--~--~-~--~~~---~--~~
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: More 1.2 validation

2007-02-08 Thread MrTufty

Bug fix for the validateRequired / validateNotEmpty:

function _evaluate($validation, $messageOnFail, $fieldName = null,
$params = array())
{
if ($validation)
{
return true;
}

if(!preg_match("/does not match pattern/",$messageOnFail) && !
preg_match("/should not be empty/", $messageOnFail))
{
if (!isset($params['message']))
{
$params['message'] = Inflector::humanize($fieldName) . "
" . $messageOnFail . ".";
}

if ($params['message'])
{
$this->model->validationErrors[$this->name][$fieldName][]
= $params['message'];
}
}
$this->errorCount++;
return false;
}

That part at least should be fine, still working on the other chunks
of code.

On Feb 8, 3:14 pm, "MrTufty" <[EMAIL PROTECTED]> wrote:
> Damn, I didn't pick that one up either. Will bug fix that later on.
>
> A possible modification would be to add an extra parameter to each
> function specifying whether or not to output the message - but that
> might make things more complicated than they need to be.
>
> When I get this sorted out and working in a way that makes sense to
> everyone, I'll post it up somewhere as a complete package to drop in.
> And probably stick it up on the Bakery or Trac, if enough people are
> interested in seeing it there.
>
> On Feb 8, 2:18 pm, "mcgordon" <[EMAIL PROTECTED]> wrote:
>
> > Good catch. I hadn't considered the default messages getting added to
> > the array.
>
> > Be careful of validateRequired calling validateNotEmpty. You'll want
> > to add a check for that error message as well or you'll see both
> > "field should not be empty" and "field is required" for the same 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?hl=en
-~--~~~~--~~--~--~---



Re: More 1.2 validation

2007-02-08 Thread MrTufty

Damn, I didn't pick that one up either. Will bug fix that later on.

A possible modification would be to add an extra parameter to each
function specifying whether or not to output the message - but that
might make things more complicated than they need to be.

When I get this sorted out and working in a way that makes sense to
everyone, I'll post it up somewhere as a complete package to drop in.
And probably stick it up on the Bakery or Trac, if enough people are
interested in seeing it there.

On Feb 8, 2:18 pm, "mcgordon" <[EMAIL PROTECTED]> wrote:
> Good catch. I hadn't considered the default messages getting added to
> the array.
>
> Be careful of validateRequired calling validateNotEmpty. You'll want
> to add a check for that error message as well or you'll see both
> "field should not be empty" and "field is required" for the same 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?hl=en
-~--~~~~--~~--~--~---



Re: More 1.2 validation

2007-02-08 Thread MrTufty

True, I'd not considered that part of the hackiness either. For now,
I've gone ahead and done it.

The solution isn't perfect - other tweaks will need to be made to the
other functions in the Error helper, for instance - but it does appear
to work.

Here's my code:

//error.php - modelErrors() function
function modelErrors()
{
$html =& new HtmlHelper;
$models = func_get_args();
$list = '';
foreach ($models as $model)
{
if ( isset($this->validationErrors[$model]) )
{
foreach ( $this->validationErrors[$model] as
$field => $errors )
{
foreach ( $errors as $error )
{
foreach( $error as $item )
{
$list .= '' . $item . '';
}
}
}
}
}

$output = '';
if ( !empty($list) )
{
$output = '

' . __('The following errors need
to be corrected:', true)
.
'

' . $list . '


';
}

return $output;
}

// validation.php - _evaluate() function
function _evaluate($validation, $messageOnFail, $fieldName = null,
$params = array())
{
if ($validation)
{
return true;
}

if(!preg_match("/does not match pattern/",$messageOnFail))
{
if (!isset($params['message']))
{
$params['message'] = Inflector::humanize($fieldName) . "
" . $messageOnFail . ".";
}

if ($params['message'])
{
$this->model->validationErrors[$this->name][$fieldName][]
= $params['message'];
}
}
$this->errorCount++;
return false;
}

Give that a try, and see if it works for you.

One thing you'll notice, and it may not be something that you want:
I've put an extra conditional in there so that any error messages
return from the validatePattern function don't get added to the array.
Reason I did this was because I'm pattern matching the email address,
but the only error I want to see is "this is not a valid email" - I
don't want to see the other one about it not matching the pattern.
Obviously if you're using patterns directly, this is not the way to
go.

On Feb 8, 1:27 pm, "mcgordon" <[EMAIL PROTECTED]> wrote:
> I totally agree that my solution is a hack. The deeper array would
> definitely be the way to go for multiple error mesages.  The only
> reason I didnt suggest it is that the validationErrors array is part
> of the core model class and I dont want to play around with its
> structure in case it breaks other things in the long run. If it works
> for you, post your code. Id love to see it.


--~--~-~--~~~---~--~~
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: More 1.2 validation

2007-02-08 Thread MrTufty

I'll take that as a challenge then :)

The workaround would be quite effective, but not ideal as you say...

One thing I considered, although it's probably not optimal, is to
store the messages in another slightly deeper array.

So when assigning the error messages, I'd use:

$this->model->validationErrors[$this->name][][$fieldName] =
$params['message'];

Which if I'm thinking correctly about this would produce something
like this:

array(
'User' => array(
0 => array(
'username' => 'You must choose a username'),
1 => array(
'username' => 'Your username is too short. It must be between 4 and 14
characters'),
2 => array(
'email' => 'Your email address is not valid')
)
);

etc...

I don't know how effective that would be, and I've not yet developed
any code for it so it could be completely wrong. But I might give it a
try next week (got a weekend away from coding, lucky me).

Thanks Marcel :)


On Feb 8, 12:46 pm, "mcgordon" <[EMAIL PROTECTED]> wrote:
> For multiple validation rules on the same field, each failure will
> overwrite the existing message with its own message, so in your case,
> for usernames, if your validation rules looked like this:
>
> 'username' => array(
>  'required' => array('message' =>'You must choose a username')
> ,'pattern' => array('pattern' => "/^[a-z0-9]+$/", 'letters and
> numbers only')
> ,'length' => array('min' => 5, 'max'=>12, 'message'=>'The username
> must be between 5 and 12 characters')
> ,unique' => array('message'=>'that username is already in use')
> )
>
> and your user chose Petr as a username, he'd first see the length rule
> and when he'd corrected that, he'd get a second error telling him
> about the uppercase P. Not ideal, but that's the way it works. Think
> about the order in which you want to apply your tests to minimize that
> kind of thing.
>
> If you want to show all messages at once, you'd have to hack the
> _evaluate routine by concatenating the $params['message']
>
> $this->model->validationErrors[$this->name][$fieldName] .= ' ' .
> $params['message'];
>
> This will generate a warning if 
> $this->model->validationErrors[$this->name][$fieldName] is not defined so be 
> sure to test using isset() and
>
> then assign(=) or concatenate(.=) accordingly.
>
> What you can't do is have a separate list item for each error because
> of the way that the validationErrors array is designed in the first
> place.
>
> A workaround could be to add a unique string separator, something that
> you know for sure will never appear in an error message, before you
> concatenate and then, in the modelErrors routine, explode() the
> combined error message based on your special string and then print out
> the single messages as individual list items.  I'll leave that as an
> exercise for the reader ;)


--~--~-~--~~~---~--~~
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: More 1.2 validation

2007-02-08 Thread MrTufty

Excellent!

Thank you Marcel, you've been a star; my code now works as expected
and I can get on with developing the other parts of my system now. I
second the call that this level of functionality should be added to
the core - it's so useful. Potentially in time the current validation
class might be able to do all this, but to be honest I find the syntax
for that fiddly at best.

One last question and then I'll leave you alone - is it expected that
I should only get one error message per field? Ideally I'd like to
have all the possible errors displayed, not just one of them. I
suspect that's something to do with the way the errors array is built
up?

On Feb 8, 11:41 am, "mcgordon" <[EMAIL PROTECTED]> wrote:
> contentTag is deprecated in 1.1 and they've taken it out of 1.2
> altogether.  Just stick straight HTML in your helper.  This is what my
> modelErrors function looks like:
>
> function modelErrors()
> {
> $html =& new HtmlHelper;
> $models = func_get_args();
> $list = '';
> foreach ($models as $model)
> {
> if ( isset($this->validationErrors[$model]) )
> {
> foreach ( $this->validationErrors[$model] as $field 
> => $errors )
> {
> foreach ( $errors as $error )
> {
> $list .= '' . $error . '' . 
> NL;
> }
> }
> }
> }
>
> $output = '';
> if ( !empty($list) )
> {
> $output = '
> 
> ' . __('The following errors need to be 
> corrected:', true) .
> '
> 
> ' . $list . '
> 
> 
> ';
> }
>
> return $output;
>
> }


--~--~-~--~~~---~--~~
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: Routes, pages and controllers

2007-02-08 Thread MrTufty

Ok... not sure of the exact syntax of this, but give this a try:

$Route->connect('/members/:action', array('controller' => 'members'));

You may also want to go a completely different way round the problem.
For a couple of sites I've developed with Cake so far, I've used the
following syntax (actually mine was slightly different, since I'm
using 1.2):

$Route->connect('/staticpagename1', array('controller' => 'pages',
'action' => 'display', 'staticpagename1');
$Route->connect('/staticpagename2', array('controller' => 'pages',
'action' => 'display', 'staticpagename2');
$Route->connect('/staticpagename3', array('controller' => 'pages',
'action' => 'display', 'staticpagename3');
...and so on.

This way only pages I specify as being static get picked up by the
pages controller, and I can call them whatever I want. I know it could
be potentially a lot of work to get the same results, but it does
work.

Maybe there's an easier way to do it though.

On Feb 8, 10:07 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> Hi
>
> Thanks for your reply. I did actually try that, and it worked for the
> specified controller action, but then it didn't work for other
> actions. For example, site.com/members would go to the members index
> action, but site.com/members/manage would look for a page called
> manage that was a subpage of a page called members.
>
> Ian
>
> On 8 Feb, 09:32, "MrTufty" <[EMAIL PROTECTED]> wrote:
>
> > I _think_, if you're going to make this work the way you expect it to,
> > you should specify the other controllers in routes above the final
> > routing.
>
> > So in your example you'd have:
>
> > $Route->connect('/members', array('controller' => 'members'));
>
> > Or something along those lines...
>
> > On Feb 8, 8:54 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
> > wrote:
>
> > > Hi
>
> > > I'm new to Cake, but loving it so far. I've been following the "Taking
> > > advantage of Pages Controller" article on the bakery, but I'm confused
> > > at the routing suggested there. I want to make the url's simpler by
> > > removing the /pages/ but the way they suggest seems to break it for
> > > the controllers. The article suggests putting:
>
> > > $Route->connect('/*', array('controller' => 'pages', 'action' =>
> > > 'display'));
>
> > > at the bottom of your routes.php so that it is a catch all route that
> > > maps any root level url to a page. My problem is whilst this works
> > > perfectly for pages, it overrides the controllers e.g: site.com/about
> > > correctly goes to the About Page, but site.com/members throws up an
> > > error saying that there isn't a page called members - this is correct,
> > > it's a controller but it's trying to load it as a page!
>
> > > I'm sure there must be another line that you need to put into it to
> > > make it work, but I can't find detailed info on the routes.php syntax
> > > so I'm a bit stuck! Can any one advise me on this? FYI: I'm using a
> > > fresh routes.php file from Cake 1.1.13.4450
>
> > > Ian


--~--~-~--~~~---~--~~
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: More 1.2 validation

2007-02-08 Thread MrTufty

Thanks again :)

I'm still having a few problems, the ErrorHelper provided uses a
method of the HTML Helper which doesn't appear to exist - it outputs
by using $html->contentTag(), which doesn't work. I've looked through
the HTML Helper itself and it seems to be using output in the format
of $this->output($this->tags['fieldset'], $data1, $data2); etc...

Unfortunately the  tag which I need for displaying the error
messages is not in the var $tags array. I know I could modify the
ErrorHelper's output to put out straight HTML, which would work, but
is there a real Cake-y way to do this?

On Feb 8, 10:23 am, "mcgordon" <[EMAIL PROTECTED]> wrote:
> The problem is in the class name "Validation" which is the same as the
> core class name.  If you rename it the conflict goes away.
>
> You've got to change two things in the code, first the name of the
> class in the class definition (file validation.php).  The author's
> name is Evan so I renamed his class eValidation:
>
> "class eValidation" on line 26 of Validation.php
>
> Don't forget to rename the constructor on line 45:
>
> function eValidation(&$data, &$model)
>
> Next you have to change the name of the class where it gets
> instantiated.  In app_model.php look for the function invalid_fields
> that you added and change this line to include your new class name:
>
> $validation =& new eValidation($data, $this);
>
> it should work now.
>
> While we're at it, the other bugs I was talking about occur when the
> code passes the field to be validated through the _evaluate function
> twice. Look at this function below:
>
> function validatePattern($fieldName, $params)
> {
> $pattern = $params['pattern'];
> return $this->_evaluate(preg_match($pattern, $this->data[$this->name]
> [$fieldName]),
> "does not match pattern {$pattern}", $fieldName, 
> $params);
>
> }
>
> it validates the field against a user-supplied pattern and sends the
> result to the _evaluate function where the model->validationErrors are
> set.  Good so far.
>
> The following function is a convenience function so that you don't
> have to remember the regex for a valid word:
>
> function validateWord($fieldName, $params)
> {
> $params['pattern'] = '/^\\w*$/';
> return $this->_evaluate(!$this->validatePattern($fieldName, $params),
> "is not a valid word", $fieldName, $params);
>
> }
>
> it first runs the field through validatePattern() [which in turn runs
> it through _evaluate()] and then sends the inverse of the result
> through _evaluate again, resulting in the opposite answer to what
> you'd expect.
>
> If we follow the logic, for a given field containing valid data,
> validateWord() calls validatePattern() which calles _evaluate() with
> "true" as the first parameter (the regex matched for valid data).
> _evaluate() in turn returns true and so validatePattern() also returns
> true.
>
> now we run _evaluate again with (!true) as the first parameter.  this
> time _evaluate() fails and the error message is set, even though the
> field is valid. the problem is with the ! symbol that negates the
> first return value. By simply removing the ! the function returns true
> as expected and the field validates.
>
> This is true throughout the code wherever a convenience function is
> used to alias a more general function. The second time through
> _evaluate()  - which is done to allow for custom error messages - the
> validation fails.
>
> The following functions need to be changed:
> validateRequired
> validateWord
> validateInteger
> validateNumber
> validateEmail
> validateYear
>
> > I was almost tempted to
> > simply delete the standard Validation class and overwrite it with this
> > one, but that would cause other problems down the road, I'm sure.
>
> Bad Idea Jeans™  ;)
>
> Don't touch the core code unless you're using some kind of versioning
> system that will let you merge in the latest updates or you'll never
> remember all the places where you made changes. That goes double for
> now as they're adding new stuff to the trunk every day.


--~--~-~--~~~---~--~~
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: More 1.2 validation

2007-02-08 Thread MrTufty

Ok, now I'm a bit further along... I've added the code to my Cake
project, but I'm confused as to which parts I need to change to stop
it conflicting with the 1.2 validation class. I was almost tempted to
simply delete the standard Validation class and overwrite it with this
one, but that would cause other problems down the road, I'm sure.

Can you advise me on which bits I need to rename/change/delete to make
this work correctly?

Thanks! :)

On Feb 7, 11:23 pm, "MrTufty" <[EMAIL PROTECTED]> wrote:
> Hi Marcel -
>
> THAT is exactly the sort of helpful answer I was hoping for. Fantastic
> bit of code, I think I'll be making use of it until such time as the
> Cake core includes something comparable.
>
> I've bookmarked the page in question, and courtesy of the Foxmarks
> extension for Firefox, I'll check it out first thing tomorrow when I
> get to work :)
>
> Thanks again - and thanks also to the author of said code :)
>
> On Feb 7, 9:06 pm, "marcelgordon" <[EMAIL PROTECTED]> wrote:
>
> > > I'm trying to use the new methods of validation from the 1.2 code
>
> > Have a look at the code on this page which works fine with 1.2
>
> >http://blog.evansagge.com/2006/12/28/evans-cakephp-validation-techniq...
>
> > it takes care of 1), 2) and 3) from above (and probably 4 but i didn't
> > check)
>
> > I've been using it for a while with good results
>
> > be aware of a couple of things if you use this code.
>
> > 1) the class name conflicts with the core Validation class.  You'll
> > have to rename it if you want to use this code with 1.2
>
> > 2) there are some bugs in the code, but they're easily fixed.  I
> > pointed one out in my comment and then went on to discover that the
> > same error occurs througout the code.
>
> > 3) there is an unresolved issue described in comment #5 that the
> > author hasn't posted a fix for and I haven't had time to track down on
> > my own.
>
> > Despite these few problems, it's a very useful piece of code as it
> > resolves the biggest shortcoming of the core Validation class so far,
> > which is multiple checks with distinct error messages on the same
> > field. Maybe one of the developers could look at incorporating this
> > into the core...


--~--~-~--~~~---~--~~
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: Routes, pages and controllers

2007-02-08 Thread MrTufty

I _think_, if you're going to make this work the way you expect it to,
you should specify the other controllers in routes above the final
routing.

So in your example you'd have:

$Route->connect('/members', array('controller' => 'members'));

Or something along those lines...

On Feb 8, 8:54 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> Hi
>
> I'm new to Cake, but loving it so far. I've been following the "Taking
> advantage of Pages Controller" article on the bakery, but I'm confused
> at the routing suggested there. I want to make the url's simpler by
> removing the /pages/ but the way they suggest seems to break it for
> the controllers. The article suggests putting:
>
> $Route->connect('/*', array('controller' => 'pages', 'action' =>
> 'display'));
>
> at the bottom of your routes.php so that it is a catch all route that
> maps any root level url to a page. My problem is whilst this works
> perfectly for pages, it overrides the controllers e.g: site.com/about
> correctly goes to the About Page, but site.com/members throws up an
> error saying that there isn't a page called members - this is correct,
> it's a controller but it's trying to load it as a page!
>
> I'm sure there must be another line that you need to put into it to
> make it work, but I can't find detailed info on the routes.php syntax
> so I'm a bit stuck! Can any one advise me on this? FYI: I'm using a
> fresh routes.php file from Cake 1.1.13.4450
>
> Ian


--~--~-~--~~~---~--~~
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: More 1.2 validation

2007-02-07 Thread MrTufty

Hi Marcel -

THAT is exactly the sort of helpful answer I was hoping for. Fantastic
bit of code, I think I'll be making use of it until such time as the
Cake core includes something comparable.

I've bookmarked the page in question, and courtesy of the Foxmarks
extension for Firefox, I'll check it out first thing tomorrow when I
get to work :)

Thanks again - and thanks also to the author of said code :)

On Feb 7, 9:06 pm, "marcelgordon" <[EMAIL PROTECTED]> wrote:
> > I'm trying to use the new methods of validation from the 1.2 code
>
> Have a look at the code on this page which works fine with 1.2
>
> http://blog.evansagge.com/2006/12/28/evans-cakephp-validation-techniq...
>
> it takes care of 1), 2) and 3) from above (and probably 4 but i didn't
> check)
>
> I've been using it for a while with good results
>
> be aware of a couple of things if you use this code.
>
> 1) the class name conflicts with the core Validation class.  You'll
> have to rename it if you want to use this code with 1.2
>
> 2) there are some bugs in the code, but they're easily fixed.  I
> pointed one out in my comment and then went on to discover that the
> same error occurs througout the code.
>
> 3) there is an unresolved issue described in comment #5 that the
> author hasn't posted a fix for and I haven't had time to track down on
> my own.
>
> Despite these few problems, it's a very useful piece of code as it
> resolves the biggest shortcoming of the core Validation class so far,
> which is multiple checks with distinct error messages on the same
> field. Maybe one of the developers could look at incorporating this
> into the core...


--~--~-~--~~~---~--~~
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: More 1.2 validation

2007-02-07 Thread MrTufty

Thanks Tarique, will take a look later on.

I was hoping to avoid having to use anything not in the core code,
purely for stability later on. But if it's required... then that's
what I'll do :)

On Feb 7, 3:55 pm, "Dr. Tarique Sani" <[EMAIL PROTECTED]> wrote:
> On 2/7/07, MrTufty <[EMAIL PROTECTED]> wrote:
>
> > I'm trying to use the new methods of validation from the 1.2 code
>
> Oh forgot to add - my code is V1.1
>
> T
>
> --
> =
> PHP for E-Biz:http://sanisoft.com
> Cheesecake-Photoblog:http://cheesecake-photoblog.org
> =


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



More 1.2 validation

2007-02-07 Thread MrTufty

Hi guys... it seems like every time I come on here, I'm posting about
validation. Probably because, at least to me, it's one of the most
confusing parts of the framework.

I'm trying to use the new methods of validation from the 1.2 code
(current SVN version as of today), and I'm hitting brick walls
probably because I'm trying to do something that makes no sense.

The initial part of my application is basic user authentication. I
have no issues with login and logout, I understand how to work with
the Session component, and I've been playing with the Cookie component
also to handle persistent logins.

The confusing part is signups, and the problem comes down to the
specific rules I want to apply.

I need my usernames to be alphanumeric only (at least for the moment),
but I also want them to be within a certain size range, and also to be
unique (for obvious reasons). Previously I've used beforeValidate for
this (although my attempt earlier on didn't get very far and gave me
nearly 100 lines of code for the various conditions).

There are similar conditions applied to the other 3 fields in my
signup form - which are password, password_confirmation, and email. I
can accept happily the difficulties of producing a validation system
that does everything that everyone needs it to do - but some things
would make life a lot easier.

1) Multiple validation rules for a single field
2) An equivalent to validates_uniqueness_of from Rails - effectively
connecting to the database and seeing if the submitted value already
exists in the table
3) A replacement for the old VALID_NOT_EMPTY - we now have a
validation rule for seeing if a field is blank, but I can't figure out
how you'd use that to make sure it's NOT blank.
4) Clarification on the comparison rule - should we be using this for
strings (such as in my password/password_confirmation) or will it only
work with numbers?

The last feature I'd like to see is definable error messages for these
validation rules, but I'm pretty sure that's something you guys are
already working on.

To clarify, I don't expect you guys to just jump and develop this
functionality simply because I've asked for it - in fact some of these
things I'm going to have a crack at developing myself before
submitting as a patch - but I would like an idea of if/when these
things are going to appear, if ever?

Thanks :)


--~--~-~--~~~---~--~~
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: Fatal error: Failed opening required 'cake\bootstrap.php'

2007-01-30 Thread MrTufty

Something you should be aware of: Cake 1.2 has an issue with Vertrigo
where Apache will crash. To be fair it's not Cake's fault, it's an
incompatibility between the Zend Accelerator version and the version
of PHP they've included. Just disable it in your php.ini (for
Vertrigo's purposes, this is located in the main program folder under
PHP - the lines you need to comment out are right at the bottom of the
file).

On Jan 30, 7:40 pm, "lynda" <[EMAIL PROTECTED]> wrote:
> I installed vertrigo, copied ext folder from php5 package to vertrigo,
> now my cakephp is running finally. Thank you very much!
> Best Regards
> Lynda
>
> On Jan 30, 6:30 am, "DJ Spark" <[EMAIL PROTECTED]> wrote:
>
> >   btw, someone in this list suggested using Vertrigo dev pack, and i
> > gave it a try, since i was stuck with easyphp for a while.
> >   Vertrigo is perfect and updated often:
> >  http://vertrigo.sourceforge.net/
>
> >   The only minor downside is you have to copy php extensions from the
> > php pack (download it at php.net) to the extensions folder. once you
> > do it, they are available to turn it on/off.
>
> > From their website:
> > Components:
> > * Apache 2.0.59
> > * PHP 5.2.0
> > * MySQL 5.0.27
> > * SQLite 3.3.8
> > * PhpMyAdmin 2.9.1.1
> > * ZendOptimizer 3.2.0
> > * SQLiteManager 1.2.0
>
> >  spark
>
> > On 1/30/07, AD7six <[EMAIL PROTECTED]> wrote:
>
> > > On Jan 30, 2:25 pm, "c1sc0" <[EMAIL PROTECTED]> wrote:
> > > > PATH_SEPARATOR is a constants that should be substituted with [ the 
> > > > operating system path seperator ]
>
> > > Hi Lynda,
>
> > > phpdev4 has version 4.0.6 (that's old!)
>
> > > You should have v 4.3 to run cake. Why not install the latest wamp, if
> > > you specifically want to run php4 instead of 5 you can do that by
> > > editing the ini files - or install each thing seperately.
>
> > > Out of interest, how did you find phpdev4? Their forum (for example)
> > > has been inactive since 2004.
>
> > > HTH,
>
> > > AD7six
> > > Please note:
> > > The manual/bakery is a good place to start any quest for info.
> > > You may get your answer quicker by asking on
> > > the IRC Channel (you can access it with just a browser
> > > here:http://irc.cakephp.org).
>
> > --
> > [web]http://synapsisdi.com.br
> > [livesets]http://djspark.com.br/mp3


--~--~-~--~~~---~--~~
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 stuff

2006-12-30 Thread MrTufty


I tried EasyPHP, and also XAMPP.

Vertrigo is my favourite, because although some files get installed in
the webroot, they're optional and can be safely deleted. I noticed that
most of the other environments install phpMyAdmin into the webroot, or
create an admin/ folder in there to hold their own tools... which is...
unhelpful, to say the least, when you're developing a site that needs
an admin section :P

I think I might have to look into alternate ways to speed up my site,
if the old Zend Optimizer is going to cause so many problems... :)


--~--~-~--~~~---~--~~
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 stuff

2006-12-30 Thread MrTufty


Hi gwoo, guess your response came in here before my other ones did.

Adding the trailing slash makes no difference, still crashes in the
same way. It looks like it's entirely Zend's fault in this case... they
are meant to be working on an updated version of the Optimizer which
fixes it, but no release as yet...


--~--~-~--~~~---~--~~
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 stuff

2006-12-30 Thread MrTufty


This may help answer some of the questions - a lot of people have seen
this issue on the Zend forums.

http://www.zend.com/forums/index.php?t=msg&th=2529&start=0&S=794daedd3f5ff2312185b52703a0f86a

At least now I know it's not just me going crazy, and that it's not
just Cake that is affected (my development server is only being used
for building my new site in Cake, so I had no idea if anything else was
breaking too).


--~--~-~--~~~---~--~~
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 stuff

2006-12-30 Thread MrTufty


And it has.

Thanks everyone for trying to help. I wish I'd thought of checking the
Windows Error Log sooner instead of looking in Apache's own log
files... would have figured this out before I'd even posted :)

It still doesn't make any sense why there would be an incompatibility
between Zend Optimizer and Cake though... particularly since it's only
in the 1.2 branches...


--~--~-~--~~~---~--~~
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 stuff

2006-12-30 Thread MrTufty


Ah... I've just checked in the Windows Error Log under MMC, it's
highlighting an error with the Zend Optimizer DLL that's included. Will
try and disable that, see if that solves the problem...


--~--~-~--~~~---~--~~
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 stuff

2006-12-30 Thread MrTufty


gwoo - this is the error that I get:

http://www.alltheusualsuspects.co.uk/users/orry/cake-vertrigo-error.png

I think Apache, or possibly a PHP module, is wiping it out even before
Apache can write to the error log.

I get this error consistently with both of the 1.2 versions I've tried
so far, but not at all with the 1.1.12 version which appears to work
normally. I can't think what you guys would be doing differently that
would make it not work...

DJ Spark mentioned that it might be an incompatible module in my PHP
installation, but I haven't installed anything beyond what ship with
this version of Vertrigo. If we track it down to it being that, I'll
let them know about it - but their support forums aren't particularly
helpful compared to here :)

What's this blank screen of death? Not encountered it before.

Is there anywhere else I could look other than the Apache error.log
file to find if it says anything more?


--~--~-~--~~~---~--~~
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 stuff

2006-12-30 Thread MrTufty


Best information I can provide is that I'm running on a default
installation of VertrigoServ 2.14 (http://vertrigo.sf.net), using the
below versions of the components:

Apache 2.0.59
PHP 5.2.0
MySQL 5.0.27
SQLite 3.3.8
PhpMyAdmin 2.9.1.1
ZendOptimizer 3.2.0
SQLiteManager 1.2.0

Cake itself is installed in a subfolder under the web document root (in
this case actually there's 3 folders, 1 for each of the versions I've
tested). Each is a direct extraction from the .tar.gz file as
downloaded from the site (I'd get the zip version, but I'm using TUGZip
to extract and it skips empty folders in zips).

If there's any more details you need I can do some investigation?


--~--~-~--~~~---~--~~
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 stuff

2006-12-29 Thread MrTufty


And the latest SVN 4230 also crashes in the same way... just tested
now.

Any ideas?


--~--~-~--~~~---~--~~
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 stuff

2006-12-29 Thread MrTufty


DJ Spark contacted me off-list, advising me to check the Apache error
logs - unfortunately in this case, it didn't help at all. When Apache
is crashing here, it's crashing badly enough so that nothing is written
to the log file.

I'm now testing 4205 and 4206 side-by-side, in different folders. 4205
continues to work, 4206 continues to bomb out every single time. I'm
going to grab the latest SVN revision now to see if that works.


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Weird stuff

2006-12-29 Thread MrTufty


Ok, I know 1.2 isn't out yet, and there's no rush.

But I've run into a small issue, and I was just wondering if anyone
else had seen it before reporting it on Trac.

I'm running a local test server using Vertrigo 2.14 - I've been using
this version, and older, quite successfully for the past few months,
and I've had Cake running in the past.

I downloading the 1.2.0.4206 dev version of Cake from the main page,
installed it - it crashes Apache. The whole Apache service bombs out on
me in other words...

Just out of curiosity, I tried the other 1.1.12.4205 version also from
the main page, and that works fine... which leaves me even more
stumped. My limited attempts at debugging have gotten me precisely
nowhere, and I'm not familiar enough with Trac and SVN to figure out
what changes were made between 4205 and 4206 that would cause such a
thing to happen... can anyone shed any light on this for me?


--~--~-~--~~~---~--~~
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: Convincing my company to use Cake

2006-10-24 Thread MrTufty

I could just do that yeah - I will have to look into it some more :)

But yes, the IonCube tools do allow for the copyright notices to be
left unencrypted, as I thought.

The client is more likely to sue us if they manage to break something.


--~--~-~--~~~---~--~~
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: Convincing my company to use Cake

2006-10-17 Thread MrTufty

Ok. I believe the IonCube tools allow for copyright notices to be left
unencoded anyway, I'd have to check the documentation to be sure but
I'm sure it mentioned something along those lines.

On Oct 17, 3:51 pm, "nate" <[EMAIL PROTECTED]> wrote:
> I'll ask gwoo to weigh in here, since he's the IP attorney, but I'm
> pretty sure the only stipulations with the MIT License are with regard
> to the copyright notice.  So if you wanted to go to the trouble, you
> could remove the copyright from the files, encode them, then add the
> copyright back at the top of the file.
>
> Also, with those auto-documentor tools, I would think they would let
> you exclude certain files from being processed.


--~--~-~--~~~---~--~~
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: Convincing my company to use Cake

2006-10-17 Thread MrTufty

You're telling me... I've been pushing the need since I started here to
finish up a couple of other projects that are nearly ready to go
online... trouble is this client takes up so much of our time, with us
being only a small team, that we don't really get chance to tackle
anything else.

I'll be glad when we've polished this one off to be honest but our
timescale at the minute suggests we'll be dealing with them until at
least next May and probably beyond.


--~--~-~--~~~---~--~~
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: Convincing my company to use Cake

2006-10-17 Thread MrTufty

Sadly, not my decision to make... although that checksum idea might not
be a bad one for future reference, I'll put that forward to the
directors. I don't think we'll be dumping them though, they really are
our main client at the moment and their business is worth a huge
amount. Plus they'd probably sue us if we did dump them, given the
system is half-developed.

This doesn't mean we can't use Cake for future projects where encoding
is unnecessary :) I reckon this client might have issues with the use
of code that we haven't developed in house in any case - they're a real
nightmare for security, unwilling to allow any of our team to work on
stuff for them from home, even via VPN. And yet their server went down
the other day because 'someone' was on there deleting files :-S

I would be very interested to know the opinion of the Cake developers
as to the encoding issue though :-)


--~--~-~--~~~---~--~~
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: ajax to update form fields?

2006-10-17 Thread MrTufty

This wouldn't strictly speaking be Ajax, at least not the way I would
do it.

I'd trap the onchange event in the select tag:





Then have some javascript code to automatically select the other
options.

You COULD do it with Ajax (and this just occurred to me while writing
this post) by putting your sub-elements in their own DIV. Then, you
again use the onchange event, tie it up with an Ajax.Updater() - and
let your Cake application generate the HTML for the other form elements
before passing it back for display.

Anyway, there's bound to be alternatives


--~--~-~--~~~---~--~~
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: Convincing my company to use Cake

2006-10-17 Thread MrTufty

This might unfortunately be a sticking point.

We're in a position with one of our clients where we simply can't trust
them not to tamper with the code we've written for them. This would be
ok, but anything that goes wrong with it they blame us for even when
it's their fault. So, we use IonCube Encoder on all the work we do for
them before it gets uploaded to their server.

If we're not allowed to do that under the license, then I reckon the
directors will be saying no to Cake (and all other open-source
frameworks, for that matter). We're happy to respect copyright and
leave those messages in place, but the code itself needs to be
protected from tampering. It's a bit of a bugger really!


--~--~-~--~~~---~--~~
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: Convincing my company to use Cake

2006-10-17 Thread MrTufty

Luckily, I've been using Cake myself for the past couple of months - so
I'm about as much as we're likely to need for the moment :)

The other options are: keep doing things the same way they've always
been done here (we have a function library, but the functions it
includes are pretty specific to certain projects and thus useless on a
general level), or to write our own framework - which from an ownership
point of view makes sense, but less so from the point of view of "hey,
this is a huge job, and it still might have security issues I've
missed".

I've also encountered the problem with having trouble going back to
basic PHP code after a few months of baking. Really, I had to relearn a
lot of my old techniques. Although I think being exposed to Cake has
helped, my code is far more organised now just as a matter of course.

I guess we'll have to see which way we wind up going. I personally
wouldn't mind the challenge of writing our own framework from scratch,
but I have no illusions about the size of the job and the fact that I'd
effectively be responsible for all of it, good or bad. Luckily there's
only one other developer in the company at the moment so training
wouldn't be that hard to manage.

I'm also trying to push for source control, I know it probably seems a
bit backwards to some of you but I don't think the company has ever
felt this sort of thing was worth developing in the past - I'm working
towards bringing them up to modern techniques, so that we can embrace
new developments instead of ignoring them.


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Convincing my company to use Cake

2006-10-17 Thread MrTufty

Hi guys,

I'm working as a web developer now, and I've been trying to convince
the directors of the company that using some open-source libraries to
build our sites would be a good move. I've almost managed to convince
them that having a template engine is a good idea - with demonstrations
of what I've managed to build myself. From that, I've extended the idea
of using Smarty for future projects...

...but that led me to thinking, the primary benefits of Smarty are to
separate content from presentation - why not go the whole hog and use
Cake? I've been here for a while myself, I think Cake is fantastic and
so far I've been frustrated that I couldn't just use it for
work-related projects.

What they're asking for though is what the advantages and disadvantages
are of adopting this sort of system. I can probably come up with most
of them by myself anyway, but if anyone can suggest any, I'd be very
pleased to hear them :)

As an aside, the MIT license Cake uses - am I right in thinking it
allows use in commercial software (specifically the sort of large
websites we'll be building with it, which of course we're charging
for)? We'll probably have to encode the files as well if only to
prevent our clients from breaking the system...

Thanks in advance for any advice :)


--~--~-~--~~~---~--~~
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: Cake error: Warning: Unknown: 1 result set(s) not freed

2006-09-24 Thread MrTufty

In this case, as far as I can tell, it's actually because Vertrigo
doesn't come with the PHP CLI. You just need to install it separately,
as I mentioned in an email reply to TWIOF before. I've not used the
bake script for quite some time so I've never noticed the lack.


--~--~-~--~~~---~--~~
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: Cake error: Warning: Unknown: 1 result set(s) not freed

2006-09-21 Thread MrTufty

You could also try Vertrigo http://vertrigo.sourceforge.net - I've been
using it happily for the last several months and find it very easy to
configure and use. Doesn't seem to get in the way as much as some of
the other WAMP servers.


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



  1   2   >