Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
parameters with /
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  6 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Mario Cesar  
View profile  
 More options Jan 14, 9:55 am
From: Mario Cesar <mario...@gmail.com>
Date: Wed, 14 Jan 2009 06:55:09 -0800 (PST)
Local: Wed, Jan 14 2009 9:55 am
Subject: parameters with /
hi!
i have parameters with / ex '2008/2,' '2008/1'
but the cake read only 2008
how can i pass the /???

i'm using
$turma = 'qqq/w';
$this->requestAction("/turmasDisciplinasHorarios/getDisciplinaTurma/
$turma/$filial/$disciplina");

someone can help me?


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
teknoid  
View profile  
 More options Jan 14, 11:29 am
From: teknoid <teknoid.cake...@gmail.com>
Date: Wed, 14 Jan 2009 08:29:00 -0800 (PST)
Subject: Re: parameters with /
Any params can be passed like: /controller/action/param1/param2/param3
Or as named params: /controller/action/name:bob/city:paris/
account:active

to see the params in your controller pr($this->params)

p.s. It is almost always a bad idea to use requestAction() ;)

On Jan 14, 9:55 am, Mario Cesar <mario...@gmail.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Martin Westin  
View profile  
 More options Jan 14, 12:01 pm
From: Martin Westin <martin.westin...@gmail.com>
Date: Wed, 14 Jan 2009 09:01:53 -0800 (PST)
Local: Wed, Jan 14 2009 12:01 pm
Subject: Re: parameters with /

Simple answer is that you can't pass a parameter containing /
Cake will interpret the / as a separator and make two parameters, 2008
and 2 in your case.

You can either reassemble your parameters in the controller by parsing
through the params array (see teknoid's reply).
Or you can choose to use another separator like - och _ and then
replace it with / in the controller before using it.
$turma = 'qqq-w'
$turma2 = str_replace('-', '/', $turma);

On Jan 14, 3:55 pm, Mario Cesar <mario...@gmail.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mario Cesar  
View profile  
 More options Jan 15, 9:05 am
From: "Mario Cesar" <mario...@gmail.com>
Date: Thu, 15 Jan 2009 12:05:15 -0200
Local: Thurs, Jan 15 2009 9:05 am
Subject: Re: parameters with /

teknoid, why is a bad idea ???

--- p.s. It is almost always a bad idea to use requestAction() ;)


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Martin Westin  
View profile  
 More options Jan 15, 9:41 am
From: Martin Westin <martin.westin...@gmail.com>
Date: Thu, 15 Jan 2009 06:41:52 -0800 (PST)
Local: Thurs, Jan 15 2009 9:41 am
Subject: Re: parameters with /
requestAction() is a bit seductive. It can look like a simple solution
to a lot of things but the problem (that you notice later on) is that
is has a high "cost" in the processing overhead and in that you don't
improve your design instead of using the "quick fix".

When requestAction() is called you are effectively making a new
request more or less as you would by refreshing the browser. You are
starting up the router and dispatcher again. You are instantiating a
new controller, loading new Models, querying the database. And, worst
of all as I understand it, you are often doing a full render of an
extra View. All this results in a very costly feature.

There are times when requestAction is a good tool (the only tool?) but
they are quite few. But without knowing your application I can't say
if you have a justified situation or not. I always feel dutifully
ashamed each time i use this feature which forces me to think if I
can't get around my problem some other way :)

In my current project I actually have a few but in those cases doing
without it is too complicated for my taste and in only one instance is
the processing overhead an issue.

/Martin

On Jan 15, 3:05 pm, "Mario Cesar" <mario...@gmail.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
teknoid  
View profile  
 More options Jan 16, 12:43 pm
From: teknoid <teknoid.cake...@gmail.com>
Date: Fri, 16 Jan 2009 09:43:02 -0800 (PST)
Local: Fri, Jan 16 2009 12:43 pm
Subject: Re: parameters with /
Martin had already answered the question quite well...

but just to add a little... in terms of good practice... think about
the usage of requestAction()...

Are you getting some data from another model and returning it to the
current controller?
In that case you are better off doing $myData = $this->CurrentModel-

>SomeOtherModel->getMyData();

You are doing two important things here. First, you are not using
requestAction() :)
secondly, you are offloading business logic of data gathering to the
model... where it really belongs.

Also, if you already have a controller with an action that does return
some data, the question is why would one "duplicate" the code in the
model as well? Actually, you are best to move that code to the model
as well, so even your controller will benefit... even if you got a
simple find(), you can wrap it in a method inside the model such as
findMeSomeCandy(); and easily call that from your controller's
find_candy():

find_candy() {
    $this->set('candy', $this->Candy->findMeSomeCandy());

}

thereby also enabling to access the same method from another
controller via model relation.

Even if you need it from a completely un-related model, you can do
$candy = ClassRegistry::init('Candy')->findMeSomeCandy();

On Jan 15, 9:41 am, Martin Westin <martin.westin...@gmail.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google