The Formhelper does NOT need JS :) As fot the OP problem - you can save the actual page to the the session. If there is a page in session - get the url, if its different then the actual - save the actual (you have the one for back in the var). It has drawbacks but its closest you can get.
-- Marcin Domanski http://kabturek.info On Mon, Aug 25, 2008 at 12:07 PM, clemos <[EMAIL PROTECTED]> wrote: > Hi draikin > > I think we can consider CakePHP actually "needs" Javascript. > Of course you can use Cake to develop javascript-free apps, but lots > of Cake features, for example some of the FormHelper functionnalities, > actually require javascript... > > You could use a code that use both, like: > controller: $this->set("referer",$this->referer()); > view: $html->link("go > back",$referer,array('onclick'=>'window.history.back(); return > false')); > Like so, Javascript enabled browser will use the Javascript function, > while Javascript disabled browser will use the $referer href. > Of course, if the browser supports neither js nor referer, the link > will likely fail; but it's still the most widely compatible way I can > imagine... > Note that the JS function and the referer link may not lead to the > exact same page; this needs to be well tested to see if there are > differences... > Well, you may also force the referer to be passed through named > variables (something like : $html->link("go > there","/controller/action/whatever/referer:".urlencode($this->here)); > ), but you'll need to do it for each link, and it'll mess up your > "nice urls" a little bit... > > ++++++ > Clément > > On Fri, Aug 22, 2008 at 4:02 PM, draikin <[EMAIL PROTECTED]> wrote: >> >> Hi clemos, >> >> thank you for your solution that I read also. But just like $this- >>>referer() doesn't work for all browsers javascript doesn't work for >> all users, as there are some users who don't like javascript. But if >> there is a need for javascript in cakephp apps anyway (i don't know if >> this is so), your solution is the easiest. >> >> draikin >> >> >> clemos schrieb: >>> Maybe I didn't understand your problem, but ... >>> Why don't you give a try to my good old plain javascript solution ? >>> >>> <a href="javascript:window.history.back()">go back</a> >>> >>> The link above will get you back just like your "back" browser button >>> would... >>> You can even go back further with "window.history.go(-10)" (ten pages back) >>> No Cake, No PHP, just simple javascript... >>> >>> $this->referer() doesn't work for all browsers, cause the referer must >>> actually be sent by the client (IE doesn't seem to send it all the >>> time). >>> +++++++ >>> Clément >>> >>> On Thu, Aug 21, 2008 at 7:35 PM, draikin <[EMAIL PROTECTED]> wrote: >>> > >>> > Thank you for your response. Yes, thats what I'm looking for. But the >>> > problem is that $this->referer() seems not to work. So I will test the >>> > bread crumb feature from the HTML helper. >>> > >>> > draikin >>> > >>> > teknoid schrieb: >>> >> You are probably looking for something like $this->referer() >>> >> >>> >> Also there is a bread crumbs feature in the HTML helper, for something >>> >> more robust. >>> >> >>> >> On Aug 21, 10:35�am, draikin <[EMAIL PROTECTED]> wrote: >>> >> > Hi, >>> >> > >>> >> > i'am searching for a solution for the following problem. I want to >>> >> > have a link on the pages of my little cakePHP app to allow to go back >>> >> > to the page where i come from. So as the back-button of the browser. >>> >> > For example: I search for a subset of my database entries and get a >>> >> > page with a table containing the results. Now i want to edit one entry >>> >> > and so i klick on the 'edit' link in the first column of the table. I >>> >> > edit the entry, save it and want to go back to the result page. If i >>> >> > dont want to edit, i will have a link on the edit page to go back to >>> >> > the result page. >>> >> > Did i describe the problem properly? >>> >> > Can anyone give me a hint? I tried to find a solution, but i can't >>> >> > find what i need. >>> >> > >>> >> > Many thanks, >>> >> > draikin >>> > >>> > > >>> > >> >> > >> > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [email protected] 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 -~----------~----~----~----~------~----~------~--~---
