Jump to content
xisto Community
SunBlind

Making A Simple Webpage Generator: Part 3 Fill The Template

Recommended Posts

This tutorial is based on a webpage generator I made (for my users with little or no HTML knowledge) after spending about 3 months collecting javascripts, code snippets, layouts, and all that other good stuff. Since this takes quite a few steps, and I'm dead tired, I'll be posting this tutorial in 3 parts:

 

Part 1- Create The Template

Part 2- Make The Form

Part 3- Fill The Template

 

When a form using the "post" method is submitted, the values that are entered into the inputs are stored in variables. These variables are defined by the name given in the input tag of the form. But how to we get the variables to be displayed on the next page? We grab them from the form and put them in more variables! It's really not as difficult as it sounds, I just suck at explaining things... Which is why I don't even know why I'm attempting to make a tutorial, but hopefully someone will be able to decipher all of my ramblings and learn something. Anywhos, this is the final step of the tutorial: filling the template

 

1. Open your html template file with the pre-filled variables(you should have created this in the first part of the tutorial). Example:

<title><?php echo $title; ?></title>

2. At the very top of the page, insert the opening and closing PHP tags:

<?php ?>

3. For each webpage attribute you generated, insert the following code in between the php tags:

$variable_name = $_POST ['variable_name'];For Example:$bgcolor = $_POST['bgcolor'];$header = $_POST['header'];$news = $_POST['news'];

4. PAY CLOSE ATTENTION to the variable names. Make sure you use the same EXACT name for the variable as you did for the input. You also have to be sure that the echo tags you placed in the template in part 1 match the variable names you assigned at the top of this page. For instance, if you call for
<?php echo $txtcolor; ?>
in your template, but assigned the text color attribute to
$textcolor
It won't work!

 

5. Like always, make sure all of your attribute variables have been called. Save the file as "generate.php" or whatever filename you specified in form.html and upload it to your PHP enabled server. Visit http://ww38.yoursite.com/form.html to see your new webpage generator in action! Or you can just go see my finished product.

 

If you would like a textbox containing the html code you generated...

 

1. Place a textarea at the end of your template like so:

<textarea cols="50" rows="25"></textarea>

2. In between the textarea codes, insert the full html of your template (with the echo tags filled in).

 

3. That's it, Enjoy! If you have any questions, just ask or PM me :lol: I'm always happy to help.

Edited by SunBlind (see edit history)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | 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.