Jump to content

edit previous variable


Hailwood

Recommended Posts

then what would you suggest for when you have a default page layout

 

 

i.e

 

 

<html>
<head>
<!--stylsheets here -->
<!--javascript here -->
</head>
<body>
<!--header div -->
<!-- menu div -->
<?php include($_GET['page.php']; ?>
<!-- footer div -->
</body>

 

 

and its not pratical for your site to include the header, footer, and menu divs from anther file

 

 

now in the the include file you want to change the site title,

and include another style sheet,

 

 

so my idea was to have a placeholder variable in the head which i could edit.

 

 

i am already calling ob_start() at the beginning of every every page so could i use that to edit it?

Link to comment
Share on other sites

see one way i could do it is to call

 

$content = ob_get_contents();

ob_end_clean();

//replace stuff here

echo $content;

 

which would work fine, as i could just put ob_start before the echo $content;

 

but is there a tidier way to do this?

 

 

 

so the entire thing to replace would actually be

 

 

$content = ob_get_contents();
$headers = array();
    if ( !headers_sent() ) 
      $headers = apache_response_headers();
ob_end_clean();
//replace stuff here
ob_start();
if ( !empty( $headers ) )
    foreach ( $headers as $name => $value )
        header( "$name: $value" );
echo $content;

   

 

 

Link to comment
Share on other sites

see one way i could do it is to call

 

$content = ob_get_contents();

ob_end_clean();

//replace stuff here

echo $content;

 

which would work fine, as i could just put ob_start before the echo $content;

 

but is there a tidier way to do this?

 

 

That was the only method I had in mind. Not exactly efficient, but it will work.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.