brisus Posted July 21, 2011 Share Posted July 21, 2011 Okay, not sure how to explain this. I got a jQuery/php tutorial (http://web.enavu.com/tutorials/curtains-opening-animation-with-jquery/comment-page-1/#comment-34661) to add a curtain to my website. When it is clicked, it opens to show the site. However, I only want it to show when the include page is "welcome.php", not every page loaded. The code I have works, but I need to use a php "if" statement somewhere to contain it and have it only load when the welcome.php is selected (or initial website is viewed). I attached my code below. I highlighted the curtain code and toward the bottom, show where hte php is calling pages. Any ideas? I'm not much of a programmer. :/ [attachment deleted by admin] Link to comment https://forums.phpfreaks.com/topic/242563-using-if-statement-for-only-one-page/ Share on other sites More sharing options...
TeNDoLLA Posted July 21, 2011 Share Posted July 21, 2011 I can give you the basic idea how to do it. Think you should form the JS code in certain parts of your page based on what page we are on atm. So when we are on welcome.php, you echo the JS that hides the content and shows the curtain and vice versa. I might have misunderstood though. Didn't read through your code. Im lazy. if ($page = 'welcome.php') { // Generate the JS blocks when page is welcome $js = 'display: none'; // Etc.. what ever is needed } else { $js = 'display: all'; // etc.. } // Then you echo out the JS parts in your page. The current JS code is then dependant on the page. Link to comment https://forums.phpfreaks.com/topic/242563-using-if-statement-for-only-one-page/#findComment-1245764 Share on other sites More sharing options...
brisus Posted July 21, 2011 Author Share Posted July 21, 2011 The js code is at the top in the HEAD along with some CSS styles for the curtains. Then the content is in th emiddle, with the endling div layers to sandwich the content. Not really sure what you are saying here. Like I said, I'm not much of a programmer; I'm more front-end design. Link to comment https://forums.phpfreaks.com/topic/242563-using-if-statement-for-only-one-page/#findComment-1245772 Share on other sites More sharing options...
TeNDoLLA Posted July 21, 2011 Share Posted July 21, 2011 What I am saying is that you check before any js or HTML output in the beginning of the file that what page we are on. And according to that you generate the javascript to the page with PHP. Link to comment https://forums.phpfreaks.com/topic/242563-using-if-statement-for-only-one-page/#findComment-1245773 Share on other sites More sharing options...
brisus Posted July 21, 2011 Author Share Posted July 21, 2011 This doesn't make sense to me... once again, I'm not a programmer much. So would I be writing this code in the HEAD of the document? B/c there is no JS in the actual body. Just div layers. Link to comment https://forums.phpfreaks.com/topic/242563-using-if-statement-for-only-one-page/#findComment-1245775 Share on other sites More sharing options...
brisus Posted July 21, 2011 Author Share Posted July 21, 2011 Nevermind though, my buddy came through and all I needed to do was add <?php if (!isset($_REQUEST['topic'])) { ?> to each beginning piece of code for the curtain and close each piece with <?php } ?> . Problem solved and it works! Link to comment https://forums.phpfreaks.com/topic/242563-using-if-statement-for-only-one-page/#findComment-1245875 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.