RE: Allowed memory size exhausted - on clean cakephp install

2009-08-13 Thread David Coleman
Chances are that your php settings are minimilistic.  Check your php.ini
locally and see how much memory you are allowing a script to use.  Then
check your server settings and if you are not allowing the same amount, make
it match.  I have had this issue with certain hosts before as well, many
“dedicated” servers are nothing more than a virtual server that is
“dedicated” to your account.  Plesk is a good example of a fake “dedicated”
platform.  If you are not allowed to change the php.ini on your “dedicated”
solution, then it is not dedicated.

 

Best of luck.

 

 
  
  
   David Kenneth Coleman

Sr.Software Engineer

 
………

United States: +
1 6468108783 Dept:  Development

Argentina:
+ 54 11 52465987  E-mail:   david.cole...@connaxis.com

The Netherlands:   + 31
208080017 Skype:   david.k.coleman

 

 

 

¡   
  
   NEW! Please check out
our new   Portfolio Website:

  Connaxis Creative Outsourcing
Specialist  
www.creative-outsourcing.com

First page position Google.com:
 Creative Outsourcing

 

-Original Message-
From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf
Of Anna P
Sent: 2009-08-13 14:23
To: CakePHP
Subject: Allowed memory size exhausted - on clean cakephp install

 

 

Hello!

I am moving my web application to dedicated server.

I uploaded all of my app files and voila - under server IP I got blank

page. So I've figured out to install clean cakephp version first and

see if it works there. I uploaded Cakephp 1.2.4.82.84 version and it

displayed me Cake's welcome page. I changed db config and Cake said it

is able to connect to db. But when I entered app_controller.php file

and wrote this:

 

var $uses = array('User');

 

it started to show this message:

 

Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to

allocate 30720 bytes) in [...]/www/cake/libs/view/helpers/form.php on

line 1312

 

and firstly it showed error at cake/libs/i18n.php at line 437 for

another model

and error at cake/libs/view/view.php on line 663 for another model

 

What is going on? This is a clean CakePHP application with just models

at "model" catalog and thats all.

Please,help. :-)

 


 


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

<>

RE: Using CakePHP to refactor an existing website

2009-07-07 Thread David Coleman

Best of luck friend!  Hope your upgrading finds you in less stressful times!

-Original Message-
From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf
Of Vincent
Sent: 2009-07-07 12:34
To: CakePHP
Subject: Re: Using CakePHP to refactor an existing website


Thanks for the feedbacks.
A bit too early to invest in that book, but definitely encouraging!
I'll carry on my learning of that framework and the possible
integration with my nemesis legacy website ;)


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



RE: Integrating Microsoft ASP with CakePHP

2009-07-07 Thread David Coleman
Simonjpa:

 

Why don’t you use jQuery on the cakePHP app and call the asp modules that
you need.  You can put the ASP on a different port let’s say for fun
mydomain.com:81 and call these modules from the php site.  You should be
able to configure the ASP modules to return a valid javascript array which
you can then jQuery back to the cake app as a POST array and voila! one
pre-fabricated-ready-to-ship-cake-php-and-asp-integrated-payment-portal.

 

This really isn’t as hard as everyone makes it out to be.  It’s just a web
server.  You are the programmer.  Tell the box to do what you want it to do.

 

 
  
  
   David Kenneth Coleman

Sr.Software Engineer

 
………

United States: +
1 6468108783 Dept:  Development

Argentina:
+ 54 11 52465987  E-mail:   david.cole...@connaxis.com

The Netherlands:   + 31
208080017 Skype:   david.k.coleman

 

 

 

¡   
  
   NEW! Please check out
our new   Portfolio Website:

  Connaxis Creative Outsourcing
Specialist  
www.creative-outsourcing.com

First page position Google.com:
 Creative Outsourcing

 

-Original Message-
From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf
Of Robert P
Sent: 2009-07-07 10:37
To: CakePHP
Subject: Re: Integrating Microsoft ASP with CakePHP

 

 

Perhaps it would help if you clarified your request.

 

Are you trying to write the store in PHP or ASP? What are these

required Components? What type of example did you get from VISA?

 

On Jul 7, 4:27 am, "simon...@gmail.com"  wrote:

> Hi Everyone,

> 

> I did a website using CakePHP. Now I need to do an e-store in this

> website using Microsoft ASP and Components.

> 

> I need to use VISA Credit Card and VISA did sent me an example that

> use ASP and some Components. The Components are already on the server.

> 

> What is the best way for me to use ASP with CakePHP?

> 

> Regards,



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

<>

RE: Using CakePHP to refactor an existing website

2009-07-06 Thread David Coleman
Michael,

 

What you propose is totally possible.  The idea would be that you would
include all of the original website in the app/wwwroot folder.  This would
allow it to be accessed as though it was never modified.  The only
restriction is you must use cake-php’s index.php file.  You can get around
this by re-designating the links to index.php to point to index-flat.php and
name your original index.php to index-flat.php…  you might have some minor
conflicts with cakePHP’s index.php being the default handler for
http://my.domain.com/ but you should be able to over come this with some
inventive manipulation.  Possibly using an empty ‘home’ controller method
and view to display the original index php, with a custom template just for
that particular view so that the “no-grade” is transparent and your
superiors think that you are not re-designing the whole site.  :-)

 

As far as the integration goes, it should be relatively simple from there
once you have the whole site functioning inside the cake framework.  As you
say, you can simply link to various controller methods to enable the
“approved” upgrades, while in the background, you can begin using cakePHP’s
features to facilitate the transition of existing code transparently to your
users/bosses.

 

FYI, you will need to remember to disable cakePHP’s default CSS in your
custom template so that the original site will render properly with little
to no changes to existing code.

 

Best of luck, and happy hacking!!!

 

 
  
  
   David Kenneth Coleman

Sr.Software Engineer

 
………

United States: +
1 6468108783 Dept:  Development

Argentina:
+ 54 11 52465987  E-mail:   david.cole...@connaxis.com

The Netherlands:   + 31
208080017 Skype:   david.k.coleman

 

 

 

¡   
  
   NEW! Please check out
our new   Portfolio Website:

  Connaxis Creative Outsourcing
Specialist  
www.creative-outsourcing.com

First page position Google.com:
 Creative Outsourcing

 

-Original Message-
From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf
Of schneimi
Sent: 2009-07-06 15:56
To: CakePHP
Subject: Re: Using CakePHP to refactor an existing website

 

 

Hi,

 

I can just give you a hint to a book concerning this topic, maybe it

helps you.

 

http://littlehart.net/book/

 

Regards,

 

Michael

 

 

Vincent schrieb:

> Hi,

> 

> I am considering refactoring a "messy" company intranet (written in

> plain PHP) using a web framework, and as you guessed, CakePHP caught

> my eye.

> 

> My constraint is that I cannot rewrite it completely from scratch

> (hard to convince a manager on that), so I am thinking to gradually

> replace existing plain PHP pages with requests going through the MVC

> workflow (routing, controller, rendering a view).

> Of course, I can only replace independent/isolated parts of the

> intranet with framework-based equivalents (wherever possible).

> 

> So my question is:

> Is it viable to mix plain PHP with CakePHP? The whole "convention over

> configuration" thing might be a problem (dealing with legacy database,

> URLs,

> Any comment/recommendation on this project?

> 

> Thanks in advance.



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

<>

RE: A little help needed on determining my model relation ships please

2009-06-04 Thread David Coleman

Resending because for some reason my 2nd message appeared and this one is
not in the list yet. :-(

The recursive refers to whether or not you want sub_categories to have other
sub_categories...

Products belong to categories, so I suggested a separate category table to
handle that relationship,
Then sub categories are related to a category of course, but you have a
HABTM relationship with the product.

It could be all done with a recursive category table, but it would
complicate the cake relationships. Especially when you start traversing deep
into sub-sub-categories...

So I suggested that you have 
Product.cat_id -> category.id
Product.id
   <-( product_sub_categories.prod_id
 Product_sub_categories.sub_cat_id
   )-> 
sub_category.id

then you can have
sub_category.cat_id -> category.id
and
sub_category.parent_id -> sub_category.id

and you are very-happy-super-tree-enabled!

:-)

Cheers,
Dave

-Original Message-
From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf
Of cake...@hbit.ie
Sent: 2009-06-04 11:57
To: CakePHP
Subject: Re: A little help needed on determining my model relation ships
please


Ok I think I follow, just to clarify:

A product will belong to at least one or more subcategories, so i
guess it will be

product_sub_categories
  id
  product_id
  sub_category_id

Im not too sure what you mean by the recursive parent_id.. can you
please elaborate?

Thanks

Kevin

On Jun 4, 3:02 pm, "David Coleman"  wrote:
> This depends on how you want to build your sub categories tree:
>
> Is it a relationship like this:
>
> category
>
>   id
>
>   parent_id
>
> or
>
> category
>
>   id
>
> sub_category
>
>   id
>
>   category_id
>
>   parent_sub_category
>
> your product could be
>
> product
>
>   id
>
>   ...
>
> Then a join table
>
> categories_products
>
>   id
>
>   product_id
>
>   category_id
>
> or you could have
>
> product
>
>   id
>
>   category_id
>
> product_sub_categories
>
>   id
>
>   product_id
>
>   sub_category_id
>
> it really depends on what your data model requirements are.
>
> The join table will be extremely useful in establishing the HABTM
> relationships you require.
>
> Cake bake will not automatically detect recursive parent_id as a category.
> so you will have to define that manually.
>
> -Original Message-
> From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On
Behalf
>
> Of Beedge
> Sent: 2009-06-04 10:46
> To: CakePHP
> Subject: A little help needed on determining my model relation ships
please
>
> Hi all, about to start on my first cake project. A straight forward e-
>
> commerce site.
>
> I am not used to having to visualise my database relationships so I
>
> was hoping for a little help.
>
> A product belongs in a category
>
> A product can be in many categories
>
> A Category has Sub categories
>
> Is this just a HABTM relationship between products and categories?
>
> I will be using tree behavior for my categories.
>
> Any comments on this or helpers?  I would love to find a tutorial that
>
> covered this, but all I can really find is blog tutorials!
>
> Thanks in advance
>
> Kev
>
>
>
>  image001.gif
> < 1KViewDownload


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



RE: A little help needed on determining my model relation ships please

2009-06-04 Thread David Coleman

FYI: I suggested the relationship of product -> category because it will
simplify queries, and help facilitate the frontend in most cases.

When dealing with a nested tree data model such as this, you want to
consider the load of your joins on the database, and take some precautions
to lower the execution cost of joins.

Having the 2 separate relationships will also make it easier to work with
the data in cake, due to the way that cake will assemble results and access
the data.

Cake is not good for dealing with deep recursion, so you want to try and
avoid basing your application on queries that will have conditions on tables
joined to tables which are joined to the current model.  By default, cake
only will join immediate descendents. 

It can join deeper with careful model construction, but it is more work than
it is worth. Careful database schema planning can ease the task of getting
your data with a minimum of custom coding and a minimum of execution
overhead for php/cake/and sql.

:-)

Cheers - D

-Original Message-
From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf
Of cake...@hbit.ie
Sent: 2009-06-04 11:57
To: CakePHP
Subject: Re: A little help needed on determining my model relation ships
please


Ok I think I follow, just to clarify:

A product will belong to at least one or more subcategories, so i
guess it will be

product_sub_categories
  id
  product_id
  sub_category_id

Im not too sure what you mean by the recursive parent_id.. can you
please elaborate?

Thanks

Kevin

On Jun 4, 3:02 pm, "David Coleman"  wrote:
> This depends on how you want to build your sub categories tree:
>
> Is it a relationship like this:
>
> category
>
>   id
>
>   parent_id
>
> or
>
> category
>
>   id
>
> sub_category
>
>   id
>
>   category_id
>
>   parent_sub_category
>
> your product could be
>
> product
>
>   id
>
>   ...
>
> Then a join table
>
> categories_products
>
>   id
>
>   product_id
>
>   category_id
>
> or you could have
>
> product
>
>   id
>
>   category_id
>
> product_sub_categories
>
>   id
>
>   product_id
>
>   sub_category_id
>
> it really depends on what your data model requirements are.
>
> The join table will be extremely useful in establishing the HABTM
> relationships you require.
>
> Cake bake will not automatically detect recursive parent_id as a category.
> so you will have to define that manually.
>
> -Original Message-
> From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On
Behalf
>
> Of Beedge
> Sent: 2009-06-04 10:46
> To: CakePHP
> Subject: A little help needed on determining my model relation ships
please
>
> Hi all, about to start on my first cake project. A straight forward e-
>
> commerce site.
>
> I am not used to having to visualise my database relationships so I
>
> was hoping for a little help.
>
> A product belongs in a category
>
> A product can be in many categories
>
> A Category has Sub categories
>
> Is this just a HABTM relationship between products and categories?
>
> I will be using tree behavior for my categories.
>
> Any comments on this or helpers?  I would love to find a tutorial that
>
> covered this, but all I can really find is blog tutorials!
>
> Thanks in advance
>
> Kev
>
>
>
>  image001.gif
> < 1KViewDownload


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



RE: A little help needed on determining my model relation ships please

2009-06-04 Thread David Coleman

The recursive refers to whether or not you want sub_categories to have other
sub_categories...

Products belong to categories, so I suggested a separate category table to
handle that relationship,
Then sub categories are related to a category of course, but you have a
HABTM relationship with the product.

It could be all done with a recursive category table, but it would
complicate the cake relationships. Especially when you start traversing deep
into sub-sub-categories...

So I suggested that you have 
Product.cat_id -> category.id
Product.id
   <-( product_sub_categories.prod_id
 Product_sub_categories.sub_cat_id
   )-> 
sub_category.id

then you can have
sub_category.cat_id -> category.id
and
sub_category.parent_id -> sub_category.id

and you are very-happy-super-tree-enabled!

:-)

Cheers,
Dave

-Original Message-
From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf
Of cake...@hbit.ie
Sent: 2009-06-04 11:57
To: CakePHP
Subject: Re: A little help needed on determining my model relation ships
please


Ok I think I follow, just to clarify:

A product will belong to at least one or more subcategories, so i
guess it will be

product_sub_categories
  id
  product_id
  sub_category_id

Im not too sure what you mean by the recursive parent_id.. can you
please elaborate?

Thanks

Kevin

On Jun 4, 3:02 pm, "David Coleman"  wrote:
> This depends on how you want to build your sub categories tree:
>
> Is it a relationship like this:
>
> category
>
>   id
>
>   parent_id
>
> or
>
> category
>
>   id
>
> sub_category
>
>   id
>
>   category_id
>
>   parent_sub_category
>
> your product could be
>
> product
>
>   id
>
>   ...
>
> Then a join table
>
> categories_products
>
>   id
>
>   product_id
>
>   category_id
>
> or you could have
>
> product
>
>   id
>
>   category_id
>
> product_sub_categories
>
>   id
>
>   product_id
>
>   sub_category_id
>
> it really depends on what your data model requirements are.
>
> The join table will be extremely useful in establishing the HABTM
> relationships you require.
>
> Cake bake will not automatically detect recursive parent_id as a category.
> so you will have to define that manually.
>
> -Original Message-
> From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On
Behalf
>
> Of Beedge
> Sent: 2009-06-04 10:46
> To: CakePHP
> Subject: A little help needed on determining my model relation ships
please
>
> Hi all, about to start on my first cake project. A straight forward e-
>
> commerce site.
>
> I am not used to having to visualise my database relationships so I
>
> was hoping for a little help.
>
> A product belongs in a category
>
> A product can be in many categories
>
> A Category has Sub categories
>
> Is this just a HABTM relationship between products and categories?
>
> I will be using tree behavior for my categories.
>
> Any comments on this or helpers?  I would love to find a tutorial that
>
> covered this, but all I can really find is blog tutorials!
>
> Thanks in advance
>
> Kev
>
>
>
>  image001.gif
> < 1KViewDownload


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



RE: A little help needed on determining my model relation ships please

2009-06-04 Thread David Coleman
This depends on how you want to build your sub categories tree:

 

Is it a relationship like this:

 

category

  id

  parent_id

 

or

 

category

  id

 

sub_category

  id

  category_id

  parent_sub_category

 

your product could be

 

product

  id

  ...

 

Then a join table

 

categories_products

  id

  product_id

  category_id

 

 

or you could have 

 

product

  id

  category_id

 

product_sub_categories

  id

  product_id

  sub_category_id

 

it really depends on what your data model requirements are.

 

The join table will be extremely useful in establishing the HABTM
relationships you require.

 

Cake bake will not automatically detect recursive parent_id as a category.
so you will have to define that manually.

 

-Original Message-
From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf
Of Beedge
Sent: 2009-06-04 10:46
To: CakePHP
Subject: A little help needed on determining my model relation ships please

 

 

Hi all, about to start on my first cake project. A straight forward e-

commerce site.

I am not used to having to visualise my database relationships so I

was hoping for a little help.

 

A product belongs in a category

A product can be in many categories

A Category has Sub categories

 

Is this just a HABTM relationship between products and categories?

 

I will be using tree behavior for my categories.

 

Any comments on this or helpers?  I would love to find a tutorial that

covered this, but all I can really find is blog tutorials!

 

Thanks in advance

 

Kev



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

<>

RE: Label information for Multiple Checkboxes

2009-01-15 Thread David Coleman
Easy as cake my friend.

 

Just use this code, and build the list for your checkboxes...

 

$selected_users=array();

 

if (empty($this->data)) {

  $this->data = $this->Site->read(null, $id);

/*

  here you would replace the data=read with something like

  $ali_list =
$this->Aliquot->find('all',array('conditions'=>.)). and get whatever you
need to make a list of.

 

  As long as your models are set up correctly you should
have all the related data that you need to build your names

*/

  //below modify the references to $this->data. and
replace them with the array structure of $ali_list

  foreach($this->data['User'] as $user){

if(is_array($user)){

//extract($user,EXTR_PREFIX_ALL,'user');

  extract($ali_list,EXTR_PREFIX_ALL,'ali');

  if($user_id !=
$this->data['Site']['admin_id']){

$selected_users[$ali_id]=$ali_username;

  }

}

  }

}

 

Then use this code to display it.

 

input(

  'Category',

  array(

'type'=>'select',

'multiple'=>'checkbox',

'options'=>$categories,

'label'=>false

)

  );

?>

 

Don't worry about the 'label' = false.

 

What you are doing is making a multi select box with no label and displaying
the individual options as checkboxes.  Internally, cake will convert this to
checkboxes and labels.

-Original Message-
From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf
Of Tony Thomas
Sent: Thursday, January 15, 2009 5:09 PM
To: CakePHP
Subject: Re: Label information for Multiple Checkboxes

 

 

On Jan 15, 1:03 pm, "David Coleman" 

wrote:

> Do you need checkboxes from multiple tables?  

 

No. The checkboxes in this case only pertain to my aliquots table so

that users can assign them to a box, which is in turn assigned to a

freezer. But in order to identify where the aliquots go, there are a

few fields from my specimens table (blood comes in as a specimen and

is then divided into aliquots) that I'd like to display in the label.

 

If so you need to use the

> trick I posted earlier today to make the hidden elements not be
duplicated.

> Overload your form.php in your app/views/helpers folder.

> 

> What you are doing is similar to a recent application that I wrote, in
which

> I developed this extention to the form->input method to accomplish just
this

> effect.

> 

> See the message "re: Ticket #5577 (new Enhancement)"  If this is what you

> need.

> 

> -Original Message-

> From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On
Behalf

> 

> Of Tony Thomas

> Sent: Thursday, January 15, 2009 4:52 PM

> To: CakePHP

> Subject: Re: Label information for Multiple Checkboxes

> 

> The complicating factor here is that Aliquot belongs to Specimen in my

> model and I want to display some information from both tables:

> Specimen.type, Specimen.draw_date, Aliquot.additive & etc. It looks

> more and more like I'm going to have to put that information in an

> array and loop through it, building each checkbox one at a time

> instead of my example below. Or am I missing something?

> 

> On Jan 15, 11:01 am, grigri  wrote:

> > You need to set the $displayField property inside your `Aliquot` model

> > to whatever field you want for the label.

> 

> > On Jan 15, 4:47 pm, Tony Thomas  wrote:

> 

> > > I'm building a list of checkboxes like so:

> 

> > > echo $form->input('Aliquot.id', array( 'label' => FALSE,

> > >


> 'type' => 'select',

> > >


> 'multiple' => 'checkbox',

> > >


> 'options' => $aliquots));

> > > echo $form->input('box_id', array('options' => $boxes));

> 

> > > $aliquots above is built from $this->Aliquot->find('list', $options);

> > > which finds all the ids of the pertinent records. The problem I have

> > > this this only generates a list of ids. Is there good way to load an

> > > array for 'label' so that I can display more than just the list of
ids?


 


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



RE: Label information for Multiple Checkboxes

2009-01-15 Thread David Coleman

Do you need checkboxes from multiple tables?  If so you need to use the
trick I posted earlier today to make the hidden elements not be duplicated.
Overload your form.php in your app/views/helpers folder.

What you are doing is similar to a recent application that I wrote, in which
I developed this extention to the form->input method to accomplish just this
effect.

See the message "re: Ticket #5577 (new Enhancement)"  If this is what you
need.

-Original Message-
From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf
Of Tony Thomas
Sent: Thursday, January 15, 2009 4:52 PM
To: CakePHP
Subject: Re: Label information for Multiple Checkboxes


The complicating factor here is that Aliquot belongs to Specimen in my
model and I want to display some information from both tables:
Specimen.type, Specimen.draw_date, Aliquot.additive & etc. It looks
more and more like I'm going to have to put that information in an
array and loop through it, building each checkbox one at a time
instead of my example below. Or am I missing something?

On Jan 15, 11:01 am, grigri  wrote:
> You need to set the $displayField property inside your `Aliquot` model
> to whatever field you want for the label.
>
> On Jan 15, 4:47 pm, Tony Thomas  wrote:
>
> > I'm building a list of checkboxes like so:
>
> > echo $form->input('Aliquot.id', array( 'label' => FALSE,
> >                                                                        
        'type' => 'select',
> >                                                                        
        'multiple' => 'checkbox',
> >                                                                        
        'options' => $aliquots));
> > echo $form->input('box_id', array('options' => $boxes));
>
> > $aliquots above is built from $this->Aliquot->find('list', $options);
> > which finds all the ids of the pertinent records. The problem I have
> > this this only generates a list of ids. Is there good way to load an
> > array for 'label' so that I can display more than just the list of ids?




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



RE: Label information for Multiple Checkboxes

2009-01-15 Thread David Coleman
Odd, I'm using that very syntax and it works just fine...

 

$selected_users=array();

if (empty($this->data)) {

  $this->data = $this->Site->read(null, $id);

/*

  here you would do something like

  $ali_list =
$this->Aliquot->find('all',array('conditions'=>.)). and get whatever you
need to make a list of.

*/

  //below modify the references to $this->data. and
replace them with the array structure of $ali_list

  foreach($this->data['User'] as $user){

if(is_array($user)){

//extract($user,EXTR_PREFIX_ALL,'user');

  extract($ali_list,EXTR_PREFIX_ALL,'ali');

  if($user_id !=
$this->data['Site']['admin_id']){

$selected_users[$ali_id]=$ali_username;

  }

}

  }

}

 

I use this method for building a custom list in another section of my site.

 

Maybe you can modify this logic to assist with this issue.

 

Load ('all') to get the data you need and then pass through the list and
then use $this->set(.) to send it to the view.  

 

it's a little dirty :-(  

 

But it should produce the desired results :-)

 

Best luck friend.

 

-Original Message-
From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf
Of Tony Thomas
Sent: Thursday, January 15, 2009 4:43 PM
To: CakePHP
Subject: Re: Label information for Multiple Checkboxes

 

 

I tried that very thing, but it didn't produce the expected results.

Maybe find('list', $options) isn't meant to accommodate more than a

single field. I'm not sure.

 

On Jan 15, 11:34 am, "David Coleman" 

wrote:

> You could also do something like this in your controller:

> 

> $aliquots = $this->Aliquot->find(

> 

>   'list',

> 

>   array(

> 

> 'fields'=>array(

> 

>   'Aliquot.id',

> 

>   'Aliquot.name'

> 

>   ),

> 

> 'conditions'=>array(

> 

>   // some conditions if necessary.

> 

>   )

> 

> )

> 

>   );

> 

> And then pass this to your view with

> 

> $this->set('aliquotes', $aliquots);

 


 


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



Complex AJAX and Cookies issue Question with CakePHP

2009-01-15 Thread David Coleman
I’m designing a survey module using CakePHP.

 

The purpose of this module is to be called from a foreign site by this code:

 

http://global_survey.localhost/visitor_sessions/init/1234";>



 

Obviously, localhost will be replaced with the production server when live.

 

I am creating the cookie with Cake’s CookieComponent.

 

When the remote site calls the init method, the cookie is not visible on the
client system

 

When I call the init component directly in the browser to test the cookie
functionality, I discover that I am not saving my cookie, even though I set
$this->Cookie->time=100;  

 

The cookie is visible in my browser when I am calling the init method
directly.

 

The code is as follows:

 

class VisitorSessionsController extends AppController {

 

  var $name = 'VisitorSessions';

  var $helpers = array('Html', 'Form','Ajax','Javascript');

  var $components = array( 'RequestHandler', 'Auth','Cookie');

  function beforeFilter(){

parent::beforeFilter();

$this->Auth->allow(

  array(

'init',

'refresh',

'respond',

'end'

)

  );

$this->Cookie->name='visitor_session';

$this->Cookie->domain='global_survey_client.localhost';

$this->Cookie->time=100;

 

  }

  function init($site_id = null){

$this->layout='ajax';

Configure::write('debug',0);

//check for existing sessions with this ip address

$ip_addr= env('REMOTE_ADDR');

$this->set('ip_addr',$ip_addr);

$num_times=$this->Cookie->read('num_times');

$this->Cookie->write('test','test');

$this->Cookie->write('num_times',($num_times?$num_times:0)+1);

$num_times=$this->Cookie->read('num_times');

$test=$this->Cookie->read('test');

$this->set('test',$test);

$this->set('num_times',$num_times);

//if no current cookie

  //create cookie

  //create session

//set ip address

//set hit times

//else

  //load current cookie

  //update current session

//update last hit.

//create javascript with links to active session

  }

  function refresh($session_id=null){

//update session.last_hit

  }

  function respond($session_id=null){

 

  }

}

 

 

In my init.ctp, I only have this simple code for now:

 

alert('test  ()');

 

The stored value is not incrementing…  Ultimately, I want to store my cookie
for the life of the browser, and create a new session when the user closes
the current browser instance, and then goes back to the client website at
some later date.

 

Can anybody tell me what I am doing wrong?

 

I’m trying to look on google and the cookbook for how to do this properly,
and I am having trouble finding anything.

 

Thank you all very much.

 

 
  
  
   David Kenneth Coleman

Software Developer

 
………

United States: +
1 6468108783 Dept:  Development

Argentina:
+ 54 11 52465987  E-mail:
david.cole...@connaxis.com

The Netherlands:+ 31
208080017 Skype:   david.k.coleman

 

 

 

¡   
  
   NEW! Please check out
our new   Portfolio Website:

  Connaxis Creative Outsourcing
Specialist  
www.creative-outsourcing.com

First page position Google.com:
 Creative Outsourcing

 


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

<>

RE: Label information for Multiple Checkboxes

2009-01-15 Thread David Coleman
You could also do something like this in your controller:

 

$aliquots = $this->Aliquot->find(

  'list',

  array(

'fields'=>array(

  'Aliquot.id',

  'Aliquot.name'

  ),

'conditions'=>array(

  // some conditions if necessary.

  )

)

  );

 

And then pass this to your view with

 

$this->set(‘aliquotes’, $aliquots);

 

 

 
  
  
   David Kenneth Coleman

Software Developer

 
………

United States: +
1 6468108783 Dept:  Development

Argentina:
+ 54 11 52465987  E-mail:
david.cole...@connaxis.com

The Netherlands:+ 31
208080017 Skype:   david.k.coleman

 

 

 

¡   
  
   NEW! Please check out
our new   Portfolio Website:

  Connaxis Creative Outsourcing
Specialist  
www.creative-outsourcing.com

First page position Google.com:
 Creative Outsourcing

 

 

-Original Message-
From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf
Of Tony Thomas
Sent: Thursday, January 15, 2009 2:48 PM
To: CakePHP
Subject: Label information for Multiple Checkboxes

 

 

I'm building a list of checkboxes like so:

 

echo $form->input('Aliquot.id', array( 'label' => FALSE,

'type' =>
'select',

'multiple' =>
'checkbox',

'options' =>
$aliquots));

echo $form->input('box_id', array('options' => $boxes));

 

$aliquots above is built from $this->Aliquot->find('list', $options);

which finds all the ids of the pertinent records. The problem I have

this this only generates a list of ids. Is there good way to load an

array for 'label' so that I can display more than just the list of ids?


 


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

<>

login redirect does not work on ie6

2008-12-19 Thread David Coleman
This is my code:

 

 

function beforeFilter()

{

$this->Auth->allow

(   'ajax_combo_subjects_by_area',

'ajax_combo_courses_by_year',

'ajax_combo_skills_by_year',

'search_skills_courses',

'search_areas_subjects',

'contact_thank_you',

'contact_teacher',

'reset_password',

'view_profile',

'activate',

'register',

'search',

'home'

);

$this->Auth->fields = array

(

'username' => 'email',

'password' => 'password'

);

$this->Auth->loginRedirect = array

(   'controller'=> 'Teachers',

'action'=> 'login_ok'

);

}

function login_ok()

{

if ($this->Auth->user('is_admin') == 1 )

{

$this->redirect('admin');

}

else

{

$this->redirect('edit_profile');

}

}

 

 

Why is it that this works in FireFox but in IE6, the login does not work.
It just redirects to the default page /users/login, instead of
/teachers/admin or /teachers/edit_profile.

 

My users controller is this:

 

Auth->fields = array

(

'username' => 'email',

'password' => 'password'

);

if(isset($this->Auth))

{

$this->Auth->loginRedirect = array

(   'controller'=> 'Teachers',

'action'=> 'login_ok'

);

}

}

 

/**

 *  The AuthComponent provides the needed functionality

 *  for login, so you can leave this function blank.

 */

function login()

{

}

 

function index()

{

 

}

 

function logout()

{

$this->redirect($this->Auth->logout());

}

}

?>

 

I have the dual controller setup because the Teachers model is the main
object, and the users controller is basically just a place holder for the
users table in the database.

 

Thank you all in advance for any help you can offer.

 

 

 
  
  
   David Kenneth Coleman

Software Developer

 
………

United States: +
1 6468108783 Dept:  Development

Argentina:
+ 54 11 52465987  E-mail:
david.cole...@connaxis.com

The Netherlands:+ 31
208080017 Skype:   david.k.coleman

 

 

 

¡   
  
   NEW! Please check out
our new   Portfolio Website:

  Connaxis Creative Outsourcing
Specialist  
www.creative-outsourcing.com

First page position Google.com:
 Creative Outsourcing

 


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

<>