Jump to content

Including a overall theme.


Guest

Recommended Posts

Split your html into a header and footer.

 

Try this.

 

themeheader.php

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

 

themefooter.php

</body>
</html>

 

index.php

<?php

// include header
include 'themeheader.php';

//echo statement
echo "Hello";

//include footer
include 'themefooter.php';
?>

 

 

Split your html into a header and footer.

 

Try this.

 

themeheader.php

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

 

themefooter.php

</body>
</html>

 

index.php

<?php

// include header
include 'themeheader.php';

//echo statement
echo "Hello";

//include footer
include 'themefooter.php';
?>

 

Oh that sort of fixes my problem, but say I want "hello" in a fixed position, like underneath a form, would I still go about doing it the same way?

Yes, this is one way.

 

Another is to declare the variables you want to echo and then include your "view".

 

Like this:

theme.php

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

<form>
</form>
<?php echo $hellovar; ?>

</body>
</html>

 

index.php

<?php

$hellovar = "Hello";

include 'theme.php';

?>

 

Yes, this is one way.

 

Another is to declare the variables you want to echo and then include your "view".

 

Like this:

theme.php

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

<form>
</form>
<?php echo $hellovar; ?>

</body>
</html>

 

index.php

<?php

$hellovar = "Hello";

include 'theme.php';

?>

 

Dude, I love you. It worked!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

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.