0

Hi All,


How do you use div class' in php such that you can attach html generated by php into that div class. Example

<html>
<head>
</head>
<body>
<div class="border">
</div>

<?php

echo "This needs to go into the class border"

?>

</body>
</html>

4
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by diafol
0
<html>
<head>
</head>
<body>
<div class="border">
<?php

echo "This needs to go into the class border";

?>

</div>


</body>
</html>

is this what you mean?

0
<html>
<head>
</head>
<body>

<div class="border">

<?php

include 'external_file.php';

?>

</div>

</body>
</html>

For an external file you can do this as well.

Edited by ShadyTyrant: grammar

0

Few ways to do this:

Place all the output into php echo:

echo "<div>blah blah blah</div>";

Just echo inside a html <div>

<div>
<?php echo blah blah blah;?>
</div>

Just include a file inside a html <div>

<div>
<?php include("blah.php");?>
</div>

Use the heredoc syntax

<?php
echo <<<HDOC
<div>
  <p>Hello $name</p>
</div>
HDOC;
?>

You can also use the newdoc syntax since php5.3

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.