- This topic is empty.
April 11, 2010 at 10:28 pm #28695kloyMember
I’m going to ask a strange question. I’m using this code and it works, but I don’t understand why.
I’m new to php, and am just learning the syntax. This syntax looks wrong to me….but it works.
I ask because I’m trying to write another conditional statement and using this as a model…
What I don’t understand is…why is ?> at the beginning and<?php at the end of the internal statements?Code:DemocritusMember
It’s just closing the php interpreter to spill out some html, and then reopening it.
If you don’t know how code works, just play with it. For example, get rid of all the php start and stops. Then, put all the html tags in something like this:
echo "<html_tags>Go in double quotes</html_tags";
The only way to learn to code is to experiment.April 12, 2010 at 4:10 am #74014falkencreativeMember
Breaking that snippet down, here’s a pseudo-code version. Opening and closing PHP tags, <?php and ?>, need to be included around everything that is php code, so the server understands how to process it correctly:Code:
… normal html code here… (only shows up if the current page is the home page)
… more normal html code… (only shows up if the current page is not the home page)AuthorPostsViewing 3 posts - 1 through 3 (of 3 total)
- The forum ‘Back End’ is closed to new topics and replies.