I have a website that uses PHP to 'dynamically update' a static content div. There is a static header, menu and footer.
What I would like to do is have some means of detecting what content the user has got loaded in the content div (e.g. home, bandpage, bandgallery etc) and stop him/her being able to click the same item in the menu, causing the content to 'refresh'. I just want the link to do nothing until the user has loaded different content.
I have a simple CSS rollover menu.
I am looking at something along the lines of maybe getting the PHP to change a variable everytime it changes the content and so when you click on something on the menu, some code is used to make PHP look at the value of the variable just before it refreshes the content and if the variable value matches X, the content assigned to X will not load again (as it's already been loaded).
E.g. I'm at my homepage. PHP has loaded the content div with the content assigned to 'homepage'. Whilst doing that, it has also set variable '$refreshchk' to the value of 'home'. Upon clicking 'bandpage' on the menu, PHP looks at the value of '$refreshchk' and determines whether it has the value corresponding to 'bandpage' (which might be something like 'bandpg'). PHP detects it does not have the value of 'bandpg' and so refreshes the content div with the content of 'bandpage'. If I click on 'bandpage' again (from the menu), PHP will scan $refreshchk, realise 'bandpage' content is still loaded and not load it again.
I am not familiar with JavaScript and so would prefer to use PHP if I possibly can. If I can't and someone knows how to do it with JS, please feel free to comment and I am sure I'll figure it out (and will be forever grateful 🙂).
Does anyone have any suggestions?
Many thanks.
Jon