Web Hosting Talk







View Full Version : Includes with a twist?


Tyler
12-02-2004, 12:13 AM
To give you a better prosperict on what I need. Go here:

http://cbttechs.com/Untitled-3.php

I need the word "Test" where the word "text" is. Here is my programming so far:

<?php
include ("header.html");

?>

Now the word "test" is in the untitled php file but the word "text" is in the html document. How do I get words from the php document into the header html file without actually saving any changes (so I need it via php). How will I go about this?

gordonzworld
12-02-2004, 04:50 PM
<?php
include ("header.html");
?>
Test
<?php
include ("footer.html");
?>

Is that what u needed?

axx2k
12-05-2004, 08:38 AM
in header.html:
Change the word:
TEXT
to:
<?=$text?>

in the php script:

<?php
$text = "TEST"
include("header.html");
?>



This what you wanted? :)

MDColson
12-06-2004, 10:21 AM
Don't you mean, in header.html change the word TEXT to:

<?php print $text; ?>

and in the php script:

<?php
$title = "TEXT";
include ('includes/header.html');
?>

Mark

axx2k
12-06-2004, 12:03 PM
Originally posted by MDColson
Don't you mean, in header.html change the word TEXT to:

<?php print $text; ?>

and in the php script:

<?php
$title = "TEXT";
include ('includes/header.html');
?>

Mark

Well first of all, yours would break, because $text and $title need to be the same... ;)

Secondly, using <?=$text?> will work, as this is an include in an html file, and php will read the single '=' as an 'echo' command. Also, if the command is only one line, the ';' is not needed, as the ?> also terminates the command string. These are just shortcuts to reduce character count. :)

Try my example out if you like... you'll find it works just fine. ;)