You could do something like this:
Add a field in the posts table named type
and do the associations like this:
var $hasAndBelongsToMany = array(
// this here is the HABTM for teams
'Team' = array(
'className' = 'Tag',
'joinTable' = 'posts_teams',
http://bakery.cakephp.org/articles/view/quick-tip-doing-ad-hoc-joins-in-model-find
On May 3, 4:40 am, Brendon Kozlowski brendon...@hotmail.com wrote:
If you can figure out the SQL query, then it could be reverse
engineered in to a CakePHP find call. Containable is merely a
mechanism to
Perhaps a decimal? -5.5 or -5.75
On May 2, 6:36 pm, Turgs timb@gmail.com wrote:
Hi
The TimeHelper's convert() function takes a userOffset parameter as an
integer (hours from GMT).
What do you do for locations that are not an *exact* hour from GMT?
Such as:
* Mumbai, Maharashtra,
When I cake bake my application isn't created in a 'app' folder.
Instead all folders are created in the root directory. All though the
application works isn't constucted like I have been taught
--~--~-~--~~~---~--~~
You received this message because you are
Hello Rob,
I am not sure, but I think Polymorphic Behavior might help you. It is
on the bakery.
You can bind that one model dynamically to other models by specifying
it category (called class).
I am not sure but I do not see why it should not work with
containable.
I'd frist try to use complex
Hello Fabian,
Are you sure that you have a HABTM relationship or a belongsTo? In
your query there is a field 'user.verse_id', that is not needed. For a
habtm, there should be three tables in your db:
--
USERS:
==
id, name, ...
VERSES:
===
id, name, ...
USERS_VERSES:
==
id,
In the blog-style MVC examples, you have one model (eg. post), a
controller with actions like write, view and list, and views for
each action. This is all quite easy to understand and works really
well.
What about more complex pages, such as the Yahoo Homepage, or the
Facebook Homepage or
For me putting real UTF-8 characters in worked as well: → for
instances (thats rarr;)
On a sidenote: I recommend moving pagination header and footer to
elements btw :)
On Mar 15, 7:54 pm, mklappen mklap...@gmail.com wrote:
thanks! working now :)
On Mar 14, 12:24 pm, brian bally.z...@gmail.com
Why not setting different modes for your virtual host only?
And yes - this changing will affect other sites aswell. (assuming your
Directiory / is /var/www)
Greets,
Faifas
On Sat, May 2, 2009 at 11:10, shinokada okada.s...@gmail.com wrote:
My school server is running on Windows 2003, XAMPP.
it works if you associate your models correctly. in each of your
models, associate them with the Alert model, like so:
public $hasMany = array(
'AccountAlert' = array(
'className' = 'Alert',
'foreignKey' = 'entity_id',
'conditions' = array(
'AccountAlert.model' = 'Account'
Hi Cake people,
I have a problem in setting user status.In particular i have a field
in users table which is called status and i have set it to enum
('active','inactive') default 'active'.now in users/views/
change_status i want to have a select tag to set status as active or
inactive.Here is the
Thank you, Brian! I thought I was supposed to use the Controller class
(var $uses), which would have then 'cascaded' down to incorporate the
appropriate Model but, having seen the fix, that seems like some
pretty stupid logic on my part ;)!
Thank you, again. Your suggestion worked perfectly and
I'm having problems with this solution.
I've got my child model - state.php
class State extends AppModel {
var $name = 'State';
var $hasMany = array('Store' = array('className' = 'Store',
'foreignKey' = 'store_id'));
}
I've got my parent model - store.php
class Store extends
var $uses = array('Store', State');
If you add a 2nd model you have to include both of them in $uses. If
the variable is present, Cake will not bother figuring it out for you.
Thus, Store is not found.
Incidentally, I changed States to State. The model name should
generally be singular.
On
Wait a sec. I just looked closer at your models (yes, I've only just
started my coffee, again). There are legitimate reasons for having
more than one model in $uses but you shouldn't need to have State in
there in this case.
var $uses = array('Store');
...
$states =
I am trying to get the Spreadsheet_Excel_Writer to work as a vendor in
CakePHP 1.2. I have downloaded the PEAR library and the
Spreadsheet_Excel_Writer libraries to the following:
app/vendors/PEAR/PEAR
app/vendors/PEAR/Spreadsheet_Excel_Writer-0.9.1
I am trying to export a list of registrations
Cake has no official support for ENUM. (there may be ways to use them,
of course)
The simplest way to deal with this would be to change your column to
(mysql version):
active BOOLEAN DEFAULT FALSE (or TRUE, whichever you want)
or
active BIT(1) DEFAULT 0 (or 1)
or
active TINYINT(1) DEFAULT 0 (or
how are you trying to create it? Did you setup the console properly?
you can also use -app whatever
but in general you should always be working from the application
directory.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
http://bakery.cakephp.org/articles/view/creating-reusable-elements-with-requestaction
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To
Have a look at elements. And you'll find that, no matter how
insignificant, creating a separate model buys you much ease of use.
On Sun, May 3, 2009 at 7:04 AM, Rangi rangi...@gmail.com wrote:
In the blog-style MVC examples, you have one model (eg. post), a
controller with actions like write,
You didn't provide the correct class name. Try it this way:
App::import('vendor', 'Spreadsheet_Excel_Writer', array('file' = 'vendors/PEAR/
Spreadsheet_Excel_Writer-0.9.1/Writer/Writer.php'));
On Sun, May 3, 2009 at 12:17 PM, shird howsoo...@gmail.com wrote:
I am trying to get the
Hi
I created a element called 'user_navigation' and placed it in views/
elements/user_navigation.ctp.I am now trying to call him but am unable
to. I tried from the default layout page and from my home.ctp view,
but no luck
I'm trying to do this, according to the manual. If i change the name,
i
Ok Brian so i ll use tinyint.But after that i make default 1 for
active and when i wanr to change it to inactive nothing happen.I am
using a checkbox coz i think it's the most appropriate for my
needs.Can you help me if i am wrong?Here is my code:
view
?php
echo $form-create('User',
I'm using
$this-Auth-allow('index');
in my controllers wildly, but cannot figure out how to allow one
specific page (like the home). Has anyone experienced this, and how
did you solved it?
--~--~-~--~~~---~--~~
You received this message because you are subscribed
Hi Amit,
Thanks for your help!
Kwun.
On Apr 30, 8:00 pm, Amit Badkas amitrb...@gmail.com wrote:
Hi,
The FormHelper::error() needs second argument in same fashion as you used it
in Form::input() method's second argument's 'error' key. i.e., echo
$form-error('fieldName', array('rule1 =
That looks ok, I think. Did you try that?
One thing I noticed is that your form won't have $id in the action, so
$this-User-id = $id; won't always work the way you expect. I usually
do something along these lines:
function change_status($id=null)
{
if (empty($this-data))
{
On Sun, May 3, 2009 at 12:58 PM, AGD anibaldam...@gmail.com wrote:
Hi
I created a element called 'user_navigation' and placed it in views/
elements/user_navigation.ctp.I am now trying to call him but am unable
to. I tried from the default layout page and from my home.ctp view,
but no luck
How to give an ID to my reset button so that I can style it with CSS.
Please advise.
This is what I have:
echo $form-button('Reset', array('type'='reset'));
This is the output:
input type=reset value=Reset /
This is something like I need to style it:
input type=reset value=Reset id=resetBtn /
In the PagesController context, 'home' is a param, not an action. I
guess you could deal with this through ACL (which is likely overkill)
or add an isAuthorized() method to PageController. Return false if you
don't want the User to see a page.
Or just check the param in display() and redirect if
echo $form-button('Reset', array('type' = 'reset', 'id' =
'resetBtn'));
On Sun, 2009-05-03 at 11:15 -0700, Bankai wrote:
How to give an ID to my reset button so that I can style it with CSS.
Please advise.
This is what I have:
echo $form-button('Reset', array('type'='reset'));
This is
Thank you for that. I made the changes as needed, but I am still
getting the error that it can not find the class. Am I possibly doing
the import wrong for the vendor? Or is it that I need to put a
different path in there for the PEAR libraries?
On May 3, 9:32 am, brian bally.z...@gmail.com
Thank you. I found the problem I was having when I first replied to
this. I am now set on this. I did have to declare the vendors path
though, I am keeping my vendors in the app directory, instead of a
level above, so I had to change that one. After that, it works like a
charm.
On May 3, 9:32
Thanks!
On 4 mayo, 13:22, Bogdan I. Bursuc bogdanbursu...@gmail.com wrote:
echo $form-button('Reset', array('type' = 'reset', 'id' =
'resetBtn'));
On Sun, 2009-05-03 at 11:15 -0700, Bankai wrote:
How to give an ID to my reset button so that I can style it with CSS.
Please advise.
Although the API says it is an INT variable, it will also accept a
float. Because CakePHP 1.2 is also PHP4 compatible, the class methods
can't explicitly define the input parameter type, so the only thing
telling you it must be an integer is the PHPDoc; however you may run
the risk of having odd
As brian pointed out, you could do certain things if you didn't want
to allow *all* pages to be visible.
To allow non-registered users to view pages, you would add 'display'
to your array of allowed pages, as that's the method the
PagesController uses to render your pages. (Just like viewing
Will Set::classicExtract be depreciated in 1.3 and removed in 1.4 or
is it still ok to use?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
CakePHP group.
To post to this group, send email to
Hello guys, thanks for your answers.
As I supposed, it was the debugger::log() function the one converting
'' into amp, the real problem was in Dr. Loboto's (thanks man)
observation about the reference parameter. After correcting it, I got
in my DB #NUMBER; no need for more, here is the
Thanks for helping out a newbie.
All the best
On May 3, 8:10 pm, brian bally.z...@gmail.com wrote:
On Sun, May 3, 2009 at 12:58 PM, AGD anibaldam...@gmail.com wrote:
Hi
I created a element called 'user_navigation' and placed it in views/
elements/user_navigation.ctp.I am now trying to
Anybody knows how is it that cake sends the ampersand when it does it
on its own?
I mean if you use standard forms and for example one textbox contains
a value with '', how cake sends it?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to
Hi
I've successfully added some user access control and now would like to
change the views to show only keywords related to that specific user.
How should i do it?
For instance for the keywords/index page, i have this simple
controller (baked):
function index() {
I still have problem.And i can't figure out what cause it!I used a checkbox
and still nothing.
view/change_status
?php
echo $form-create('User', array('action' = 'change_status'));
echo $form-input('User.status', array ('type' = 'checkbox','label'=
It's usually best to state exactly what problems one is encountering.
That being said, for a single checkbox, I usually use this format:
?php echo $form-hidden('User.id'); ?
labelActive
?php echo $form-checkbox(’User.status’); ?
/label
The way you were doing it is more like what one would use
Adjust the conditions in the controller's $paginate array.
function index() {
$this-Keyword-recursive = 0;
$this-paginate['conditions'] = array(
'Keyword.user_id' = $user_id
);
$this-set('keywords', $this-paginate());
}
But this seems
On May 3, 10:55 am, jmcneese jmcne...@gmail.com wrote:
it works if you associate your models correctly. in each of your
models, associate them with the Alert model, like so:
public $hasMany = array(
'AccountAlert' = array(
'className' = 'Alert',
'foreignKey' = 'entity_id',
I am attempting to make a loop that goes through all the tags a user
has provided(comma seperated) and then if it's not already in the tags
table, save it then add it to the event they just added. I can't seem
to get it to work because $tag_id is always the same for all the tags
so only the last
It's likely because you're not calling create() before each save. In
any case, that code is a bit unweildy. You can save yourself a lot of
trouble by using TagBehavior:
http://bakery.cakephp.org/articles/view/simple-tagging-behavior
No muss, no fuss. Ain't the Bakery grand?
On Sun, May 3, 2009
On May 3, 6:43 pm, Rob Wilkerson r...@robwilkerson.org wrote:
Hey, Joshua -
This is the first solution I've seen/found that looked like it had any
hope, but I'm not even a little bit familiar with the association
syntax you're using. I already have, in my Account model:
public $hasMany =
Thanks, the create() fixed everything and I didn't know there was a
Tag Behavior, I'll look into that!
On May 3, 7:28 pm, brian bally.z...@gmail.com wrote:
It's likely because you're not calling create() before each save. In
any case, that code is a bit unweildy. You can save yourself a lot of
Yes you are right.Sorry for not being more accurate.The problem i am facing
is that when i select a choice check/uncheck the checkbox the controller
function dont do anything.In other words the new data in user status cant
replace the older.And i cant find if it is problem in form or in
I'm new to CakePHP, so this might be an extremely stupid question.
I'm converting an old application to CakePHP. The problem I can't
figure out is how to use the users table correctly. I have a table
that uses the user table to assign a person to the log, as well as a
creater. I can't figure
Tnx i solved
On May 1, 7:40 am, kani infok...@gmail.com wrote:
ok tnx
i trying to make simple edictionary
i created 3 table /mnens,enmns,wordtypes/
Relations is
mnens - n wordtypes n - enmns
i used scaffolding
mnens belongsTo wordtypes
enmns belongsTo wordtypes
On Apr 30, 8:13 am,
in form textarea will be sent as exactly.
Cake replace by amp; only on output with $html-link(), h(), etc.
Not in $form-input().
On May 4, 3:32 am, rartavia royarta...@gmail.com wrote:
Anybody knows how is it that cake sends the ampersand when it does it
on its own?
I mean if you use
So - if I needed a controller to be able to modify multiple tables
that are related to each other - I would do the changes in Behaviors,
which would be used by each Model (of each affected table) - correct?
i.e. If multiple tables need to be modified at once, use a Behavior
(called by multiple
Yup, moving a legacy app to Cake can be a bit confusing. Can you post
the schema for the tables in question? I mean the old app's, as well
as whatever you've come up with so far for Cake. I'm sure something
can be worked out.
On Sun, May 3, 2009 at 10:46 PM, damanlovett ed...@lovettcreations.org
On Sun, May 3, 2009 at 11:57 PM, takabanana ttorim...@gmail.com wrote:
So - if I needed a controller to be able to modify multiple tables
that are related to each other - I would do the changes in Behaviors,
which would be used by each Model (of each affected table) - correct?
i.e. If
55 matches
Mail list logo