hash url in yii for Ajax

Hi All,

I have implemented some ajax links, but now I want to implement "hash url" like in gmail. so that I can follow that action from url too. Please any one tell me how to implement thi hash url in yii.

Something like this?

CHtml::link('I am a link',array('controller/action','#'=>'someValue'));

yes actually kinda like this. But bit different from that. If there are four divs in the page and on every click you are remaining in that page but your state is changing.

Now here if we donot use this hash url , and if we click the previous button of browser it will take us to the "previous page" not in the "previous state".

If you use gmail, You can see that. Firt you click on inbox and then click on outbox. Now if you click on the previous button of your web browser it will take you to the inbox with some # and followed by some id.

now copy that url from gmail and open a new tab and paste it. you will see that it will take you to inbox directly. They are using ajax although they are maintaining the state with help of this hash url. Don’t know how to implement it here.

Please help me…

Ok, but to achieve that you would have to make use of the HTML5 history API (which isn’t supported by IE until version 10 if I am correct). There is a nice js library that is abstracting the nasty parts away from you called history.js: https://github.com/balupton/History.js/

With Yii 1.1.11 you are able to use this feature in CListView and CGridView (for pagination) so history.js is already shipped with Yii but if you want to use it in combination with your ajax links you would have to implement that by yourself. Yii is a server side tool, not a client side one so it leaves it up to the developer to decide how to do that

Thanks for the reply but you can use gmail features in ie too. Is there any possiblities of using any other way?

and please help me on another topic in which also I need help.


From history.js description:

So you can just represent state in your urls in HTML5 Browers without using the hashes and can fall back to classic hashes for HTML4 browers (IE)