pmccall2 Posted February 19, 2013 Share Posted February 19, 2013 I'm new here and looking for help with a problem (already tried googling it, though I'm not sure I'm even explaining it correctly). The only file visible to the user is this <?php include "../../the-actual-site/index.php"; ?> The rest of the site is behind the "www" folder, and uses includes, get, and session, variables to navigate the pages. Now I want to add some javascript to the display pages, but some nasty things are happening when i do, i trimmed everything down to a bare example (just to make sure something else was not interfering), but these problems still persist. So for the example page I have setup the index.php in the www folder the same way, and used the page from this tutorial as a working example. The tutorial pages work fine if laid out as instructed, or renamed/moved around (but not included). So the first problem is that that the javascript requires me to expose the "index.php" part of the url to send a get variable. (I trued outputting just the "?var=" part, and it did not work) The production site never exposes this, and while I don't believe it would cause an issue, I would rather keeps things "as-is" than having people freak out over it. The second issues is that the javascript is making the page display twice once it starts working. Another instance of the page is created below the first one (the second is non-functional). So first, how can I use js in an include without the page duplicating? And second how do I get javascript to output clean GET variables without showing the "index.php" part? Quote Link to comment https://forums.phpfreaks.com/topic/274668-includes-and-javascript/ Share on other sites More sharing options...
pmccall2 Posted February 19, 2013 Author Share Posted February 19, 2013 Ok, so found some js stuff in the project, and figured out how its done.... the display pages arent included if the variable from javascript is found. A simple way to do this in testing was: if (!isset($_POST['java_var']) { //include html } which works (though to be honest i dont understand it 100%). and the get variables, well there are none for the js, its all done in post. (I guess somebody already ran into that issue =p) Quote Link to comment https://forums.phpfreaks.com/topic/274668-includes-and-javascript/#findComment-1413291 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.