Re: Customizing relations

2007-11-21 Thread BoSc

unbindModel lets me terminate a relationship between tables, this
does not let me choose the level of recursion on a model to model
basis. I will have a look at the expects behaviour.

On 20 nov, 17:46, [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:
 What you need is unbindModel (see models section in the manual), or
 the expects behaviour (see the bakery)

 Simon

 BoSc wrote:
  Hi,

  Just a simple problem, I have one central table (model) that has a lot
  of relationships with other tables. The problem is, for one view I
  need to get 3 levels of hierarchy (recursive) to be able to get to
  specific data, but only for one specific direction. Since the table is
  connected to 5 other tables, Cake tries to fetch 3 levels of hierarchy
  in all the directions causing major overhead. I know that I can cut
  loose some associations, but this is not the way since I do need the
  other data be it in not so many levels of hierarchy.

  Now I came up with a possible solution but I thought there could be
  some more acceptable way in achieving this:

  - just findAll() using 1/2 levels of hierarchy and query the remaning
  information.
  - Also I was wondering if there is some way to include the fields that
  need to be fetched for certain relationships, when a book is connected
  to an author, when querying all the books I might only be interested
  in the author's name and not in the address (for instance)

  Any help on this in really appreciated.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Problem with model inheritance

2007-11-21 Thread kgrimm

I'm inheriting from my own model class which itself is inherited from
AppModel.

Adding a require statement doesn't work (Cannot redeclare class ...).
With the inheritance itself everything works fine, the problem lies in
the Cake function loadModels() in basics.php.


On Nov 20, 8:04 pm, francky06l [EMAIL PROTECTED] wrote:
 What do you mean by inheritance ? I mean inheriting from a cake core
 class (ie : Appmodel etc ..) or one of your own class ?
 If it's you own class, you need a require statement before your class
 declaration, then it should not be a problem.

 Sorry if I misunderstood the problem

 On Nov 20, 5:57 pm, kgrimm [EMAIL PROTECTED] wrote:

  Hi,

  I'm using inheritance for my own models and controllers. On my local
  machine everything works fine.

  When installing in another environment (from SVN or a tar archive for
  example) I have the problem, that the model classes are not loaded in
  the same order, so it happens that a child class is loaded before its
  parent which leads to error messages. It seems they are loaded in
  alphabetical order, which is not the case locally.

  Does anybody have an idea for a clean solution without for example
  adding absolute paths in cake's code?
  Isn't it just usual to use inheritance for your own models? Why
  doesn't Cake check for it?

  I'm using Cake 1.1.8.3544

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



cakePHP Console script generates timeout

2007-11-21 Thread cronet

Hi,

i've written a shell for the cakphp console, which takes long time.
(It tries to load about 250 MB data with XML in small steps).

But: Althought i set max_execution_time and max_input_time to 0 (in
php.ini), for both, apache and cli version of php5, i get the message

Fatal error: Maximum execution time of 300 seconds exceeded in /var/
www/cake/libs/set.php on line 393


I think it's an cakphp issue, because i've written a loop which
displays the script runtime and then sleeps 1 second. After about
about 5 hours i stopped it without errors.

Anyone else has timeouts?

Regards,
alexander



--~--~-~--~~~---~--~~
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: Customizing relations

2007-11-21 Thread BoSc

It is a but of a hassle with the expects behaviour (a bit hard to
understand the logic at some times), but I've managed fixing my
problem (reduced the result set to a marginal factor of the original).

On 20 nov, 17:46, [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:
 What you need is unbindModel (see models section in the manual), or
 the expects behaviour (see the bakery)

 Simon

 BoSc wrote:
  Hi,

  Just a simple problem, I have one central table (model) that has a lot
  of relationships with other tables. The problem is, for one view I
  need to get 3 levels of hierarchy (recursive) to be able to get to
  specific data, but only for one specific direction. Since the table is
  connected to 5 other tables, Cake tries to fetch 3 levels of hierarchy
  in all the directions causing major overhead. I know that I can cut
  loose some associations, but this is not the way since I do need the
  other data be it in not so many levels of hierarchy.

  Now I came up with a possible solution but I thought there could be
  some more acceptable way in achieving this:

  - just findAll() using 1/2 levels of hierarchy and query the remaning
  information.
  - Also I was wondering if there is some way to include the fields that
  need to be fetched for certain relationships, when a book is connected
  to an author, when querying all the books I might only be interested
  in the author's name and not in the address (for instance)

  Any help on this in really appreciated.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: cakePHP Console script generates timeout

2007-11-21 Thread francky06l

The max_execution_time is set in console/cake.php in
__initConstants(). You can overwrite it I suppose in your shell.

On Nov 21, 9:32 am, cronet [EMAIL PROTECTED] wrote:
 Hi,

 i've written a shell for the cakphp console, which takes long time.
 (It tries to load about 250 MB data with XML in small steps).

 But: Althought i set max_execution_time and max_input_time to 0 (in
 php.ini), for both, apache and cli version of php5, i get the message

 Fatal error: Maximum execution time of 300 seconds exceeded in /var/
 www/cake/libs/set.php on line 393

 I think it's an cakphp issue, because i've written a loop which
 displays the script runtime and then sleeps 1 second. After about
 about 5 hours i stopped it without errors.

 Anyone else has timeouts?

 Regards,
 alexander
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Best Practice: Views, renderElement

2007-11-21 Thread releod

Hello, I am wondering if there is a better approach to this built into
CakePHP 1.2

Basically I have a few views, admin_create, admin_update,
admin_destroy, all using the same code for the form.
I have created another view file called _admin_form.ctp

Right now, for example, I write:
$this-renderElement('../user/_admin_form');

inside of my admin_create.ctp, is there anyway to
render('_admin_form'); without needing to jump out of the current
directory? (_admin_form is in the users directory along with the other
views).

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: Problem with model inheritance

2007-11-21 Thread francky06l

I had this problem a while ago, and I have seen a correction about
this in loadModels(). This was failing because of the parent class
that was expected to be appModel.
Maybe this has changed, I haven't tried this application for few
month.. I will check

On Nov 21, 9:15 am, kgrimm [EMAIL PROTECTED] wrote:
 I'm inheriting from my own model class which itself is inherited from
 AppModel.

 Adding a require statement doesn't work (Cannot redeclare class ...).
 With the inheritance itself everything works fine, the problem lies in
 the Cake function loadModels() in basics.php.

 On Nov 20, 8:04 pm, francky06l [EMAIL PROTECTED] wrote:

  What do you mean by inheritance ? I mean inheriting from a cake core
  class (ie : Appmodel etc ..) or one of your own class ?
  If it's you own class, you need a require statement before your class
  declaration, then it should not be a problem.

  Sorry if I misunderstood the problem

  On Nov 20, 5:57 pm, kgrimm [EMAIL PROTECTED] wrote:

   Hi,

   I'm using inheritance for my own models and controllers. On my local
   machine everything works fine.

   When installing in another environment (from SVN or a tar archive for
   example) I have the problem, that the model classes are not loaded in
   the same order, so it happens that a child class is loaded before its
   parent which leads to error messages. It seems they are loaded in
   alphabetical order, which is not the case locally.

   Does anybody have an idea for a clean solution without for example
   adding absolute paths in cake's code?
   Isn't it just usual to use inheritance for your own models? Why
   doesn't Cake check for it?

   I'm using Cake 1.1.8.3544

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



Re: Best Practice: Views, renderElement

2007-11-21 Thread RichardAtHome

Put your element code in app/view/elements

and you can display them with:

echo $this-renderElement(element_name);


On Nov 21, 8:52 am, releod [EMAIL PROTECTED] wrote:
 Hello, I am wondering if there is a better approach to this built into
 CakePHP 1.2

 Basically I have a few views, admin_create, admin_update,
 admin_destroy, all using the same code for the form.
 I have created another view file called _admin_form.ctp

 Right now, for example, I write:
 $this-renderElement('../user/_admin_form');

 inside of my admin_create.ctp, is there anyway to
 render('_admin_form'); without needing to jump out of the current
 directory? (_admin_form is in the users directory along with the other
 views).

 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: Best Practice: Views, renderElement

2007-11-21 Thread grigri

From my understanding, if you have a form (or any other chunk of html)
that is used by several views, then it clearly qualifies as an
element. Sure, it's a private element (only used by views in /user),
but still an element.

You could always create subfolders under the elements folder, so you'd
have $this-renderElement('user/admin_form'); to render app/views/
elements/user/admin_form.ctp.

If that seems odd to you, try creating an 'elements' subfolder under
app/views/user/, then registering app/views/user as a view path (in
bootstrap.php), so that View::renderElement() will look there too.
That feels a bit hacky, but should work.


On Nov 21, 8:52 am, releod [EMAIL PROTECTED] wrote:
 Hello, I am wondering if there is a better approach to this built into
 CakePHP 1.2

 Basically I have a few views, admin_create, admin_update,
 admin_destroy, all using the same code for the form.
 I have created another view file called _admin_form.ctp

 Right now, for example, I write:
 $this-renderElement('../user/_admin_form');

 inside of my admin_create.ctp, is there anyway to
 render('_admin_form'); without needing to jump out of the current
 directory? (_admin_form is in the users directory along with the other
 views).

 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: Cake Vendors directory access?

2007-11-21 Thread avairet

Hello and thank's for help!

My vendor call is: vendor('file_name');
Not including .php in the call.
My file is not in a subfolder, but my Cake's core folder and my App
folder and Webroot are separate.
I'm using Cake 1.2.0.5875 pre-beta, on Windows XP with Apache 2/PHP
5.2/MySQL 5.
I will test again... maybe it's just a path error.

BR

Avairet



On 21 nov, 05:54, Grant Cox [EMAIL PROTECTED] wrote:
 I have no idea why it doesn't work for you, it works fine here.  Are
 you sure you aren't including the .php part of the filename in your
 vendor call?  Is your file in a subfolder or anything?  What version
 of Cake are you using?

 The vendor() function is defined in /cake/basics.php, and is not very
 complex.  Throw some log() statements in there, you should figure out
 what is going wrong.

 On Nov 20, 11:21 pm, avairet [EMAIL PROTECTED] wrote:





  Hello,

  If I put a php file in cake/vendors directory, when I try to include
  it by using vendor(my_php_file) in a controller or a helper, this
  doesn't work... I must put my php file in app/vendors directory to
  access it.
  So to share an external PHP library in all my cake applications, I
  must copy this library in all apps directories, this is not useful!

  Why the cake/vendors directory doesn't work correctly?

  I need to point out that my Cake directory and apps directories are
  separated.

  Avairet
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Problem with model inheritance

2007-11-21 Thread kgrimm

I have solved the problem now by putting the derivated model classes
in subdirectories, letting the loadModels() function load first the
models of the current directory, then of subdirectories.

On Nov 21, 9:56 am, francky06l [EMAIL PROTECTED] wrote:
 I had this problem a while ago, and I have seen a correction about
 this in loadModels(). This was failing because of the parent class
 that was expected to be appModel.
 Maybe this has changed, I haven't tried this application for few
 month.. I will check

 On Nov 21, 9:15 am, kgrimm [EMAIL PROTECTED] wrote:

  I'm inheriting from my own model class which itself is inherited from
  AppModel.

  Adding a require statement doesn't work (Cannot redeclare class ...).
  With the inheritance itself everything works fine, the problem lies in
  the Cake function loadModels() in basics.php.

  On Nov 20, 8:04 pm, francky06l [EMAIL PROTECTED] wrote:

   What do you mean by inheritance ? I mean inheriting from a cake core
   class (ie : Appmodel etc ..) or one of your own class ?
   If it's you own class, you need a require statement before your class
   declaration, then it should not be a problem.

   Sorry if I misunderstood the problem

   On Nov 20, 5:57 pm, kgrimm [EMAIL PROTECTED] wrote:

Hi,

I'm using inheritance for my own models and controllers. On my local
machine everything works fine.

When installing in another environment (from SVN or a tar archive for
example) I have the problem, that the model classes are not loaded in
the same order, so it happens that a child class is loaded before its
parent which leads to error messages. It seems they are loaded in
alphabetical order, which is not the case locally.

Does anybody have an idea for a clean solution without for example
adding absolute paths in cake's code?
Isn't it just usual to use inheritance for your own models? Why
doesn't Cake check for it?

I'm using Cake 1.1.8.3544

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



Re: Bypassing Cake processing

2007-11-21 Thread Dr. Tarique Sani

On 11/21/07, peterl [EMAIL PROTECTED] wrote:

 I have inherited a Cake site and am still learning it, so help
 appreciated. I want to add a couple of straight files which require
 no work by Cake - a sitemap.xml and a popup window (terms and
 conditions). How could I do this - do I really have to add
 controller / model as well? Thanks.

Put it in app/webroot

HTH
Tarique

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



Bypassing Cake processing

2007-11-21 Thread peterl

I have inherited a Cake site and am still learning it, so help
appreciated. I want to add a couple of straight files which require
no work by Cake - a sitemap.xml and a popup window (terms and
conditions). How could I do this - do I really have to add
controller / model as well? 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: Difference between Session helper and Session component?

2007-11-21 Thread avairet

Hello Grant and thank you very much for your attention and answer!

First, I have not read with precision the SessionHelper's write()
method, sorry for my confusion...
Then, I better understand the difference between this two Session
handlers. It's just a matter of utility!

But when I use a new methodology or new programming technique, I need
to understand all its logic and in this case it was illogical for me!

In my job we are trying to separate Controllers development and Views
design, so I thought using SessionHelper was not in line with this
principle, because the intregator/designer must know PHP's sessions
and/or Helper's methods/properties to create his views.

So I must avoid to be a fundamentalist of MVC ;o)

Avairet




On 21 nov, 00:31, Grant Cox [EMAIL PROTECTED] wrote:
 Obviously, component is for controllers, helper is for views.  The
 reason for the helper is that often view output depends on what is in
 the session, and it can get a little tedious set()'ing everything from
 the session out for the view, in the app_controller beforeFilter
 (just in case the view needs it for this request).

 You will notice that the session helper is read only - you cannot
 write from the view.  So while it may be a little against the grain of
 MVC, it is also very handy :)

 On Nov 20, 8:01 pm, avairet [EMAIL PROTECTED] wrote:

  Hi everybody,

  I'm relatively newbie with Cake 1.2 and I don't understand very well
  the difference between Session Helper and Session Component, which
  have some common methods.
  Is this againsts the 'DRY' (don't repeat yourself) rule?
  Why using write and read Session method in a view? This is
  normally controller's job, isn't it?
  Can you explain the difference or show me an example of Session usage
  with component and helper?
  Thank's by advance and excuse me for my simple English.

  BR

  Avairet
--~--~-~--~~~---~--~~
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: Bypassing Cake processing

2007-11-21 Thread francky06l

You can set the pages in views/pages. This place is designated for
static page, such as the home page etc ...
There is a pagescontroller (default one in the cake libs), mainly it
has 1 action which is display.
You can copy it into your controller directory and modify it if you
need (maybe you will select another layout for example).
hope this helps

On Nov 21, 11:22 am, peterl [EMAIL PROTECTED] wrote:
 I have inherited a Cake site and am still learning it, so help
 appreciated. I want to add a couple of straight files which require
 no work by Cake - a sitemap.xml and a popup window (terms and
 conditions). How could I do this - do I really have to add
 controller / model as well? 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
-~--~~~~--~~--~--~---



Undefined variable: ... CORE\app\views\layouts\default.ctp

2007-11-21 Thread FoxMaSk

Hi,
in the boostrap.php i call a vendor script that does a lot of stuff

one of them is to get the punbb (a BB sofware) config

class foxtal
{
public $pun_config;
{
public function __construct()
# Load cached config
if (file_exists(PUN_ROOT.'/cache/cache_config.php'))
require PUN_ROOT.'/cache/cache_config.php';

if (!defined('PUN_CONFIG_LOADED')  $this-
_generate_config_cache())
require PUN_ROOT.'/cache/cache_config.php';

$this-pun_config = $pun_config;
}
[...]
}

so i do $foxtal =  new foxtal();

now in the layout and everywhere in my application i'd like to be able
to do use $foxtal
for example : echo $foxtal['o_cur_version'] in the defailt.ctp file

Is it possible ?

What do i need to do ?

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



Re: recursive = 3

2007-11-21 Thread wluigi

are you sure you define correctly the relationships ?
did you try from the third model to find the sencond and the first ?

didn t you set recursive to your seconde model ?

On Nov 21, 3:58 am, rtconner [EMAIL PROTECTED] wrote:
 Uhm..

 Creata Model
 Create a second model and HABTM relate them
 Then create a Third mode and HABTM relate it to the second one.

 On the first model, set recursive = 3 and do a find. Note how data
 from the third model is not there.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Undefined variable: ... CORE\app\views\layouts\default.ctp

2007-11-21 Thread Repsah
Inizialize the class in your app_controller and export it to views using the
set() method.

On Nov 21, 2007 12:18 PM, FoxMaSk [EMAIL PROTECTED] wrote:


 Hi,
 in the boostrap.php i call a vendor script that does a lot of stuff

 one of them is to get the punbb (a BB sofware) config

 class foxtal
 {
 public $pun_config;
 {
 public function __construct()
# Load cached config
if (file_exists(PUN_ROOT.'/cache/cache_config.php'))
require PUN_ROOT.'/cache/cache_config.php';

if (!defined('PUN_CONFIG_LOADED')  $this-
 _generate_config_cache())
require PUN_ROOT.'/cache/cache_config.php';

$this-pun_config = $pun_config;
 }
 [...]
 }

 so i do $foxtal =  new foxtal();

 now in the layout and everywhere in my application i'd like to be able
 to do use $foxtal
 for example : echo $foxtal['o_cur_version'] in the defailt.ctp file

 Is it possible ?

 What do i need to do ?

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



Re: Warning: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object

2007-11-21 Thread dandreta

Thanks for your response, but this doesn't solve the problem.
I don't know what to do.
Do you know another way of showing two fields
joined in a select?

On 20 nov, 22:56, francky06l [EMAIL PROTECTED] wrote:
 I do not know if this can be a hint ... I have had the same problem
 recently (working from the SVN branch).. Again I am not sure, but this
 was linked to a Cache::config that had a serialize = false, in my
 core.php.
 I am quite sure it's not related, but  might be a track :

 http://groups.google.com/group/cakephp-edge/browse_thread/thread/d127...

 cheers

 On Nov 20, 8:20 pm, dandreta [EMAIL PROTECTED] wrote:


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Looking for an example with Extjs lib

2007-11-21 Thread aniston

Hello, I found the edit-grid example of extjs very neat and was
looking for an example setup with cake  if anyone has used this
already http://extjs.com/deploy/dev/examples/grid/edit-grid.html

Must admit i'm a new to AJAX and Javascript and risk a kicking from
the grus and pros who might dislike the asking for an example straight
out but I found it easier to Learn by example and then dig into the
code to suit it to my needs.

On the practical end I tried including the ext-base.js, ext-core.js
and ext-all.js incl. the edit-grid.js  libs with the default.thtml but
ended up with Ext is not defined errors (trying to recreate a working
sample of a standard 3x3 table)

any help in howto start with this is appreciated.

ciao,
aniston
--~--~-~--~~~---~--~~
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: Undefined variable: ... CORE\app\views\layouts\default.ctp

2007-11-21 Thread FoxMaSk

i tried :
class AppController extends Controller {

public function index() {
$foxtal =  new foxtal();
$this-set('foxtal', $foxtal);
}
}

and then in default.ctp i still have :
pre
?php
echo foobar;
print_r($foxtal); ?
/pre
which give the error Undefined variable: foxtal

where is the mistake ?
Kind Regards.


On 21 nov, 12:29, Repsah [EMAIL PROTECTED] wrote:
 Inizialize the class in your app_controller and export it to views using the
 set() method.

 On Nov 21, 2007 12:18 PM, FoxMaSk [EMAIL PROTECTED] wrote:



  Hi,
  in the boostrap.php i call a vendor script that does a lot of stuff

  one of them is to get the punbb (a BB sofware) config

  class foxtal
  {
  public $pun_config;
  {
  public function __construct()
 # Load cached config
 if (file_exists(PUN_ROOT.'/cache/cache_config.php'))
 require PUN_ROOT.'/cache/cache_config.php';

 if (!defined('PUN_CONFIG_LOADED')  $this-
  _generate_config_cache())
 require PUN_ROOT.'/cache/cache_config.php';

 $this-pun_config = $pun_config;
  }
  [...]
  }

  so i do $foxtal =  new foxtal();

  now in the layout and everywhere in my application i'd like to be able
  to do use $foxtal
  for example : echo $foxtal['o_cur_version'] in the defailt.ctp file

  Is it possible ?

  What do i need to do ?

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



Re: Warning: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object

2007-11-21 Thread Grant Cox

Have you tried debugging this yourself - what problems did you
encounter?  The errors above give you specific line numbers in your
own code that should give a good idea what is happening.

For a guess, since it is in your afterFind, you are expecting the
afterFind to have an array of results each with a $this-name key,
e.g.
$results = array(  array('Professor'=array()),
array('Professor'=array()) )

which is the case when the model is the primary one being queried.
When the model is only associated to the model being queried, then you
may get an array with a single $this-name key, under which is a
numerically indexed array of results, e.g.

$results = array( 'Professor'=array(  0=array(...), 1=array(...),
2=array(...) ));

So, your afterFind needs to be a bit smarter.  Personally, I have the
following in my app_model:

function afterFind( $results )
{
// see if the model wants to attach attributes
if ( method_exists($this, '_attachAttributes') ){
for ($i = 0; $i  sizeof($results); $i++) {
// check if this is a model, or if it is an 
array of models
if ( isset($results[$i][$this-name]) ){
// this is the model we want, see if 
it's a single or array
if ( 
isset($results[$i][$this-name][0]) ){
// run on every model
for ($j = 0; $j  
sizeof($results[$i][$this-name]); $j++) {

$this-_attachAttributes( $results[$i][$this-name][$j] );
}
} else {
$this-_attachAttributes( 
$results[$i][$this-name] );
}
}
}
}

return $results;
}

and then in my model class I would have something like:

function _attachAttributes( $row )
{
if ( isset($row['firstname']) and isset($row['surname']) ){
$row['fullname'] = $row['firstname'].' 
'.$row['surname'];
}
}


But if you really just want a select with the two fields, just do it
by hand:

function niceSelect( $conditions )
{
$select_list = array();

$rows = $this-findAll( $conditions, null, null null, 1, -1 );
if ( !empty($rows) ){
foreach( $rows as $row ){
$select_list[ $row[$this-name]['id'] ] = 
$row[$this-name]
['firstname'].' '.$row[$this-name]['surname'];
}
}

return $select_list;
}



On Nov 21, 9:41 pm, dandreta [EMAIL PROTECTED] wrote:
 Thanks for your response, but this doesn't solve the problem.
 I don't know what to do.
 Do you know another way of showing two fields
 joined in a select?

 On 20 nov, 22:56, francky06l [EMAIL PROTECTED] wrote:

  I do not know if this can be a hint ... I have had the same problem
  recently (working from the SVN branch).. Again I am not sure, but this
  was linked to a Cache::config that had a serialize = false, in my
  core.php.
  I am quite sure it's not related, but  might be a track :

 http://groups.google.com/group/cakephp-edge/browse_thread/thread/d127...

  cheers

  On Nov 20, 8:20 pm, dandreta [EMAIL PROTECTED] wrote:
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Bypassing Cake processing

2007-11-21 Thread peterl

That did the trick - easy when you know how. Thanks

On Nov 21, 11:01 am, Dr. Tarique Sani [EMAIL PROTECTED] wrote:
 On 11/21/07, peterl [EMAIL PROTECTED] wrote:
...
 Put it in app/webroot

 HTH
 Tarique

 --
 =
 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: Undefined variable: ... CORE\app\views\layouts\default.ctp

2007-11-21 Thread Repsah
because you have to put that declaration in the constructor, not in an
index() method that you probably won't call.

On Nov 21, 2007 1:09 PM, FoxMaSk [EMAIL PROTECTED] wrote:


 i tried :
 class AppController extends Controller {

public function index() {
$foxtal =  new foxtal();
$this-set('foxtal', $foxtal);
}
 }

 and then in default.ctp i still have :
 pre
 ?php
 echo foobar;
 print_r($foxtal); ?
 /pre
 which give the error Undefined variable: foxtal

 where is the mistake ?
 Kind Regards.


 On 21 nov, 12:29, Repsah [EMAIL PROTECTED] wrote:
  Inizialize the class in your app_controller and export it to views using
 the
  set() method.
 
  On Nov 21, 2007 12:18 PM, FoxMaSk [EMAIL PROTECTED] wrote:
 
 
 
   Hi,
   in the boostrap.php i call a vendor script that does a lot of stuff
 
   one of them is to get the punbb (a BB sofware) config
 
   class foxtal
   {
   public $pun_config;
   {
   public function __construct()
  # Load cached config
  if (file_exists(PUN_ROOT.'/cache/cache_config.php'))
  require PUN_ROOT.'/cache/cache_config.php';
 
  if (!defined('PUN_CONFIG_LOADED')  $this-
   _generate_config_cache())
  require PUN_ROOT.'/cache/cache_config.php';
 
  $this-pun_config = $pun_config;
   }
   [...]
   }
 
   so i do $foxtal =  new foxtal();
 
   now in the layout and everywhere in my application i'd like to be able
   to do use $foxtal
   for example : echo $foxtal['o_cur_version'] in the defailt.ctp file
 
   Is it possible ?
 
   What do i need to do ?
 
   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
-~--~~~~--~~--~--~---



Re: Undefined variable: ... CORE\app\views\layouts\default.ctp

2007-11-21 Thread FoxMaSk

Thanks you very much !
i'm starting to see how to rethink a complet CMS which did not use
MVC ; its a real pain, but that's come slowly  ;)

On 21 nov, 13:17, Repsah [EMAIL PROTECTED] wrote:
 because you have to put that declaration in the constructor, not in an
 index() method that you probably won't call.

 On Nov 21, 2007 1:09 PM, FoxMaSk [EMAIL PROTECTED] wrote:



  i tried :
  class AppController extends Controller {

 public function index() {
 $foxtal =  new foxtal();
 $this-set('foxtal', $foxtal);
 }
  }

  and then in default.ctp i still have :
  pre
  ?php
  echo foobar;
  print_r($foxtal); ?
  /pre
  which give the error Undefined variable: foxtal

  where is the mistake ?
  Kind Regards.

  On 21 nov, 12:29, Repsah [EMAIL PROTECTED] wrote:
   Inizialize the class in your app_controller and export it to views using
  the
   set() method.

   On Nov 21, 2007 12:18 PM, FoxMaSk [EMAIL PROTECTED] wrote:

Hi,
in the boostrap.php i call a vendor script that does a lot of stuff

one of them is to get the punbb (a BB sofware) config

class foxtal
{
public $pun_config;
{
public function __construct()
   # Load cached config
   if (file_exists(PUN_ROOT.'/cache/cache_config.php'))
   require PUN_ROOT.'/cache/cache_config.php';

   if (!defined('PUN_CONFIG_LOADED')  $this-
_generate_config_cache())
   require PUN_ROOT.'/cache/cache_config.php';

   $this-pun_config = $pun_config;
}
[...]
}

so i do $foxtal =  new foxtal();

now in the layout and everywhere in my application i'd like to be able
to do use $foxtal
for example : echo $foxtal['o_cur_version'] in the defailt.ctp file

Is it possible ?

What do i need to do ?

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



Re: HABTM

2007-11-21 Thread villas

Am I the only one using the current 1.2 code who finds that the
simplest case HABTM does not work?
The associated data is not being found.  Maybe no one else needs it,
or maybe it's just me :-)

On 20 Nov, 22:01, villas [EMAIL PROTECTED] wrote:
 In case it interests anyone else,  my work-around is to make a model
 for the join table which includes
 var $belongsTo = array('Mail', 'Tag');

 I have then put this code at the end of my Mail controller view
 action:

 $joinRecords = $this-Mail-MailsTag-findAll(
   array('MailsTag.mail_id' = $id)
  ,array(Tag.id
  ,Tag.name,Tag.tagtype
  )
 );
 $mailarray = $this-Mail-read(null, $id);
 $mailarray['Tag'] = $joinRecords;
 $this-set('mail', $mailarray);

 This succeeds in populating and passing the expected  $mail['Tag']
 into my (baked) view.
 But surely this is an ugly hack compared to the auto-magic solution I
 expected with HABTM?

 On 20 Nov, 20:17, villas [EMAIL PROTECTED] wrote:





  Using the latest 1.2 I cannot get the HABTM working. I think it may be
  a bug (3617).  I have two tables:  Mails and Tags and the join table
  Mails_Tags etc.  When I read the Mails table two select queries fire
  OK.  I tested the SQL queries outside Cake and they returns correct
  results.

  However,  whilst the Cake array 'Mail' shows data OK,  the 'Tag' array
  is empty.  That's a bug right?

  Can anyone give me a bit of work around code to get my Tag array
  populated because I'm a bit stuck for a solution right now.  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
-~--~~~~--~~--~--~---



Behaviours - Session data

2007-11-21 Thread villas

Cake 1.2  -- How can I access session data from inside a 'behaviour'
file?  TIA
--~--~-~--~~~---~--~~
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: Best Practice: Views, renderElement

2007-11-21 Thread releod

Cool, thanks - makes sense.



On Nov 21, 4:52 am, grigri [EMAIL PROTECTED] wrote:
 From my understanding, if you have a form (or any other chunk of html)
 that is used by several views, then it clearly qualifies as an
 element. Sure, it's a private element (only used by views in /user),
 but still an element.

 You could always create subfolders under the elements folder, so you'd
 have $this-renderElement('user/admin_form'); to render app/views/
 elements/user/admin_form.ctp.

 If that seems odd to you, try creating an 'elements' subfolder under
 app/views/user/, then registering app/views/user as a view path (in
 bootstrap.php), so that View::renderElement() will look there too.
 That feels a bit hacky, but should work.

 On Nov 21, 8:52 am, releod [EMAIL PROTECTED] wrote:

  Hello, I am wondering if there is a better approach to this built into
  CakePHP 1.2

  Basically I have a few views, admin_create, admin_update,
  admin_destroy, all using the same code for the form.
  I have created another view file called _admin_form.ctp

  Right now, for example, I write:
  $this-renderElement('../user/_admin_form');

  inside of my admin_create.ctp, is there anyway to
  render('_admin_form'); without needing to jump out of the current
  directory? (_admin_form is in the users directory along with the other
  views).

  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: Multiple Slave Servers?

2007-11-21 Thread SeanW

For multiple slave servers I'd look at a load balancer, either
hardware or ipvs + heartbeat.  There's more than just which server do
I send it to?, there's also making sure the server is alive and not
too lagged.

Sean

On Nov 20, 8:24 pm, Mike Lewis [EMAIL PROTECTED] wrote:
 I saw a post about setting up one slave server (http://
 groups.google.com/group/cake-php/browse_thread/thread/58ea010f930fab6c/
 df64d493b24d5a67?lnk=gstq=master+slave+mysqlrnum=1), but I'm
 assuming thats not how you set up multiple slave servers. Quoting 
 fromhttp://www.alertra.com/article446.php:

 If necessary, set up multiple slave servers all replicating from the
 same master. Design your application to distribute SELECT queries
 across all available slaves in some type of rotating or random
 fashion. Once this basic infrastructure is in place, you can simply
 add more slaves as query volume increases.

 Is there a simple way of doing this in CakePHP?
--~--~-~--~~~---~--~~
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 Conditions (using arrays) , a bug in 1.2?

2007-11-21 Thread Adam Royle

I agree - it gets pretty convoluted when you add a bit of complexity
into the conditions.

However, I haven't yet come up with a better syntax (aside from
writing plain sql of course).

Have you got any suggestions?

Adam

On Nov 21, 3:23 am, zonium [EMAIL PROTECTED] wrote:
 I figured it out:
 The statement should be:
 $count 
 =$this-PromoCode-findCount(array('or'=array(array(PromoCode.start_date 
 =

 $datetime, 'PromoCode.promo_code'=$promo_code),
 array('PromoCode.active'='1';

 and the result is as expected:
 SELECT COUNT(*) AS `count` FROM `promo_codes` AS `PromoCode` WHERE
 (((`PromoCode`.`start_date`  '2007-11-20 09:11:23') AND
 (`PromoCode`.`promo_code` = 'freemug')) OR (`PromoCode`.`active` 
 1))

 But ... Too complicated a statement for a simple query. Don't you
 think?
 Thanks!

 On Nov 20, 8:55 am, zonium [EMAIL PROTECTED] wrote:

  In fact, my select statement was

  $count =$this-PromoCode-findCount(array(PromoCode.start_date =
  $datetime, 'PromoCode.promo_code'=$promo_code,
  OR=array('PromoCode.active'='1')));
  and

  Cake created:
  SELECT COUNT(*) AS `count` FROM `promo_codes` AS `PromoCode` WHERE
  `PromoCode`.`start_date`  '2007-11-19 08:50:20' AND
  `PromoCode`.`promo_code` = 'freemug' AND ((`PromoCode`.`active`  1))

  I expected

  SELECT COUNT(*) AS `count` FROM `promo_codes` AS `PromoCode` WHERE
  (`PromoCode`.`start_date`  '2007-11-19 08:50:20' AND
  `PromoCode`.`promo_code` = 'freemug') OR ((`PromoCode`.`active`  1))

  Thanks,

  On Nov 19, 8:42 pm, Grant Cox [EMAIL PROTECTED] wrote:

   Put both conditions in the 'or' key:

   $datetime =  date(Y-m-d H:i:s);
   $count 
   =$this-PromoCode-findCount(array(OR=array(PromoCode.start_date 
   = $datetime,

   'PromoCode.active'='1')));

   On Nov 20, 11:49 am, zonium [EMAIL PROTECTED] wrote:

I have these statements:

$datetime =  date(Y-m-d H:i:s);
$count =$this-PromoCode-findCount(array(PromoCode.start_date =
$datetime, OR=array('PromoCode.active'='1')));

With debug enabled I saw cake tried to create this query:

SELECT COUNT(*) AS `count` FROM `promo_codes` AS `PromoCode` WHERE
`PromoCode`.`start_date`  '2007-11-19 17:38:54' AND
((`PromoCode`.`active`  1))

According to the official manual (http://manual.cakephp.org/chapter/
models) I expected

OR (`PromoCode`.`active`  1)
instead of
AND ((`PromoCode`.`active`  1))

Is it a bug or my statement was not correctly written.

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



cake 1.18 - has it changed the behavior of Sessions?

2007-11-21 Thread keymaster

I have an app which has been working steadily for almost a year,
through several cake releases, up to and including cake 1.17.

When I upgrated to cake 1.18, with no changes to the app, all of a
sudden session variables are disappearing during some (not all) of my
ajax requests. The call to $this-Session-check('myVar') is returning
false.

I am using CAKE_SECURITY = high.

I checked through the release notes of 1.18 and found several session
related fixes. One in particular caught my eye - it had to do with a
bugfix to regenerate session id's on every request. (update which
fixes #3313)

I wondered if perhaps that might have something to do with my
problems.

So, I lowered CAKE_SECURITY from high to medium. That fixed the
problem. To double check, I raised it back to high, and problem
returned.

I reverted back to cake 1.17 and there was no problem both for
CAKE_SECURITY = high and low.

Anyone else experience problems with session vars in 1.18?

Are we supposed to do things differently now that session id's are
being regenerated for CAKE_SECURITY = high?


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



session problems with cake 1.18 and CAKE_SECURITY=high?

2007-11-21 Thread keymaster

Anyone experiencing any problems with session vars in cake 1.18?

I have an app which has been working solidly for almost a year, since
1.11, through all the cake releases until 1.17.

When I upgraded to 1.18, all of a sudden on some of my ajax requests,
the call to $this-Session-check('myVar') was returning false. The
app runs with CAKE_SECURITY = high.

There is one fix in the release notes which changes the way session
id's are regenerated (fixes bug #3313), and that looks like it may be
the problem (for me anyways). When I lower CAKE_SECURITY to medium, I
have no problems with the $this-Session-check('myVar') call. When I
set CAKE_SECURITY to high, the value returned is often false.

I reverted back to cake 1.17, and this problem doesn't occur either
for CAKE_SECURITY high or medium.

Anyone else experiencing issues with sessions in 1.18?

Is there a special or different way we are supposed to handle sessions
when CAKE_SECURITY is high, or should it be transparent?
--~--~-~--~~~---~--~~
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: Looking for an example with Extjs lib

2007-11-21 Thread hydra12

I have used extjs with cake a few times.  I'll send you some examples
later, but I'm on vacation right now and away from my dev. machine.

hydra12

On Nov 21, 5:42 am, aniston [EMAIL PROTECTED] wrote:
 Hello, I found the edit-grid example of extjs very neat and was
 looking for an example setup with cake  if anyone has used this
 alreadyhttp://extjs.com/deploy/dev/examples/grid/edit-grid.html

 Must admit i'm a new to AJAX and Javascript and risk a kicking from
 the grus and pros who might dislike the asking for an example straight
 out but I found it easier to Learn by example and then dig into the
 code to suit it to my needs.

 On the practical end I tried including the ext-base.js, ext-core.js
 and ext-all.js incl. the edit-grid.js  libs with the default.thtml but
 ended up with Ext is not defined errors (trying to recreate a working
 sample of a standard 3x3 table)

 any help in howto start with this is appreciated.

 ciao,
 aniston
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



tree list

2007-11-21 Thread Voyager2K

How generate tree list  by Tree behaviour ?
There are left, right and prent_id key.

each time to get childrens do:
$item-children($parent_id)
is too many sql queries.

PS. Others implementation i see  use  left, right and level fields.
They define change level column for this.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: session problems with cake 1.18 and CAKE_SECURITY=high?

2007-11-21 Thread keymaster

Saw this note from phpnut in bug #3507 on trac:

=
Added id() to Session helper and component to return current Session
id, the component accepts a $id parameter to force setting the Session
id which must be called in a Controller::beforeFilter().

Sessions id are not longer renewed if a request is from Ajax, or from
requestAction();

When Security.level (1.2) or CAKE_SECURITY (1.1) is set the 'high'
renewing of Session id only happens if request is 2 seconds after the
last request.

Added $_Session[Config][timeout] which forces renewing Session if
request are within the 2 second limit and over 10 request. If an
application is expected to make multiple request (more than 10) to the
server in a single proccess, Configure::write('Security.level',
'medium'); (1.2) or $this-Session-security = 'medium'; (1.1) should
be used in a beforeFilter for the specific methods.
=

Anyone understand what this means for ajax requests when CAKE_SECURITY
is high in 1.18? Do we need to change any of our session handling and/
or ajax code?
--~--~-~--~~~---~--~~
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: Eclipse code completion in Views

2007-11-21 Thread avairet

Hi Michael and thank you very much for your baking advice!

For a small application like yours, obviously it's nice to write all
PHPDoc comments for Models in AppController and more nice if nothing
is loading!
But in my case, the application is big and we are 4 developpers to
code... so I think it's not good to surcharge the AppController file
with many PHPDocs comments.
Because the file will become unreadable and because we don't know all
the models we are using or we will use along the application's life.
(Sorry, I'm not sure this sentence is clear?!)

Otherwise, why Helpers/Components are loaded and Models are not?

Bye,

Aurélien
--~--~-~--~~~---~--~~
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: Best Practice: Views, renderElement

2007-11-21 Thread [EMAIL PROTECTED]

Another solution extend basic view class.

?php
class ExView extends View
{

function renderPartial($name, $params = array(), $loadHelpers =
false) {
if ((strpos($name, '\\')===false)  (strpos($name, 
'/')===false)) {
$name = '..' . DS . Inflector::underscore($this-name) 
. DS .
$name;
}
return $this-renderElement($name, $params, $loadHelpers);
}


}
?

And set this class as default view class

?php
class AppController extends Controller {
var $helpers = array('Debug','Javascript','Html','Jquery');

function beforeRender() {
$this-view='Ex';
return true;
}

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



solution to 500 errors running 1.2 on dreamhost and others

2007-11-21 Thread busytoby

i finally found the cause of the 500 errors on dreamhost (and I would
suspect others).  Here's a solid easy walkthrough to get a base setup
going:

1. php cake.php -app ~/projects/newproject bake
2. ln -s ~/projects/newproject ~/sitename.com
3. edit ~/projects/newproject/config/database.php.default and rename
to config/database.php
4. edit ~/projects/newproject/views/layouts/default.ctp and remove or
comment out the $html-link as follows:

?php /* echo $html-link(
$html-
image('cake.power.gif', array('alt'= __(CakePHP: the rapid
development php framework, true), 'border'=0)),
'http://
www.cakephp.org/',
 
array('target'='_new'), null, false
);
*/ ?


I'm still stumped as to why this is causing problems but at least it's
a start.

--~--~-~--~~~---~--~~
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: Woo Hoo! IIS Problems Solved! Somewhat...

2007-11-21 Thread Christopher E. Franklin, Sr.

Thanks John!  I appreciate that!

On Nov 20, 1:08 pm, Jon Bennett [EMAIL PROTECTED] wrote:
  I feel so relieved!

 great news Christopher!! I've been watching this thread hoping to read
 something along those lines!

 jb

 --

 jon bennett
 w:http://www.jben.net/
 iChat (AIM): jbendotnet Skype: jon-bennett
--~--~-~--~~~---~--~~
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: Empty page response

2007-11-21 Thread [EMAIL PROTECTED]

Thanks Claudia! Thanks a ton!

I have been fighting with my hosting provider to disable zend
optimizer and he has been giving me all sorts or excuses.
You nailed the problem well. After making these changes, cakephp is
now alive!

thanks and regards,
Rex

On Oct 30, 3:10 pm, Claudia [EMAIL PROTECTED] wrote:
 I fixed this problem on my (local) machine by changing the translation
 function __ in the basics.phpfile.

 The translation function __ uses debug_backtrace() to find out where a
 translation was called from which can cause problems in combination
 with the zend optimizer extension. But as all the translations for my
 app are in the translation file default, I do not need to check
 whether the translation is called from.

 Therefore I replaced to code of __ by this one:
 code
 function __($singular, $return = false) {
   if (!class_exists('I18n')) {
 uses('i18n');
   }
   if ($return === false) {
 echo I18n::translate($singular, null, 'default');
   }
   else {
 return I18n::translate($singular, null, 'default');
   }}

 /code

 and the translation function __n by this one:
 code
 function __n($singular, $plural, $count, $return = false) {
   if (!class_exists('I18n')) {
 uses('i18n');
   }
   if ($return === false) {
 echo I18n::translate($singular, $plural, 'default', 5, $count);
   }
   else {
 return I18n::translate($singular, $plural, 'default', 5, $count);
   }}

 /code

 Hope it helps

 Claudia

 On Oct 27, 11:16 am, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

  I have submitted a request with my hosting provider. I am hoping he
  will respond soon.

  On Oct 26, 7:01 pm, francky06l [EMAIL PROTECTED] wrote:

   have you tried to ask your hosting peovider ?
   I had the same problem and I asked if I could tweak as follow :

   - having a CGI that would runphpusing a special .ini (they have done
   it, since I can't control everything in it)
   - make it workd in my htaccess as :

   Action application/x-httpd-php5 /php5.cgi

   the cgi does contain :

   #!/bin/sh
   exec /usr/local/cpanel/cgi-sys/php5 -c /home/mydomain/php.ini

   hope this helps

   On Oct 26, 11:48 am, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

Hi,

As I had written in my previous post:cannot accessphp.ini as I am
using a shared hosting.
So, I need some .htaccess based solution.

I am running cake 1.1, 1.2-alpha and 1.2-pre-beta on the same server
but only pre-beta is giving problems.

regards,
Prateek

On Oct 25, 9:15 pm, francky06l [EMAIL PROTECTED] wrote:

 To disable Zend optimiser you need to comment the lines inphp.ini.

 On Oct 25, 5:01 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

  Hi all,

  I tried the following:

  1. lempReplace __(CakePHP: the rapid developmentphpframework,
  true)  ... did not work

  2. Kuntharadding php_flag display_errors on in .htaccess file 
  ...
  did not work

  3. Zend Optimizer was running. I tried disabling it by adding the
  following lines in .htaccess file. I was not able to disable it.
  php_flag display_errors on
  php_flag zend_optimizer.optimization_level 0
  php_flag eaccelerator.enable 0
  php_flag eaccelerator.optimizer 0
  php_flag zlib.output_compression off

  Does anybody have a better idea of how to disable Zend Optimizer? I
  cannot accessphp.ini as I am using a shared hosting.
  Zend Optimizer version is 3.2.2.
  This problem only appears on the above server configuration. I am
  running WAMP on my laptop and it does not appear there.

  Still no luck. Thanks to all for your suggestions. If there are any
  other ideas, do let me know.

  regards,
  Rex

  On Oct 25, 2:53 am, francky06l [EMAIL PROTECTED] wrote:

   The zend optimizer fails on the __() ..I had to remove 
   fromphp.ini
   in order to avoid the crash ..Maybe this is linked.

   On Oct 24, 11:40 pm, lemp [EMAIL PROTECTED] wrote:

On Oct 24, 6:22 am, [EMAIL PROTECTED] [EMAIL PROTECTED] 
wrote:

 After install, when I go to the cake link, a blank page is 
 returned.

Had the same problem.

In cake/libs/view/templates/layouts/default.ctp at line 59

Replace __(CakePHP: the rapid developmentphpframework, true) 
by
any string and it will work.

The same function is used on line 45, so I presume the problem 
is
contextual but I don't know why yet.

Someone has a suggestion?
--~--~-~--~~~---~--~~
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: Eclipse code completion in Views

2007-11-21 Thread schneimi

Hi Aurélien,

 Hi Michael and thank you very much for your baking advice!

You're very welcome!

 For a small application like yours, obviously it's nice to write all
 PHPDoc comments for Models in AppController and more nice if nothing
 is loading!
 But in my case, the application is big and we are 4 developpers to
 code... so I think it's not good to surcharge the AppController file
 with many PHPDocs comments.
 Because the file will become unreadable and because we don't know all
 the models we are using or we will use along the application's life.
 (Sorry, I'm not sure this sentence is clear?!)

I agree, it's not nice to have that code in the AppController, but
it's at least one central place where you can put it, update it and if
you want, remove it before delivering. You can also put it in the root
Controller-Class so it will not appear directly in your application,
but you will always have to update that code along the development.

 Otherwise, why Helpers/Components are loaded and Models are not?

Helpers aren't loaded either (Components are treated like Models), in
this case it's code that is even never executed (because of the
exit()). So both times it's pretty much nothing but useless code to
get eclipse doing the completion.

The difference is that one time you want the completion on certain
class-variables ($this-...), the other time you want to have the
completion in your views on basically undefined variables.

Happy baking,

Michael


avairet schrieb:
 Hi Michael and thank you very much for your baking advice!

 For a small application like yours, obviously it's nice to write all
 PHPDoc comments for Models in AppController and more nice if nothing
 is loading!
 But in my case, the application is big and we are 4 developpers to
 code... so I think it's not good to surcharge the AppController file
 with many PHPDocs comments.
 Because the file will become unreadable and because we don't know all
 the models we are using or we will use along the application's life.
 (Sorry, I'm not sure this sentence is clear?!)

 Otherwise, why Helpers/Components are loaded and Models are not?

 Bye,

 Aur�lien
--~--~-~--~~~---~--~~
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: HABTM problem - Underscore in primary key name?

2007-11-21 Thread Action

Nvm, fixed. Was searching the google groups for the wrong term.

On Nov 21, 12:55 pm, Action [EMAIL PROTECTED] wrote:
 I need to set up a HABTM association between two tables: users and
 teams.

 The problem I'm having is that the primary key in the users table is
 called user_id, not id. (I am not allowed to change this).

 How do I set up my join table and association so it associates Team.id
 with User.user_id, not User.id?

 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: javascript declarations

2007-11-21 Thread ldb

G'day

Thanks very much for that reference.  I did try the fix but it did not
work in my situation. But it's a great link and is bookmarked for
future issues. Much appreciated.

I did end up trying a grueling comparison of the header tags between
two cake projects, one works, one (the current one) did not. I
couldn't visually see any differences. However, replacing it with a
copy of the header from the working project behaves. There's something
in there and I have to get on with this project but am keeping the
code aside so I can finally figure out what it is a bit later. Because
it's going to bother me.  Definitely syntax, hex or something.

Funny too, the javascript- link  was generating the identical code
to just entering it using the script type='text/javascript tag
which did work fine.

On Nov 20, 6:06 pm, bingo [EMAIL PROTECTED] wrote:
 hi idb

 I came across this problem many times..and the only reason IE7 fails
 to load javascript is when the script type=...  ... is the first
 element of the page..checkout my blog where I reported all the
 problems related to javascript and IE7. There is nothing specific to
 cakephp, its javascript and browser problem

 http://ragrawal.wordpress.com/2007/10/25/top-5-reasons-why-ie7-is-com...

 On Nov 20, 3:11 pm, Pablo Viojo [EMAIL PROTECTED] wrote:

  Please provide more details...javascript error, if any, generated html code,
  etc

  --
  Pablo Viojo
  [EMAIL PROTECTED]://pviojo.net

  On Nov 20, 2007 4:07 PM,ldb[EMAIL PROTECTED] wrote:

   G'day

   This has got to be a tweak I missed, can someone please tell me what
   IE7 doesn't like about the following javascript declaration I have in
   my default.thtml header?  I've tested and the isset($javascript) is
   true.

   ?php
 if(isset($javascript)) {
  echo ($javascript-link('prototype'));
  echo ($javascript-link('scriptaculous'));
  echo ($javascript-link('datepicker'));
 }
   ?

   This works fine in Firefox and Safari on Windows and of course any
   linux browser???

   Thanks...;-)

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



Pages Controller issue

2007-11-21 Thread mehodgson

I am working on an ecommerce site using v1.2 and I am having a weird
problem with anything static pages run through the pages
controller.

The navigation is set up to dynamically pull the product information
from the database to create all of the necessary links. I currently
have the appController set like this:

class AppController extends Controller
{
var $components = array('Session');
var $uses = array('Product');

function beforeFilter()
{
$subProducts = $this-Product-
findAll('Product.status='.PRODUCT_ACTIVE,null,null,2); // this is
line 48 referred to in the error below
$this-set('subProducts', $subProducts);
}
}


 It works for perfectly for any of the pages that are run through any
of the other controllers, but the pages controller gives me this
message:

Fatal error: Call to a member function on a non-object in
(directory_path)/app/app_controller.php on line 48

Just as an experiment I set $uses = array('Product'); in the pages
controller and the dynamic navigation worked, but as expected I get
the missing model error for pages.

It seems like setting $uses = null; in the pages controller is
overriding the $uses=array('Product'); in the app controller and
causing the $this-Products fatal call to a member functionon a non-
object.

Does anyone have any suggestions on how to deal with 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
-~--~~~~--~~--~--~---



HABTM problem - Underscore in primary key name?

2007-11-21 Thread Action

I need to set up a HABTM association between two tables: users and
teams.

The problem I'm having is that the primary key in the users table is
called user_id, not id. (I am not allowed to change this).

How do I set up my join table and association so it associates Team.id
with User.user_id, not User.id?

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



Confusing problem with insert/update via AJAX (have exhausted solutions find via search)

2007-11-21 Thread designvoid

Hi there!

I'm trying to perform an insert query via an ajax call, having
searched throughout the group, I have come to the conclusion that it
is something to do with Cake taking the only parameter passed as the
PK and performing an update rather than an insert. I have found posts
regarding this suggesting setting the id to null at start of function,
using the model-create command etc, but none of these seem to work...

I'll paste some snippets, this is my view file with the AJAX call:

input id=job_mark_?php echo $item['j_id']; ? type=checkbox
onClick=new Ajax.Updater('jobs_marked','markit/?php echo
$item['j_id']; ?', {asynchronous:true, evalScripts:true}); /


This is my controller function:

function markit($j_id)
{
$this-Mark-id = null;
$this-params['marked_jobs']['Mark']['jm_j_id'] = $j_id;

if ($this-Mark-save($this-params['marked_jobs']))
{
$this-set('jobs', $this-Job-findAll());
$this-set('marked_jobs', $this-Mark-findAll());
$this-render('marked', 'ajax');
}
}


And this is my 'mark' model:

class Mark extends AppModel {
var $name = 'Mark';
var $primaryKey = 'jm_j_id';
var $useTable = 'jobs_marked';


var $hasOne = array('Job' =
array('className'= 'Job',
'conditions'   = '',
'order'= '',
'dependent'=  true,
'foreignKey'   = 'j_id'
)
);

}


I hope that this is something simple that I have overlooked and one of
you fine people can shed some light on it...
TIA,
d.

--~--~-~--~~~---~--~~
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: Customizing relations

2007-11-21 Thread rvntone

how you fixed?

On Nov 21, 4:39 am, BoSc [EMAIL PROTECTED] wrote:
 It is a but of a hassle with the expects behaviour (a bit hard to
 understand the logic at some times), but I've managed fixing my
 problem (reduced the result set to a marginal factor of the original).

 On 20 nov, 17:46, [EMAIL PROTECTED]

 [EMAIL PROTECTED] wrote:
  What you need is unbindModel (see models section in the manual), or
  the expects behaviour (see the bakery)

  Simon

  BoSc wrote:
   Hi,

   Just a simple problem, I have one central table (model) that has a lot
   of relationships with other tables. The problem is, for one view I
   need to get 3 levels of hierarchy (recursive) to be able to get to
   specific data, but only for one specific direction. Since the table is
   connected to 5 other tables, Cake tries to fetch 3 levels of hierarchy
   in all the directions causing major overhead. I know that I can cut
   loose some associations, but this is not the way since I do need the
   other data be it in not so many levels of hierarchy.

   Now I came up with a possible solution but I thought there could be
   some more acceptable way in achieving this:

   - just findAll() using 1/2 levels of hierarchy and query the remaning
   information.
   - Also I was wondering if there is some way to include the fields that
   need to be fetched for certain relationships, when a book is connected
   to an author, when querying all the books I might only be interested
   in the author's name and not in the address (for instance)

   Any help on this in really appreciated.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Complex Find Conditions (using arrays) , a bug in 1.2?

2007-11-21 Thread AD7six

On Nov 21, 3:23 pm, Adam Royle [EMAIL PROTECTED] wrote:
 I agree - it gets pretty convoluted when you add a bit of complexity
 into the conditions.

Where is the complexity in the stated example?

Any nested array that is written on a single line is going to be
'difficult' to read as such it's easier to read if it's written as:

$conditions['OR']['PromoCode.start_date'] =  $datetime;
$conditions['OR']['PromoCode.promo_code'] = $promo_code;
$conditions['NOT']['PromoCode.active'] = 1; // or
$condiions['PromoCode.active'] = ' ' . 1;
$count =$this-PromoCode-findCount($conditions);

OR as:

$conditions = array(
 'OR' = array(
'PromoCode.start_date' =   $datetime,
'PromoCode.promo_code' =  $promo_code
  )
  'NOT' = array('PromoCode.active' = 1) // or 'PromoCode.active' =
' ' . 1
);
$count =$this-PromoCode-findCount($conditions);

Both of which are unambiguos (, identical) and easy to read. If you /
do/ write a more complex constraint you'll find it's quite easy to do
so if you adopt on or the other means of writing them.

my 2c, hth,

AD
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: tree list

2007-11-21 Thread AD7six



On Nov 21, 4:19 pm, Voyager2K [EMAIL PROTECTED] wrote:
 How generate tree list  by Tree behaviour ?
 There are left, right and prent_id key.

 each time to get childrens do:
 $item-children($parent_id)
 is too many sql queries.

 PS. Others implementation i see  use  left, right and level fields.
 They define change level column for this.

What an amusingly similarly named method:

http://api.cakephp.org/1.2/tree_8php-source.html#l00252
--~--~-~--~~~---~--~~
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: Confusing problem with insert/update via AJAX (have exhausted solutions find via search)

2007-11-21 Thread mehodgson

This may be the problem, in your controller your set:

$this-params['marked_jobs']['Mark']['jm_j_id'] = $j_id;

and in your model your set:

var $primaryKey = 'jm_j_id';

...so in your controller you are setting the passed value to 'jm_j_id'
which is the PK.


On Nov 21, 8:34 am, designvoid [EMAIL PROTECTED] wrote:
 Hi there!

 I'm trying to perform an insert query via an ajax call, having
 searched throughout the group, I have come to the conclusion that it
 is something to do with Cake taking the only parameter passed as the
 PK and performing an update rather than an insert. I have found posts
 regarding this suggesting setting the id to null at start of function,
 using the model-create command etc, but none of these seem to work...

 I'll paste some snippets, this is my view file with the AJAX call:

 input id=job_mark_?php echo $item['j_id']; ? type=checkbox
 onClick=new Ajax.Updater('jobs_marked','markit/?php echo
 $item['j_id']; ?', {asynchronous:true, evalScripts:true}); /

 This is my controller function:

 function markit($j_id)
 {
 $this-Mark-id = null;
 $this-params['marked_jobs']['Mark']['jm_j_id'] = $j_id;

 if ($this-Mark-save($this-params['marked_jobs']))
 {
 $this-set('jobs', $this-Job-findAll());
 $this-set('marked_jobs', $this-Mark-findAll());
 $this-render('marked', 'ajax');
 }
 }

 And this is my 'mark' model:

 class Mark extends AppModel {
 var $name = 'Mark';
 var $primaryKey = 'jm_j_id';
 var $useTable = 'jobs_marked';

 var $hasOne = array('Job' =
 array('className'= 'Job',
 'conditions'   = '',
 'order'= '',
 'dependent'=  true,
 'foreignKey'   = 'j_id'
 )
 );

 }

 I hope that this is something simple that I have overlooked and one of
 you fine people can shed some light on it...
 TIA,
 d.
--~--~-~--~~~---~--~~
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: Multiple Slave Servers?

2007-11-21 Thread Mike Lewis

I realize that but as far as I know Load Balancers only these
protocols:

HTTP
HTTPS
FTP
POP3
SMTP
IMAPv4
DNS
Telnet
LDAP

I'm not to sure if connecting to a DB is anywhere in there.

So from a application standpoint is there anyway to do some rotation
and/or random act to using multiple slave servers.

-
Mike

On Nov 21, 9:08 am, SeanW [EMAIL PROTECTED] wrote:
 For multiple slave servers I'd look at a load balancer, either
 hardware or ipvs + heartbeat.  There's more than just which server do
 I send it to?, there's also making sure the server is alive and not
 too lagged.

 Sean

 On Nov 20, 8:24 pm, Mike Lewis [EMAIL PROTECTED] wrote:

  I saw a post about setting up one slave server (http://
  groups.google.com/group/cake-php/browse_thread/thread/58ea010f930fab6c/
  df64d493b24d5a67?lnk=gstq=master+slave+mysqlrnum=1), but I'm
  assuming thats not how you set up multiple slave servers. Quoting 
  fromhttp://www.alertra.com/article446.php:

  If necessary, set up multiple slave servers all replicating from the
  same master. Design your application to distribute SELECT queries
  across all available slaves in some type of rotating or random
  fashion. Once this basic infrastructure is in place, you can simply
  add more slaves as query volume increases.

  Is there a simple way of doing this in CakePHP?

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



Cake 1.2 :: Prefixing url with parameter

2007-11-21 Thread stev

I'm developing an app and we'd like our url's to be prefixed with a
username followed by the normal controller and action.  For instance

A non-prefixed url to view one of my photo's might look like:

http://server.com/photos/view/steve/3

Instead, we would like to prefix the url with the username, so it
would look like:

http://server.com/steve/photos/view/3

The username 'steve' would then be passed to the view action of the
photos controller as a parameter (or be made available to the
controller somehow). Obviously, this should work for any user who
registers on the site.

I've played with the router but have not been able to get it to work.
Any thoughts?

-steve

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Sad Question

2007-11-21 Thread trooney

Hey Chris,

Looks like we're in a similar boat. I don't have a massive
application, but have to deal with deadly decisions from above. Thanks
for your help on the other thread, and good luck getting everything
setup.

Tyler Rooney
--~--~-~--~~~---~--~~
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: Multiple Slave Servers?

2007-11-21 Thread SeanW

Most of those protocols are balanced at layer 4 (IP and port), the
load balancer has no knowledge of the underlying protocol.  Just
balance port 3306 across your slaves, it'll work just fine.

Sean

On Nov 21, 12:18 pm, Mike Lewis [EMAIL PROTECTED] wrote:
 I realize that but as far as I know Load Balancers only these
 protocols:

 HTTP
 HTTPS
 FTP
 POP3
 SMTP
 IMAPv4
 DNS
 Telnet
 LDAP

 I'm not to sure if connecting to a DB is anywhere in there.

 So from a application standpoint is there anyway to do some rotation
 and/or random act to using multiple slave servers.

 -
 Mike

 On Nov 21, 9:08 am, SeanW [EMAIL PROTECTED] wrote:

  For multiple slave servers I'd look at a load balancer, either
  hardware or ipvs + heartbeat.  There's more than just which server do
  I send it to?, there's also making sure the server is alive and not
  too lagged.

  Sean

  On Nov 20, 8:24 pm, Mike Lewis [EMAIL PROTECTED] wrote:

   I saw a post about setting up one slave server (http://
   groups.google.com/group/cake-php/browse_thread/thread/58ea010f930fab6c/
   df64d493b24d5a67?lnk=gstq=master+slave+mysqlrnum=1), but I'm
   assuming thats not how you set up multiple slave servers. Quoting 
   fromhttp://www.alertra.com/article446.php:

   If necessary, set up multiple slave servers all replicating from the
   same master. Design your application to distribute SELECT queries
   across all available slaves in some type of rotating or random
   fashion. Once this basic infrastructure is in place, you can simply
   add more slaves as query volume increases.

   Is there a simple way of doing this in CakePHP?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Help with database structure

2007-11-21 Thread eid

Hi.

I am trying to create an online matchsystem kind of like this one:
http://www.ngl-one.com/en/match/629/

Now, I decided to try and do this project in CakePHP, but I can't
figure out how my database should be set up. At the moment I've nearly
given up because it seems so chaotic, so now I ask for help with the
structure:

What the site is supposed to do:
You can sign up as a user, and you can be invited to join teams =
users table with id, name, team_id and country
You can create teams = teams table with id, teamleader and  teamname.
I'm not sure how to add the members of the team here. Perhaps just
keep it in the users table and find all where team_id = x?
Then there's the tricky part, the matches. The teamleader can report
the lineup (attending players) out of the players from his team = The
table must include the lineup as well as both team_ids. Normally I
would just associate with team_id but when there's two different
team_ids for the same match how can this be done?
Even worse, the match is played by 5 rounds. And each round is best of
3.

What I need help with is the matches table, I just don't know how to
do it with both several team_ids and several rounds in the same table
with the same match_id.

I know this gets off very confusing. Sorry for that but I'm having a
hard time explaining this, I'm not native English speaker. Hopefully
my intentions will get through :-)

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: Cake 1.2 :: Prefixing url with parameter

2007-11-21 Thread Walker Hamilton

For this: http://portfolio.colum.edu

We did this: Router::connect('/:sitename/', array('controller' =
'public', 'action' = 'template', 'prefix'='public'));

Which...in the controller, you can echo out $this-params['sitename']
to get the :sitename, which in our case was a student's url.
--~--~-~--~~~---~--~~
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: Pages Controller issue

2007-11-21 Thread Walker Hamilton

Read this: 
http://cakebaker.42dh.com/2007/10/30/what-i-didnt-knew-about-controllers-without-models/
--~--~-~--~~~---~--~~
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: Pages Controller issue

2007-11-21 Thread the_woodsman

Complete stab in the dark here...

I remember a blog post somewhere about the difference between setting
$uses to null or to an empty array.

This was the best google hit:

http://groups.google.es/group/tickets-cakephp/browse_thread/thread/57d2165f775020e8

Hope thats relevant...



On Nov 21, 2:54 pm, mehodgson [EMAIL PROTECTED] wrote:
 I am working on an ecommerce site using v1.2 and I am having a weird
 problem with anything static pages run through the pages
 controller.

 The navigation is set up to dynamically pull the product information
 from the database to create all of the necessary links. I currently
 have the appController set like this:

 class AppController extends Controller
 {
 var $components = array('Session');
 var $uses = array('Product');

 function beforeFilter()
 {
 $subProducts = 
 $this-Product-findAll('Product.status='.PRODUCT_ACTIVE,null,null,2); // 
 this is

 line 48 referred to in the error below
 $this-set('subProducts', $subProducts);
 }

 }

  It works for perfectly for any of the pages that are run through any
 of the other controllers, but the pages controller gives me this
 message:

 Fatal error: Call to a member function on a non-object in
 (directory_path)/app/app_controller.php on line 48

 Just as an experiment I set $uses = array('Product'); in the pages
 controller and the dynamic navigation worked, but as expected I get
 the missing model error for pages.

 It seems like setting $uses = null; in the pages controller is
 overriding the $uses=array('Product'); in the app controller and
 causing the $this-Products fatal call to a member functionon a non-
 object.

 Does anyone have any suggestions on how to deal with 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: Pages Controller issue

2007-11-21 Thread mehodgson

I tried switching the pages controller to $uses = array(); and now I
get this error:

Missing controller

You are seeing this error because controller Controller could not be
found.

Notice: If you want to customize this error message, create app/views/
errors/missing_controller.ctp

Fatal: Create the class below in file: app/controllers/controller.php

?php
class Controller extends AppController {
   var $name = '';
}
?

Did they change this behavior in the newest build of 1.2?


On Nov 21, 1:05 pm, Walker Hamilton [EMAIL PROTECTED] wrote:
 Read 
 this:http://cakebaker.42dh.com/2007/10/30/what-i-didnt-knew-about-controll...
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Help with database structure

2007-11-21 Thread Grant Cox

http://manual.cakephp.org/chapter/models

Read up on associations, and how they are meant to work.  And perhaps
make something a bit smaller until you understand what the difference
between associations are.

Anyway, this is the kind of structure I would start with for what you
outlined.  I've used the tennis analogy of game, set, match.

DB Structure
--
User
 - id
 - team_id

Team
 - id
 - team_leader_id

Match
 - id
 - winning_team_id (set when a match is completed)

Set
 - id
 - match_id
 - winning_team_id (set when a set is completed)

Game
 - id
 - set_id
 - home_team_id
 - away_team_id
 - home_team_score
 - away_team_score


Associations
--
User belongsTo Team
User hasOne LeadTeam (class = Team, foreignKey = team_leader_id)

Team hasMany Member (class = User)
Team belongsTo Leader (class = User, foreignKey = team_leader_id)

Match hasMany Set
Match belongsTo WinningTeam (class = Team, foreignKey =
winning_team_id)

Set hasMany Game
Set belongsTo WinningTeam (class = Team, foreignKey =
winning_team_id)

Game belongsTo HomeTeam (class = Team, foreignKey = home_team_id)
Game belongsTo AwayTeam (class = Team, foreignKey = away_team_id)
Game belongsTo Set


On Nov 22, 6:39 am, eid [EMAIL PROTECTED] wrote:
 Hi.

 I am trying to create an online matchsystem kind of like this 
 one:http://www.ngl-one.com/en/match/629/

 Now, I decided to try and do this project in CakePHP, but I can't
 figure out how my database should be set up. At the moment I've nearly
 given up because it seems so chaotic, so now I ask for help with the
 structure:

 What the site is supposed to do:
 You can sign up as a user, and you can be invited to join teams =
 users table with id, name, team_id and country
 You can create teams = teams table with id, teamleader and  teamname.
 I'm not sure how to add the members of the team here. Perhaps just
 keep it in the users table and find all where team_id = x?
 Then there's the tricky part, the matches. The teamleader can report
 the lineup (attending players) out of the players from his team = The
 table must include the lineup as well as both team_ids. Normally I
 would just associate with team_id but when there's two different
 team_ids for the same match how can this be done?
 Even worse, the match is played by 5 rounds. And each round is best of
 3.

 What I need help with is the matches table, I just don't know how to
 do it with both several team_ids and several rounds in the same table
 with the same match_id.

 I know this gets off very confusing. Sorry for that but I'm having a
 hard time explaining this, I'm not native English speaker. Hopefully
 my intentions will get through :-)

 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: Behaviours - Session data

2007-11-21 Thread Grant Cox

Cake does not provide a method, as you should not be accessing the
session from any model / behaviour.

Sometimes it is just much easier to do so though, so you can still
access $_SESSION directly.  But you really should reconsider whether
you have to access the session in your model / behaviour - it may
indicate an overall problem with your application structure.


On Nov 21, 11:46 pm, villas [EMAIL PROTECTED] wrote:
 Cake 1.2  -- How can I access session data from inside a 'behaviour'
 file?  TIA
--~--~-~--~~~---~--~~
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: Looking for an example with Extjs lib

2007-11-21 Thread aniston

Thankx Hydra, will wait for your examples, in the mean time have a
nice vacation wherever you are :)
..aniston

On 21 Nov, 15:41, hydra12 [EMAIL PROTECTED] wrote:
 I have used extjs with cake a few times.  I'll send you some examples
 later, but I'm on vacation right now and away from my dev. machine.

 hydra12

 On Nov 21, 5:42 am, aniston [EMAIL PROTECTED] wrote:

  Hello, I found the edit-grid example of extjs very neat and was
  looking for an example setup with cake  if anyone has used this
  alreadyhttp://extjs.com/deploy/dev/examples/grid/edit-grid.html

  Must admit i'm a new to AJAX and Javascript and risk a kicking from
  the grus and pros who might dislike the asking for an example straight
  out but I found it easier to Learn by example and then dig into the
  code to suit it to my needs.

  On the practical end I tried including the ext-base.js, ext-core.js
  and ext-all.js incl. the edit-grid.js  libs with the default.thtml but
  ended up with Ext is not defined errors (trying to recreate a working
  sample of a standard 3x3 table)

  any help in howto start with this is appreciated.

  ciao,
  aniston
--~--~-~--~~~---~--~~
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: Best Practice: Views, renderElement

2007-11-21 Thread releod

Where is the best place to keep files that extend the CORE CAKE
Framework?

On Nov 21, 10:30 am, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 Another solution extend basic view class.

 ?php
 class ExView extends View
 {

 function renderPartial($name, $params = array(), $loadHelpers =
 false) {
 if ((strpos($name, '\\')===false)  (strpos($name, 
 '/')===false)) {
 $name = '..' . DS . 
 Inflector::underscore($this-name) . DS .
 $name;
 }
 return $this-renderElement($name, $params, $loadHelpers);
 }

 }

 ?

 And set this class as default view class

 ?php
 class AppController extends Controller {
 var $helpers = array('Debug','Javascript','Html','Jquery');

 function beforeRender() {
 $this-view='Ex';
 return true;
 }

 }

 ?
--~--~-~--~~~---~--~~
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: recommendations for credit card processing

2007-11-21 Thread ldb

G'day

Are there any favorites for processing credit card transactions with
CakePHP? Are there any cavets about installing things like Google
Checkout or Authorize.net? I've been reading about this, but haven't
gained any solid opinions yet, sounds like I have to just pick one.

My particular application involves only one product unit which I would
like to feed the checkout and process the credit card. So no shopping
cart is necessary but I can alter one if necessary for the same
effect.


Thanks..
--
ldb

--~--~-~--~~~---~--~~
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: solution to 500 errors running 1.2 on dreamhost and others

2007-11-21 Thread DJ Spark

 It's because dreamhost's default php 5 doesn't include gettext.
 You must compile it yourself (they do have a nice script to do that
for you, in their wiki), or switch back to php4 (the simpler way)

 whenever you use __(), you'll stumble into this.

 spark


On Nov 21, 2007 1:42 PM, busytoby [EMAIL PROTECTED] wrote:

 i finally found the cause of the 500 errors on dreamhost (and I would
 suspect others).  Here's a solid easy walkthrough to get a base setup
 going:

 1. php cake.php -app ~/projects/newproject bake
 2. ln -s ~/projects/newproject ~/sitename.com
 3. edit ~/projects/newproject/config/database.php.default and rename
 to config/database.php
 4. edit ~/projects/newproject/views/layouts/default.ctp and remove or
 comment out the $html-link as follows:

 ?php /* echo $html-link(
 $html-
 image('cake.power.gif', array('alt'= __(CakePHP: the rapid
 development php framework, true), 'border'=0)),
 'http://
 www.cakephp.org/',

 array('target'='_new'), null, false
 );
 */ ?


 I'm still stumped as to why this is causing problems but at least it's
 a start.

 




-- 
[livesets] http://djspark.com.br/
[web] http://sydi.net
[filmes] http://melhoresfilmes.com.br

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: HABTM problem - Underscore in primary key name?

2007-11-21 Thread DJ Spark

 if you did check the manual, in 'models' chapter, you find about
model variables:
 http://manual.cakephp.org/chapter/models

 $primaryKey
 If this model relates to a database table, and the table's primary
key is not named 'id', use this variable to tell Cake the name of the
primary key.


 Spark


On Nov 21, 2007 3:55 PM, Action [EMAIL PROTECTED] wrote:

 I need to set up a HABTM association between two tables: users and
 teams.

 The problem I'm having is that the primary key in the users table is
 called user_id, not id. (I am not allowed to change this).

 How do I set up my join table and association so it associates Team.id
 with User.user_id, not User.id?

 Thanks.
 




-- 
[livesets] http://djspark.com.br/
[web] http://sydi.net
[filmes] http://melhoresfilmes.com.br

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: solution to 500 errors running 1.2 on dreamhost and others

2007-11-21 Thread Larry E. Masters aka PhpNut

  It's because dreamhost's default php 5 doesn't include gettext.
  You must compile it yourself (they do have a nice script to do that
 for you, in their wiki), or switch back to php4 (the simpler way)

  whenever you use __(), you'll stumble into this.

  spark


__() has nothing to do with gettext being compiled in your version of
PHP, there is a known issue with the Zend Optimizer.

-- 
/**
* @author Larry E. Masters
* @var string $userName
* @param string $realName
* @returns string aka PhpNut
* @access  public
*/

--~--~-~--~~~---~--~~
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: Behaviours - Session data

2007-11-21 Thread DJ Spark

 Hi,

 I just thought of a problem I have, and maybe it's a case where model
would need session data: a model behaviour to change table columns
according to the choosen language. How that language could be stored ?
How model could access it ?

 thanks
 spark

On Nov 21, 2007 8:54 PM, Grant Cox [EMAIL PROTECTED] wrote:

 Cake does not provide a method, as you should not be accessing the
 session from any model / behaviour.

 Sometimes it is just much easier to do so though, so you can still
 access $_SESSION directly.  But you really should reconsider whether
 you have to access the session in your model / behaviour - it may
 indicate an overall problem with your application structure.



 On Nov 21, 11:46 pm, villas [EMAIL PROTECTED] wrote:
  Cake 1.2  -- How can I access session data from inside a 'behaviour'
  file?  TIA
 




-- 
[livesets] http://djspark.com.br/
[web] http://sydi.net
[filmes] http://melhoresfilmes.com.br

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Multiple Slave Servers?

2007-11-21 Thread Mike Lewis

So what your saying is put the load balancer IP Address for the
slave.host.ip ?

var $default = array(
'driver'= 'mysql',
'host'  = 'slave.host.ip',
'login' = '',
'password'  = '.',
'database'  = 'my_db'
);

-
Mike

On Nov 21, 3:39 pm, SeanW [EMAIL PROTECTED] wrote:
 Most of those protocols are balanced at layer 4 (IP and port), the
 load balancer has no knowledge of the underlying protocol.  Just
 balance port 3306 across your slaves, it'll work just fine.

 Sean

 On Nov 21, 12:18 pm, Mike Lewis [EMAIL PROTECTED] wrote:

  I realize that but as far as I know Load Balancers only these
  protocols:

  HTTP
  HTTPS
  FTP
  POP3
  SMTP
  IMAPv4
  DNS
  Telnet
  LDAP

  I'm not to sure if connecting to a DB is anywhere in there.

  So from a application standpoint is there anyway to do some rotation
  and/or random act to using multiple slave servers.

  -
  Mike

  On Nov 21, 9:08 am, SeanW [EMAIL PROTECTED] wrote:

   For multiple slave servers I'd look at a load balancer, either
   hardware or ipvs + heartbeat.  There's more than just which server do
   I send it to?, there's also making sure the server is alive and not
   too lagged.

   Sean

   On Nov 20, 8:24 pm, Mike Lewis [EMAIL PROTECTED] wrote:

I saw a post about setting up one slave server (http://
groups.google.com/group/cake-php/browse_thread/thread/58ea010f930fab6c/
df64d493b24d5a67?lnk=gstq=master+slave+mysqlrnum=1), but I'm
assuming thats not how you set up multiple slave servers. Quoting 
fromhttp://www.alertra.com/article446.php:

If necessary, set up multiple slave servers all replicating from the
same master. Design your application to distribute SELECT queries
across all available slaves in some type of rotating or random
fashion. Once this basic infrastructure is in place, you can simply
add more slaves as query volume increases.

Is there a simple way of doing this in CakePHP?

--~--~-~--~~~---~--~~
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: Multiple Slave Servers?

2007-11-21 Thread SeanW

Yup

Sean

On Nov 21, 6:40 pm, Mike Lewis [EMAIL PROTECTED] wrote:
 So what your saying is put the load balancer IP Address for the
 slave.host.ip ?

 var $default = array(
 'driver'= 'mysql',
 'host'  = 'slave.host.ip',
 'login' = '',
 'password'  = '.',
 'database'  = 'my_db'
 );

 -
 Mike

 On Nov 21, 3:39 pm, SeanW [EMAIL PROTECTED] wrote:

  Most of those protocols are balanced at layer 4 (IP and port), the
  load balancer has no knowledge of the underlying protocol.  Just
  balance port 3306 across your slaves, it'll work just fine.

  Sean

  On Nov 21, 12:18 pm, Mike Lewis [EMAIL PROTECTED] wrote:

   I realize that but as far as I know Load Balancers only these
   protocols:

   HTTP
   HTTPS
   FTP
   POP3
   SMTP
   IMAPv4
   DNS
   Telnet
   LDAP

   I'm not to sure if connecting to a DB is anywhere in there.

   So from a application standpoint is there anyway to do some rotation
   and/or random act to using multiple slave servers.

   -
   Mike

   On Nov 21, 9:08 am, SeanW [EMAIL PROTECTED] wrote:

For multiple slave servers I'd look at a load balancer, either
hardware or ipvs + heartbeat.  There's more than just which server do
I send it to?, there's also making sure the server is alive and not
too lagged.

Sean

On Nov 20, 8:24 pm, Mike Lewis [EMAIL PROTECTED] wrote:

 I saw a post about setting up one slave server (http://
 groups.google.com/group/cake-php/browse_thread/thread/58ea010f930fab6c/
 df64d493b24d5a67?lnk=gstq=master+slave+mysqlrnum=1), but I'm
 assuming thats not how you set up multiple slave servers. Quoting 
 fromhttp://www.alertra.com/article446.php:

 If necessary, set up multiple slave servers all replicating from the
 same master. Design your application to distribute SELECT queries
 across all available slaves in some type of rotating or random
 fashion. Once this basic infrastructure is in place, you can simply
 add more slaves as query volume increases.

 Is there a simple way of doing this in CakePHP?
--~--~-~--~~~---~--~~
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: Multiple Slave Servers?

2007-11-21 Thread KyleKai

Try
?php
$slave_db_list = array('1','2','3');
$slave_db_host = $slave_db_list[rand(0,count($slave_db_list))-1];
class DATABASE_CONFIG {
   var $default = array(
 'driver'= 'mysql',
 'host'  = $slave_db_host,
 'login' = '',
 'password'  = '.',
 'database'  = 'my_db'
 );
}
?
On 11月22日, 上午8時40分, Mike Lewis [EMAIL PROTECTED] wrote:
 So what your saying is put the load balancer IP Address for the
 slave.host.ip ?

 var $default = array(
 'driver'= 'mysql',
 'host'  = 'slave.host.ip',
 'login' = '',
 'password'  = '.',
 'database'  = 'my_db'
 );

 -
 Mike

 On Nov 21, 3:39 pm, SeanW [EMAIL PROTECTED] wrote: Most of those protocols 
 are balanced at layer 4 (IP and port), the
  load balancer has no knowledge of the underlying protocol.  Just
  balance port 3306 across your slaves, it'll work just fine.

  Sean

  On Nov 21, 12:18 pm, Mike Lewis [EMAIL PROTECTED] wrote:

   I realize that but as far as I know Load Balancers only these
   protocols:

   HTTP
   HTTPS
   FTP
   POP3
   SMTP
   IMAPv4
   DNS
   Telnet
   LDAP

   I'm not to sure if connecting to a DB is anywhere in there.

   So from a application standpoint is there anyway to do some rotation
   and/or random act to using multiple slave servers.

   -
   Mike

   On Nov 21, 9:08 am, SeanW [EMAIL PROTECTED] wrote:

For multiple slave servers I'd look at a load balancer, either
hardware or ipvs + heartbeat.  There's more than just which server do
I send it to?, there's also making sure the server is alive and not
too lagged.

Sean

On Nov 20, 8:24 pm, Mike Lewis [EMAIL PROTECTED] wrote:

 I saw a post about setting up one slave server (http://
 groups.google.com/group/cake-php/browse_thread/thread/58ea010f930fab6c/
 df64d493b24d5a67?lnk=gstq=master+slave+mysqlrnum=1), but I'm
 assuming thats not how you set up multiple slave servers. Quoting 
 fromhttp://www.alertra.com/article446.php:

 If necessary, set up multiple slave servers all replicating from the
 same master. Design your application to distribute SELECT queries
 across all available slaves in some type of rotating or random
 fashion. Once this basic infrastructure is in place, you can simply
 add more slaves as query volume increases.

 Is there a simple way of doing this in CakePHP?
--~--~-~--~~~---~--~~
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: Multiple Slave Servers?

2007-11-21 Thread KyleKai

sorry forget say...
   if you have many slave_database , you can try this.

On 11月22日, 上午10時05分, KyleKai [EMAIL PROTECTED] wrote:
 Try
 ?php
 $slave_db_list = array('1','2','3');
 $slave_db_host = $slave_db_list[rand(0,count($slave_db_list))-1];
 class DATABASE_CONFIG {
var $default = array(
  'driver'= 'mysql',
  'host'  = $slave_db_host,
  'login' = '',
  'password'  = '.',
  'database'  = 'my_db'
  );}

 ?
 On 11月22日, 上午8時40分, Mike Lewis [EMAIL PROTECTED] wrote:

  So what your saying is put the load balancer IP Address for the
  slave.host.ip ?

  var $default = array(
  'driver'= 'mysql',
  'host'  = 'slave.host.ip',
  'login' = '',
  'password'  = '.',
  'database'  = 'my_db'
  );

  -
  Mike

  On Nov 21, 3:39 pm, SeanW [EMAIL PROTECTED] wrote: Most of those 
  protocols are balanced at layer 4 (IP and port), the
   load balancer has no knowledge of the underlying protocol.  Just
   balance port 3306 across your slaves, it'll work just fine.

   Sean

   On Nov 21, 12:18 pm, Mike Lewis [EMAIL PROTECTED] wrote:

I realize that but as far as I know Load Balancers only these
protocols:

HTTP
HTTPS
FTP
POP3
SMTP
IMAPv4
DNS
Telnet
LDAP

I'm not to sure if connecting to a DB is anywhere in there.

So from a application standpoint is there anyway to do some rotation
and/or random act to using multiple slave servers.

-
Mike

On Nov 21, 9:08 am, SeanW [EMAIL PROTECTED] wrote:

 For multiple slave servers I'd look at a load balancer, either
 hardware or ipvs + heartbeat.  There's more than just which server do
 I send it to?, there's also making sure the server is alive and not
 too lagged.

 Sean

 On Nov 20, 8:24 pm, Mike Lewis [EMAIL PROTECTED] wrote:

  I saw a post about setting up one slave server (http://
  groups.google.com/group/cake-php/browse_thread/thread/58ea010f930fab6c/
  df64d493b24d5a67?lnk=gstq=master+slave+mysqlrnum=1), but I'm
  assuming thats not how you set up multiple slave servers. Quoting 
  fromhttp://www.alertra.com/article446.php:

  If necessary, set up multiple slave servers all replicating from 
  the
  same master. Design your application to distribute SELECT queries
  across all available slaves in some type of rotating or random
  fashion. Once this basic infrastructure is in place, you can simply
  add more slaves as query volume increases.

  Is there a simple way of doing this in CakePHP?
--~--~-~--~~~---~--~~
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: Pages Controller issue

2007-11-21 Thread mehodgson

Never mind that last question...had a typo in my routes that was
causing the problem.

Thanks.

On Nov 21, 1:33 pm, mehodgson [EMAIL PROTECTED] wrote:
 I tried switching the pages controller to $uses = array(); and now I
 get this error:

 Missing controller

 You are seeing this error because controller Controller could not be
 found.

 Notice: If you want to customize this error message, create app/views/
 errors/missing_controller.ctp

 Fatal: Create the class below in file: app/controllers/controller.php

 ?php
 class Controller extends AppController {
var $name = '';}

 ?

 Did they change this behavior in the newest build of 1.2?

 On Nov 21, 1:05 pm, Walker Hamilton [EMAIL PROTECTED] wrote:

  Read 
  this:http://cakebaker.42dh.com/2007/10/30/what-i-didnt-knew-about-controll...
--~--~-~--~~~---~--~~
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: Multiple Slave Servers?

2007-11-21 Thread Samuel DeVore

make sure you set the 'persistent' to false and don't use mysql_pconnect

On Nov 21, 2007 7:07 PM, KyleKai [EMAIL PROTECTED] wrote:

 sorry forget say...
if you have many slave_database , you can try this.


 On 11月22日, 上午10時05分, KyleKai [EMAIL PROTECTED] wrote:
  Try
  ?php
  $slave_db_list = array('1','2','3');
  $slave_db_host = $slave_db_list[rand(0,count($slave_db_list))-1];
  class DATABASE_CONFIG {
 var $default = array(
   'driver'= 'mysql',
   'host'  = $slave_db_host,
   'login' = '',
   'password'  = '.',
   'database'  = 'my_db'
   );}
 
  ?
  On 11月22日, 上午8時40分, Mike Lewis [EMAIL PROTECTED] wrote:
 
   So what your saying is put the load balancer IP Address for the
   slave.host.ip ?
 
   var $default = array(
   'driver'= 'mysql',
   'host'  = 'slave.host.ip',
   'login' = '',
   'password'  = '.',
   'database'  = 'my_db'
   );
 
   -
   Mike
 
   On Nov 21, 3:39 pm, SeanW [EMAIL PROTECTED] wrote: Most of those 
   protocols are balanced at layer 4 (IP and port), the
load balancer has no knowledge of the underlying protocol.  Just
balance port 3306 across your slaves, it'll work just fine.
 
Sean
 
On Nov 21, 12:18 pm, Mike Lewis [EMAIL PROTECTED] wrote:
 
 I realize that but as far as I know Load Balancers only these
 protocols:
 
 HTTP
 HTTPS
 FTP
 POP3
 SMTP
 IMAPv4
 DNS
 Telnet
 LDAP
 
 I'm not to sure if connecting to a DB is anywhere in there.
 
 So from a application standpoint is there anyway to do some rotation
 and/or random act to using multiple slave servers.
 
 -
 Mike
 
 On Nov 21, 9:08 am, SeanW [EMAIL PROTECTED] wrote:
 
  For multiple slave servers I'd look at a load balancer, either
  hardware or ipvs + heartbeat.  There's more than just which server 
  do
  I send it to?, there's also making sure the server is alive and not
  too lagged.
 
  Sean
 
  On Nov 20, 8:24 pm, Mike Lewis [EMAIL PROTECTED] wrote:
 
   I saw a post about setting up one slave server (http://
   groups.google.com/group/cake-php/browse_thread/thread/58ea010f930fab6c/
   df64d493b24d5a67?lnk=gstq=master+slave+mysqlrnum=1), but I'm
   assuming thats not how you set up multiple slave servers. Quoting 
   fromhttp://www.alertra.com/article446.php:
 
   If necessary, set up multiple slave servers all replicating from 
   the
   same master. Design your application to distribute SELECT queries
   across all available slaves in some type of rotating or random
   fashion. Once this basic infrastructure is in place, you can 
   simply
   add more slaves as query volume increases.
 
   Is there a simple way of doing this in CakePHP?
 




-- 
(the old fart) the advice is free, the lack of crankiness will cost you

- its a fine line between a real question and an idiot

http://blog.samdevore.com/archives/2007/03/05/when-open-source-bugs-me/

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Behaviours - Session data

2007-11-21 Thread rtconner

Ya Grant not to argue with you, but if you are going to make a
statement like that, you make me think you have not done much cake
programming. (Though for how long you've been around I'll assume
otherwise)

I need data from the session in the models all the time. It's usually
a modified_by or created_by type of thing. Sometimes its other things,
like enclosing  shopping cart abilities into a model and component.
Cake is meant to make tasks simple  and isolated so you don't have to
repeat yourself. If you can't enclose this type of thing into a
behavior, then what good is cake? Not accessing this data from within
a model really defeats the DRY principal.

On Nov 21, 3:54 pm, Grant Cox [EMAIL PROTECTED] wrote:
 Cake does not provide a method, as you should not be accessing the
 session from any model / behaviour.

 Sometimes it is just much easier to do so though, so you can still
 access $_SESSION directly.  But you really should reconsider whether
 you have to access the session in your model / behaviour - it may
 indicate an overall problem with your application structure.

 On Nov 21, 11:46 pm, villas [EMAIL PROTECTED] wrote:

  Cake 1.2  -- How can I access session data from inside a 'behaviour'
  file?  TIA
--~--~-~--~~~---~--~~
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: Multiple Slave Servers?

2007-11-21 Thread Mike Lewis

So now that I have heard from both sides, what would be the better
thing to do here.

Load Balancer With multiple slaves

OR KyleKai way of randomizing what slave host to choose by the
application

-
Mike

On Nov 21, 9:58 pm, Samuel DeVore [EMAIL PROTECTED] wrote:
 make sure you set the 'persistent' to false and don't use mysql_pconnect

 On Nov 21, 2007 7:07 PM, KyleKai [EMAIL PROTECTED] wrote:





  sorry forget say...
 if you have many slave_database , you can try this.

  On 11月22日, 上午10時05分, KyleKai [EMAIL PROTECTED] wrote:
   Try
   ?php
   $slave_db_list = array('1','2','3');
   $slave_db_host = $slave_db_list[rand(0,count($slave_db_list))-1];
   class DATABASE_CONFIG {
  var $default = array(
'driver'= 'mysql',
'host'  = $slave_db_host,
'login' = '',
'password'  = '.',
'database'  = 'my_db'
);}

   ?
   On 11月22日, 上午8時40分, Mike Lewis [EMAIL PROTECTED] wrote:

So what your saying is put the load balancer IP Address for the
slave.host.ip ?

var $default = array(
'driver'= 'mysql',
'host'  = 'slave.host.ip',
'login' = '',
'password'  = '.',
'database'  = 'my_db'
);

-
Mike

On Nov 21, 3:39 pm, SeanW [EMAIL PROTECTED] wrote: Most of those 
protocols are balanced at layer 4 (IP and port), the
 load balancer has no knowledge of the underlying protocol.  Just
 balance port 3306 across your slaves, it'll work just fine.

 Sean

 On Nov 21, 12:18 pm, Mike Lewis [EMAIL PROTECTED] wrote:

  I realize that but as far as I know Load Balancers only these
  protocols:

  HTTP
  HTTPS
  FTP
  POP3
  SMTP
  IMAPv4
  DNS
  Telnet
  LDAP

  I'm not to sure if connecting to a DB is anywhere in there.

  So from a application standpoint is there anyway to do some rotation
  and/or random act to using multiple slave servers.

  -
  Mike

  On Nov 21, 9:08 am, SeanW [EMAIL PROTECTED] wrote:

   For multiple slave servers I'd look at a load balancer, either
   hardware or ipvs + heartbeat.  There's more than just which 
   server do
   I send it to?, there's also making sure the server is alive and 
   not
   too lagged.

   Sean

   On Nov 20, 8:24 pm, Mike Lewis [EMAIL PROTECTED] wrote:

I saw a post about setting up one slave server (http://
groups.google.com/group/cake-php/browse_thread/thread/58ea010f930fab6c/
df64d493b24d5a67?lnk=gstq=master+slave+mysqlrnum=1), but I'm
assuming thats not how you set up multiple slave servers. 
Quoting fromhttp://www.alertra.com/article446.php:

If necessary, set up multiple slave servers all replicating 
from the
same master. Design your application to distribute SELECT 
queries
across all available slaves in some type of rotating or random
fashion. Once this basic infrastructure is in place, you can 
simply
add more slaves as query volume increases.

Is there a simple way of doing this in CakePHP?

 --
 (the old fart) the advice is free, the lack of crankiness will cost you

 - its a fine line between a real question and an idiot

 http://blog.samdevore.com/archives/2007/03/05/when-open-source-bugs-me/

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Behaviours - Session data

2007-11-21 Thread nate

@rtconner: Grant is right and you don't know what you're talking
about.  Stop acting like a punk.

$this-Model-set('member', $this-Session-read('Member.name'));

It's not rocket surgery.

On Nov 22, 12:01 am, rtconner [EMAIL PROTECTED] wrote:
 Ya Grant not to argue with you, but if you are going to make a
 statement like that, you make me think you have not done much cake
 programming. (Though for how long you've been around I'll assume
 otherwise)

 I need data from the session in the models all the time. It's usually
 a modified_by or created_by type of thing. Sometimes its other things,
 like enclosing  shopping cart abilities into a model and component.
 Cake is meant to make tasks simple  and isolated so you don't have to
 repeat yourself. If you can't enclose this type of thing into a
 behavior, then what good is cake? Not accessing this data from within
 a model really defeats the DRY principal.

 On Nov 21, 3:54 pm, Grant Cox [EMAIL PROTECTED] wrote:

  Cake does not provide a method, as you should not be accessing the
  session from any model / behaviour.

  Sometimes it is just much easier to do so though, so you can still
  access $_SESSION directly.  But you really should reconsider whether
  you have to access the session in your model / behaviour - it may
  indicate an overall problem with your application structure.

  On Nov 21, 11:46 pm, villas [EMAIL PROTECTED] wrote:

   Cake 1.2  -- How can I access session data from inside a 'behaviour'
   file?  TIA
--~--~-~--~~~---~--~~
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: Behaviours - Session data

2007-11-21 Thread Grant Cox

And that nate's response came in 20 minutes before mine showed how
long I sat here thinking about it, heh.
--~--~-~--~~~---~--~~
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: Best Practice: Views, renderElement

2007-11-21 Thread [EMAIL PROTECTED]

In place where thay should be.
For view class extensisions correct place is /app/views folder

BTW: @grigri
Your proposiiton need aditional manual work. We need to describe each
subview folder in bootstrap or create aditional code that will take
time.
--~--~-~--~~~---~--~~
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: Undefined variable: ... CORE\app\views\layouts\default.ctp

2007-11-21 Thread FoxMaSk

Hi,
I meet 2 issue :

A) Constantes
B) Array and undefined index

A) Constantes
When i define a constante in the __construct of the app_controller.php
cakephp try to define it twice ...

one for each controllor ? (app_controller.php and one for
[myapp]_controller.php ) ?

if so ; do i have to define my constantes in bootstrap.php instead ?

B) Undefined index

when i instanciate my $foxtal in __construct of the my
app_controller.php

class AppController extends Controller {

public function __construct() {
$foxtal =  new foxtal();
$this-set('foxtal', $foxtal);
}
}

and access to http://localhost/ and do ?php echo $foxtal['my_index'] ?
 in the  layout
everything goes well

BUT as soon as i do  http://localhost/article/index

the same echo in my the view give a NOTICE undefined index ...

Why ?
Kind Regards

On 21 nov, 13:54, FoxMaSk [EMAIL PROTECTED] wrote:
 Thanks you very much !
 i'm starting to see how to rethink a complet CMS which did not use
 MVC ; its a real pain, but that's come slowly  ;)

 On 21 nov, 13:17, Repsah [EMAIL PROTECTED] wrote:

  because you have to put that declaration in the constructor, not in an
  index() method that you probably won't call.

  On Nov 21, 2007 1:09 PM, FoxMaSk [EMAIL PROTECTED] wrote:

   i tried :
   class AppController extends Controller {

  public function index() {
  $foxtal =  new foxtal();
  $this-set('foxtal', $foxtal);
  }
   }

   and then in default.ctp i still have :
   pre
   ?php
   echo foobar;
   print_r($foxtal); ?
   /pre
   which give the error Undefined variable: foxtal

   where is the mistake ?
   Kind Regards.

   On 21 nov, 12:29, Repsah [EMAIL PROTECTED] wrote:
Inizialize the class in your app_controller and export it to views using
   the
set() method.

On Nov 21, 2007 12:18 PM, FoxMaSk [EMAIL PROTECTED] wrote:

 Hi,
 in the boostrap.php i call a vendor script that does a lot of stuff

 one of them is to get the punbb (a BB sofware) config

 class foxtal
 {
 public $pun_config;
 {
 public function __construct()
# Load cached config
if (file_exists(PUN_ROOT.'/cache/cache_config.php'))
require PUN_ROOT.'/cache/cache_config.php';

if (!defined('PUN_CONFIG_LOADED')  $this-
 _generate_config_cache())
require PUN_ROOT.'/cache/cache_config.php';

$this-pun_config = $pun_config;
 }
 [...]
 }

 so i do $foxtal =  new foxtal();

 now in the layout and everywhere in my application i'd like to be able
 to do use $foxtal
 for example : echo $foxtal['o_cur_version'] in the defailt.ctp file

 Is it possible ?

 What do i need to do ?

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



Re: Undefined variable: ... CORE\app\views\layouts\default.ctp

2007-11-21 Thread Repsah
1) Constants should be defined in app/config/bootstrap.php, not in the
controller class

2) debug the view variables, if defined in app_controller that variable
should be available to views, also check that you don't unset it.

On Nov 22, 2007 8:48 AM, FoxMaSk [EMAIL PROTECTED] wrote:


 Hi,
 I meet 2 issue :

 A) Constantes
 B) Array and undefined index

 A) Constantes
 When i define a constante in the __construct of the app_controller.php
 cakephp try to define it twice ...

 one for each controllor ? (app_controller.php and one for
 [myapp]_controller.php ) ?

 if so ; do i have to define my constantes in bootstrap.php instead ?

 B) Undefined index

 when i instanciate my $foxtal in __construct of the my
 app_controller.php

 class AppController extends Controller {

public function __construct() {
$foxtal =  new foxtal();
$this-set('foxtal', $foxtal);
}
 }

 and access to http://localhost/ and do ?php echo $foxtal['my_index'] ?
  in the  layout
 everything goes well

 BUT as soon as i do  http://localhost/article/index

 the same echo in my the view give a NOTICE undefined index ...

 Why ?
 Kind Regards

 On 21 nov, 13:54, FoxMaSk [EMAIL PROTECTED] wrote:
  Thanks you very much !
  i'm starting to see how to rethink a complet CMS which did not use
  MVC ; its a real pain, but that's come slowly  ;)
 
  On 21 nov, 13:17, Repsah [EMAIL PROTECTED] wrote:
 
   because you have to put that declaration in the constructor, not in an
   index() method that you probably won't call.
 
   On Nov 21, 2007 1:09 PM, FoxMaSk [EMAIL PROTECTED] wrote:
 
i tried :
class AppController extends Controller {
 
   public function index() {
   $foxtal =  new foxtal();
   $this-set('foxtal', $foxtal);
   }
}
 
and then in default.ctp i still have :
pre
?php
echo foobar;
print_r($foxtal); ?
/pre
which give the error Undefined variable: foxtal
 
where is the mistake ?
Kind Regards.
 
On 21 nov, 12:29, Repsah [EMAIL PROTECTED] wrote:
 Inizialize the class in your app_controller and export it to views
 using
the
 set() method.
 
 On Nov 21, 2007 12:18 PM, FoxMaSk [EMAIL PROTECTED] wrote:
 
  Hi,
  in the boostrap.php i call a vendor script that does a lot of
 stuff
 
  one of them is to get the punbb (a BB sofware) config
 
  class foxtal
  {
  public $pun_config;
  {
  public function __construct()
 # Load cached config
 if
 (file_exists(PUN_ROOT.'/cache/cache_config.php'))
 require
 PUN_ROOT.'/cache/cache_config.php';
 
 if (!defined('PUN_CONFIG_LOADED')  $this-
  _generate_config_cache())
 require
 PUN_ROOT.'/cache/cache_config.php';
 
 $this-pun_config = $pun_config;
  }
  [...]
  }
 
  so i do $foxtal =  new foxtal();
 
  now in the layout and everywhere in my application i'd like to
 be able
  to do use $foxtal
  for example : echo $foxtal['o_cur_version'] in the defailt.ctpfile
 
  Is it possible ?
 
  What do i need to do ?
 
  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
-~--~~~~--~~--~--~---