Jump to content

Using if statement for only one page?


brisus

Recommended Posts

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

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.

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.