PHP question about if statements and includes?

Dan

New member
I am creating a single page site. And i'm new to php most of my site is driven by javascript and jquery plugins. I see that php is similar to the way that javascript is written main difference is client and server side.

So my question is: I am having things appear and disappear using javascript depending on what link is clicked and there is going to be a large amount of content on this site because it is my portfolio.

So instead of bogging the server down loading everything at one time for the entire page i am curious if i can utilize the if statements and includes of php.

since everything is hidden from the users view unless they click on it, is there a way i can tell the page to include the information once that link is clicked.

i tried to set up an if statement and it looked a little like so:
$desDis = 'joe';

if ($desDis == 'bob'){
include_once('designDis.php');
}

and on the link i have:

<a href="#" id="design" onclick="<?php $desDis = 'bob'; ?>">Design</a>


I thought it would work like javascript and run the if statement when it was clicked and changed the variable to bob. But i was wrong. instead it just ran the includes as usual and not by the onclick

So is it possible to do things this way or am i just wasting my time? Thank you in advanced
 
Back
Top