Wednesday, August 11, 2010

How can I create a content placeholder similar to an asp.net placeholder, using PHP?

I want to have a page-specific style sheet, and put a placeholder in the head of the document (located in an include), then specify the style sheet on each page. These are PHP pages.How can I create a content placeholder similar to an asp.net placeholder, using PHP?
I believe what you're asking for is something like this:





header.php:





%26lt;html%26gt;


%26lt;head%26gt;


%26lt;link rel=';stylesheet'; type=';text/css'; href=';%26lt;?php echo $stylesheet ?%26gt;'; /%26gt;


%26lt;/head%26gt;





page.php:





%26lt;?php


$stylesheet = ';css/page.css';;


require(';header.php';);


?%26gt;


%26lt;body%26gt;


%26lt;p%26gt;Page with page-specific CSS%26lt;/p%26gt;


%26lt;/body%26gt;


%26lt;/html%26gt;

No comments:

Post a Comment