Re: Parameter passing in URL

2008-11-25 Thread Daniel Süpke

Hi Mathew,

thanks for the help (and sorry for the delay in answering). That's a 
good idea and I followed your advise, but still one problem persists:
If, in step 3 there is something wrong in validation, cake will return 
to the form again. But now, the ID is no longer in the URL, so there is 
an error about that.

I think, passing a parameter along the URL is a pretty common task, 
isn't it? There should be more support for that in cake. For example, if 
I add it to the form action (helper), cake gets all confused about it. 
Yet, that would be the simplest solution.

Best Regards,
Daniel Süpke

Mathew wrote:
 Hi Daniel,
 
 You want to include the ID in the URL so that it persists when
 bookmarked, and using a session doesn't provide that feature.
 
 I understand what your trying to do, but the form action does not
 require the ID to be included, because posted form requests first
 require an HTML page to display the form.
 
 Let me example.
 
 1) User follows a link with the ID.
 2) HTML with the form is shown in the browser, with the ID in the URL.
 3) User enters form data, and submits the form.
 4) A response from the server is shown to the user.
 
 In step #2 when the form is displayed. You should take the ID from the
 URL and add it as a hidden field in the form.
 In step #3 the action that handles the form request does not need the
 ID in the URL because it will be in the posted data.
 In step #4 as part of the response you redirect the user to a URL that
 contains the ID.
 
 Also.
 
 I would create a simple Helper object for your views. Not one that
 creates an HTML link, because Cake comes with Form and Html helpers to
 do that. All you need to do is modified a Router array to include the
 ID
 
 for example;
 
 $html-link('Somewhere',$myhelper-
 id(array('controller'='documents','action'='show')));
 
 You create a helper called Myhelper, and add a function called id
 that injects your ID from the URL into the array. Now you can call all
 various helper objects that require routed links.
 
 I think you can inject the ID as a get request like this (I can't
 remember how to handle gets with params, but I think its like this)
 
 function id( $arr )
 {
   $arr['?'] = array('id'=$this-params['id']);
 }
 
 That should provide Html that looks like this in your view
 
 a href=/documents/show?id=#Somewhere/a
 

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Parameter passing in URL

2008-11-25 Thread Daniel Süpke

Hi,

thanks for your support. I think Mathew got it pretty good, let's say I 
want to safe the parameter in the URL for bookmarking. Also, the user 
can have some tabs open with different IDs (actually, location IDs he 
can change at any time).

Best Regards,
Daniel

RyOnLife wrote:
 
 Daniel, I'm a big fan of Firecake. Big time saver!!
 
 Back to your problem: You've described it in pretty general terms, which I
 think is usually a good idea for posting in a forum. In this case though,
 maybe if you provided some background and gave more specifics on what you're
 trying to do, myself or others could help you think through the logic. Some
 for the issue with IDs/tabs would be helpful.
 
 -Ryan
 
 
 
 Feanor's Curse wrote:

 Well, thanks for the tool RyOnLife, that's very nice indeed. Yet, I do 
 not see how this will solve the general problem. There is an ID which 
 has to be assigned to every page. The user can change this ID, but this 
 should not affect any opened tabs, where he still must be able to 
 continue with the old ID. So I do not think that the session can be used 
 here.

 Best Regards,
 Daniel Süpke

 RyOnLife wrote:
 Daniel, I suggest you download the Firebug Firefox add-on and try it out
 with
 the  http://bakery.cakephp.org/articles/view/firecake-helper Firecake
 helper 
 for CakePHP. Makes it really easy to see what's going on with session
 variables.



 Feanor's Curse wrote:
 How? If the user opens a new tab and changes the ID there (in the 
 session), it will affect all other tabs, won't it?

 Best Regards,
 Daniel Süpke



 RyOnLife wrote:
 Multiple tabs won't inhibit the use of sessions.


 Feanor's Curse wrote:
 Thanks for the suggestion, but session variable won't work since the
 user could have open multiple tabs with different IDs.

 Best Regards,
 Daniel Süpke

 On Oct 27, 4:06 pm, RyOnLife [EMAIL PROTECTED] wrote:
 Any reason setting a session variable wouldn't work?



 Feanor's Curse wrote:

 Hi,
 we are using CakePHP 1.2 and I was wondering how it could be
 achieved
 to pass a parameter along every URL. We have a parameter set to an
 ID
 and it needs to be included in every URL in the application.
 Now, the first solution was to create a LinkHelper which added the
 location via $_GET, but this is not working when forms are validated
 by Cake, since then the url is not going via the LinkHelper.
 So, is there any easy way to pass around a parameter in the URL in
 the
 entire application?
 Best Regards,
 Daniel Süpke
 --
 View this message in
 context:http://n2.nabble.com/Parameter-passing-in-URL-tp1118744p1382739.html
 Sent from the CakePHP mailing list archive at Nabble.com.

 -- 
 Dipl.-Inform. Daniel Süpke
 Universität Oldenburg
 Abt. Wirtschaftsinformatik I
 Very Large Business Applications
 Ammerländer Heerstr. 114-118
 26129 Oldenburg
 Raum: A4-3-327
 Tel: 0441/798-4471
 Fax: 0441/798-4472




 


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Parameter passing in URL

2008-11-05 Thread Daniel Süpke

Well, thanks for the tool RyOnLife, that's very nice indeed. Yet, I do 
not see how this will solve the general problem. There is an ID which 
has to be assigned to every page. The user can change this ID, but this 
should not affect any opened tabs, where he still must be able to 
continue with the old ID. So I do not think that the session can be used 
here.

Best Regards,
Daniel Süpke

RyOnLife wrote:
 
 Daniel, I suggest you download the Firebug Firefox add-on and try it out with
 the  http://bakery.cakephp.org/articles/view/firecake-helper Firecake helper 
 for CakePHP. Makes it really easy to see what's going on with session
 variables.
 
 
 
 Feanor's Curse wrote:

 How? If the user opens a new tab and changes the ID there (in the 
 session), it will affect all other tabs, won't it?

 Best Regards,
 Daniel Süpke



 RyOnLife wrote:
 Multiple tabs won't inhibit the use of sessions.


 Feanor's Curse wrote:
 Thanks for the suggestion, but session variable won't work since the
 user could have open multiple tabs with different IDs.

 Best Regards,
 Daniel Süpke

 On Oct 27, 4:06 pm, RyOnLife [EMAIL PROTECTED] wrote:
 Any reason setting a session variable wouldn't work?



 Feanor's Curse wrote:

 Hi,
 we are using CakePHP 1.2 and I was wondering how it could be achieved
 to pass a parameter along every URL. We have a parameter set to an ID
 and it needs to be included in every URL in the application.
 Now, the first solution was to create a LinkHelper which added the
 location via $_GET, but this is not working when forms are validated
 by Cake, since then the url is not going via the LinkHelper.
 So, is there any easy way to pass around a parameter in the URL in the
 entire application?
 Best Regards,
 Daniel Süpke
 --
 View this message in
 context:http://n2.nabble.com/Parameter-passing-in-URL-tp1118744p1382739.html
 Sent from the CakePHP mailing list archive at Nabble.com.

 -- 
 Dipl.-Inform. Daniel Süpke
 Universität Oldenburg
 Abt. Wirtschaftsinformatik I
 Very Large Business Applications
 Ammerländer Heerstr. 114-118
 26129 Oldenburg
 Raum: A4-3-327
 Tel: 0441/798-4471
 Fax: 0441/798-4472


 


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Parameter passing in URL

2008-11-04 Thread Daniel Süpke

How? If the user opens a new tab and changes the ID there (in the 
session), it will affect all other tabs, won't it?

Best Regards,
Daniel Süpke



RyOnLife wrote:
 
 Multiple tabs won't inhibit the use of sessions.
 
 
 Feanor's Curse wrote:

 Thanks for the suggestion, but session variable won't work since the
 user could have open multiple tabs with different IDs.

 Best Regards,
 Daniel Süpke

 On Oct 27, 4:06 pm, RyOnLife [EMAIL PROTECTED] wrote:
 Any reason setting a session variable wouldn't work?



 Feanor's Curse wrote:

 Hi,
 we are using CakePHP 1.2 and I was wondering how it could be achieved
 to pass a parameter along every URL. We have a parameter set to an ID
 and it needs to be included in every URL in the application.
 Now, the first solution was to create a LinkHelper which added the
 location via $_GET, but this is not working when forms are validated
 by Cake, since then the url is not going via the LinkHelper.
 So, is there any easy way to pass around a parameter in the URL in the
 entire application?
 Best Regards,
 Daniel Süpke
 --
 View this message in
 context:http://n2.nabble.com/Parameter-passing-in-URL-tp1118744p1382739.html
 Sent from the CakePHP mailing list archive at Nabble.com.


 

-- 
Dipl.-Inform. Daniel Süpke
Universität Oldenburg
Abt. Wirtschaftsinformatik I
Very Large Business Applications
Ammerländer Heerstr. 114-118
26129 Oldenburg
Raum: A4-3-327
Tel: 0441/798-4471
Fax: 0441/798-4472

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Parameter passing in URL

2008-11-03 Thread Daniel Süpke

Thanks for the suggestion, but session variable won't work since the
user could have open multiple tabs with different IDs.

Best Regards,
Daniel Süpke

On Oct 27, 4:06 pm, RyOnLife [EMAIL PROTECTED] wrote:
 Any reason setting a session variable wouldn't work?



 Feanor's Curse wrote:

  Hi,

  we are using CakePHP 1.2 and I was wondering how it could be achieved
  to pass a parameter along every URL. We have a parameter set to an ID
  and it needs to be included in every URL in the application.

  Now, the first solution was to create a LinkHelper which added the
  location via $_GET, but this is not working when forms are validated
  by Cake, since then the url is not going via the LinkHelper.

  So, is there any easy way to pass around a parameter in the URL in the
  entire application?

  Best Regards,
  Daniel Süpke

 --
 View this message in 
 context:http://n2.nabble.com/Parameter-passing-in-URL-tp1118744p1382739.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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Parameter passing in URL

2008-10-10 Thread Daniel Süpke

Thanks for your answer! Storing the id in the session is unfortunately 
not possible as the user may have different tabs with different ids. 
Anyway, I think most of the problems are solved, but suddenly there is 
something new (at least, I discovered it just now), which I think might 
be a bug:

We are using the Auth-Component for automatic login. But this component 
always redirects with all URL parameters missing (and, thus, the id 
parameter). I don't think this is intended behaviour.

I found a similar bug report about this, but upgrading to the newest RC 
did not solve the problem. Any ideas?
https://trac.cakephp.org/ticket/4750

Regards,
Daniel Süpke

RichardAtHome wrote:
 or store the id in the session?
 
 On Sep 26, 12:17 pm, Daniel Süpke [EMAIL PROTECTED] wrote:
 Thank you very much, I'll have a look at that!

 Best Regards,
 Daniel Süpke

 [EMAIL PROTECTED] wrote:

 I haven't done exactly that but I think you could set all urls and
 links using the array notation. The array could then also be pre-
 populated with the parameter you want to keep in each request. (Pre-
 populated in some central place like AppController::beforeFilter
 before any links are generated)
 On Sep 25, 1:23 pm, Daniel Süpke [EMAIL PROTECTED] wrote:
 Hi,
 we are using CakePHP 1.2 and I was wondering how it could be achieved
 to pass a parameter along every URL. We have a parameter set to an ID
 and it needs to be included in every URL in the application.
 Now, the first solution was to create a LinkHelper which added the
 location via $_GET, but this is not working when forms are validated
 by Cake, since then the url is not going via the LinkHelper.
 So, is there any easy way to pass around a parameter in the URL in the
 entire application?
 Best Regards,
 Daniel Süpke
 
-- 
Dipl.-Inform. Daniel Süpke
Universität Oldenburg
Abt. Wirtschaftsinformatik I
Very Large Business Applications
Ammerländer Heerstr. 114-118
26129 Oldenburg
Raum: A4-3-327
Tel: 0441/798-4471
Fax: 0441/798-4472

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Parameter passing in URL

2008-09-26 Thread Daniel Süpke

Thank you very much, I'll have a look at that!

Best Regards,
Daniel Süpke

[EMAIL PROTECTED] wrote:
 
 I haven't done exactly that but I think you could set all urls and
 links using the array notation. The array could then also be pre-
 populated with the parameter you want to keep in each request. (Pre-
 populated in some central place like AppController::beforeFilter
 before any links are generated)
 
 
 On Sep 25, 1:23 pm, Daniel Süpke [EMAIL PROTECTED] wrote:
 Hi,

 we are using CakePHP 1.2 and I was wondering how it could be achieved
 to pass a parameter along every URL. We have a parameter set to an ID
 and it needs to be included in every URL in the application.

 Now, the first solution was to create a LinkHelper which added the
 location via $_GET, but this is not working when forms are validated
 by Cake, since then the url is not going via the LinkHelper.

 So, is there any easy way to pass around a parameter in the URL in the
 entire application?

 Best Regards,
 Daniel Süpke
 

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Parameter passing in URL

2008-09-25 Thread Daniel Süpke

Hi,

we are using CakePHP 1.2 and I was wondering how it could be achieved
to pass a parameter along every URL. We have a parameter set to an ID
and it needs to be included in every URL in the application.

Now, the first solution was to create a LinkHelper which added the
location via $_GET, but this is not working when forms are validated
by Cake, since then the url is not going via the LinkHelper.

So, is there any easy way to pass around a parameter in the URL in the
entire application?

Best Regards,
Daniel Süpke


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---