Got Cake installed ok but can't see any apps

2007-12-16 Thread indy50

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-16 Thread manuj bansal

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: Will CakePHP be able to survive as the Zend Framework matures?

2007-12-16 Thread Dr. Tarique Sani

This is a hypothetical question!

I have been following CakePHP as well as Zend Framework since very
early stages. At this moment what seems to be going very well for Zend
is the workflow processes but it is still missing too many things for
me to work with it on a project.

CakePHP on the other hand is already a fairly mature (read as "field
tested") framework and it works for me NOW

At some time in future every software becomes obsolete - the question
you should be asking is "Is the lifetime of the current software worth
it for me?"

I once was involved with development of phplib - a set of classes
which provided amongst other things sessions for php3, all us knew
that php4 will have sessions but we had enough users who wanted the
development to continue and it did for quite some time even after php4
was released and I am told that a some people still use some parts of
the old code (I don't)...

So keep growing and keep investing time in learning new things.

That said - I don't see any *one* framework becoming an industry
standard in PHP world


On 12/17/07, Action <[EMAIL PROTECTED]> wrote:
>
> I've always used Cake as my primary framework, but the Zend Framework
> seems to be shaping up nicely. Most of its published criticisms have
> been dealt with since 1.0 and it has some very impressive features
> (webservices, etc.).
>
> Given the fact that it's "Zend" and that there's an entire team of
> professional developers behind it, do you think this framework will
> become the industry standard for PHP? Also, do you think other
> frameworks such as CakePHP will die off as a result?
>
> The reason I ask is because I question Cake's future. I've already
> spent a lot of time on this framework, but I don't want to waste time
> if something like Zend is going to become the standard. Cake's
> releases are far more infrequent than Zend's and Cake's documentation
> is STILL horrible.
>
> What do you think?
> >
>


-- 
=
Cheesecake-Photoblog: http://cheesecake-photoblog.org
PHP for E-Biz: http://sanisoft.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: Will CakePHP be able to survive as the Zend Framework matures?

2007-12-16 Thread Grant Cox

I'm sure you'll get a number of responses from people familiar with
both systems, professing that CakePHP is better / smaller / faster,
whatever.  I haven't used Zend, so I can't comment on that.

However, the reason I am going to stick with CakePHP is because I know
it, and trust its direction.  We have already invested a couple of
years in learning CakePHP, our team is familiar with it, and it is
providing us with substantial benefits over using no framework (or the
custom "framework" we used to use).  I can't remember the last time we
had a business need for a site that we couldn't solve because of
CakePHP.

So basically:
I know CakePHP
It can handle anything I want to do
It is driven by very strong developer(s), who have a proven commitment
to quality.

and that's enough for me :)


On Dec 17, 2:59 pm, Action <[EMAIL PROTECTED]> wrote:
> I've always used Cake as my primary framework, but the Zend Framework
> seems to be shaping up nicely. Most of its published criticisms have
> been dealt with since 1.0 and it has some very impressive features
> (webservices, etc.).
>
> Given the fact that it's "Zend" and that there's an entire team of
> professional developers behind it, do you think this framework will
> become the industry standard for PHP? Also, do you think other
> frameworks such as CakePHP will die off as a result?
>
> The reason I ask is because I question Cake's future. I've already
> spent a lot of time on this framework, but I don't want to waste time
> if something like Zend is going to become the standard. Cake's
> releases are far more infrequent than Zend's and Cake's documentation
> is STILL horrible.
>
> What do you think?
--~--~-~--~~~---~--~~
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-16 Thread Grant Cox

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



how to call function from app model in view file

2007-12-16 Thread manuj bansal

I want to call function in view by passing argument and wanted a value
in return

***app_model.php
(code)**

function abc ($y)
{
   $v = $this->query(using $y in query);
   return $v;
}


**default.ctp
(code)

now how can i call this function by passing the argument $y and get
the value $v


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



want to call function in default ctp from app model

2007-12-16 Thread manuj bansal

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

*

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



Will CakePHP be able to survive as the Zend Framework matures?

2007-12-16 Thread Action

I've always used Cake as my primary framework, but the Zend Framework
seems to be shaping up nicely. Most of its published criticisms have
been dealt with since 1.0 and it has some very impressive features
(webservices, etc.).

Given the fact that it's "Zend" and that there's an entire team of
professional developers behind it, do you think this framework will
become the industry standard for PHP? Also, do you think other
frameworks such as CakePHP will die off as a result?

The reason I ask is because I question Cake's future. I've already
spent a lot of time on this framework, but I don't want to waste time
if something like Zend is going to become the standard. Cake's
releases are far more infrequent than Zend's and Cake's documentation
is STILL horrible.

What do you think?
--~--~-~--~~~---~--~~
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: Same Model&Controller but different Views for 2 different domains

2007-12-16 Thread Lloyd

Thanks heaps - I will try that!!

Lloyd

--~--~-~--~~~---~--~~
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: Id in table is named prj_id

2007-12-16 Thread thespadeworkers

Thanx.  I actually figured it out right after i posted this.  I will
do better research next time before i post something.



On Dec 16, 3:20 pm, Grant Cox <[EMAIL PROTECTED]> wrote:
> var $primaryKey = 'prj_id';
>
> in your model file.
>
> On Dec 17, 7:51 am, situator <[EMAIL PROTECTED]> wrote:
>
> > I am in trying to make the edit page of my app to call the field name
> > 'prj_id' as opposed to 'id' in the WHERE clause.  There is no 'id', it
> > is only 'prj_id'.  I need the read() and other functions to, when
> > calling a query to the 'projects' table, say "...WHERE 'prj_id' = 18"
> > instead of "...WHERE 'id' = 18".  Hope this makes sense.
>
> > Situator

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



Passing parameters to index page without calling index action

2007-12-16 Thread Lloyd

Hey everyone, I've been using cake for a little bit now but something
has got me stumped!

My controller:

function index($id) {  }
function somethingElse($id){ }
function somethingElseTwo($id) {  }

So basically, If i want to pass the $id to the 'somethingElse' and
'somethingElseTwo' functions I just go to the url:

domain.com/controller/somethingElse/id<-- (id would be say 2 or
something)

But if i go www.domain.com/controller/id   and try and access the
index page through this, it passes the id to the controller and thinks
it's an action and not the parameter as intended to be.  if i go,
www.domain.com/controller/index/id , then that works, but obviously
that isn't ideal for me!!

I have messed around with routes and even tried this - but that
doesn't work with ajax for some reason (maybe because its kindof
cheating) - it does work with general links though

$Route->connect('/controller/somethingElse', array('controller' =>
'Controller', 'action' => 'somethingElse'));
$Route->connect('/controller/somethingElseTwo', array('controller' =>
'Controller', 'action' => 'somethingElseTwo'));
$Route->connect('/controller/somethingElseThree', array('controller'
=> 'Controller', 'action' => 'somethingElseThree'));
// anything else ie - a link pointing towards controller/id
$Route->connect('/controller/*', array('controller' => 'Controller',
'action' => 'index'));

Is there a way to do this properly?  I'm not very good with regex
either

P.s.  the real reason for wanting to simplify url's as much as
possible is really an seo thing

--~--~-~--~~~---~--~~
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: Render a blank Page (Don't show the form)

2007-12-16 Thread Grant Cox

Use $this->flash() from your controller.
http://manual.cakephp.org/chapter/controllers


On Dec 17, 12:08 pm, oracle411 <[EMAIL PROTECTED]> wrote:
> When a user submits a form successfully, I would like to display my
> setFlash message on a blank page.  I can redirect it to another page
> and display my message their ($this->redirect('/');), but I want to
> display it on a blank page to make sure that they read the message.
>
> What I would like to do is just render the existing view, but without
> displaying the form.  I tried setting autoRender to false in my
> controller, but this just displays a blank page with no message and no
> layout.
>
> Is their a way to render the current view, without rendering the form
> just submitted?
>
> 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
-~--~~~~--~~--~--~---



Render a blank Page (Don't show the form)

2007-12-16 Thread oracle411

When a user submits a form successfully, I would like to display my
setFlash message on a blank page.  I can redirect it to another page
and display my message their ($this->redirect('/');), but I want to
display it on a blank page to make sure that they read the message.

What I would like to do is just render the existing view, but without
displaying the form.  I tried setting autoRender to false in my
controller, but this just displays a blank page with no message and no
layout.

Is their a way to render the current view, without rendering the form
just submitted?

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: chaging default model

2007-12-16 Thread jon

Hi Grant,
Thanks for the reply, I'll check it out and let you know if it works!
BTW sorry if my thread appears twice everyone, my Google groups seems
to be playing up today!

J

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



changing

2007-12-16 Thread jon

oes anyone know a way to change the default model used by a page? I
need to try to 'fool' Cake into believing it's running from a
different URL in part of the page.

 My example is for classified listings. On my listings index page,
underneath the main content from the listings controller, I have a
form allowing a user to edit their personal profile at any time - and
should show a pre-filled form, as you'd get by going to
/profiles/edit/4.

I tried using RequestAction in the following but it didn't work as all
that does is return the results of that page, it doesn't change the
"this->..." info being used:

model;
// returns "Listing"

$this->data = $this->requestAction('/profiles/edit/4');

echo $this->model;

// still echoes 'Listing', not 'Profile' as hoped.

?>

Can anyone tell me how to achieve this change, as RequestAction
clearly doesn't work. I need to change it so that the form helper
(using the value function in helper.php) will populate, as it takes
its criteria from $this->data[$this->model][$this->field] and if it's
using the wrong model to start with, it's not going to populate the
form correctly.

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: chaging default model

2007-12-16 Thread jon

On Dec 16, 9:23 pm, "Chris Hartjes" <[EMAIL PROTECTED]> wrote:
> On Dec 16, 2007 1:18 PM, Jon Miller <[EMAIL PROTECTED]> wrote:

> Perhaps I am misunderstanding the problem you are trying to explain
> here.  What you have is one section of your page that contains a form
> that someone can alter, right?  Why not display the info as an element
> in your page and then use an Ajax submit to process the information?

Hi Chris,
Good suggestion, but the client brief says no Javascript (it's a site
for mobile phone browsers), and AJAX requires Javascript I'm afraid.

At this stage it's not so much about finding a way to get the desired
output, but to prove to the client that Cake is a viable solution for
the site, and hence able to do this sort of thing without any client-
side requirements.

Any other ideas most welcome!

Jon.

--~--~-~--~~~---~--~~
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: Accelerating cakePHP

2007-12-16 Thread SeanW

Also look at

http://www.ibm.com/developerworks/linux/library/l-tune-lamp-1/
(tuning Linux)
http://www.ibm.com/developerworks/linux/library/l-tune-lamp-2.html
(tuning Apache and PHP)
http://www.ibm.com/developerworks/linux/library/l-tune-lamp-3.html
(tuning MySQL)

Sean

On Dec 16, 3:29 am, majna <[EMAIL PROTECTED]> wrote:
> before John David Anderson tips,
> try to configure apache to fit your site needs.
> tweak mysql conf. if your queries took more then few ms.
> use nix ramdisk on  php files for disk IO
>
> On Dec 15, 9:21 pm, "John David Anderson (_psychic_)"
>
> <[EMAIL PROTECTED]> wrote:
> > On Dec 15, 2007, at 1:12 PM, Chris Hartjes wrote:
>
> > > On Dec 15, 2007 3:00 PM, Pillow <[EMAIL PROTECTED]> wrote:
>
> > >> Hi,
> > >> I've website which has about 3 uniq visits per day (up to 1500
> > >> online). The problem is that CMS written on CakePHP consumes too much
> > >> of CPUs power.
>
> > >> Almost everything is beeing cached (whole views, sometimes db
> > >> results).
>
> > >> In addition the same site was earlier driven by some poor free system
> > >> which hadn't even had cache, and the CPU usage was about 6 times
> > >> less.
>
> > >> Do you have any tricks and tips to speed up system based on cake?
>
> > > Sounds like it was poorly designed, as 3 hits a day isn't what I
> > > would consider high traffic.  However, I would suggest the following:
>
> > (agreed)
>
> > > 1) install a PHP opcode cache like APC
> > > 2) make sure you have appropriate database indexes in place
> > > 3) spend some time profiling your code using tools like Xdebug and
> > > Cachegrind to find out where the slow spots really are.
>
> > I might also add
>
> > 4) Move rewrite instructions to apache conf rather than .htaccess
> > 5) Use unbind model (or something similar) more extensively.
>
> > -- John
--~--~-~--~~~---~--~~
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: Preserve other params using paginator

2007-12-16 Thread Grant Cox

Or you can just have

options(array('url' => $this->passedArgs));?>

directly in the view, without anything in your controller.  It works
fine for me without the connectNamed stuff.


On Dec 16, 7:36 am, Matjaz Drolc <[EMAIL PROTECTED]> wrote:
> Thanks, it works.
>
> On 15 dec., 22:15, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
>
> > In app_controller i add
>
> > function connectNamed($data=null,$exclude=array()) {
> > if (!isset($data)) {
> > $data=$this->passedArgs;
> > }
> > if (!is_array($data)) return;
> > foreach ($data as $key => $value) {
> > if (!is_numeric($key) && !in_array($key,$exclude)) {
> > Router::connectNamed(array($key));
> > }
> > }
> > }
>
> > in controller I use
> > $this->connectNamed();
> > $this->set('options',$this->passedArgs);
> > where $fieldFilter is a list of variables that needn't to pass in
> > paginator.
>
> > in start of view use something like
> > options(array('url' => $options));?>
--~--~-~--~~~---~--~~
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: Show All Errors on submit

2007-12-16 Thread Grant Cox

To ensure that both models show validation errors, just call
validates() manually (which will in turn invalidate() each field that
does not match).

$this->User->set( $this->data );
$this->Profile->set( $this->data );

$user_validates = $this->User->validates();
$profile_validates = $this->Profile->validates();

if ( $user_validates && $profile_validates ){
  // ok to proceed, save both models
} else {
  // validation error, show form again
}

Perhaps explain more about what this custom validation entails.  If
possible, all validation should be done in the model files themselves
(in beforeValidate() ), so the above code would work fine.  But
otherwise, you can always have whatever you like, and just call
something like $this->User->invalidate('name', 'That name is silly');



On Dec 16, 7:15 pm, AussieFreelancer <[EMAIL PROTECTED]>
wrote:
> Hi All,
>
> I have 2 tables, users and profiles. Along with those I have 2 models,
> and in those models I have some validation rules.
>
> When I submit a form that has fields for User and Profile on it, the
> User is validated first. If a required field is empty, obviously cake
> stops processing it and sends you back to show the errors.
>
> But I would like to validate both the User and Profile models, then
> return error messages for all the fields with errors - not just from
> the one model. How can I do this?
>
> Also in the same form, I have some fields that I join before saving,
> so I will need custom validation going on there. My controller doesn't
> have a specific model, it uses User and Profile instead. How can I
> validate this field and return the error message at the same time?
>
> Thanks
>
> Patrick
--~--~-~--~~~---~--~~
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: chaging default model

2007-12-16 Thread Grant Cox

For the form helper - if you have $form->create('YourModel'); then the
form helper will automatically use the "YourModel" model for the
form.  However, you can also create each form item with $form-
>input('OtherModel.somefield') to use any other model.

The data that prepopulates these fields is taken from $this->data in
your controller.  So if you populate $this->data['YourModel'] and
$this->data['OtherModel'] in the controller (through reading the
appropriate rows, or a requestAction) then your form can prepopulate.

And as Chris mentioned, if you are going to use a form on multiple
screens it makes sense to use an element.


On Dec 17, 4:18 am, "Jon Miller" <[EMAIL PROTECTED]> wrote:
> Does anyone know a way to change the default model used by a page? I
> need to try to 'fool' Cake into believing it's running from a
> different URL in part of the page.
>
>  My example is for classified listings. On my listings index page,
> underneath the main content from the listings controller, I have a
> form allowing a user to edit their personal profile at any time - and
> should show a pre-filled form, as you'd get by going to
> /profiles/edit/4.
>
> I tried using RequestAction in the following but it didn't work as all
> that does is return the results of that page, it doesn't change the
> "this->..." info being used:
>
>  echo $this->model;
> // returns "Listing"
>
> $this->data = $this->requestAction('/profiles/edit/4');
>
> echo $this->model;
>
> // still echoes 'Listing', not 'Profile' as hoped.
>
> ?>
>
> Can anyone tell me how to achieve this change, as RequestAction
> clearly doesn't work. I need to change it so that the form helper
> (using the value function in helper.php) will populate, as it takes
> its criteria from $this->data[$this->model][$this->field] and if it's
> using the wrong model to start with, it's not going to populate the
> form correctly.
>
> 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: Complex find queries: conditions in the assoc model

2007-12-16 Thread Grant Cox

You have to put the conditions in the association itself.

var $hasMany = array('InvoiceItem' =>
array(
'className' => 'InvoiceItem',
'conditions' => 'InvoiceItem.invoice_id IS NULL',
)
);

If you need to do this dynamically, then look at bindModel /
unbindModel (or any one of the extensions for this process, such as
Mariano's Bindable Behaviour -
http://bakery.cakephp.org/articles/view/bindable-behavior-control-your-model-bindings
);


On Dec 17, 9:00 am, the_woodsman <[EMAIL PROTECTED]> wrote:
> Hi Bakers!
>
> After a long break from development, Im back at it, and I have a
> problem querying my models.
>
> I want to get all client records, where their associated invoiceitems
> (client hasMany invoiceitems) have a particular condition.
>
> Now, If I do
>
> $this->Client->findAll("name='some name' ")
>
> All is well, my invoice table is joined in one query, and all the
> others are joined in their own queries too:
>
> SELECT `Client`.`id`, `Client`.`name`, `Client`.`address`,
> `Client`.`postcode`, `Client`.`contact`, `Client`.`email`,
> `Client`.`method`, `Client`.`paymentterms`, `Client`.`signedinvoices`
> FROM `clients` AS `Client` WHERE name='some name'   1   1 
>   0
> 2   SELECT `Invoiceitem`.`id`, `Invoiceitem`.`client_id`,
> `Invoiceitem`.`date`, `Invoiceitem`.`description`,
> `Invoiceitem`.`cost`, `Invoiceitem`.`quantity`,
> `Invoiceitem`.`invoice_id`, `Invoiceitem`.`type`,
> `Invoiceitem`.`service_category_id`, `Invoiceitem`.`user_id` FROM
> `invoiceitems` AS `Invoiceitem` WHERE `Invoiceitem`.`client_id` IN
> (230)
>
> But when I try to add conditions for the associated Invoiceitem:
>
> SELECT `Client`.`id`, `Client`.`name`, `Client`.`address`,
> `Client`.`postcode`, `Client`.`contact`, `Client`.`email`,
> `Client`.`method`, `Client`.`paymentterms`, `Client`.`signedinvoices`
> FROM `clients` AS `Client` WHERE name='some name' AND invoice_id IS
> NULL
>
> 1054: Unknown column 'invoice_id' in 'where clause'
>
> These conditions are inserted in the first query, only for the Client
> table, which of course fails.
>
> I've tried this with adding the table name, no change (1054: Unknown
> column 'Invoiceitem.invoice_id' in 'where clause'), and specifying
> with the new expects behaviour exactly which models use.
>
> What's the Cake way to add conditions for the associated 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: Id in table is named prj_id

2007-12-16 Thread Grant Cox

var $primaryKey = 'prj_id';

in your model file.

On Dec 17, 7:51 am, situator <[EMAIL PROTECTED]> wrote:
> I am in trying to make the edit page of my app to call the field name
> 'prj_id' as opposed to 'id' in the WHERE clause.  There is no 'id', it
> is only 'prj_id'.  I need the read() and other functions to, when
> calling a query to the 'projects' table, say "...WHERE 'prj_id' = 18"
> instead of "...WHERE 'id' = 18".  Hope this makes sense.
>
> Situator
--~--~-~--~~~---~--~~
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: Id in table is named prj_id

2007-12-16 Thread the_woodsman

Look in the Model section of the manual, it describes how to set
custom keys...

On Dec 16, 9:51 pm, situator <[EMAIL PROTECTED]> wrote:
> I am in trying to make the edit page of my app to call the field name
> 'prj_id' as opposed to 'id' in the WHERE clause.  There is no 'id', it
> is only 'prj_id'.  I need the read() and other functions to, when
> calling a query to the 'projects' table, say "...WHERE 'prj_id' = 18"
> instead of "...WHERE 'id' = 18".  Hope this makes sense.
>
> Situator
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Complex find queries: conditions in the assoc model

2007-12-16 Thread the_woodsman

Hi Bakers!

After a long break from development, Im back at it, and I have a
problem querying my models.

I want to get all client records, where their associated invoiceitems
(client hasMany invoiceitems) have a particular condition.

Now, If I do

$this->Client->findAll("name='some name' ")

All is well, my invoice table is joined in one query, and all the
others are joined in their own queries too:

SELECT `Client`.`id`, `Client`.`name`, `Client`.`address`,
`Client`.`postcode`, `Client`.`contact`, `Client`.`email`,
`Client`.`method`, `Client`.`paymentterms`, `Client`.`signedinvoices`
FROM `clients` AS `Client` WHERE name='some name'   1   1   0
2   SELECT `Invoiceitem`.`id`, `Invoiceitem`.`client_id`,
`Invoiceitem`.`date`, `Invoiceitem`.`description`,
`Invoiceitem`.`cost`, `Invoiceitem`.`quantity`,
`Invoiceitem`.`invoice_id`, `Invoiceitem`.`type`,
`Invoiceitem`.`service_category_id`, `Invoiceitem`.`user_id` FROM
`invoiceitems` AS `Invoiceitem` WHERE `Invoiceitem`.`client_id` IN
(230)

But when I try to add conditions for the associated Invoiceitem:

SELECT `Client`.`id`, `Client`.`name`, `Client`.`address`,
`Client`.`postcode`, `Client`.`contact`, `Client`.`email`,
`Client`.`method`, `Client`.`paymentterms`, `Client`.`signedinvoices`
FROM `clients` AS `Client` WHERE name='some name' AND invoice_id IS
NULL

1054: Unknown column 'invoice_id' in 'where clause'

These conditions are inserted in the first query, only for the Client
table, which of course fails.

I've tried this with adding the table name, no change (1054: Unknown
column 'Invoiceitem.invoice_id' in 'where clause'), and specifying
with the new expects behaviour exactly which models use.

What's the Cake way to add conditions for the associated 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
-~--~~~~--~~--~--~---



Id in table is named prj_id

2007-12-16 Thread situator

I am in trying to make the edit page of my app to call the field name
'prj_id' as opposed to 'id' in the WHERE clause.  There is no 'id', it
is only 'prj_id'.  I need the read() and other functions to, when
calling a query to the 'projects' table, say "...WHERE 'prj_id' = 18"
instead of "...WHERE 'id' = 18".  Hope this makes sense.

Situator

--~--~-~--~~~---~--~~
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: Few questions from a Cake newcomer...

2007-12-16 Thread Chris Hartjes

On Dec 15, 2007 2:57 AM, Funkdafied <[EMAIL PROTECTED]> wrote:
>
>
> 1. If I go to "http://localhost/users";, it works just fine and the
> index page comes up as expected.. but all links seem to have a top-
> level directory of "app". eg:
> http://localhost/app/users/add
> http://localhost/app/users
> How can I remove "app" from the URL? Pages work fine without (and
> with) it, but all links seem to have it by default even though it's
> unnecessary.

Make sure you are using URL rewriting.  If you're using Apache, there
are lots of instructions on Google on how to get it to work with
CakePHP.

>
> 2. I'd like to create a "mobile" version of my website, accessible
> from mobile/cell phones.. I want the URL to be something like
> "domain.com/mobile", so it would have pages such as "domain.com/mobile/
> users". They would share the same controller and model as the main
> page but with a different view. How would I do this?

You can use a combination of custom routes and code in your controller
that detects if you're using a mobile browser or not, then telling it
what view you want to use.

> 3. I see that layouts have placeholders for content and the title..
> but what do I do about menus? In particular, I'd like to be able
> highlight the current menu item but obviously not put the markup in
> all views.

Not a Cake issue.  Javascript/DHTML issue.

> 4. I noticed "bake" can create admin pages, but how can I make them
> secure with a password?

Well, that's not really a CakePHP issue either.  Use standard HTTP
Authentication *or* spend some time learning how to use the Auth
component in CakePHP 1.2

> 5. I'm sure it's simple but how would I make a page such as
> "domain.com/legal" ? There's no model behind it, it doesn't really
> need a controller.. and the name is singular.

You could use the static 'pages' controller, again with a custom route
to make calls to domain.com/legal go to pages/legal

Others will correct me I'm sure.

-- 
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: simple noob question - accessing model functions from bootstrap.php

2007-12-16 Thread Chris Hartjes

On Dec 16, 2007 11:21 AM, glastoveteran <[EMAIL PROTECTED]> wrote:
>
> i.e. I have configuration parameters stored in a db table and I want
> to set them as constants at startup time.  My model name is Parameter
> (parameter.php).

Yes, I agree with the other posted suggestions:

1) put in a beforeFilter() method in your app_controller
2) take a look at the Configure class if using 1.2

-- 
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: chaging default model

2007-12-16 Thread Chris Hartjes

On Dec 16, 2007 1:18 PM, Jon Miller <[EMAIL PROTECTED]> wrote:
>
> Can anyone tell me how to achieve this change, as RequestAction
> clearly doesn't work. I need to change it so that the form helper
> (using the value function in helper.php) will populate, as it takes
> its criteria from $this->data[$this->model][$this->field] and if it's
> using the wrong model to start with, it's not going to populate the
> form correctly.

Perhaps I am misunderstanding the problem you are trying to explain
here.  What you have is one section of your page that contains a form
that someone can alter, right?  Why not display the info as an element
in your page and then use an Ajax submit to process the information?

No need to mess around with RequestAction or anything like that as far
as I can see.

-- 
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: simple noob question - accessing model functions from bootstrap.php

2007-12-16 Thread Luiz Fernando

I'm no Cake god either, but my first idea was to do it on
AppController...

Put this on app_controller.php, on the /app directory:

findAll();
foreach ($parameters as $parameter)
define($parameter['Parameter']['name'], 
$parameter['Parameter']
['value']);
}
}
?>

You just have to be careful that the constant value
( $parameter['Parameter']['value'] ) always evaluate to a scalar
value  (i.e., it's not an array or object).

Greetings,

Luiz F.

On Dec 16, 2:21 pm, glastoveteran <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> Sorry for the stupid question, but how can I access a model's function
> (.e.g. findAll) from bootstrap.php?
>
> i.e. I have configuration parameters stored in a db table and I want
> to set them as constants at startup time.  My model name is Parameter
> (parameter.php).
>
> // something like
> $parameters = $this->model->Parameter->findAll();
> foreach ($parameters as $parameter) {
> define($parameter['Parameter']['name'], $parameter['Parameter']
> ['value']);
>
> }
>
> Thanks, Alex

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



chaging default model

2007-12-16 Thread Jon Miller

Does anyone know a way to change the default model used by a page? I
need to try to 'fool' Cake into believing it's running from a
different URL in part of the page.

 My example is for classified listings. On my listings index page,
underneath the main content from the listings controller, I have a
form allowing a user to edit their personal profile at any time - and
should show a pre-filled form, as you'd get by going to
/profiles/edit/4.

I tried using RequestAction in the following but it didn't work as all
that does is return the results of that page, it doesn't change the
"this->..." info being used:

model;
// returns "Listing"

$this->data = $this->requestAction('/profiles/edit/4');

echo $this->model;

// still echoes 'Listing', not 'Profile' as hoped.

?>

Can anyone tell me how to achieve this change, as RequestAction
clearly doesn't work. I need to change it so that the form helper
(using the value function in helper.php) will populate, as it takes
its criteria from $this->data[$this->model][$this->field] and if it's
using the wrong model to start with, it's not going to populate the
form correctly.

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: Few questions from a Cake newcomer...

2007-12-16 Thread jelmer

I guess we're "in the same boat", I've just started with cakephp today
but did find out a few things that might help you!

1. Have you tried editing the routing.php file? take a look at this
article for some examples:
http://bakery.cakephp.org/articles/view/custom-urls-from-the-site-root

4. Maybe you need to setup a system with users and permissions etc.

5. There's a simple solution for this, create a .thml file in the
views/pages (the pages controller is standard, you don't need to
change it).
If you name it example.thml it's accesible via /pages/example, again
the routing can be used to change that I guess.

I just learned that from this article, which has lots of useful tips:
http://www.avatarfinancial.com/pages/cake/

have fun baking :)

--~--~-~--~~~---~--~~
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: simple noob question - accessing model functions from bootstrap.php

2007-12-16 Thread chad

I'm not sure that you can, I think bootstrap is loaded before any of
the model classes.  Put your code in app_controller.php
beforeFilter().  If you're using 1.2 check out the Configure class as
well.

On Dec 16, 9:21 am, glastoveteran <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> Sorry for the stupid question, but how can I access a model's function
> (.e.g. findAll) from bootstrap.php?
>
> i.e. I have configuration parameters stored in a db table and I want
> to set them as constants at startup time.  My model name is Parameter
> (parameter.php).
>
> // something like
> $parameters = $this->model->Parameter->findAll();
> foreach ($parameters as $parameter) {
> define($parameter['Parameter']['name'], $parameter['Parameter']
> ['value']);
>
> }
>
> Thanks, Alex
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



simple noob question - accessing model functions from bootstrap.php

2007-12-16 Thread glastoveteran

Hi all,

Sorry for the stupid question, but how can I access a model's function
(.e.g. findAll) from bootstrap.php?

i.e. I have configuration parameters stored in a db table and I want
to set them as constants at startup time.  My model name is Parameter
(parameter.php).

// something like
$parameters = $this->model->Parameter->findAll();
foreach ($parameters as $parameter) {
define($parameter['Parameter']['name'], $parameter['Parameter']
['value']);
}

Thanks, Alex

--~--~-~--~~~---~--~~
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: Same Model&Controller but different Views for 2 different domains

2007-12-16 Thread the_woodsman

Perhaps you could store your views in different folders per domain,
i.e views/domain1/ and views/domain2

Then, in your beforeRender function of your AppController, switch the
controller's viewPath depending on the domain.

Something like that should work...



On Dec 16, 1:42 am, Lloyd <[EMAIL PROTECTED]> wrote:
> I'm just wondering, is there a simple or even feasible way of having
> different views for 2 different domains - but the same model and
> controller?  Ie, both websites so to speak will be exactly the same in
> content but just differ in appearance.. maybe I could do this in
> routes.. I'm not sure.. any help would be awesome, 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: dependent=true not working

2007-12-16 Thread [EMAIL PROTECTED]

that was it thanks. found it in the api about an hour after I posted
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: Plugins and RequestAction Issues

2007-12-16 Thread foxmask

in cake/libs/object.php i've changed the following

if (isset($this->plugin)) {
#$extra['plugin'] = $this->plugin;
}

and it's working
but i dont think it's the best


On 16 déc, 11:21, foxmask <[EMAIL PROTECTED]> wrote:
> notice :i use cakephp 1.2.x.x
--~--~-~--~~~---~--~~
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: Extended Validation !?

2007-12-16 Thread ianh

There is also a conditional validation behaviour around somewhere. It
is not listed on the bakery but you can find references to it through
Google. I have a customised version if you want it else if someone
else knows where it has got to that would be great.

On Dec 15, 10:29 pm, Adam Royle <[EMAIL PROTECTED]> wrote:
> Use... $this->data[$this->name]['fieldname']
>
> function checkEmpty($value) {
> $valid = false;
> if ($value == 'c' && !empty($this->data[$this->name]['field4']) {
> $valid = true;
> } elseif (($value == 'a' || $value == 'b') &&
> 
> !empty($this->data[$this->name]['field2']) &&
> 
> empty($this->data[$this->name]['field3'])) {
> $valid = true;
> }
> return $valid;
>
> }
>
> I often use pr($this) in my model to figure out how certain things
> work.
>
> Cheers,
> Adam
>
> On Dec 16, 8:08 am, stefuNz <[EMAIL PROTECTED]> wrote:
>
> > hi chris!
>
> > i think i found what you meant ... "custom validation methods", right?
>
> > but i have one little problem. i don't know how to access field2,
> > field3, field4 when validating field1...
> > here's my approach:
>
> > var $validate = array(
> > 'field1' => array(
> > 'rule' => array('checkEmpty'),
> > 'message' => 'Required field empty.'
> > )
> > );
> > function checkEmpty($data) {
> > $valid = false;
> > print_r($data);
> > if($data == "c" AND !empty($field4)) $valid = true;
> > elseif(($data == "a" OR $data == "b") AND !empty($field2) AND !
> > empty($field3)) $valid = true;
> > return $valid;
> > }
>
> > you see ... i don't know how to access field2 - field4
> > do you know how i can handle that situation?
> > sorry im just new to cakephpp
>
> > sincerely
> > stefan
>
> > On 15 Dez., 20:36, "Chris Hartjes" <[EMAIL PROTECTED]> wrote:
>
> > > On Dec 15, 2007 2:34 PM, stefuNz <[EMAIL PROTECTED]> wrote:
>
> > > > Hi!
>
> > > > I want to use validation for the following situation:
>
> > > > I have a select field (field1) with options a,b,c
> > > > If field1 is a or b then field2 and field3 may not be empty (text
> > > > fields)
> > > > if field1 is c then field4 may not be empty ...
>
> > > > is there a way to use the validation for this or has it to be
> > > > "manually"
>
> > > Sounds to me like it is definitely custom validation, which means
> > > you'll have to do it "manually".  Luckily it's very easy to do it.
>
> > >http://tempdocs.cakephp.org/#TOC121877
>
> > > 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
-~--~~~~--~~--~--~---



Re: How can I build a Forum with Cake?

2007-12-16 Thread Marcin Domanski aka kabturek

Exactly like any other app:
create tables, bake models, views , controllers, edit the generated
stuff to suit your needs

:)

On Dec 15, 10:31 pm, 703designs <[EMAIL PROTECTED]> wrote:
> Can someone help me out? I'd like to build a forum using CakePHP. I'll
> end up documenting my efforts in a tutorial at some point.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: dependent=true not working

2007-12-16 Thread Marcin Domanski aka kabturek

when delating do you set the 'cascade' param ?

On Dec 16, 6:37 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> Here is my model
> class Question extends AppModel {
>
> var $name = 'Question';
> var $validate = array(
> 'question' => VALID_NOT_EMPTY,
> 'type_id' => VALID_NOT_EMPTY,
> );
>
> //The Associations below have been created with all possible keys,
> those that are not needed can be removed
> var $belongsTo = array(
> 'Type' =>
> array('className' => 'Type',
> 'foreignKey' => 'type_id',
> 'conditions' => '',
> 'fields' => '',
> 'order' => '',
> 'counterCache' => ''
> ),
>
> );
>
> var $hasMany = array(
> 'Answer' =>
> array('className' => 'Answer',
> 'foreignKey' => 'question_id',
> 'conditions' => '',
> 'fields' => '',
> 'order' => '',
> 'limit' => '',
> 'offset' => '',
> 'dependent' => true,
> 'exclusive' => '',
> 'finderQuery' => '',
> 'counterQuery' => ''
> ),
>
> And here is the sql from questions and answers
> CREATE TABLE `p6_questions` (
>   `id` int(11) NOT NULL auto_increment,
>   `question` text NOT NULL,
>   `tip` text,
>   `type_id` int(11) NOT NULL,
>   `published` int(11) default NULL,
>   `created` datetime NOT NULL,
>   `modified` datetime NOT NULL,
>   PRIMARY KEY  (`id`)
> ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;
>
> CREATE TABLE `p6_answers` (
>   `id` int(11) NOT NULL auto_increment,
>   `answer` text NOT NULL,
>   `rational` text NOT NULL,
>   `priority` int(11) default NULL,
>   `correct` int(11) default NULL,
>   `question_id` int(11) NOT NULL,
>   `created` datetime NOT NULL,
>   `modified` datetime NOT NULL,
>   PRIMARY KEY  (`id`)
> ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=14 ;
>
> I have p6_ set as the prefix in the config file. I have no other
> problems except that when I delelte a question the related answers are
> not also deleted. Anyone have 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: Plugins and RequestAction Issues

2007-12-16 Thread foxmask

notice :i use cakephp 1.2.x.x
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Plugins and RequestAction Issues

2007-12-16 Thread foxmask

i've a controller
app/controller/reports_controller.php (which count warns to be
displayed of not)
that is used in
app/view/elements/top.ctp like that :

$reports_lists = $this->requestAction('/reports/
index',array('return'=>false));

if (!empty($reports_lists['nb_report']))
   $tpl_temp .= "\n\t\t\t\t".''.__('new warnings',true).';

echo $tpl_temp;

this works well until i dont do http://localhost/articles where
articles is a plugins... (app/plugins/articles/)

i have the foloowing error message :

You are seeing this error because the action reports is not defined in
controller ArticlesController
If you want to customize this error message, create app\views\errors
\missing_action.ctp.
Fatal: Confirm you have created the ArticlesController::reports in
file : app\controllers\articles_controller.php.


but of course reports is not a method of Articles but a controller
itself.

i also tried to specify the route to make understand for the
"requestAction" where to find the stuff :

Router::connect('/reports/*', array('controller' => 'reports',
'action' => 'index'));
Router::connect('/articles/*',
array('plugin'=>'articles','controller' => 'articles', 'action' =>
'index'));

but that does not work too.

if i dont use articles as a plugins and let stuff is app/controllers
app/views app/models everything is ok, but i need plugins as i have a
lot of little app that has to be dispatch as plugins.

What can i do to make this work ?

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



Show All Errors on submit

2007-12-16 Thread AussieFreelancer

Hi All,

I have 2 tables, users and profiles. Along with those I have 2 models,
and in those models I have some validation rules.

When I submit a form that has fields for User and Profile on it, the
User is validated first. If a required field is empty, obviously cake
stops processing it and sends you back to show the errors.

But I would like to validate both the User and Profile models, then
return error messages for all the fields with errors - not just from
the one model. How can I do this?

Also in the same form, I have some fields that I join before saving,
so I will need custom validation going on there. My controller doesn't
have a specific model, it uses User and Profile instead. How can I
validate this field and return the error message at the same time?

Thanks

Patrick

--~--~-~--~~~---~--~~
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: Accelerating cakePHP

2007-12-16 Thread majna

before John David Anderson tips,
try to configure apache to fit your site needs.
tweak mysql conf. if your queries took more then few ms.
use nix ramdisk on  php files for disk IO





On Dec 15, 9:21 pm, "John David Anderson (_psychic_)"
<[EMAIL PROTECTED]> wrote:
> On Dec 15, 2007, at 1:12 PM, Chris Hartjes wrote:
>
>
>
>
>
> > On Dec 15, 2007 3:00 PM, Pillow <[EMAIL PROTECTED]> wrote:
>
> >> Hi,
> >> I've website which has about 3 uniq visits per day (up to 1500
> >> online). The problem is that CMS written on CakePHP consumes too much
> >> of CPUs power.
>
> >> Almost everything is beeing cached (whole views, sometimes db
> >> results).
>
> >> In addition the same site was earlier driven by some poor free system
> >> which hadn't even had cache, and the CPU usage was about 6 times
> >> less.
>
> >> Do you have any tricks and tips to speed up system based on cake?
>
> > Sounds like it was poorly designed, as 3 hits a day isn't what I
> > would consider high traffic.  However, I would suggest the following:
>
> (agreed)
>
> > 1) install a PHP opcode cache like APC
> > 2) make sure you have appropriate database indexes in place
> > 3) spend some time profiling your code using tools like Xdebug and
> > Cachegrind to find out where the slow spots really are.
>
> I might also add
>
> 4) Move rewrite instructions to apache conf rather than .htaccess
> 5) Use unbind model (or something similar) more extensively.
>
> -- John
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---