Jump to content

echo before value?


wastedthelight

Recommended Posts

Hi, I was wondering if there's anyone to do the echo before saying what the echo of the value is.

 

<?php  echo $header; ?>
<?php $header= "test"; ?>  

 

Displays nothing, while doing that backward of course does since it reads the page top to bottom.

 

I'm splitting the pages into header and footer and want to header (title of the current page) to be like this so i can just start my pages off saying what the page is with the header= "blah blah blah"

 

Thanks.

Link to comment
Share on other sites

You simply can't echo a variable before it is defined. It is ilogical on so many levels.

 

How would i go about doing this then?

 

Anything that would be like

if index.php then display "home"

if contact.php display "contact"

 

 

Something like that you could link me to?

 

Thanks.

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.