I haven’t found a good resource in using # in urls to enable bookmarking with ajax calls so I have a few questions.
We have a site based on CakePHP using ‘pretty’ urls essentially www.mysite.com/controller/action/param1:param2 I noticed that Facebook uses a weird syntax with their pretty urls ex) #!/?ref=logo
Is there a way we can use # marks to enable bookmarking this way keeping our ‘pretty’ urls?
Thanks
Only if you use Javascript to redirect to the correct URL.
PHP, and any other server-based platform does not have access to the data after the hash mark, and therefore is only for use in Javascript and other client-side languages.
You could put some Javascript code to correctly load a page via AJAX based on the tag. However, it is probably not of much value unless your website is a complete application. AKA, most of the stuff that happens doesn’t require a refresh.
An example of this would be (in jQuery):