Forum Moderators: open
i'm developing my association new website which is quite experimental, using javascript for all sort of animations and also for one or two dynamic calls to xml files.
I append many links with UI-related variables so as to improve the user experience in between clicks, and then retrieve the variables from the query string.
All works super well, until i used mod_rewrite to allow the use of semantic urls (such as example.com/projects/my-project-name instead of projects.php?project=my-project-name)
Since then, no issue with php because it is using the rewritten url, but the javascript uses the cloaking url, so it breaks.
I was wondering if someone already run into this issue and what was his solution?
Thanks a lot for your help and advises,
Alexandre
the problem is not that the js file does not get loaded, the problem is that in the script i modify the <A> elements href attribute (so the links)
so for example, php would output
<a href="app.php?section=projects&item=touch">link</a>
javascript would modify the link by adding variable/value pairs (this is an example):
<a href="app.php?section=projects&item=touch&menu=open&js=1">link</a>
then my javascript code disables the click event, opens or closes the menu (depending on the menu variable value), and js indicates that the data is loaded via ajax. If js var does not exist, the customer does not have javascript enabled so the php script should send a full page code, not just the updated bit a la ajax.
problem is, now i'm using pretty urls so it becomes:
<a href="projects/touch/">link</a>
if then my js appends the link :
<a href="projects/touch/open/1">link </a>
it's getting hard to know what value goes for which variable because i have many of those UI -related variables.
so i'm left to decide how to repair my javascript logic so that those UI related variables can be controled just like before.
any idea, someone?
Essentially, you're adding a dependency on JavaScript for your content (the links) to be available. JavaScript should only be used as an enhancement, not a requirement.
A better solution would be to modify your PHP to create the links correctly in the first place.