Thanks it worked like a charm. So has $this-controller been
deprecated in the View?
I ask this because the view still accepts the $controller object as a
parameter. I have just started using Cake, and so I just hacked the
view constructor to populate var $controller like in 1.1. What's the
On Mar 6, 8:36 am, francky06l [EMAIL PROTECTED] wrote:
Sorry for the bad references, actually is use hasMany relation in both
cases for the foreign model. So basically :
model Application
var $hasMany = array('Company' = array('className' =
'Company',
'foreignKey' =
On 3/6/07, Steven Chan [EMAIL PROTECTED] wrote:
What's the recommended way to access the controller in the view?
None! it is strongly recommended that you do not access controller in
your views.
I would further recommend that do not hack core CakePHP files - sooner
or later it leads to
the best way to do this is using generateList in your controller - see
the model functions in the manual. I have one which looks like this:
view:
?php echo $html-selectTag('Review/cruiseline', $cruise_lines, null,
array(), null, true, false);?
controller:
$this-set('cruise_lines',
Hello all,
I have some problems with that kind of association in cakePHP.
There are two models: Profile and Event. And the table which joins
them together is `event_profiles` (event_id, profile_id, date). Date
is necessary. It is simple to save event_id and profile_id using
standard ways, but I
Mariano Iglesias írta:
To stay compatible with CakePHP 1.2 the following line:
if($this-Contact-validates($this-data))
should be:
if($this-Contact-create($this-data) $this-Contact-validates())
If i use this I get:
Notice: Undefined offset: 0 in
Yes SQL statement with Debug to 2 are ok so I am sure I am doing
something wrong, this data model (this is a short view here) begins to
be complex. Anyway, I will examine everything again, maybe after one
night of good sleep will be better..
Yes everything follows convention, but when I began
Hi,
To make the session time longer go to php.ini and set
session.cookie_lifetime to 0 that means (keep session alive until
browser is closed)...
As for security risks...I think you can answer that for yourself...if
there wasn't risk, there would be no session...:-) The rule: Longer
Sessions,
Hi,
I did some debugging and found that if I use bookmarklet to open new
firefox window, it fires three new sessions. Only One of the session
(generally the first one) contains redirect information. Any idea
where the problem is. Is it with firefox or cakephp session handler..
Regards,
bingo
I don't like hacking core files as well, but until a fix comes out or
a recommended way comes out in the docs, I guess it will do for the
time being.
Thanks
Steven
On Mar 6, 4:32 pm, Dr. Tarique Sani [EMAIL PROTECTED] wrote:
On 3/6/07, Steven Chan [EMAIL PROTECTED] wrote:
What's the
I don't like hacking core files as well, but until a fix comes out or
a recommended way comes out in the docs, I guess it will do for the
time being.
I suppose the obvious question now is why do you need access to your
controller? I think from an MVC perspective a Component (or a
combination
Hi,
I checked my phpinfo() details and over there it shows
session_cookie_lifetime = 0. Is this the same cookie_lifetime you were
talking off or is there some other...I don't have access to php.ini
file..
Regards,
bingo
On Mar 6, 5:24 am, mindcharger [EMAIL PROTECTED] wrote:
Hi,
To make the
Mariano Iglesias írta:
Do a var_dump() of $this-data before calling $this-Contact-create() and
send us what you get. Also what version of CakePHP are you using? Next time
you send the group an issue like this try to give us more information, just
by looking at an error message it's very
On 3/6/07, Steven Chan [EMAIL PROTECTED] wrote:
I don't like hacking core files as well, but until a fix comes out or
Trust me there will never be a fix for allowing access to controller
from within views :)
Cheers
Tarique
--
=
PHP
Ok change:
$this-Contact-create($this-data)
To:
$this-Contact-set($this-data)
PS: I could've realized you were using CakePHP 1.2 from your error line
since it reports an error on model.php which would only happen on 1.2 :)
-MI
Hello, I know this topic has been discussed several times, but I'm not
able to find the solution for my problem so I'll try to explain it.
I need a navigation menu for my CakePHP application, I have chosen to
use a css+javascritp menu, so I have added the css+javascript files to
it locations and
Mariano Iglesias írta:
Please tell me if it works because if it does we need to report something.
Yes. It is working :) The 1.2 is very good!
-MI
---
Remember, smart coders answer ten questions for every question
Hi Bakers,
I thik I found a possible bug in cakephp session...but I am no expert
in either PHP or CakePHP to confirm it..In reference to above problem,
I tried changing the security level to medium and then everything
seemed worked fine...finally i took a look into /cake/libs/session.php
and
Ok can you do us bakers a favour and report this to https://trac.cakephp.org
?
This is what you should report:
When using a model that has no table defined (with var $useTable = false)
issuing:
$this-Model-create($this-data);
When $this-data is available and valid, throws:
Notice: Undefined
Hello,
I'm having an implementation specific problem where i would like to
structure the paramaterdata other than the default manner.
[params] = Array
..(
[form] = Array
..(
[data] = Array
(
Mariano Iglesias írta:
Ok can you do us bakers a favour and report this to https://trac.cakephp.org
?
This is what you should report:
When using a model that has no table defined (with var $useTable = false)
issuing:
$this-Model-create($this-data);
When $this-data is available and
Forgot to ask:
If you know how to create patchs then submit a patch with your issue for the
fix I've included. Otherwise when you have submitted the issue, give me the
link so I can attach the patch.
As we all remember what Larry and Nate said, issues submitted to the trac
should now have
What? I mean you've just found an issue that could be resolved so other
people don't face the same you did... What is stopping you from reporting?
-MI
---
Remember, smart coders answer ten questions for every question they
Mariano Iglesias írta:
Forgot to ask:
If you know how to create patchs then submit a patch with your issue for the
fix I've included. Otherwise when you have submitted the issue, give me the
link so I can attach the patch.
If You tell me how can I make patches I can make it, but I do not
Mariano Iglesias írta:
What? I mean you've just found an issue that could be resolved so other
people don't face the same you did... What is stopping you from reporting?
Here is the trac
https://trac.cakephp.org/ticket/2200
And I send every bug (with patches, I hope)
-MI
Great, ok, I'll add the patch then. Thanks for your collaboration.
-MI
---
Remember, smart coders answer ten questions for every question they ask.
So be smart, be cool, and share your knowledge.
BAKE ON!
blog:
Change the controller action to return $data, rather than to set it.
Then change your element to $dirtabTs = $this-requestAction('/
dirtab_ts/listado');
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake
PHP
To have more than just the two foreign ids, then you need a join model
in the middle. There was word that the HABTM relationship will be
extended to allow this to be through a model, but I don't think this
is implemented yet. In the meantime, you need to make the middle
model and associate it
Many thanks Grant, obviously changing the function to return $data in
stead of send it, worked. By the way I also think the best way could
be to use it in the app_controller but in that case, how I force
beforeFilter in app_controller to use the proper model?
Thanks again.
2007/3/6, Grant Cox
Im not sure if this thread is relevant anymore, but it may help:
http://groups.google.com/group/cake-php/browse_thread/thread/b01e21968ce9a151/1af66e7bae2685df
search the group for habtm
On Mar 6, 3:49 am, superjean [EMAIL PROTECTED] wrote:
Hello all,
I have some problems with that kind of
Okay not accessing the controller from the views. I can live with
that. But what about access to validation errors from the views? How
does one do that in 1.2?
Steven
On Mar 6, 7:09 pm, Dr. Tarique Sani [EMAIL PROTECTED] wrote:
On 3/6/07, Steven Chan [EMAIL PROTECTED] wrote:
I don't like
AD,
Thanks for asking about what I've been stuck on. I was able to figure
out the problems not long after your e-mail. The problems were mostly
related to using $uses in the app_controller and removing underscores
from model file names.
I ended up using ThinkingPHP's method of adding models
On Mar 6, 3:02 pm, TheIdeaMan [EMAIL PROTECTED] wrote:
AD,
Thanks for asking about what I've been stuck on. I was able to figure
out the problems not long after your e-mail. The problems were mostly
related to using $uses in the app_controller and removing underscores
from model file
hello, all!
I'm migrating from 1.1 to 1.2, and receive such Cake messages when
trying to validate data in controller old way:
if ($this-Model-validates($this-data)) {
...
}
else {
$this-validateErrors($this-Model);
}
(Model::validates) Parameter usage is deprecated, set the
New baker here. I am working on my first application but I am
noticing some unexpected results. When I go to access my app from the
web - /cake/app, I get a bad request message. However /cake/apps
works just fine.
On the webserver (UNIX filesystem): /usr/.../htdocs/cake/app
but the URL to
I learned a lot about Cake 1.2 from studying the baked files.
There's also a look at forms over at:
http://cake.insertdesignhere.com/posts/view/15
Hope this helps,
Zoltan
www.yyztech.ca
On Mar 6, 10:00 am, LMX [EMAIL PROTECTED] wrote:
hello, all!
I'm migrating from 1.1 to 1.2, and receive
On 2 Mrz., 15:16, nateklaiber [EMAIL PROTECTED] wrote:
Cake 1.2 has a new email component, I believe that is what he is
referring to.
Yes you're right! I'm talking about the new Email Component
implemented in Cake 1.2 - sorry for that :-)
On Mar 6, 2:32 am, Steven Chan [EMAIL PROTECTED] wrote:
Thanks it worked like a charm. So has $this-controller been
deprecated in the View?
Yes, deprecated and removed.
I ask this because the view still accepts the $controller object as a
parameter. I have just started using Cake, and so I
It could be helpful for me, because I sometimes use a static database-
table-layout (what a nice word ;) ). For example, when I store users
as aros, it could be easier for later developers in my company to
figure out where I store the whole data. So I would like to give the
aros-Table such
I'm working on a plugin for acl and authentication. When someone goes
to a page, if they haven't logged in yet, they are redirected to my
authentication plugin. When they successfully authenticate, they are
redirected back to the original page they tried to view. To do this,
when they are
On Mar 6, 5:52 pm, symfony [EMAIL PROTECTED] wrote:
It could be helpful for me, because I sometimes use a static database-
table-layout (what a nice word ;) ). For example, when I store users
as aros, it could be easier for later developers in my company to
figure out where I store the
I am working on an course registration application. It is my first
project with cakephp.
The courses are organized in hierarchial course_categories via a
category_id. The scaffolding and DB structure work fine but I am a
little stumped on how to proceed with the interface.
I intend to navigate
I fixed this one myself. I'm still not sure if this is the best way
to do things, but here's how I got it to work:
In my controller, in beforeFilter(), I set a session variable called
auth.page. It's value is set with this code:
$temp = str_replace(url=,/,$_SERVER['QUERY_STRING']);
As u suggested this is an apache question. Nothing wrong with asking
here, but u will likely a better faster answer at an apache forum.
Google your question, and u will find many such questions asked and
answered.
There might even be an example of what you want here:
yep. some interesting comments here as well:
http://www.eukhost.com/forums/showthread.php?p=7176
figured somebody has dealt with this here or might have a tip. would
appreciate any feedback. thanks.
On Mar 6, 1:40 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
As u suggested this is an apache
I hope my subject line was descriptive enough.
I know and unsterstan how the HABTM works pretty well. But i have come
across an interesing issue and the googles, they do nothing.
In a classic habtm example: (mainly for the noobs)
article
tag
articles can have multiple tags and tags can have
I'm dealing with his now. the way i have figured it out is to check
the domain in the app_controller.php's beforeFilter() method. Then
look up that user info based on the domain and save the user's info in
the session. Then in your other controllers you do:
Mariano Iglesias írta:
Great, ok, I'll add the patch then. Thanks for your collaboration.
What is the command to make a patch? Or it come form a svn? Or what is
the best way?
-MI
---
Remember, smart coders answer
Just spam
On Mar 5, 2:32 pm, Mariano Iglesias [EMAIL PROTECTED]
wrote:
Is he kidding us? I'm guessing he read that thread about ettiquete... The
one where we were kidding about people demanding free work...
Here you have it, we were *not* kidding
-MI
I use WinMerge (since I'm on a XP box):
http://winmerge.org/
With it you open the original file on one side, the modified on another, and
it generates the .patch file.
-MI
---
Remember, smart coders answer ten questions
On Mar 6, 2:15 am, Langdon Stevenson [EMAIL PROTECTED] wrote:
it would take some serious commitment to keep the accounting rules straight
for each country.
that's what ERPs are for. there are some open source ones, compiere
off the top of my head.
Hello
I'm getting a strange result with the following configuration in my
component:
$fieldArray = array('id', 'prev', 'filename',
'fileExtension','folder',if(fileExtension='0', filename,
concat(filename, '.', fileExtension)) AS fullfilename);
$fileData =
On Mar 6, 8:38 pm, Christopher E. Franklin, Sr.
[EMAIL PROTECTED] wrote:
This isn't really a cake question I guess... but I cannot find the
answer and this group has a bunch of smart cookies.
How do I get the browser to prompt the user to download a file AFTER
HTML has been rendered?
ERPs are great for large to mid-size companies, but it's not a
solution for a small companies (like mine) who may want something more
flexible than QickBooks, but far less involved than and an ERP. That
middle ground is completely missing in the OpenSource accounting app
market. That's my take.
FYI for anyone interested.
ok, well i added the data into the joining table to test an sql query
i could from the below url and it worked. Now i need to figure out how
to get it to work with the add/edit/delete functions for the Package.
Hello,
I just started playing with Cake yesterday and am trying to set up a
self referential many to many relationship using an example of users/
friends that is common to most social networks. To set up the DB I
created two tables; users with id and username, and friends with
user_id and
AH! Good stuff! Didn't think about that. Thank you for the reply.
On Mar 6, 12:17 pm, AD7six [EMAIL PROTECTED] wrote:
On Mar 6, 8:38 pm, Christopher E. Franklin, Sr.
[EMAIL PROTECTED] wrote:
This isn't really a cake question I guess... but I cannot find the
answer and this group has a
I just installed the CakePHP on the Apache 2.0 with PHP 5. I used the
Alternative installation on the CakePHP manual.
However, when I tried to connect to the default page on a web browser,
I got this error message:
Warning: require(config/core.php) [function.require]: failed to open
stream: No
Hello,
I just started playing with Cake yesterday and am trying to set up a
self referential many to many relationship using an example of users/
friends that is common to most social networks. To set up the DB I
created two tables; users with id and username, and friends with
user_id and
I uploaded my bootstrap and core.php to the files section of this
group:
http://groups.google.com/group/cake-php/files?hl=en
The only thing I have changed in core.php was the DEBUG and the
CAKE_SESSION_SAVE' parts.
Change define('CAKE_SESSION_SAVE', 'database'); to
define('CAKE_SESSION_SAVE',
Hi thelorax
My solution to a similar problem was to use one table for all users, but
have two models: users and friends that point to that one table.
Then use a HABTM relationship between the two models to manage the
association.
Regards,
Langdon
I just started playing with Cake yesterday
I am getting an error with setFlash on a new installation with version
1.2.0.4451alpha.
Here is the code calling it:
$this-setFlash(You have successfully been logged in.);
and I get this error:
Fatal error: Call to undefined method UsersController::setFlash() in
users_controller.php on line 211
I'm very new to CakePHP, I've only worked with it for a day or so now.
However, I'm confused as to how validation is handled when you want to
perform different actions.
For example:
I have a login form that has a username and password required field.
THEN I have a Signup form that has a
I just checked the API and all I had seen wast just flash.
So, try $this-flash('Message', 'URL to go to after the seconds
expire', seconds to display);
eg - $this-flash(You have successfully been logged in., /);
On Mar 6, 2:08 pm, ericc59 [EMAIL PROTECTED] wrote:
I am getting an error with
Hi Eric,
Try $this-Session-setFlash.
rhett waldock
clearsite new media
-Original Message-
From: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf
Of ericc59
Sent: Tuesday, March 06, 2007 4:08 PM
To: Cake PHP
Subject: setFlash()
I am getting an error with setFlash on a new
Sorry, I did find setFlash, it is in the Session component. So, you
can use the controller to do a flash or the session but, I think you
have to do $this-Session-setFlash or $this-SessionComponent-
setFlash
I am still using 1.1.
On Mar 6, 2:08 pm, ericc59 [EMAIL PROTECTED] wrote:
I am
Controller::flash() includes a redirect
Session::setFlash() adds the message to the session and will display it in
the appropriate place when a layout is rendered.
If you want to immediately redirect with setFlash, you should add the
redirect statement separately. Something like this:
I can't really wrap my head around this one. I have Entries and
Screenshots. From my Entries - Add view I want to add an entry (no
problem) and add a Screenshot (problem).
-My view contains this:
pTitle:
?php echo $html-input('Entry/title')?/p
etc...
pScreenshot (optional):
?php
Ah, $this-Session-setFlash() worked. I thought I tried that.
Thanks for the replies.
On Mar 6, 4:28 pm, Christopher E. Franklin, Sr.
[EMAIL PROTECTED] wrote:
Sorry, I did find setFlash, it is in the Session component. So, you
can use the controller to do a flash or the session but, I think
Hello,
Can you provide more information about how you are using save() in your
controllers?
The model-defined validation rules that apply automatically to save() would
usually be used in an insert or update operation. Presumably, the signup
action you describe would be in this category.
Set up all your validation rules in the model (such as username not empty
and only letters, email valid, etc. etc.).
On the save() action you validate with the model as usual.
On the login action, instead of calling save() on the model you would call
validates(), and since you want only to
What if I have 15 fields and I only want 2 of them validated. Is there
no construct available to let me validate a specific set of fields?
On Mar 6, 6:01 pm, Mariano Iglesias [EMAIL PROTECTED]
wrote:
Set up all your validation rules in the model (such as username not empty
and only letters,
In that case, instead of unsetting each field you don't want validated, just
set validation to a new, abridged array of rules. Something like:
$this-User-validate = array(
'username' = VALID_NOT_EMPTY,
'password' = VALID_NOT_EMPTY
);
rhett
Well, you can't really execute two controller actions, so you either
need to have two separate forms that are submitted and processed
separately (one for Entry, one for Screenshot), or you need the one
action to deal with both models.
If you want to do it in a single action, then keep as much of
Assuming that User is your model, you would use $this-User-validates().
Mariano gave a good example in his response:
if ($this-User-set($this-data) $this-User-validates()) {
// Perform your thing to check user / password
}
You could also do the reverse:
Good info Rhett!
On Mar 6, 2:43 pm, Rhett Waldock [EMAIL PROTECTED] wrote:
Controller::flash() includes a redirect
Session::setFlash() adds the message to the session and will display it in
the appropriate place when a layout is rendered.
If you want to immediately redirect with setFlash,
On the User model class add a function like:
function validateFields($fields)
{
$ignore = array_diff(array_keys($this-validate), $fields);
foreach($ignore as $field)
{
unset($this-validate[$field]);
}
}
You could also instead move this
I'm using the nightly build (v1.1.x.x)... wrong urls appear both in
controller and views, and always for the related controllers, e.g.
links for adding a new user when editing a group are wrong... I can
reproduce the error easily; does anyone else have the same problem
when using bake.php? (I
If you find a bug, please report it on https://trac.cakephp.org
brief FAQ:
question: well i dont know if its a bug.
answer: try to debug it.
question: but i dont have time...
answer: then, I dont have time to fix it either
question: but its your project
answer: no, the Project belongsTo Everyone
I'm too slow... :(
https://trac.cakephp.org/ticket/2205 (... and i fixed it at the
wrong place)
thx, I'll try to do better next time...
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake
PHP group.
To post to
thx, I'll try to do better next time...
me 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,
I don't know what your setup is like, but I explained to someone else
how I do my alternative setup here:
http://groups.google.com/group/cake-php/browse_thread/thread/8f96dbb2bc3a9557/bd341672e9029bd8#bd341672e9029bd8
I have a cake folder and an app folder inside my server's document
root
I stand corrected, things seem to be working fine now. Must have been
my in-experience with cake.
Thanks for all your help.
Steven
On Mar 7, 12:41 am, nate [EMAIL PROTECTED] wrote:
On Mar 6, 2:32 am, Steven Chan [EMAIL PROTECTED] wrote:
Thanks it worked like a charm. So has
Hi all,
I want to use HtmlHelper::link() to create a cake url with key-value
pairs of GET variables. So I can access the $this-params['url']. I
used this code:
$html-link($country,array(
'controller' = 'PibProfiles',
'action' = 'listAll',
I'm currently building the front page for an application. On this page
there's a list of users with some of their profile data.
The model looks kinda like this: User hasOne Profile
In the 'profiles' table i have two fields 'location' and 'nationality'
wich both point to id's from the countries
Hi,
I want users to have an option to select layout. More specifically,
each user will have an option to select one of the layout from three
different layout choices. However, I am not sure how I can globally
change the layout based on user's selection. I read previous post on
changing layout
Hi all,
Oops I found the answer, I guess you find it in $this-params['pass']
Steven
On Mar 7, 11:25 am, Steven Chan [EMAIL PROTECTED] wrote:
Hi all,
I want to use HtmlHelper::link() to create a cake url with key-value
pairs of GET variables. So I can access the $this-params['url']. I
Hi gribelu
What you need to do is create two new models for the countries table:
location.php
nationality.php
These models will both use the countries table, and can, if you choose
have a hasMany relationship to Profile.
Then in your Profile model, you have two belongsTo relationships,
Hi bingo
If the user has to choose the layout why not just give them a link or
button to a controller that sets the chosen layout and stores the
result? They click once and the value is set, and you just check the
session on each request.
This seems easier to me than always having to
I answer myself because it was a very basic question, to use any
other model in a Controller is as easy as specify it with
var $uses = array('ModelName');
Thanks.
2007/3/6, Javier Ramirez Molina [EMAIL PROTECTED]:
Many thanks Grant, obviously changing the function to return $data in
stead of
Hi Langdon,
I initially thought of doing that..but there are some problem. Let me
explain you my scenario.
I am building a website and currently there is only default layout. In
the default layout, left colum displays login box and if user is
logged in, the left column display menu to navigate
91 matches
Mail list logo