...

View Full Version : coding help



ssoko92
05-21-2010, 12:29 AM
I wanted to know if you could use php or javascript so you could write a script so the script creates the page itself from something like a template but with variables.

Nightfire
05-21-2010, 12:57 AM
Yeah.

whizard
05-21-2010, 01:24 AM
Yes, you can. However, this is really not an HTML/CSS issue. What I generally do when I am doing this is I write up my entire HTML page, style it, and then take that and apply PHP code to it. The way PHP works is it is interpreted (run) before the page is sent to the browser, and the result of running the PHP code is what is sent to the browser.

So, for example, I can take this basic HTML page:


<html>
<head>
<title>This is my site.</title>
</head>
<body>
<p>Hello World!</p>
</body>
</html>

and add PHP to it like this:



<html>
<head>
<title><?php print $title; ?></title>
</head>
<body>
<p>Hello <?php print $userName; ?></p>
</body>
</html>

and save that as a .php file, and you can see that a title and welcome text will be added dynamically.

:thumbsup:
Dan



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum