Re: Passing variables in URl

2007-05-08 Thread xavi

hi!

imagine this URL http://domain/mycontroller/myaction/param1/param2

In your MycontrollerController.php you must have a myaction action,
and you can read the params with something like this:


function myaction($param1 = null, param2=null){

}


Bye


On 7 mayo, 15:54, Enchy [EMAIL PROTECTED] wrote:
 Hi

 New to this.

 How do you pass variables in the URL in cakephp

 index.php?/app/index/name/John
 Is this how you do it?

 and how do you print it in thml files
 ? echo $name; ?

 Thanks


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



Passing variables in URl

2007-05-07 Thread Enchy

Hi

New to this.

How do you pass variables in the URL in cakephp

index.php?/app/index/name/John
Is this how you do it?

and how do you print it in thml files
? echo $name; ?

Thanks


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



Re: Passing variables in URl

2007-05-07 Thread Enchy

Oh nvm I discovered the set function.

But now I have another problem , it blurts out an error if I dont send
a variable.
Does anybody have solution for this?

L


On May 7, 3:54 pm, Enchy [EMAIL PROTECTED] wrote:
 Hi

 New to this.

 How do you pass variables in the URL in cakephp

 index.php?/app/index/name/John
 Is this how you do it?

 and how do you print it in thml files
 ? echo $name; ?

 Thanks


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



Re: Passing variables in URl

2007-05-07 Thread Walker Hamilton

yes, make sure your controller's function has standard php method of
making a variable optional.

On May 7, 9:47 am, Enchy [EMAIL PROTECTED] wrote:
 Oh nvm I discovered the set function.

 But now I have another problem , it blurts out an error if I dont send
 a variable.
 Does anybody have solution for this?

 L

 On May 7, 3:54 pm, Enchy [EMAIL PROTECTED] wrote:

  Hi

  New to this.

  How do you pass variables in the URL in cakephp

  index.php?/app/index/name/John
  Is this how you do it?

  and how do you print it in thml files
  ? echo $name; ?

  Thanks


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



Re: Passing variables in URl

2007-05-07 Thread Samuel DeVore

the are some other ways as well

you can use func_get_args to get a variable number of args see
http://php.net/func_get_args now this does require you do keep the
args in order, also cakephp 1.2 you can use named args  like
index.php?/app/index/first:John/last:Smith  that are mapped to
$this-namedArgs['first'] and $this-namedArgs['last']  (there is an
article in the bakery on this as well
http://bakery.cakephp.org/articles/view/passing-named-parameters

HTH

  Sam D

On 5/7/07, Walker Hamilton [EMAIL PROTECTED] wrote:

 yes, make sure your controller's function has standard php method of
 making a variable optional.

 On May 7, 9:47 am, Enchy [EMAIL PROTECTED] wrote:
  Oh nvm I discovered the set function.
 
  But now I have another problem , it blurts out an error if I dont send
  a variable.
  Does anybody have solution for this?
 
  L
 
  On May 7, 3:54 pm, Enchy [EMAIL PROTECTED] wrote:
 
   Hi
 
   New to this.
 
   How do you pass variables in the URL in cakephp
 
   index.php?/app/index/name/John
   Is this how you do it?
 
   and how do you print it in thml files
   ? echo $name; ?
 
   Thanks


 



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

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

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

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