PHP: Echo function output in function-line, not line of function call

Posted by Brill on Stack Overflow See other posts from Stack Overflow or by Brill
Published on 2013-07-02T17:01:25Z Indexed on 2013/07/02 17:05 UTC
Read the original article Hit count: 373

Filed under:
|
|

I have a problem with my self-coded template system. The content is inserted by Include(). Now I need to add a meta redirect to one page. I know, meta redirect is not the safest way, but I need it because of it's delay possibility.

Now i'm looking for a way to influence the wrapping page (template) by the wrapped page (content).

So I thought a function can do this job.

<?php function test($testvar){
    echo $testvar;}
    ?>

<hr />

<?php
test("testtext");
?>

Of course the text echos in the line of the function call, not in the function line. Is there a way to make the function echo in the line of the function itself? In this case above the horizontal rule, not below?

Of course every other best pratice for this "template problem" ist welcome!

THX

© Stack Overflow or respective owner

Related posts about php

Related posts about function