Re: Dividing Users

2009-03-21 Thread John Andersen

Hi Dave,

Looking at your model, I understand your problem.

As I understand it from your description:
1) A user can have one profile;
2) A user belongs to one group;
3) A user can create one or more ads;
4) A user can create one or more bookmarks;
5) A bookmark refers to one ad;
6) An ad may be referred to by one or more bookmark.

Text version of my data model ( A -- B means B belongsTo A and A
hasMany B; no indication of mandatory relationships ):
groups -- users -- profiles -- profile_attributes
users -- ads -- bookmarks
users -- bookmarks
profile_types -- profiles
attribute_types -- profile_attributes.

The major changes from your model are:
1) The ads belongs to a user, not to a profile.
2) The bookmark belongs to a user, not to a profile.
3) One table (profiles) for all profiles, at least the information
that are common for all profiles.
4) Two tables (attribute_types and profile_attributes) for the profile
information, that are not common for all profiles.

So when you model this i CakePHP, and you read a users profile (Agent)
then the model should automatically also read all the profile
attributes (using HasMany relationship) from that model, thus ensuring
the correct information is available for your presentation of the
profile (Agent). And the same when you read a users profile
(Investor).

Did this help you?
Best wishes,
John

On Mar 20, 5:56 pm, Dave Maharaj :: WidePixels.com
d...@widepixels.com wrote:
 Thanks again for your input. I been trying to get this right and for some
 reason either I am a complete idiot I just cant get it. Or If it is I do not
 think its right. I have been playing with it on the cakeapp site to build
 the tables to give people an 
 idea.http://cakeapp.com/sqldesigners/sql/leiabeans

 In my head User belongs to a group (either the INVESTOR or AGENT)
 Group hasMany Users ok that all makes sense no problems yet

 Now because the INVESTOR and AGENT profile information in completely
 different I want a table for each (INVESTORS and AGENTS), normally USER
 would have 1 profile but in this case there are 2 options of what profile a
 USER will have based on the GROUP they are in.
 User hasOne INVESTOR or AGENT (which is a profile) depending on the GROUP
 they belong to...this is where I am confusing myself. So a USER who belongs
 to the GROUP AGENT will have a AGENT USER.ID in the table...? Lost myself
 even trying to write it.

 Does this make sense to anyone?

 Thanks,

 Dave
[snip]
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



email component attach domainkeys

2009-03-21 Thread Claudiu Apetrei

Hello,

Just lunched the new version of my website cakephp powered. Having
some problem with sending emails on yahoo, they go directly to the
spam folder.

Talked to the webhosting provider and the made a domain key for my
domain, but I can't see to get it to work. The domain key looks like
this:

default._domainkey IN TXT k=rsa;
p=MHwwDQYJKoZIhvcNAQEBBQADawAwaAJhAMYLmn/XGwo3ffCbIHrsyXdJdZ
+IPxqHQbd9isQ7gz1frgGCcipEm80gl1kow/
Y2cL1+segRnnXd6moxz4OXn6f6LeytGvwGkMqUBLOrSya3gpvdt
+YLMkldAEBLBorqeQIDX;

Does anyone have experience with domain keys and how they should be
implemented in the mail function ?

Claudiu,
--~--~-~--~~~---~--~~
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: Database Setup

2009-03-21 Thread John Andersen

My suggestion is in the thread Dividing users at
http://groups.google.com/group/cake-php/browse_thread/thread/3899aa6e312af1d1/72b8a3223b0f86f6?hl=en#72b8a3223b0f86f6

Enjoy,
   John

On Mar 19, 4:46 pm, Dave d...@widepixels.com wrote:
 Can someone take a look at my SQL to see if it is correct? Or if there
 is a better way to set it up?http://cakeapp.com/sqldesigners/sql/leiabeans

 Everyone is a user, users are divided into investors and agents

 then agents have posts which have options,

 investors have bookmarks which belong to a post by a agent.

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



method signature madness

2009-03-21 Thread welzie

I am trying to call $this-Html-link(...) in a helper method I
created.  My helper method has the same method signature as the Html-
link method does, but for some reason the $htmlAttributes parameter
is null.  What I really don't understand is when I call the Html-link
method with the same parameters it works.  Below is an example of
each.  Please help me understand this.

The call to html helper that DOES work:
?php
echo $html-link( 'linkTitle', array('controller'='candidates',
'action'='index') );
?

The call to my helper method that does NOT work.
?php
echo $simpleAuthorization-createLinkIfAuthorized( 'linkTitle', array
('controller'='candidates', 'action'='index') );
?

My helper class (not all methods are shown)::
?php
class SimpleAuthorizationHelper extends Helper {

var $helpers = array('Session', 'Html');

function createLinkIfAuthorized($title, $url = null,
$htmlAttributes = array(), $confirmMessage = false, $escapeTitle =
true) {
$controllerName = $htmlAttributes['controller'];
$actionName = $htmlAttributes['action'];
if ($this-isCurrentUserAuthorized($controllerName,
$actionName)) {
return $this-Html-link($title, $url, $htmlAttributes,
$confirmMessage, $escapeTitle);
}
//more methods not shown
}
}?

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



Help with routing (/cat/:alias/feed - /:cat/feed)

2009-03-21 Thread rod

Hi,

I need help with routes.php, I've read the documentation and many
blogs, articles but I still can't figure out how to do this:

http://localhost/cat/categoryAlias/feed

I have this which works fine:

Router::connect(
'/cat/:category',
array('controller' = 'categories', 'action' = 'index'),
array('category' = '(.*)')
);

But then I'd like to have, for example: http://localhost/cat/Food/feed
- and that would point to Food/index.rss, however it doesn't work,
probably due to (.*) in the previous Router::connect.

How can I do that? I tried things like:

Router::connect(
'/cat/:category/feed',
array('controller' = 'categories', 'action' = 'index', 'ext' =
'rss'),
array('category' = '(.*)')
);

but no luck..

Also, how far is that from 'http://localhost/:categoryAlias/feed' ?
It would affect other routings if I add a ('/:categories/feed')
wouldn't it?

Any help is appreciated,
Thanks

--~--~-~--~~~---~--~~
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: Articles both hasOne and hasAndBelongsToMany Photos ... What's the syntax?

2009-03-21 Thread NiteRain

My Problem is similar, however, I don't seem to understand.

/models/user.php

class User extends AppModel {
public $name = 'User';
public $hasAndBelongsToMany = array(
'Fundraiser' = array(
'className' = 'Fundraiser',
'joinTable' = 'fundraisers_users',
'foreignKey' = 'user_id',
'associationForeignKey' = 'fundraiser_id',
'with' = 'FundraisersUser',
'unique' = false
)
);
}

/models/fundraiser.php

class Fundraiser extends AppModel {
public $name = 'Fundraiser';
public $hasAndBelongsToMany = array(
'User' = array(
'className' = 'User',
'joinTable' = 'fundraisers_users',
'foreignKey' = 'fundraiser_id',
'associationForeignKey' = 'user_id',
'with' = 'FundraisersUser',
'unique' = false
)
);
}

/models/fundraisers_user.php

class FundraisersUser extends AppModel {
public $name = 'FundraisersUser';
public $belongsTo = array('User', 'Fundraiser');
}

This is what I get when I run the script:

7   START TRANSACTION   0   0
8   START TRANSACTION   0   0
9   INSERT INTO `users` (`first_name`, `last_name`, `username`,
`password`, `created`) VALUES ('', '', '', '', '2009-03-21 01:25:08')
1   0
10  SELECT LAST_INSERT_ID() AS insertID 1   1   0
11  SELECT `FundraisersUser`.`fundraiser_id` FROM `fundraisers_users`
AS `FundraisersUser` WHERE `FundraisersUser`.`user_id` = 12 0   
0   0
12  INSERT INTO `fundraisers_users` (`user_id`,`fundraiser_id`) VALUES
(12,0), (12,1)  1452: Cannot add or update a child row: a foreign key
constraint fails (`db_frontrunner_01/fundraisers_users`, CONSTRAINT
`user_fundraiser_fk2` FOREIGN KEY (`fundraiser_id`) REFERENCES
`fundraisers` (`id`))   0
13  COMMIT

Note:  Several things aren't happening, fundraisers table isn't being
populated, hence we don't have the fundraiser id to insert the
fundraisers_users table, and also the image, and other extra data on
the join table isn't being populated either.  What am I doing wrong?

Any assistance in this matter would be greatly appreciated.

Best regards,
Levi

On Mar 11, 8:41 pm, mattalexx mattal...@gmail.com wrote:
 It works! You guys rock. Thanks.

 On Mar 11, 7:28 am, ohcibi i...@dwgadf.de wrote:

  if you have two different types of photos for your news, which should
  use the same photo-model you can define other model-aliases. like
  this:

  app/models/article.php:
  var $hasAndBelongsToMany = array(
      'Photo' = array(
          'className' = 'Photo', // should be the name of the Photo-
  Model
          // rest of habtm defintion of the normal photos
      )
  );
  var $belongsTo = array(
      'MainPhoto' = array(
          'className' = 'Photo', // should be the name of the Photo-
  model
      )
  );

  app/models/photo.php
  var $hasAndBelongsToMany = array(
      'Article'= array(
          'className' = 'Article'
      )
  );
  var $hasMany = array(
      'Article' = array(
          'className' = 'Article'
      )
  );

  providing a main_photo_id field in yourarticles-table you can now do
  normal find()'s and cake will fetch all the 'Photos' which are related
  via habtm and the one 'MainPhoto' as they were two different models...
  no need for an extra field in the join-table.

  you could also define the relation like Article hasOne MainPhoto and
  Photo belongsTo Article (and then you have to provide an article_id
  field in your photos-table), but then you cant use the same MainPhoto
  for differentarticles its up to you how to do it, but basically,
  if you want to use the same model for different relations, you can use
  different alias-names for this model

  On Mar 11, 11:52 am, Xoubaman xouba...@gmail.com wrote:

   Just model it like a normal HABTM relationship, no special syntaxis,
   and add the field in the database.

   When saving, try this:

  http://teknoid.wordpress.com/2008/09/24/saving-extra-fields-in-the-jo...

   I haven't done it before, so i can't secure his fiability, but looks
   good.

   On Mar 11, 10:38 am, mattalexx mattal...@gmail.com wrote:

What's the syntax for adding an extra field to the
$hasAndBelongsToMany var?

Thank you for you response.

On Mar 11, 2:43 am, Xoubaman xouba...@gmail.com wrote:

 You can model it like a normal HABTM relationship with an extra field
 named 

HABTM isn't working

2009-03-21 Thread NiteRain

/models/users.php

class User extends AppModel {
public $name = 'User';
public $hasAndBelongsToMany = array(
'Fundraiser' = array(
'className' = 'Fundraiser',
'joinTable' = 'fundraisers_users',
'foreignKey' = 'user_id',
'associationForeignKey' = 'fundraiser_id',
'with' = 'FundraisersUser',
'unique' = false
)
);
}

/models/fundraisers.php

class Fundraiser extends AppModel {
public $name = 'Fundraiser';
public $hasAndBelongsToMany = array(
'User' = array(
'className' = 'User',
'joinTable' = 'fundraisers_users',
'foreignKey' = 'fundraiser_id',
'associationForeignKey' = 'user_id',
'with' = 'FundraisersUser',
'unique' = false
)
);
}

/models/fundraisers_user.php

class FundraisersUser extends AppModel {
public $name = 'FundraisersUser';
public $belongsTo = array('User', 'Fundraiser');
}

Debug output:

7   START TRANSACTION   0   0
8   START TRANSACTION   0   0
9   INSERT INTO `users` (`first_name`, `last_name`, `username`,
`password`, `created`) VALUES ('', '', '', '', '2009-03-21 01:25:08')
1   0
10  SELECT LAST_INSERT_ID() AS insertID 1   1   0
11  SELECT `FundraisersUser`.`fundraiser_id` FROM `fundraisers_users`
AS `FundraisersUser` WHERE `FundraisersUser`.`user_id` = 12 0   
0   0
12  INSERT INTO `fundraisers_users` (`user_id`,`fundraiser_id`) VALUES
(12,0), (12,1)  1452: Cannot add or update a child row: a foreign key
constraint fails (`db_frontrunner_01/fundraisers_users`, CONSTRAINT
`user_fundraiser_fk2` FOREIGN KEY (`fundraiser_id`) REFERENCES
`fundraisers` (`id`))   0
13  COMMIT


Notice, fundraisers table isn't populated, what is even odder, it
looks like it is trying to get a fundraiser_id from the join table.
And it is attempting to put two rows into the fundraisers_users table
with weird ids.  Not to mention the other fields in fundraisers_users
are not being populated as well.  What am I doing wrong?

--~--~-~--~~~---~--~~
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: Session Resetting itself and/or Not saving

2009-03-21 Thread John Andersen

Look in the manual at http://book.cakephp.org/view/399/write for
understanding the session write method! You are missing the first
parameter! The second parameter should be your data!

Enjoy
John

On Mar 21, 11:36 am, Charles cri...@gmail.com wrote:
 I started a simple breadcrumb component. I am trying to use the
 session in order to keep track of, where the user is in the system and
 where he came from. I've broke it down to it's most basic form and for
 the life of me I cannot get my sessions to save! I've already tried
 setting my session security to low to no avail.

         ?php

         class CrumbComponent extends Object{
                 var $components = array('Session');
                 function breadCrumb($newPageArray = null,  $reset = null){

                         $crumbCount = count($_SESSION['Crumbs'])+1;

                         echo $crumbCount;
                         $crumb_array[$crumbCount] = array('crumb_link'  =   
 $newPageArray
 ['link'],
                                                                               
                                                   'crumb_name'    =   
 $newPageArray['name'],);

         $current_crumb_array = array('Crumbs' = $crumb_array);

                 $this-Session-write($current_crumb_array);
                 echo pre;
                 debug($_SESSION);
                 echo /pre;
                 }
         }
         ?

 I tried to get a count and +1 because at first i thought it wasn't
 incrementing the sessions for whatever reason.. but this still does
 not work.

 Any clues or something I need to set in order to have the session
 save??

 Thanks!
--~--~-~--~~~---~--~~
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: scaffold

2009-03-21 Thread Johnny

Scaffold is not supposed to be used in production environments.
Use bake instead to physically create the model,view and controller
files and edit those according to your needs.

On Mar 20, 5:54 pm, Alejandro Weintz Aguilar
alejan...@pixelestudios.com wrote:
 Hello, I am build a large proyect catalogs of product, like the scaffold
 feautures of Cake but need on UPDATE action to update a
 delete(varchar(1) field on the database not to delete the record. Also
 when it querys the record list to show all the record but the one with
 the delete field set to 1.

 The question is can I redefine scaffold functions?

 ty.
 --
 
 PixelEstudios.com
 Alejandro Weintz Aguilar.
 Tel: (506)25920328
 alejan...@pixelestudios.com
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Session Resetting itself and/or Not saving

2009-03-21 Thread Charles

I started a simple breadcrumb component. I am trying to use the
session in order to keep track of where the user is in the system and
where he came from. I've broke it down to it's most basic form and for
the life of me I cannot get my sessions to save! I've already tried
setting my session security to low to no avail.

?php

class CrumbComponent extends Object{
var $components = array('Session');
function breadCrumb($newPageArray = null,  $reset = null){

$crumbCount = count($_SESSION['Crumbs'])+1;

echo $crumbCount;
$crumb_array[$crumbCount] = array('crumb_link'  =  
$newPageArray
['link'],

'crumb_name'=  
$newPageArray['name'],);

$current_crumb_array = array('Crumbs' = $crumb_array);

$this-Session-write($current_crumb_array);
echo pre;
debug($_SESSION);
echo /pre;
}
}
?

I tried to get a count and +1 because at first i thought it wasn't
incrementing the sessions for whatever reason.. but this still does
not work.

Any clues or something I need to set in order to have the session
save??

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



Tree structure..

2009-03-21 Thread Aneesh S
Hello,
  Need some help..!!

I have a page where the admin adds new pages, either as a sub-page or
sub-sub-page or parent page. Anyway, i need to to show the tree structure of
those pages, like,



1. Test1
2. Test2
3.Test3
4.Test4
5. Test5
6. Test6
7. Test7
8. Test8
9.Test9


so that its easily accessable for admin to edit and also to display it in a
dropdown so as to create new...


Pls help me out,



--
*Aneesh S
Software Engineer
*illustris software solutions private limited
TBI, National Institute Of Technology Calicut
Kerala, India - 673601
Tel No +91 495 3264321
Fax No +91 495 2287723
ane...@illustris.in cont...@illustris.in | www.illustris.in

--~--~-~--~~~---~--~~
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: method signature madness

2009-03-21 Thread David Persson

Hi,

Try:

class SimpleAuthorizationHelper extends AppHelper {


On 21 Mrz., 04:35, welzie wel...@gmail.com wrote:
 I am trying to call $this-Html-link(...) in a helper method I
 created.  My helper method has the same method signature as the Html-link 
 method does, but for some reason the $htmlAttributes parameter

 is null.  What I really don't understand is when I call the Html-link
 method with the same parameters it works.  Below is an example of
 each.  Please help me understand this.

 The call to html helper that DOES work:
 ?php
 echo $html-link( 'linkTitle', array('controller'='candidates',
 'action'='index') );
 ?

 The call to my helper method that does NOT work.
 ?php
 echo $simpleAuthorization-createLinkIfAuthorized( 'linkTitle', array
 ('controller'='candidates', 'action'='index') );
 ?

 My helper class (not all methods are shown)::
 ?php
 class SimpleAuthorizationHelper extends Helper {

     var $helpers = array('Session', 'Html');

     function createLinkIfAuthorized($title, $url = null,
 $htmlAttributes = array(), $confirmMessage = false, $escapeTitle =
 true) {
         $controllerName = $htmlAttributes['controller'];
         $actionName = $htmlAttributes['action'];
         if ($this-isCurrentUserAuthorized($controllerName,
 $actionName)) {
             return $this-Html-link($title, $url, $htmlAttributes,
 $confirmMessage, $escapeTitle);
         }
     //more methods not shown
     }

 }?
--~--~-~--~~~---~--~~
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: Tree structure..

2009-03-21 Thread BrianRehg

Can't you handle this with style sheets. Assign a div tag to the
various page levels. If the tree does not have an finite number of
levels you may have to  use inline styles and increment the indention
(left margin) appropriately for the various page levels.

On Mar 21, 6:02 am, Aneesh S aneeshs.em...@gmail.com wrote:
 Hello,
   Need some help..!!

 I have a page where the admin adds new pages, either as a sub-page or
 sub-sub-page or parent page. Anyway, i need to to show the tree structure of
 those pages, like,

 1. Test1
 2.         Test2
 3.                Test3
 4.                Test4
 5.         Test5
 6.         Test6
 7. Test7
 8.         Test8
 9.                Test9

 so that its easily accessable for admin to edit and also to display it in a
 dropdown so as to create new...

 Pls help me out,

 --
 *Aneesh S
 Software Engineer
 *illustris software solutions private limited
 TBI, National Institute Of Technology Calicut
 Kerala, India - 673601
 Tel No +91 495 3264321
 Fax No +91 495 2287723
 ane...@illustris.in cont...@illustris.in |www.illustris.in
--~--~-~--~~~---~--~~
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: scaffold

2009-03-21 Thread BrianRehg

You can manually override the scaffolding by creating your own custom
actions(update, delete etc) within the controller. You can bake these
actions or you manually add them yourself. You will also be required
to bake or manually create the views ,if you are overriding the
dynamic scaffolding. I would never use dynamic scaffolding in a
production environment. I don't use it in a dev environment - I bake
everything.

On Mar 21, 5:46 am, Johnny joh...@codynamic.com wrote:
 Scaffold is not supposed to be used in production environments.
 Use bake instead to physically create the model,view and controller
 files and edit those according to your needs.

 On Mar 20, 5:54 pm, Alejandro Weintz Aguilar

 alejan...@pixelestudios.com wrote:
  Hello, I am build a large proyect catalogs of product, like the scaffold
  feautures of Cake but need on UPDATE action to update a
  delete(varchar(1) field on the database not to delete the record. Also
  when it querys the record list to show all the record but the one with
  the delete field set to 1.

  The question is can I redefine scaffold functions?

  ty.
  --
  
  PixelEstudios.com
  Alejandro Weintz Aguilar.
  Tel: (506)25920328
  alejan...@pixelestudios.com
--~--~-~--~~~---~--~~
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: Is this possible?

2009-03-21 Thread BrianRehg

To me it sounds like Tools, Equipment and Supplies are all items
that a user can select.  Have you thought about placing them all into
one table like equipment and then create a new table called
categories. Then store the categories primary id as the foreign key
catetgory_id in the  equipment table.


On Mar 20, 9:35 pm, Dave Maharaj :: WidePixels.com
d...@widepixels.com wrote:
 I have 3 tables with various options a user can select which are all HABTM
 (TOOLS -hammer, measuring tape, level, screwdriver...)
 (EQUIPMENTS -drill, saw, router ...)
 (SUPPLIES -nails, screws, bolts...)

 If I made a table called CATEGORIES (id title)

 Could or should I put them all in one table such as OPTIONS and break them
 into groups such as
 OPTIONS TABLE
 id
 category_id
 title

 so tools in the db look like
 1 1  hammer
 2 1  measuring tape
 3 1 screwdriver
 4 2 drill
 5 2 saw
 6 2 router
 7 3 nails
 8 3 screws
 9 3 bolts

 Rather than having extra tables put them all into one?
 And if I do that can I then display them in sections when using the echo
 $form-input('Option',array('multiple'='checkbox')); if I added a category
 = whatever I wanted to display?

 Thanks guys

 Dave
--~--~-~--~~~---~--~~
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: Loading time of my cakephp website

2009-03-21 Thread BrianRehg

It appears to be fairly slow for me. You need to go through your
queries and see where the bottle-neck is. You want to make sure that
recursive is set to the lowest number possible and if all else fails
override with custom queries.


On Mar 20, 12:00 pm, Sam2008 samirvohra2...@gmail.com wrote:
 Hi all,

    Please give me some good suggestion as I have my website it's url
 is =www.samif.com
    I am doing seo for this site  when any one click on this site it
 take around 14 to 18 secounds to loading so please look  give me some
 suggestion to imporove loading speed of my site I want it's loading
 speed under 5 secouds.

   Looking forward to your reply..

 Thanks,
 Samir
--~--~-~--~~~---~--~~
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: how to make XML of this format in Cake

2009-03-21 Thread aman batra

i have done it with the help of xml helper and it works fine for me..

in order to make something like
media:content url=http://www.abc.com; type= video/quicktime
.
.
./media:content

it can be done as..
$url = Router::url(array('controller'='controller', 'action'='view',
'name1'=$entity['Table']['name1']),true);
echo $xml-elem('content', array('namespace'='media'));

it will output as
media:content url=http:///

thanx,
/Aman

On Mar 14, 11:40 pm, aman batra batra_aman2...@yahoo.com wrote:
 ut i need to make videositemaps and the format is different as of the
 link sent by you. and thexmlis of the format i sent you..
 i am unable to generate the type of
 media:content url= type= ---
 and so on...
 like..

 rss version=2.0 xmlns:media=http://search.yahoo.com/mrss;
   xmlns:dcterms=http://purl.org/dc/terms/; 
 xmlns:gm=http://www.google.com/schemas/gm/1.1;
   channel
     item
       pubDate2005-06-18/pubDate
       media:content url=http://www.google.com/samples/
 localandmaps.mpeg type=video/mpeg
         media:titleGoogle Local and Google Maps/media:title
         media:descriptionHow to use Google Local and Google Maps to
 find local information./media:description
         media:player url=http://www.google.com/playerLaunch?
 id=localAndMaps /
         media:thumbnail url=http://www.google.com/images/
 localAndMaps.jpg/
         media:credit role=productioncompanyGoogle.com/
 media:credit
         media:credit role=producerJoe Smith/media:credit
         media:categoryAds  Promotional/media:category
         media:categoryNews/media:category
 /item
 /media:content
 /channel
 /rss

 Can u help me out of this..

 the link sent by you is exactly my sitemap..

 On Mar 14, 5:56 pm, Smelly Eddie ollit...@gmail.com wrote:

  aman:

  How about generating dynamic sitemaps with 
  CakePHPhttp://edwardawebb.com/programming/php-programming/cakephp/generating...

  everything from getting the detailas to publishing asxml(in google
  sitemap format)

  good luck

  On Mar 13, 3:49 am, aman batra batra_aman2...@yahoo.com wrote:

   hello, i want to make the video sitemaps and according to google te
  xmlshould be like
   rss version=2.0 xmlns:media=http://search.yahoo.com/mrss;
     xmlns:dcterms=http://purl.org/dc/terms/; 
   xmlns:gm=http://www.google.com/schemas/gm/1.1;
     channel
       item
         pubDate2005-06-18/pubDate
         media:content url=http://www.google.com/samples/
   localandmaps.mpeg type=video/mpeg

           media:titleGoogle Local and Google Maps/media:title
           media:descriptionHow to use Google Local and Google Maps to
   find local information./media:description
           media:player url=http://www.google.com/playerLaunch?
   id=localAndMaps /
           media:thumbnail url=http://www.google.com/images/
   localAndMaps.jpg/
           media:credit role=productioncompanyGoogle.com/
   media:credit
           media:credit role=producerJoe Smith/media:credit

           media:categoryAds  Promotional/media:category
           media:categoryNews/media:category
   /item
   /media:content
   /channel
   /rss

   how should i useXmlhelper in my controller to make the namespace
   like above and get my sitemap working like that.


--~--~-~--~~~---~--~~
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: xml element to create the format

2009-03-21 Thread aman batra

i have done it with the help of xml helper and it works fine for me..

in order to make something like
media:content url=http://www.abc.com; type= video/quicktime
.
.
./media:content

it can be done as..
$url = Router::url(array('controller'='controller', 'action'='view',
'name1'=$entity['Table']['name1']),true);
echo $xml-elem('content', array('namespace'='media'));

it will output as
media:content url=http:///
--~--~-~--~~~---~--~~
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: Tree structure..

2009-03-21 Thread brian

Nested ULs would be simpler.

On Sat, Mar 21, 2009 at 9:38 AM, BrianRehg brianr...@gmail.com wrote:

 Can't you handle this with style sheets. Assign a div tag to the
 various page levels. If the tree does not have an finite number of
 levels you may have to  use inline styles and increment the indention
 (left margin) appropriately for the various page levels.

 On Mar 21, 6:02 am, Aneesh S aneeshs.em...@gmail.com wrote:
 Hello,
   Need some help..!!

 I have a page where the admin adds new pages, either as a sub-page or
 sub-sub-page or parent page. Anyway, i need to to show the tree structure of
 those pages, like,

 1. Test1
 2.         Test2
 3.                Test3
 4.                Test4
 5.         Test5
 6.         Test6
 7. Test7
 8.         Test8
 9.                Test9

 so that its easily accessable for admin to edit and also to display it in a
 dropdown so as to create new...

 Pls help me out,

 --
 *Aneesh S
 Software Engineer
 *illustris software solutions private limited
 TBI, National Institute Of Technology Calicut
 Kerala, India - 673601
 Tel No +91 495 3264321
 Fax No +91 495 2287723
 ane...@illustris.in cont...@illustris.in |www.illustris.in
 


--~--~-~--~~~---~--~~
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: method signature madness

2009-03-21 Thread brian

On Fri, Mar 20, 2009 at 11:35 PM, welzie wel...@gmail.com wrote:

 The call to my helper method that does NOT work.
 ?php
 echo $simpleAuthorization-createLinkIfAuthorized( 'linkTitle', array
 ('controller'='candidates', 'action'='index') );
 ?

called with 2 params ...


 My helper class (not all methods are shown)::
 ?php
 class SimpleAuthorizationHelper extends Helper {

    var $helpers = array('Session', 'Html');

    function createLinkIfAuthorized($title, $url = null,
 $htmlAttributes = array(), $confirmMessage = false, $escapeTitle =
 true) {

... 4 params, htmlAttributes is 3rd

--~--~-~--~~~---~--~~
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: Help with routing (/cat/:alias/feed - /:cat/feed)

2009-03-21 Thread brian

On Fri, Mar 20, 2009 at 11:58 PM, rod rodrigo.z...@gmail.com wrote:

 Hi,

 I need help with routes.php, I've read the documentation and many
 blogs, articles but I still can't figure out how to do this:

 http://localhost/cat/categoryAlias/feed

 I have this which works fine:

 Router::connect(
        '/cat/:category',
        array('controller' = 'categories', 'action' = 'index'),
        array('category' = '(.*)')
 );

 But then I'd like to have, for example: http://localhost/cat/Food/feed
 - and that would point to Food/index.rss, however it doesn't work,
 probably due to (.*) in the previous Router::connect.

You should tighten up the regexp a bit. Something like [-A-Za-z]+ or
[_A-Za-z]+ or thereabouts. It'll obviously depend on whatever rules
you have for creating your :category (slug)

Router::connect(
'/cat/:category',
array('controller' = 'categories', 'action' = 'index'),
array(
'category' = '[-_A-Za-z]+',
'pass' = array('category')
)
);

Router::connect(
'/cat/:category/feed',
array(
'controller' = 'categories',
'action' = 'index',
'ext' = 'rss'
),
array(
'category' = '[-_A-Za-z]+',
'pass' = array('category')
)
);

--~--~-~--~~~---~--~~
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: Is this possible?

2009-03-21 Thread brian

On Sat, Mar 21, 2009 at 9:57 AM, BrianRehg brianr...@gmail.com wrote:

 To me it sounds like Tools, Equipment and Supplies are all items
 that a user can select.  Have you thought about placing them all into
 one table like equipment and then create a new table called
 categories. Then store the categories primary id as the foreign key
 catetgory_id in the  equipment table.

I agree, though I'd probably look at using TreeBehavior for Category
with many Items.

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



Foreign Characters

2009-03-21 Thread blckspder

Hello,

I have a form that people from all different countries use. I see to
have a problem with foreign characters. my page is in utf-8, i tried
using the php function utf8_encode and htmlspecialchars but everything
comes out jumbled when foreign characters are used.

here is an example of what I see in the database and in the email:
arabacı

That example is when I use htmlspecialchars, The database is utf-8 as
well.

If anyone can help I would appreciate it.
--~--~-~--~~~---~--~~
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: Debug Helper problems on my server

2009-03-21 Thread ProFire

I'm experiencing the same problem.
I don't think it's a permission problem but PHP version problem.
The developer's machine is using PHP5 while the live machine uses
PHP4.
Could this be the problem?

Anybody have a solution to this?

On Feb 22, 5:42 am, jer2665 jeremyhalvor...@gmail.com wrote:
 I've got debug_kit working fine on my dev machine, now trying to set
 it up on my server 1and1 it's giving me a problem, someone in #cakephp
 said it's probably a permissions error, but I haven't been able to
 nail this down.

 All folders seem to be 755, and all files seem to be 644, what other
 permissions need to be changed?   Is there another issue?

 Currently I'm getting...

 Fatal error: Call to undefined method: toolbarhelper-makeneatarray()
 in /path to /app/plugins/debug_kit/views/elements/session_panel.ctp
 on line 31
 (default) 0 query took ms
 Nr      Query   Error   Affected        Num. rows       Took (ms)

 just incase it is a permissions issue, i threw together a file list 
 athttp://www.jeremyhalvorsen.com/list.txtin case that helps.

 any tips?

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



access other models for CRUD

2009-03-21 Thread hmvrulz


I have two tables.

CREATE TABLE `restaurants` (
  `id` int(4) NOT NULL auto_increment,
  `name` varchar(255) NOT NULL,
  `street` varchar(255) NOT NULL,
  `area` varchar(255) NOT NULL,
  `pincode` int(11) NOT NULL,
  `zone_id` tinyint(1) NOT NULL,
  `lat` decimal(10,0) NOT NULL,
  `long` decimal(10,0) NOT NULL,
  `avgCost` int(5) NOT NULL,
  `buffet` tinyint(1) NOT NULL,
  `catering` tinyint(1) NOT NULL,   
  `homeDelivery` tinyint(1) NOT NULL,
  `reservation` tinyint(1) NOT NULL,
  `valetParking` tinyint(1) NOT NULL,
  `amex` tinyint(1) NOT NULL,
  `master` tinyint(1) NOT NULL,
  `visa` tinyint(1) NOT NULL,
  `foodCoupon` tinyint(1) NOT NULL,
  `created` datetime NOT NULL,
  `modified` datetime NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;


CREATE TABLE `phones` (
  `id` int(11) NOT NULL auto_increment,
  `restaurant_id` int(11) NOT NULL,
  `number` int(11) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;





i baked the models, controllers, views with scafolding.

now from inside the Restaurant Controller CRUD methods

how can i make entries to phones tables while ADD/EDITING/DELETING etc

when i hit Add restaurant. there should be a field that allows be to enter
phone numbers. when i hit save it should save it to the phones tables.
-- 
View this message in context: 
http://n2.nabble.com/access-other-models-for-CRUD-tp2513431p2513431.html
Sent from the CakePHP mailing list archive at Nabble.com.


--~--~-~--~~~---~--~~
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: Cakephp Developers Required

2009-03-21 Thread Earth Technology


Hello Rajesh,

We have a lot of experience in Cake PHP development. Please look up at
http://earthtechnology.co.in/credential_cakephp/; where you shall
find our credentials.

Please send us your requirement and then we can proceed to the next
step.

Thanks,

D e b a s i s h   B a n e r j e e
CEO, EarthTechnology
www.earthtechnology.co.in

gchat : deban...@gmail.com
msn   : debasish_baner...@hotmail.com
skype : debanerj
On Mar 13, 5:48 am, Rajesh rajesh.mukk...@gmail.com wrote:
 I need cakephp developer for a new project. If any one interested let
 me know.

--~--~-~--~~~---~--~~
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: Mod_rewrite not working

2009-03-21 Thread Tony Thomas

mod_rewrite is enabled. Like I mentioned, I can run another CakePHP
app already using mod_rewrite with my current setup. It's only this
brand new one that's behaving bizarrely.

On Mar 20, 5:22 pm, Miles J mileswjohn...@gmail.com wrote:
 Id first check your apache config files anyways, to make sure
 mod_rewrite is enabled. If you are using vhosts, check those settings
 also.
--~--~-~--~~~---~--~~
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: Mod_rewrite not working

2009-03-21 Thread Tony Thomas

I still don't know exactly what the problem was, but I downloaded a
new copy of cake and moved my models and controllers over and it
worked right away. Something must have happened when copying the files
over originally.

On Mar 21, 11:10 am, Tony Thomas truet...@gmail.com wrote:
 mod_rewrite is enabled. Like I mentioned, I can run another CakePHP
 app already using mod_rewrite with my current setup. It's only this
 brand new one that's behaving bizarrely.

 On Mar 20, 5:22 pm, Miles J mileswjohn...@gmail.com wrote:

  Id first check your apache config files anyways, to make sure
  mod_rewrite is enabled. If you are using vhosts, check those settings
  also.
--~--~-~--~~~---~--~~
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: CakePHP in Google Summer of Code

2009-03-21 Thread cantor.alep...@gmail.com

I plan on finishing my SpinxSearchable plugin over the summer, which
includes a searchable behavior that works with Sphinx. The plugin will
also include shell tasks for configuring and managing sphinx.

really rough work: 
http://github.com/namelessnotion/sphinx-cakephp-plugin/tree/master
http://sphinxsearch.com


On Mar 11, 12:14 pm, Diego Caro A. diegoc...@gmail.com wrote:
 Hello everyone,
            today I went to a talk by Google Summer of Code[1], a
 google program for open source projects. This program offers student
 developers stipends to write code.

 Well, I want CakePHP in Google SoC. For this, we need a send a
 proposal with ideas to Google with a mentor (dedicated to the new
 developer guide), more info at [2].

 My first idea for develop in this program are:
  - Mechanism to search into different models (like
 searchable-behaviour-for-cakephp [3]) for mysql and postgresql.

 Now, we need ideas, get a mentor and submit CakePHP into Google SoC

 Bye, and discuss this!.

 [1]:http://code.google.com/soc/
 [2]:http://socghop.appspot.com/
 [3]:http://code.google.com/p/searchable-behaviour-for-cakephp/
 --
 Diego Caro A.
 Estudiante Ing. Civil Informática

 diegocaro |http://diego.bloog.cl

 No tengo talentos especiales, pero sí soy
  profundamente curioso, Albert Einstein.

--~--~-~--~~~---~--~~
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: Is this possible?

2009-03-21 Thread Dave Maharaj :: WidePixels.com

Thanks ...

I did end up putting everything into 2 tables rather than the mess I had
going on. I will read about TreeBehavior and see what thats all about as its
all new to me.

Good looking out!

Thanks

Dave

-Original Message-
From: brian [mailto:bally.z...@gmail.com] 
Sent: March-21-09 12:39 PM
To: cake-php@googlegroups.com
Subject: Re: Is this possible?


On Sat, Mar 21, 2009 at 9:57 AM, BrianRehg brianr...@gmail.com wrote:

 To me it sounds like Tools, Equipment and Supplies are all items
 that a user can select.  Have you thought about placing them all into 
 one table like equipment and then create a new table called 
 categories. Then store the categories primary id as the foreign key 
 catetgory_id in the  equipment table.

I agree, though I'd probably look at using TreeBehavior for Category with
many Items.



--~--~-~--~~~---~--~~
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: Dividing Users

2009-03-21 Thread Dave Maharaj :: WidePixels.com

Thanks John,

It does make more sense. I will give that a try and see how it goes.

Thanks for your detailed feedback.

Dave

-Original Message-
From: John Andersen [mailto:j.andersen...@gmail.com] 
Sent: March-21-09 5:38 AM
To: CakePHP
Subject: Re: Dividing Users


Hi Dave,

Looking at your model, I understand your problem.

As I understand it from your description:
1) A user can have one profile;
2) A user belongs to one group;
3) A user can create one or more ads;
4) A user can create one or more bookmarks;
5) A bookmark refers to one ad;
6) An ad may be referred to by one or more bookmark.

Text version of my data model ( A -- B means B belongsTo A and A hasMany B;
no indication of mandatory relationships ):
groups -- users -- profiles -- profile_attributes users -- ads --
bookmarks users -- bookmarks profile_types -- profiles attribute_types --
profile_attributes.

The major changes from your model are:
1) The ads belongs to a user, not to a profile.
2) The bookmark belongs to a user, not to a profile.
3) One table (profiles) for all profiles, at least the information that are
common for all profiles.
4) Two tables (attribute_types and profile_attributes) for the profile
information, that are not common for all profiles.

So when you model this i CakePHP, and you read a users profile (Agent) then
the model should automatically also read all the profile attributes (using
HasMany relationship) from that model, thus ensuring the correct information
is available for your presentation of the profile (Agent). And the same when
you read a users profile (Investor).

Did this help you?
Best wishes,
John

On Mar 20, 5:56 pm, Dave Maharaj :: WidePixels.com
d...@widepixels.com wrote:
 Thanks again for your input. I been trying to get this right and for 
 some reason either I am a complete idiot I just cant get it. Or If it 
 is I do not think its right. I have been playing with it on the 
 cakeapp site to build the tables to give people an 
 idea.http://cakeapp.com/sqldesigners/sql/leiabeans

 In my head User belongs to a group (either the INVESTOR or AGENT) 
 Group hasMany Users ok that all makes sense no problems yet

 Now because the INVESTOR and AGENT profile information in completely 
 different I want a table for each (INVESTORS and AGENTS), normally 
 USER would have 1 profile but in this case there are 2 options of what 
 profile a USER will have based on the GROUP they are in.
 User hasOne INVESTOR or AGENT (which is a profile) depending on the 
 GROUP they belong to...this is where I am confusing myself. So a USER 
 who belongs to the GROUP AGENT will have a AGENT USER.ID in the 
 table...? Lost myself even trying to write it.

 Does this make sense to anyone?

 Thanks,

 Dave
[snip]


--~--~-~--~~~---~--~~
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: Session Resetting itself and/or Not saving

2009-03-21 Thread Charles

I've tried that several times!

It's writing to it as the debug spits it out after i write to it but
then it does not save it from page to page.

The code I presented yields this array while debugging $_SESSION:
Array
(
[Crumbs] = Array
(
[1] = Array
(
[crumb_link] = /
[crumb_name] = Home
)

)

)



so it gets INTO $_SESSION it just doesn't carry over.

On Mar 21, 4:48 am, John Andersen j.andersen...@gmail.com wrote:
 Look in the manual athttp://book.cakephp.org/view/399/writefor
 understanding the session write method! You are missing the first
 parameter! The second parameter should be your data!

 Enjoy
     John

 On Mar 21, 11:36 am, Charles cri...@gmail.com wrote:

  I started a simple breadcrumb component. I am trying to use the
  session in order to keep track of, where the user is in the system and
  where he came from. I've broke it down to it's most basic form and for
  the life of me I cannot get my sessions to save! I've already tried
  setting my session security to low to no avail.

          ?php

          class CrumbComponent extends Object{
                  var $components = array('Session');
                  function breadCrumb($newPageArray = null,  $reset = null){

                          $crumbCount = count($_SESSION['Crumbs'])+1;

                          echo $crumbCount;
                          $crumb_array[$crumbCount] = array('crumb_link'  =  
   $newPageArray
  ['link'],
                                                                              
                                                      'crumb_name'    =   
  $newPageArray['name'],);

          $current_crumb_array = array('Crumbs' = $crumb_array);

                  $this-Session-write($current_crumb_array);
                  echo pre;
                  debug($_SESSION);
                  echo /pre;
                  }
          }
          ?

  I tried to get a count and +1 because at first i thought it wasn't
  incrementing the sessions for whatever reason.. but this still does
  not work.

  Any clues or something I need to set in order to have the session
  save??

  Thanks!
--~--~-~--~~~---~--~~
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: Session Resetting itself and/or Not saving

2009-03-21 Thread Charles

Guess what, I tried your suggestion and... gasp! exact same results!
?php

class CrumbComponent extends Object{
var $components = array('Session');
function breadCrumb($newPageArray = null,  $reset = null){

print_r($newPageArray);

$crumbCount = count($_SESSION['Crumbs'])+1;

echo $crumbCount;
$crumb_array[$crumbCount] = array('crumb_link'  =  
$newPageArray
['link'],

'crumb_name'=  
$newPageArray['name'],);

$current_crumb_array = array('Crumbs' = $crumb_array);

$this-Session-write('Crumbs', $crumb_array);
$mySessionVars = $this-Session-read();

debug($mySessionVars);
}
}
?

Yields:


Array
(
[Crumbs] = Array
(
[1] = Array
(
[crumb_link] = /
[crumb_name] = Home
)

)

)




On Mar 21, 4:48 am, John Andersen j.andersen...@gmail.com wrote:
 Look in the manual athttp://book.cakephp.org/view/399/writefor
 understanding the session write method! You are missing the first
 parameter! The second parameter should be your data!

 Enjoy
     John

 On Mar 21, 11:36 am, Charles cri...@gmail.com wrote:

  I started a simple breadcrumb component. I am trying to use the
  session in order to keep track of, where the user is in the system and
  where he came from. I've broke it down to it's most basic form and for
  the life of me I cannot get my sessions to save! I've already tried
  setting my session security to low to no avail.

          ?php

          class CrumbComponent extends Object{
                  var $components = array('Session');
                  function breadCrumb($newPageArray = null,  $reset = null){

                          $crumbCount = count($_SESSION['Crumbs'])+1;

                          echo $crumbCount;
                          $crumb_array[$crumbCount] = array('crumb_link'  =  
   $newPageArray
  ['link'],
                                                                              
                                                      'crumb_name'    =   
  $newPageArray['name'],);

          $current_crumb_array = array('Crumbs' = $crumb_array);

                  $this-Session-write($current_crumb_array);
                  echo pre;
                  debug($_SESSION);
                  echo /pre;
                  }
          }
          ?

  I tried to get a count and +1 because at first i thought it wasn't
  incrementing the sessions for whatever reason.. but this still does
  not work.

  Any clues or something I need to set in order to have the session
  save??

  Thanks!
--~--~-~--~~~---~--~~
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: Debug Helper problems on my server

2009-03-21 Thread ProFire

I just made a temporary fix on this problem.
I'm not sure what's the source of the problem but I'm guessing that
it's because my live server is running PHP4 while my developer's
machine is running PHP5.

I have modified the following files:
debug_kit/views/elements/log_panel.ctp
debug_kit/views/elements/memory_panel.ctp
debug_kit/views/elements/request_panel.ctp
debug_kit/views/elements/session_panel.ctp
debug_kit/views/elements/timer_panel.ctp
debug_kit/views/elements/variables_panel.ctp

Everytime I encounter the following:
$toolbar-makeNeatArray($vars)
$toolbar-table($vars)
$toolbar-message($vars)

I change it to:
$toolbar-HtmlToolbar-makeNeatArray($vars)
$toolbar-HtmlToolbar-table($vars)
$toolbar-HtmlToolbar-message($vars)

I don't think it's the perfect solution because I still encounter
minor bugs with it.
But so far, at least I got my site up and running properly and the
bugs don't bother me yet.
I think I'm going to put a ticket for this.




On Mar 21, 11:25 pm, ProFire profir...@hotmail.com wrote:
 I'm experiencing the same problem.
 I don't think it's a permission problem but PHP version problem.
 The developer's machine is using PHP5 while the live machine uses
 PHP4.
 Could this be the problem?

 Anybody have a solution to this?

 On Feb 22, 5:42 am, jer2665 jeremyhalvor...@gmail.com wrote:

  I've got debug_kit working fine on my dev machine, now trying to set
  it up on my server 1and1 it's giving me a problem, someone in #cakephp
  said it's probably a permissions error, but I haven't been able to
  nail this down.

  All folders seem to be 755, and all files seem to be 644, what other
  permissions need to be changed?   Is there another issue?

  Currently I'm getting...

  Fatal error: Call to undefined method: toolbarhelper-makeneatarray()
  in /path to /app/plugins/debug_kit/views/elements/session_panel.ctp
  on line 31
  (default) 0 query took ms
  Nr      Query   Error   Affected        Num. rows       Took (ms)

  just incase it is a permissions issue, i threw together a file list 
  athttp://www.jeremyhalvorsen.com/list.txtincase that helps.

  any tips?

  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: Tree structure..

2009-03-21 Thread mscdex

On Mar 21, 7:02 am, Aneesh S aneeshs.em...@gmail.com wrote:
 so that its easily accessable for admin to edit and also to display it in a
 dropdown so as to create new...

The Tree Behavior has a 'generatetreelist' method that makes it easy
to generate a PHP array for use in dropdown form elements.
--~--~-~--~~~---~--~~
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: Tree structure..

2009-03-21 Thread Dave Maharaj :: WidePixels.com

Can it also be used to create the multiple checkboxes rather than the select
list? 

-Original Message-
From: mscdex [mailto:msc...@gmail.com] 
Sent: March-21-09 3:06 PM
To: CakePHP
Subject: Re: Tree structure..


On Mar 21, 7:02 am, Aneesh S aneeshs.em...@gmail.com wrote:
 so that its easily accessable for admin to edit and also to display it 
 in a dropdown so as to create new...

The Tree Behavior has a 'generatetreelist' method that makes it easy to
generate a PHP array for use in dropdown form elements.


--~--~-~--~~~---~--~~
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: Session Resetting itself and/or Not saving

2009-03-21 Thread Charles

Here is undeniable proof that the session is just not saving itself:

I set up two random names using rand(). I set ONE value using rand().


$name   = rand(7, 15);
$value  =   rand(5, 15);
$Sname  =   rand(1, 15);

$_SESSION[$Sname] = $value;

$this-Session-write($name,$value);

echo pre;
print_r($_SESSION);
echo /pre;

debug($this-Session-read());



Yields:

print_r:
Array
(
[15] = 5
)

Debugger:
Array
(
[15] = 5
)



They should both have different names for the fields, yet they share
it. my sessions just don't save themselves.. someone 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: Accessing Data in a Controller rather than view

2009-03-21 Thread MichTex

I hit upon a slight elaboration of the idea of adding debug( ) calls
which I have found very useful for untangling a problematic find( ) or
other query. Basically, I added to my controller another action whose
only purpose is to display the output of such queries. For example,
here is what this action currently looks like (slightly sanitized):

function zztest() {
# set up query
$user_id = 43;
$subject_id = 2;
$myaction_data = $this-Myaction-find('all', array(
'conditions' = array(
'Myaction.user_id'=$user_id,
'Myaction.subject_id'=$subject_id),
'fields' = array(
'max(fact_count)')));
# output results
$this-set('result', $myaction_data);
}

and here is the corresponding view:

zztest.ctp:
?php
echo bzztest/bbr\n;
debug($result);
?

Whenever I have a find( ) or a query( ) or whatever whose behavior is
causing problems, I copy and paste it over the lines between the two
comments in zztest. Sometimes, I have to set up dummy values for
variables, as in this example. Then I run this action in a different
browser window:

  http://mydomain.com/myaction/zztest

This will show the output of the query in the handy debug-style
format, without messing up the appearance of the real page. Using it,
I can immediately check out the query, and even play with it without
having to touch my real code. When I have figured out the problem
(e.g., what combination of numbers and strings I actually get back as
keys for my data), then I can fix my real code and move on. What's
more, while I'm figuring this out, I don't have to clutter up my real
code with bits of debugging. Also, it can be pretty handy to have your
app running in one browser window and zztest in another. That way, you
are not having to flip back and forth between two different URLs in
the same browser window, but just flip between the two windows if you
need to.

Of course, you can use this same idea of a special purpose debug
action for any kind of experimentation, such as trying out different
library functions, or just learning how PHP works.

On Mar 20, 11:48 am, brian bally.z...@gmail.com wrote:
 You might want to consider using the Model's afterFind() method,
 instead. But, if you'd rather do it in the controller, the best way to
 figure out how to access your data is to toss a debug($mydata) in
 there. (seems to be my standard response these days ;-) You're
 probably getting hung up on the numerical indexes for a hasMany
 relation or something.

 On Fri, Mar 20, 2009 at 11:19 AM, ryanam1 ryan...@gmail.com wrote:

  Hi,

  How can I access data within a controller?

  Lets say I have the following find() method in my controller

  $mydata=$this-User-find('all', array('conditions'='new;),
  'fields'=array('name'))

  Let's say I wanted to do some sort of proccessing to that data before
  outputting to a view How would I do that?

  I see examples of how to output that data in the view but I see none
  about accessing the data from within the controller.

  I figure I should do a loop but how should I write $mydata?

  Should it be like this:  $mydata['User']['name']  ?  That seems to
  work in the view but I get a Undefined Index error when I write it
  that  way from within the controller.

  I don't have the issue when a method returns one record such as field
  () because it is not returning an array

  I hope I'm not confusing anyone :(
--~--~-~--~~~---~--~~
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: Session Resetting itself and/or Not saving

2009-03-21 Thread John Andersen

I just tried your bread crumb component, a little rewritten and the
debug information presents the session content with the bread crumb
information without problems! So have you done all the setting up
before you use the component?

Here is the bread crumb component with my changes:
?php
class CrumbComponent extends Object
{
   var $components = array('Session');

   function breadCrumb($newPageArray = null,  $reset = null)
   {
  $crumbs = $this-Session-read('Crumbs');
  $crumbCount = count($crumbs);
  echo $crumbCount;
  $crumbs[] = array('crumb_link'  =   $newPageArray
['link'],'crumb_name'=   $newPageArray['name'],);
  $this-Session-write('Crumbs',$crumbs);
  echo pre;
 debug($_SESSION);
  echo /pre;
   }
}
?

In my controller I added:
   var $components = array( 'Crumb' );

And a place where I call it as:
  $this-Crumb-breadCrumb(array('link'='somewhere
link','name'='Somewhere I where!'));

No problem, the information is there, so check your code! :)
Hope this helps you on the way,
   John

On Mar 21, 7:50 pm, Charles cri...@gmail.com wrote:
 Here is undeniable proof that the session is just not saving itself:

 I set up two random names using rand(). I set ONE value using rand().

                 $name           = rand(7, 15);
                 $value  =       rand(5, 15);
                 $Sname  =       rand(1, 15);

                 $_SESSION[$Sname] = $value;

                 $this-Session-write($name,$value);

                 echo pre;
                 print_r($_SESSION);
                 echo /pre;

                 debug($this-Session-read());

 Yields:

 print_r:
 Array
 (
     [15] = 5
 )

 Debugger:
 Array
 (
     [15] = 5
 )

 They should both have different names for the fields, yet they share
 it. my sessions just don't save themselves.. someone 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: Session Resetting itself and/or Not saving

2009-03-21 Thread Charles

Yes I am starting to realize it is not the code but rather a setting
somewhere that keeps resetting my session. I have no idea where to
being looking, however. I have set session security to low, changed it
from php to cake.. going to try db next but i'd rather not query the
db for all the sessions. but if it works, it works I guess. Thanks for
the input!



On Mar 21, 1:16 pm, John Andersen j.andersen...@gmail.com wrote:
 I just tried your bread crumb component, a little rewritten and the
 debug information presents the session content with the bread crumb
 information without problems! So have you done all the setting up
 before you use the component?

 Here is the bread crumb component with my changes:
 ?php
 class CrumbComponent extends Object
 {
    var $components = array('Session');

    function breadCrumb($newPageArray = null,  $reset = null)
    {
       $crumbs = $this-Session-read('Crumbs');
       $crumbCount = count($crumbs);
       echo $crumbCount;
       $crumbs[] = array('crumb_link'  =   $newPageArray
 ['link'],'crumb_name'    =   $newPageArray['name'],);
       $this-Session-write('Crumbs',$crumbs);
       echo pre;
          debug($_SESSION);
       echo /pre;
    }}

 ?

 In my controller I added:
    var $components = array( 'Crumb' );

 And a place where I call it as:
       $this-Crumb-breadCrumb(array('link'='somewhere
 link','name'='Somewhere I where!'));

 No problem, the information is there, so check your code! :)
 Hope this helps you on the way,
    John

 On Mar 21, 7:50 pm, Charles cri...@gmail.com wrote:

  Here is undeniable proof that the session is just not saving itself:

  I set up two random names using rand(). I set ONE value using rand().

                  $name           = rand(7, 15);
                  $value  =       rand(5, 15);
                  $Sname  =       rand(1, 15);

                  $_SESSION[$Sname] = $value;

                  $this-Session-write($name,$value);

                  echo pre;
                  print_r($_SESSION);
                  echo /pre;

                  debug($this-Session-read());

  Yields:

  print_r:
  Array
  (
      [15] = 5
  )

  Debugger:
  Array
  (
      [15] = 5
  )

  They should both have different names for the fields, yet they share
  it. my sessions just don't save themselves.. someone 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: Session Resetting itself and/or Not saving

2009-03-21 Thread John Andersen

Yes, I agree, after comparing your result with mine, I think your
session is not activate at all!
My session looks as this:
28871\controllers\components\crumb.php (line 14)

Array
(
[Config] = Array
(
[userAgent] = 83b3d3a563eb8249b0a9673105b4aae7
[time] = 1237660346
[rand] = 1199379407
[timeout] = 10
)
[Language] = en
[Crumbs] = Array
(
[0] = Array
(
[crumb_link] = somewhere link
[crumb_name] = Somewhere I where!
)
[1] = Array
(
[crumb_link] = somewhere link
[crumb_name] = Somewhere I where!
)
)
)

And you can see that it contains also other information needed by my
site, not only the crumb information!

I do hope you find the missing step :)
   John

On Mar 21, 8:21 pm, Charles cri...@gmail.com wrote:
 Yes I am starting to realize it is not the code but rather a setting
 somewhere that keeps resetting my session. I have no idea where to
 being looking, however. I have set session security to low, changed it
 from php to cake.. going to try db next but i'd rather not query the
 db for all the sessions. but if it works, it works I guess. Thanks for
 the input!

[snip]
--~--~-~--~~~---~--~~
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: Debug Helper problems on my server

2009-03-21 Thread mark_story

This could be an issue with references to the inner helper class, or
the overloading of methods.  I've never tested debug_kit on PHP4, but
changing as you have will break the FirePHP output. And cause other
fatal errors.

-Mark

On Mar 21, 1:22 pm, ProFire profir...@hotmail.com wrote:
 I just made a temporary fix on this problem.
 I'm not sure what's the source of the problem but I'm guessing that
 it's because my live server is running PHP4 while my developer's
 machine is running PHP5.

 I have modified the following files:
 debug_kit/views/elements/log_panel.ctp
 debug_kit/views/elements/memory_panel.ctp
 debug_kit/views/elements/request_panel.ctp
 debug_kit/views/elements/session_panel.ctp
 debug_kit/views/elements/timer_panel.ctp
 debug_kit/views/elements/variables_panel.ctp

 Everytime I encounter the following:
 $toolbar-makeNeatArray($vars)
 $toolbar-table($vars)
 $toolbar-message($vars)

 I change it to:
 $toolbar-HtmlToolbar-makeNeatArray($vars)
 $toolbar-HtmlToolbar-table($vars)
 $toolbar-HtmlToolbar-message($vars)

 I don't think it's the perfect solution because I still encounter
 minor bugs with it.
 But so far, at least I got my site up and running properly and the
 bugs don't bother me yet.
 I think I'm going to put a ticket for this.

 On Mar 21, 11:25 pm, ProFire profir...@hotmail.com wrote:

  I'm experiencing the same problem.
  I don't think it's a permission problem but PHP version problem.
  The developer's machine is using PHP5 while the live machine uses
  PHP4.
  Could this be the problem?

  Anybody have a solution to this?

  On Feb 22, 5:42 am, jer2665 jeremyhalvor...@gmail.com wrote:

   I've got debug_kit working fine on my dev machine, now trying to set
   it up on my server 1and1 it's giving me a problem, someone in #cakephp
   said it's probably a permissions error, but I haven't been able to
   nail this down.

   All folders seem to be 755, and all files seem to be 644, what other
   permissions need to be changed?   Is there another issue?

   Currently I'm getting...

   Fatal error: Call to undefined method: toolbarhelper-makeneatarray()
   in /path to /app/plugins/debug_kit/views/elements/session_panel.ctp
   on line 31
   (default) 0 query took ms
   Nr      Query   Error   Affected        Num. rows       Took (ms)

   just incase it is a permissions issue, i threw together a file list 
   athttp://www.jeremyhalvorsen.com/list.txtincasethat helps.

   any tips?

   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: Accessing Data in a Controller rather than view

2009-03-21 Thread John Andersen

I agree with Brian, that if the data changes you want to make applies
every time you read the models data, then the afterFind method is the
correct place to make your changes.

But if the data changes only is to take place in a specific method in
the controller, then it is there you should do it (or in the model as
a new method).

As far as I understand, you operate on the data exactly the same way
as you operate on the data in the view.

When you are finished changing the data, you use the set method to
make the data available to the view.

Hope this helps you on the way :)

Enjoy,
   John

On Mar 20, 5:48 pm, brian bally.z...@gmail.com wrote:
 You might want to consider using the Model's afterFind() method,
 instead. But, if you'd rather do it in the controller, the best way to
 figure out how to access your data is to toss a debug($mydata) in
 there. (seems to be my standard response these days ;-) You're
 probably getting hung up on the numerical indexes for a hasMany
 relation or something.

[snip]
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Newbie needs help with hidden input helper

2009-03-21 Thread cpeele


Hey guys,

I have checked the manual and I still find it a little confusing as
far as how to use the hidden input control.

I have a session variable named User.user_id that I want to put in the
hidden input helper but can't seem to get it to work.

I have tried the following: echo $form-hidden('user_id', $session-
read('User.user_id')); but this does not work. I checked to ensure
that there was indeed something in the session beforehand.

Could someone please help me out with this?

Thank you!

Chris


--~--~-~--~~~---~--~~
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: Newbie needs help with hidden input helper

2009-03-21 Thread John Andersen

Do not do that! Do not expose your user tables primary key like that
for every to see!

Please explain why you would like to do this?
   John

On Mar 21, 8:39 pm, cpeele chris.peel...@gmail.com wrote:
 Hey guys,

 I have checked the manual and I still find it a little confusing as
 far as how to use the hidden input control.

 I have a session variable named User.user_id that I want to put in the
 hidden input helper but can't seem to get it to work.

 I have tried the following: echo $form-hidden('user_id', 
 $session-read('User.user_id')); but this does not work. I checked to ensure

 that there was indeed something in the session beforehand.

 Could someone please help me out with this?

 Thank you!

 Chris
--~--~-~--~~~---~--~~
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: Session Resetting itself and/or Not saving

2009-03-21 Thread Charles

Interestingly, I decided to take this completely outside of cakephp to
see if THAT was the issue and as it turns out it is not, here is my
out-of-cake test w/ the code included:

http://cricex.com/session_test.php

Now I am really starting to scratch my head..




On Mar 21, 1:33 pm, John Andersen j.andersen...@gmail.com wrote:
 Yes, I agree, after comparing your result with mine, I think your
 session is not activate at all!
 My session looks as this:
 28871\controllers\components\crumb.php (line 14)

 Array
 (
     [Config] = Array
         (
             [userAgent] = 83b3d3a563eb8249b0a9673105b4aae7
             [time] = 1237660346
             [rand] = 1199379407
             [timeout] = 10
         )
     [Language] = en
     [Crumbs] = Array
         (
             [0] = Array
                 (
                     [crumb_link] = somewhere link
                     [crumb_name] = Somewhere I where!
                 )
             [1] = Array
                 (
                     [crumb_link] = somewhere link
                     [crumb_name] = Somewhere I where!
                 )
         )
 )

 And you can see that it contains also other information needed by my
 site, not only the crumb information!

 I do hope you find the missing step :)
    John

 On Mar 21, 8:21 pm, Charles cri...@gmail.com wrote: Yes I am starting to 
 realize it is not the code but rather a setting
  somewhere that keeps resetting my session. I have no idea where to
  being looking, however. I have set session security to low, changed it
  from php to cake.. going to try db next but i'd rather not query the
  db for all the sessions. but if it works, it works I guess. Thanks for
  the input!

 [snip]
--~--~-~--~~~---~--~~
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: Foreign Characters

2009-03-21 Thread John Andersen

Can you show us the headers you are setting in order to specify the
utf-8 encoding?

When a form is being submitted, the form will use the page's encoding,
so that must be set correctly to utf-8.

Enjoy,
   John

On Mar 21, 5:14 pm, blckspder blcksp...@gmail.com wrote:
 Hello,

 I have a form that people from all different countries use. I see to
 have a problem with foreign characters. my page is in utf-8, i tried
 using the php function utf8_encode and htmlspecialchars but everything
 comes out jumbled when foreign characters are used.

 here is an example of what I see in the database and in the email:
 arabacı

 That example is when I use htmlspecialchars, The database is utf-8 as
 well.

 If anyone can help I would appreciate it.
--~--~-~--~~~---~--~~
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: Session Resetting itself and/or Not saving

2009-03-21 Thread John Andersen

You have an error in the code!
Changes as:
  $Sname = $k+1;
  $value = $v+1;
becaue $k++ and $v++ changes the value after the value has been
transferred to $Sname and $value :)

And then it works in vanilla PHP!

Enjoy,
   John

On Mar 21, 8:48 pm, Charles cri...@gmail.com wrote:
 Interestingly, I decided to take this completely outside of cakephp to
 see if THAT was the issue and as it turns out it is not, here is my
 out-of-cake test w/ the code included:

 http://cricex.com/session_test.php

 Now I am really starting to scratch my head..

[snip]
--~--~-~--~~~---~--~~
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: Session Resetting itself and/or Not saving

2009-03-21 Thread John Andersen

Ps. do you core php file contain:

Configure::write('Session.start', true);
??
Enjoy,
   John
--~--~-~--~~~---~--~~
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: Foreign Characters

2009-03-21 Thread blckspder

I setting it to utf in the meta tag

meta http-equiv=Content-Type content=text/html; charset=utf-8 /


On Mar 21, 2:50 pm, John Andersen j.andersen...@gmail.com wrote:
 Can you show us the headers you are setting in order to specify the
 utf-8 encoding?

 When a form is being submitted, the form will use the page's encoding,
 so that must be set correctly to utf-8.

 Enjoy,
    John

 On Mar 21, 5:14 pm, blckspder blcksp...@gmail.com wrote:

  Hello,

  I have a form that people from all different countries use. I see to
  have a problem with foreign characters. my page is in utf-8, i tried
  using the php function utf8_encode and htmlspecialchars but everything
  comes out jumbled when foreign characters are used.

  here is an example of what I see in the database and in the email:
  arabacı

  That example is when I use htmlspecialchars, The database is utf-8 as
  well.

  If anyone can help I would appreciate it.
--~--~-~--~~~---~--~~
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: Foreign Characters

2009-03-21 Thread John Andersen

That is fine, so the problem is not in the html!

In what way are you looking at the data and seeing the erroneous
representation (in another page, using a tool or what)?

How are you processing your data before saving them in the database?
And when you are retrieving them from the database?
And before presenting the data in html?

Enjoy,
   John

On Mar 21, 9:28 pm, blckspder blcksp...@gmail.com wrote:
 I setting it to utf in the meta tag

 meta http-equiv=Content-Type content=text/html; charset=utf-8 /

[snip]
--~--~-~--~~~---~--~~
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: Session Resetting itself and/or Not saving

2009-03-21 Thread Charles

Interesting!

I got it to work in vanilla php, i saw my errors.

Session.start was set to true.

So I set it to false.

Put session_start(); at the top of my controller and b-i-n-g-o! I can
now write to sessions in cakephp.

WTF?

On Mar 21, 2:12 pm, John Andersen j.andersen...@gmail.com wrote:
 Ps. do you core php file contain:

         Configure::write('Session.start', true);
 ??
 Enjoy,
    John
--~--~-~--~~~---~--~~
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: Session Resetting itself and/or Not saving

2009-03-21 Thread John Andersen

Ok :)
But you should only set Session.start to true in core.php and not use
session_start at all anywhere in your code!
What is your Session.save set to in core.php?
   John

On Mar 21, 9:49 pm, Charles cri...@gmail.com wrote:
 Interesting!

 I got it to work in vanilla php, i saw my errors.

 Session.start was set to true.

 So I set it to false.

 Put session_start(); at the top of my controller and b-i-n-g-o! I can
 now write to sessions in cakephp.

 WTF?

[snip]
--~--~-~--~~~---~--~~
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: Foreign Characters

2009-03-21 Thread blckspder

John,

Thanks for the help. I see the errors in the mysql database using
query browser and I also see the error in outlook and gmail when the
results are emailed.

I basically keep all the results in an array. I then loop through the
array and do mysql_real_escape_string(). I tried nesting the
utf8_encode function and the htmlspecialchars function into the escape
function like so:

mysql_real_escape_string(utf8_encode($array['item'])); or
mysql_real_escape_string(htmlspecialchars($array['item']));

On Mar 21, 3:41 pm, John Andersen j.andersen...@gmail.com wrote:
 That is fine, so the problem is not in the html!

 In what way are you looking at the data and seeing the erroneous
 representation (in another page, using a tool or what)?

 How are you processing your data before saving them in the database?
 And when you are retrieving them from the database?
 And before presenting the data in html?

 Enjoy,
    John

 On Mar 21, 9:28 pm, blckspder blcksp...@gmail.com wrote: I setting it to 
 utf in the meta tag

  meta http-equiv=Content-Type content=text/html; charset=utf-8 /

 [snip]
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Problems with CONCAT function

2009-03-21 Thread Chrillemeter

Hello!

I got a problem with $this-Model-find() and sql-functions such as
CONCAT.

CODE
-
$this-User-find(
'all',
array(
'fields' = array(
'CONCAT(User.firstname,\' \'User.lastname)) AS 
full_name'
)
)
);


When I use sql function with find() it returns arrays lookin like
this.

RESULT
-
Array
(
[0] = Array
(
[0] = Array
(
[full_name] = Christher Lenander
)

)
)



I want the returned array to look like this

Array
(
[0] = Array
(
[User] = Array
(
[full_name] = Christher Lenander
)

)
)

--~--~-~--~~~---~--~~
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: Problems with CONCAT function

2009-03-21 Thread John Andersen

I haven't used this before, but reading the manual and checking your
code, I come up with this change:

'fields' = array( 'CONCAT( User.firstname, \' \',
User.lastname ) AS full_name' )

There was a mismatching of the brackets, one was actually inside the
CONCAT string.
Hope this helps :)
Enjoy,
   John


On Mar 21, 9:51 pm, Chrillemeter i...@christher.se wrote:
 Hello!

 I got a problem with $this-Model-find() and sql-functions such as
 CONCAT.

 CODE
 -
 $this-User-find(
         'all',
         array(
                 'fields' = array(
                                 'CONCAT(User.firstname,\' \'User.lastname)) 
 AS full_name'
                         )
         )
 );

[snip]
--~--~-~--~~~---~--~~
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: Problems with CONCAT function

2009-03-21 Thread Chrillemeter

No change at all. Get the same result.

[0] = Array
(
[0] = Array
(
[full_name] = Christher Lenander
)

)


On Mar 21, 10:00 pm, John Andersen j.andersen...@gmail.com wrote:
 I haven't used this before, but reading the manual and checking your
 code, I come up with this change:

                 'fields' = array( 'CONCAT( User.firstname, \' \',
 User.lastname ) AS full_name' )

 There was a mismatching of the brackets, one was actually inside the
 CONCAT string.
 Hope this helps :)
 Enjoy,
    John

 On Mar 21, 9:51 pm, Chrillemeter i...@christher.se wrote:

  Hello!

  I got a problem with $this-Model-find() and sql-functions such as
  CONCAT.

  CODE
  -
  $this-User-find(
          'all',
          array(
                  'fields' = array(
                                  'CONCAT(User.firstname,\' \'User.lastname)) 
  AS full_name'
                          )
          )
  );

 [snip]

--~--~-~--~~~---~--~~
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: Problems with CONCAT function

2009-03-21 Thread mscdex

On Mar 21, 3:51 pm, Chrillemeter i...@christher.se wrote:
 Hello!

 I got a problem with $this-Model-find() and sql-functions such as
 CONCAT.

This is a known problem and it happens when using any SQL functions.
Teknoid has a solution for this issue here:
http://teknoid.wordpress.com/2008/09/29/dealing-with-calculated-fields-in-cakephps-find/
--~--~-~--~~~---~--~~
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: Newbie needs help with hidden input helper

2009-03-21 Thread mscdex

I have to agree with John here, you should probably try to keep those
sorts of things out of user-submittable forms.

Anyhow, the syntax for $form-hidden() is different than you are
trying to use it as. The second parameter is an $options array, so to
set a default value use:

echo $form-hidden('fieldname', array( 'value' = 'foo' ));
--~--~-~--~~~---~--~~
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: Tree structure..

2009-03-21 Thread mscdex

On Mar 21, 1:39 pm, Dave Maharaj :: WidePixels.com
d...@widepixels.com wrote:
 Can it also be used to create the multiple checkboxes rather than the select
 list?

Sure, all 'generatetreelist' does is create the php array containing
the appropriate key=value pairs and appropriate indentation for each
level for you. See the manual entry on it here:
http://book.cakephp.org/view/517/generatetreelist
--~--~-~--~~~---~--~~
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: Help with routing (/cat/:alias/feed - /:cat/feed)

2009-03-21 Thread rod

Thanks for your help,

The first ::connect (/cat/:category/) works fine, but the second one
for  /feed still doesn't work.

If I try to access /cat/category_name/index.rss I get an error, maybe
that's the reason why /feed isn't working. However I can access it if
I change the first ::connect to (/cat/:category/*)  but still nothing
for /feed

Any idea?

Thanks

On 21 mar, 11:58, brian bally.z...@gmail.com wrote:
 On Fri, Mar 20, 2009 at 11:58 PM, rod rodrigo.z...@gmail.com wrote:

  Hi,

  I need help with routes.php, I've read the documentation and many
  blogs, articles but I still can't figure out how to do this:

 http://localhost/cat/categoryAlias/feed

  I have this which works fine:

 Router::connect(
         '/cat/:category',
         array('controller' = 'categories', 'action' = 'index'),
         array('category' = '(.*)')
  );

  But then I'd like to have, for example:http://localhost/cat/Food/feed
  - and that would point to Food/index.rss, however it doesn't work,
  probably due to (.*) in the previousRouter::connect.

 You should tighten up the regexp a bit. Something like [-A-Za-z]+ or
 [_A-Za-z]+ or thereabouts. It'll obviously depend on whatever rules
 you have for creating your :category (slug)

 Router::connect(
         '/cat/:category',
         array('controller' = 'categories', 'action' = 'index'),
         array(
                 'category' = '[-_A-Za-z]+',
                 'pass' = array('category')
         )
 );

 Router::connect(
         '/cat/:category/feed',
         array(
                 'controller' = 'categories',
                 'action' = 'index',
                 'ext' = 'rss'
         ),
         array(
                 'category' = '[-_A-Za-z]+',
                 'pass' = array('category')
         )
 );
--~--~-~--~~~---~--~~
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: Session Resetting itself and/or Not saving

2009-03-21 Thread Charles

That's the problem, If session.start = true in core it would not save
my sessions. If I set it to false and through session_start at the top
of my controllers, it saved them.

I've tried both php and cake for the save w/ no luck.

On Mar 21, 2:59 pm, John Andersen j.andersen...@gmail.com wrote:
 Ok :)
 But you should only set Session.start to true in core.php and not use
 session_start at all anywhere in your code!
 What is your Session.save set to in core.php?
    John

 On Mar 21, 9:49 pm, Charles cri...@gmail.com wrote: Interesting!

  I got it to work in vanilla php, i saw my errors.

  Session.start was set to true.

  So I set it to false.

  Put session_start(); at the top of my controller and b-i-n-g-o! I can
  now write to sessions in cakephp.

  WTF?

 [snip]
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



HABTM Select question

2009-03-21 Thread Hernan

Hi there,
I'm trying to make a (kind of) dictionary and I have the following
setup:

Tables:
tag: The word, for example, free
tag_content: Each tag has one or many contents or meanings: as in
beer and as in speech. This example might not be the best but those
contents could be linked to other tags.
tags_tag_content: The relationship table, since many tags can have
many contents and viceversa.

I have established the HABTM relationship correctly (Or so I think)

Then, in the Tag model, I have a function that should bring the all
contents for that tag.
How do I do that? is it possible using find or do I need to make a
custom query?

If I do a find on the Content model, I can bring all the contents but
I don't know how to do a contidion for Tag.id=1

I've also tried doing a find on the relationship table but it repeats
the Tag object in every returned row.

Thanks!



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



Tree Behaviour help

2009-03-21 Thread Dave Maharaj :: WidePixels.com
I am following along on the Cake site
http://book.cakephp.org/view/228/Basic-Usage to set up the tree table in the
database.
 
I get error Missing database table 'parents' for model 'Parent'. This is all
new to me so I am not sure about the parent? Can someone provide some
assistance on this? What am missing here? Obviously the Parent but is this
something defined in the controller? Database?
 
Thanks
 
Dave

--~--~-~--~~~---~--~~
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: Newbie needs help with hidden input helper

2009-03-21 Thread cpeele

Thanks for the help guys. I appreciate it. The reason I need to do
this is I need to associate a submitted item (in this case a project)
with the logged in user. Is there another way to do this then?

Thanks again!

Chris

On Mar 21, 4:52 pm, mscdex msc...@gmail.com wrote:
 I have to agree with John here, you should probably try to keep those
 sorts of things out of user-submittable forms.

 Anyhow, the syntax for $form-hidden() is different than you are
 trying to use it as. The second parameter is an $options array, so to
 set a default value use:

 echo $form-hidden('fieldname', array( 'value' = 'foo' ));
--~--~-~--~~~---~--~~
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: Tree Behaviour help

2009-03-21 Thread Dave Maharaj :: WidePixels.com
Sorry I got it... my bad.
 
But as I read thru the add part... how do I add to a Category? I figured it
would be a drop down with the categories to select from to add a new item to
new parent? Is this not the case? You have to add it knowing the parent_id
in the controller itself?
 
Is there any documentation other than the cookbook that has more details?
When I try to simply Bake the MVC for Categories it comes up no parent table
found
 
Dave

  _  

From: Dave Maharaj :: WidePixels.com [mailto:d...@widepixels.com] 
Sent: March-21-09 10:37 PM
To: cake-php@googlegroups.com
Subject: Tree Behaviour help


I am following along on the Cake site
http://book.cakephp.org/view/228/Basic-Usage to set up the tree table in the
database.
 
I get error Missing database table 'parents' for model 'Parent'. This is all
new to me so I am not sure about the parent? Can someone provide some
assistance on this? What am missing here? Obviously the Parent but is this
something defined in the controller? Database?
 
Thanks
 
Dave




--~--~-~--~~~---~--~~
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: method signature madness

2009-03-21 Thread welzie

I forgot to include the method signature for the Html helper link
method, which is the exact same as the signature for my helper
method.  That is why I was so confused because the call to that method
works and the call to my method with the SAME exact signature does NOT
work.  Is there some magic that I'm missing?

Here are the two method signatures.
function link($title, $url = null, $htmlAttributes = array(),
$confirmMessage = false, $escapeTitle = true) {
function createLinkIfAuthorized($title, $url = null, $htmlAttributes =
array(), $confirmMessage = false, $escapeTitle = true) {

Here are the two usages.  Again the call to my method does NOT work.
echo $html-link( 'linkTitle', array('controller'='candidates',
'action'='index') );
echo $simpleAuthorization-createLinkIfAuthorized( 'linkTitle', array
('controller'='candidates', 'action'='index') );



On Mar 21, 9:47 am, brian bally.z...@gmail.com wrote:
 On Fri, Mar 20, 2009 at 11:35 PM, welzie wel...@gmail.com wrote:

  The call to my helper method that does NOT work.
  ?php
  echo $simpleAuthorization-createLinkIfAuthorized( 'linkTitle', array
  ('controller'='candidates', 'action'='index') );
  ?

 called with 2 params ...



  My helper class (not all methods are shown)::
  ?php
  class SimpleAuthorizationHelper extends Helper {

     var $helpers = array('Session', 'Html');

     function createLinkIfAuthorized($title, $url = null,
  $htmlAttributes = array(), $confirmMessage = false, $escapeTitle =
  true) {

 ... 4 params, htmlAttributes is 3rd
--~--~-~--~~~---~--~~
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: Newbie needs help with hidden input helper

2009-03-21 Thread mscdex

On Mar 21, 9:11 pm, cpeele chris.peel...@gmail.com wrote:
 Thanks for the help guys. I appreciate it. The reason I need to do
 this is I need to associate a submitted item (in this case a project)
 with the logged in user. Is there another way to do this then?

One solution would be to remove the hidden form field and instead
append a new array containing the user_id to $this-data right before
you call saveAll:

$this-data += array('User' = array('user_id' = $session-read
('User.user_id')));
$this-Project-saveAll($this-data);
--~--~-~--~~~---~--~~
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: HABTM Select question

2009-03-21 Thread mscdex

On Mar 21, 8:07 pm, Hernan hernancalabr...@gmail.com wrote:
 Then, in the Tag model, I have a function that should bring the all
 contents for that tag.
 How do I do that? is it possible using find or do I need to make a
 custom query?

Assuming you have your models and everything set up correctly, you
should be able to use the model's find method to get what you want.

 If I do a find on the Content model, I can bring all the contents but
 I don't know how to do a contidion for Tag.id=1

Try something like: $tag = $this-Tag-find('first', array
('conditions' = array('Tag.id' = 1), 'recursive' = 0));
Then $tag should contain information about the tag and its associated
contents. You may wish to specify a 'fields' sub-array also if you do
not want to pull in all information from each model.
--~--~-~--~~~---~--~~
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: Newbie needs help with hidden input helper

2009-03-21 Thread cpeele

Hey Thanks man! I'll give it a shot!

On Mar 21, 9:12 pm, mscdex msc...@gmail.com wrote:
 On Mar 21, 9:11 pm, cpeele chris.peel...@gmail.com wrote:

  Thanks for the help guys. I appreciate it. The reason I need to do
  this is I need to associate a submitted item (in this case a project)
  with the logged in user. Is there another way to do this then?

 One solution would be to remove the hidden form field and instead
 append a new array containing the user_id to $this-data right before
 you call saveAll:

 $this-data += array('User' = array('user_id' = $session-read
 ('User.user_id')));
 $this-Project-saveAll($this-data);
--~--~-~--~~~---~--~~
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: Newbie needs help with hidden input helper

2009-03-21 Thread cpeele

Actually, can I use the $session helper in a controller? Is it
supposed to be Session ?

Thanks again!

On Mar 21, 9:12 pm, mscdex msc...@gmail.com wrote:
 On Mar 21, 9:11 pm, cpeele chris.peel...@gmail.com wrote:

  Thanks for the help guys. I appreciate it. The reason I need to do
  this is I need to associate a submitted item (in this case a project)
  with the logged in user. Is there another way to do this then?

 One solution would be to remove the hidden form field and instead
 append a new array containing the user_id to $this-data right before
 you call saveAll:

 $this-data += array('User' = array('user_id' = $session-read
 ('User.user_id')));
 $this-Project-saveAll($this-data);
--~--~-~--~~~---~--~~
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: Newbie needs help with hidden input helper

2009-03-21 Thread cpeele

Okay, here's what's going on . I am using $this-Session because
$session in the controller causes it blow up.

$this-data += array('User' = array('user_id' = $this-Session-
read
('User.user_id')));
$this-Project-saveAll($this-data);

However, now when it saves it doesn't grab the value of user_id stored
in the Session. It should insert the value 1 for the user_id but
instead inserts 0

Am I supposed to set something up in order to use $this-Session in my
controller?

Thanks,

Chris







On Mar 21, 9:12 pm, mscdex msc...@gmail.com wrote:
 On Mar 21, 9:11 pm, cpeele chris.peel...@gmail.com wrote:

  Thanks for the help guys. I appreciate it. The reason I need to do
  this is I need to associate a submitted item (in this case a project)
  with the logged in user. Is there another way to do this then?

 One solution would be to remove the hidden form field and instead
 append a new array containing the user_id to $this-data right before
 you call saveAll:

 $this-data += array('User' = array('user_id' = $session-read
 ('User.user_id')));
 $this-Project-saveAll($this-data);
--~--~-~--~~~---~--~~
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: dynamic arguments with autocomplete

2009-03-21 Thread phil.mcgu...@gmail.com

I am trying to do something very similar. Only I have a static select
box and I want to filter the results of my autocomplete by what's
selected. The problem I'm running into is that that ajax post is only
post-ing the var from the autocomplete field. I don't know of a way to
specify for it to post two variables.



On Feb 19, 3:43 pm, juanf.cord...@gmail.com
juanf.cord...@gmail.com wrote:
 I have 2 input fields, both areautocompletefields
 for example:
 first field would be state field,
 and the second field would be the city field -those that belong to the
 first field (state field)-

 How can I pass the ID of the state to the 2ndautocompleteso i can
 get the cities that belong to the state

 here is a piece of what I have
                         ?php echo $ajax-autoComplete('state.name', '/map/
 autoCompleteState',array('minChars'=3,'frequency'='0.4',
 'afterUpdateElement' =  'getSelectedId'))?

                         ?php echo $ajax-autoComplete('city.name', '/map/
 autoCompleteCity/'  ,array('minChars'=3,'frequency'='0.4'))?

 Thank you

--~--~-~--~~~---~--~~
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: HABTM Select question

2009-03-21 Thread Hernan

Thanks for the quick reply!
It does indeed work that way so thanks for that! However, I forgot to
tell a part of the story.

Those tags have other HATBM relationships as well to a 'users' table.
Many Users can have many tags. So when I execute the query, all the
users relationships come as well which is not cool. Is there any way
to tell which HATBM relationship to show and which not?

Thanks!

On Mar 21, 11:19 pm, mscdex msc...@gmail.com wrote:
 On Mar 21, 8:07 pm, Hernan hernancalabr...@gmail.com wrote:

  Then, in the Tag model, I have a function that should bring the all
  contents for that tag.
  How do I do that? is it possible using find or do I need to make a
  custom query?

 Assuming you have your models and everything set up correctly, you
 should be able to use the model's find method to get what you want.

  If I do a find on the Content model, I can bring all the contents but
  I don't know how to do a contidion for Tag.id=1

 Try something like: $tag = $this-Tag-find('first', array
 ('conditions' = array('Tag.id' = 1), 'recursive' = 0));
 Then $tag should contain information about the tag and its associated
 contents. You may wish to specify a 'fields' sub-array also if you do
 not want to pull in all information from each model.
--~--~-~--~~~---~--~~
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: Foreign Characters

2009-03-21 Thread Marcelo Andrade

On Sat, Mar 21, 2009 at 12:14 PM, blckspder blcksp...@gmail.com wrote:

 Hello,

 I have a form that people from all different countries use. I see to
 have a problem with foreign characters. my page is in utf-8, i tried
 using the php function utf8_encode and htmlspecialchars but everything
 comes out jumbled when foreign characters are used.

 here is an example of what I see in the database and in the email:
 arabacı

 That example is when I use htmlspecialchars, The database is utf-8 as
 well.

 If anyone can help I would appreciate it.

Well, I wrote a checklist about it.  Hope it helps:

http://tinyurl.com/dxwx7z

Best regards.

--
MARCELO DE F. ANDRADE (aka eleKtron)
Belem, PA, Amazonia, Brazil
Linux User #221105

Visit my blog: http://mfandrade.wordpress.com

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



MVC best practice advice needed

2009-03-21 Thread mattalexx

I have a table full of users. Each record has an expiration datetime
field. I have a shell script that checks to see if there are users
who's accounts have expired and deactivate them. So here's the
process:

1. Get all users who's accounts have expired but are still marked
active.
2. Mark them not active.

It's really pretty simple. My question is, is it good practice to have
a model method handle the whole thing or should I just use the model
to retrieve the records and to save them.

Really this isn't a big deal, but it could be more complicated and
when it invariably is, I would like to know the best course of attack.

Thanks.
--~--~-~--~~~---~--~~
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: HABTM Select question

2009-03-21 Thread mscdex

On Mar 22, 12:04 am, Hernan hernancalabr...@gmail.com wrote:
 Is there any way to tell which HATBM relationship to show and which not?

Yup, use the Containable behavior in the Tag model. Then try something
like:
$tag = $this-Tag-find('first', array('conditions' = array('Tag.id'
= 1), 'contain' = array('TagContent')));
--~--~-~--~~~---~--~~
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: HABTM Select question

2009-03-21 Thread Hernan

Awesome! Thanks!

On Mar 22, 2:36 am, mscdex msc...@gmail.com wrote:
 On Mar 22, 12:04 am, Hernan hernancalabr...@gmail.com wrote:

  Is there any way to tell which HATBM relationship to show and which not?

 Yup, use the Containable behavior in the Tag model. Then try something
 like:
 $tag = $this-Tag-find('first', array('conditions' = array('Tag.id'
 = 1), 'contain' = array('TagContent')));
--~--~-~--~~~---~--~~
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: Newbie needs help with hidden input helper

2009-03-21 Thread mscdex

On Mar 21, 11:10 pm, cpeele chris.peel...@gmail.com wrote:
 Am I supposed to set something up in order to use $this-Session in my
 controller?

At the top of your controller, you should only have to ensure your
$components array attribute includes Session. For example:

var $components = array('Session');

Then use:

$this-Session-write('User.user_id', $userID);

to write the session variable (replace $userID with the correct user
ID), and:

$current_userid = $this-Session-read('User.user_id');

to read the current user ID.
--~--~-~--~~~---~--~~
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: MVC best practice advice needed

2009-03-21 Thread mscdex

On Mar 22, 12:57 am, mattalexx mattal...@gmail.com wrote:
 It's really pretty simple. My question is, is it good practice to have
 a model method handle the whole thing or should I just use the model
 to retrieve the records and to save them.

My approach would be to have a method in the User model called
deactivate or similar that would have a User ID parameter and would
do any necessary checking and subsequent saving to the database when
necessary.
--~--~-~--~~~---~--~~
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: MVC best practice advice needed

2009-03-21 Thread mscdex

Sorry, I half-misread your situation.
In my opinion, I would probably add a deactivateExpired function in
the User model that would do the necessary checking and saving.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---