Re: echo other way to output a constant? [message #169503 is a reply to message #169501] |
Wed, 15 September 2010 16:27 |
MikeB
Messages: 65 Registered: September 2010
Karma:
|
Member |
|
|
Gordon wrote:
> Doing it this way is making your life harder than it needs to be. A
> better approach would be to have a page of basically standard HTML
> markup and using PHP to inject the values into that.
>
> The way I'd do it would be to have a PHP file that does all your
> business logic, and at its last line does an include () of another PHP
> file that defines how the output should be presented to the users.
>
> Using this approach, you'd end up with something more along these
> lines:
>
> (businesslogic.php)
>
> <?php
>
> define ('MAX_FILE_SIZE', 300);
>
> /**
> * The rest of your business logic goes here. Store anything you want
> * to use on your page into a variable
> */
>
> include ('page.php');
> ?>
>
> (page.php)
>
> <html><head><title>PHP Form Upload</title></head><body>
> <form method='post' action='UploadFile2.php' enctype='multipart/form-
> data'>
> <!-- MAX_FILE_SIZE must precede the file input field -->
> <input type="hidden" name="MAX_FILE_SIZE" value="<?php echo
> (MAX_FILE_SIZE); ?>" />
> Select a JPG, GIF, PNG or TIF File:
> <input type='file' name='filename' size='60' />
> <br/><input type='submit' value='Upload' /></form>
> </body></html>
>
> Hope you can understand what's going on here.
I think I understand, but I don't see how it's easier and I don't see
how you will expand that example to include the form processing without
making it more confusing than it seems to be.
But then I'm new at this, so perhaps I'm missing something?
|
|
|