Re: Not found error with DEBUG 0

2006-11-06 Thread Vanchuck

I think this has been posted in several threads before, but just in
case someone goes searching groups for this in the future, and the
above solution doesn't work...

Instead of setting permissions, try deleting the model cache files.
They'll be re-created next time around with the proper permissions
automatically (much lazier and easier). They're in
/app/tmp/cache/models . They aren't read from in DEBUG  0, so that is
why it's only happening with DEBUG=0.

I think I also read once that if the database table changes, the cached
model file will of course be wrong, and it can cause similar or other
errors. The app/tmp/cache/models directory holds the results of the
DESC database queries, IIRC. If you have $persistModel = true; for
any of your models, then you might also have some problems if the
permissions are off in your /app/tmp/cache/persistent directory

I once accidentally checked in the model cache files in my versioning
software without realizing, so for a while, every time I did an update
of the project files I kept on getting this error, as the files were
being replaced with old and broken versions! Don't forget to exclude
that directory from your project if you are using version control
software (cvs/svn).


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



Discussion on test page

2006-10-05 Thread Vanchuck

Very Wiki Like

Group Pages is a new feature of Groups Beta - http://groups-beta.google.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
-~--~~~~--~~--~--~---



Re: Discussion on test page

2006-10-05 Thread Vanchuck

oops, didn't realize discuss this page in groups-beta meant posting a
message to the entire list. Now we know, eh?

Pardon the spam. :-)


--~--~-~--~~~---~--~~
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: Route : defaut action for a controller

2006-09-27 Thread Vanchuck

I don't know if this can be done automatically just using a single
route. If you want:
http://host/blog/test  = Blog-Index('test')
BUT
http://host/blog/history/2006 = Blog-History('2006')

Then one thing you could do is hand over the routing logic to your
BlogController's index function, by using the following route:

$Route-connect('/blog/*', array('controller'='Blog',
'action'='index'));

Then, in your index function check to see if the first parameter passed
is a defined action in the controller by using method_exists($this,
first parameter);, and if it does exist use call_user_method(); to
hand over execution to that action (you'll have to make sure you also
manually set which view to render by calling
$this-render('actionname') in each of your actions. The problem with
this though is it is a security issue since if someone enters
http://host/blog/redirect, since method_exists($this, 'redirect')
exists in AppController, it would execute that function. If you use
some action-based security (like the ACM plugin), then its
functionality is messed up as well.

Alternatively (and probably the easiest way, unless you're going to
have dozens of actions), like AD7 says, you can simply define routes
for all your OTHER actions above where you do the /blog/* catch-all
route, then you get the same desired effect with a lot less hacking.


--~--~-~--~~~---~--~~
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: Simple question about $this-set

2006-09-08 Thread Vanchuck

Use the standard way of setting a variable in a PHP Class, if you want
to say, set a variable in one method of a class and retrieve it in
another.

Class SomethingController extends AppController{
function a(){
   $this-myVar = whee;
   $this-b();
}

function b(){
echo $this-myVar;
}
}

as nate said, $this-set is used for transferring data from the
Controller side of things to the View.


--~--~-~--~~~---~--~~
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: Does anyone know how to handle carriage returns from user input

2006-09-07 Thread Vanchuck

I just tried this out on one of my actions, and noted one thing, maybe
worth mentioning.

If you already know about and are using regex's but still can't get it
to work for some reason, maybe double check that the line breaks are
actually there? ...

There are some components and helpers I have seen that have some
input/output parsing (the OutputComponent being the one I've used
before)-- make sure you are not running
Output-filter($this-params['data']) on your input before checking for
\n's, as it replaces newlines with br/ tags (the OutputComponent also
has a br2nl function to reverse the process for spitting back out into
the edit form textarea).

Best way to check is pr($this-params[data']) and then view the HTML
source that is spat out, and see whether it is actually \n or whether
it's br/.


--~--~-~--~~~---~--~~
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: State List

2006-08-24 Thread Vanchuck

The ISO is your friend!
http://www.iso.org/iso/en/prods-services/iso3166ma/04background-on-iso-3166/index.html

ISO3166-1: Country Codes
ISO3166-2: Province/State (Subdivision) Codes
ISO3166-3: Named Places (ie, cities)

The ISO website offers them for sale, but I do remember finding one
place (and only ONE) where you could get the ISO3166-2 as a textfile
for download: http://philmcrew.com/freeworldaddressdb.html (dumb luck I
was able to find that again)

But that's in CSV format, and since I'm such a nice guy I did a dump of
my mySQL tables that I generated using the data:
http://www.preceptdesign.net/stuff/countries_provinces.sql

All nice and tidy for ya. This is from a non-Cake app though, so notice
the lack of numerical primary keys. (there's also a 'preferred' column
for countries that I used to keep the most common countries at the top
of a select-drop down).

:-)


--~--~-~--~~~---~--~~
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: Let user submit multiple records

2006-08-21 Thread Vanchuck

While we're talking implementations, I thought I'd chime in with how I
solved this problem).

My implementation was for editing Translations (I may post about my
i18n implementation in another topic soon enough). One example
specifically is for a user's first and last name (if I'm posting a
message on the Chinese message board of the site, I want my Chinese
name to show up, but if I'm on the English side, I want my English
name). Anyway, a user shouldn't have to go to a complicated separate
page to enter their name in when signing up. The name as usual consists
of 2 fields -- firstname and lastname

I wanted to keep use of the TranslationModel for doing auto error
checking, and so I could continue to use the HTML helper for creating
form inputs, outputing errors, and filling in existing values for the
name inputs, so rather than doing everything manually, I kind of hacked
things a bit.

When the page is displayed a helper outputs a set of inputs for each of
firstname and lastname. The inputs are the visible 'value' text field
as well as various hidden fields for specifying what language it's in,
etc. In the view this is accomplished with a simple 1 line call to the
helper function. Each set of inputs is given it's own enumerated 'fake'
model name, such as  Translation1, Translation2, etc.

When data is submitted, a TranslateComponent is used to check the
submitted data array for models matching Translation#. When it finds
them, it creates a new instances of the TranslationModel, and adds them
to the controller's array of models in $this-modelNames (this is
needed so that the validationErrors array for these fake models are
properly merged and outputted to the view, since Model-render() uses
this array for that).

Upon successful validation of the TranslationModel's and other data,
the translations need to be saved (there are 2 separate saves, so
validation must be validated manually, not just automatically during
the Model-save() call). Another TranslateComponent function steps in
to do this, by executing a loop like Mike wrote about above (and yes,
don't forget the create() call!), to save each of the found 'fake'
models.

If something doesn't validate, then you don't have to do anything-- the
view helper ensures that the error messages and existing values are
properly displayed thanks to the inputs' naming.

The only problem with this is that when I go to save the 2
newly-created translation id's into my User Object, I then have to make
an assumption, that the 1st set of inputs (Translation1) is the first
name, and the second (Translation2) is the last name. Swapping these in
the view will mix things up, so it violates the MVC principle a bit.

I enjoyed reading the other solution provided, and would love to hear
about how others are doing this, I have another similar situation that
I haven't coded yet that will be even more complicated, so if there's
some better solution, it's not too late to save me from the clutches of
my own ignorance!

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