beginContentFor and endContentFor

Hello,

I want to report you a problem I have with PicoraView methods : beginContentFor and endContentFor when there is many variables.

A sample to explain (based on the blank sample) : http://jtam.free.fr/stockage/picora-beginContentFor.zip

/controller/TestController.php

class TestController extends PicoraController {
    public function index () {
        return new PicoraView($this, BASE_DIR.'/views/test.php');
    }
    public function afterCall($method,$args,$response) {
        $response = $response->display();
        $view = new PicoraView($this, BASE_DIR.'/views/index.php');
        return $view->display();
    }
}

/views/test.php

<?php $this->beginContentFor('title');?>
    Page title
<?php $this->endContentFor('title');?>
<?php $this->beginContentFor('head');?>
    <script>alert('The about page template demonstrates how to inject content into the head tag.');</script>
<?php $this->endContentFor('head');?>
<?php $this->beginContentFor('body');?>
    <h1>Page content</h1>
<?php $this->endContentFor('body');?>

/views/index.php

<html>
    <head>
        <title><?php print $title; ?></title>
        <?php print $head; ?>
    </head>
    <body>
        <?php print $body; ?>
    </body>
</html>

The response is :

<html>
    <head>
        <title>   <h1>Page content</h1>
</title>
            <h1>Page content</h1>
    </head>
    <body>
            <h1>Page content</h1>
    </body>
</html>

But it may be :

<html>
    <head>
        <title>Page title</title>
        <script>alert('The about page template demonstrates how to inject content into the head tag.');</script>
    </head>
    <body>
        <h1>Page content</h1>
    </body>
</html>

Posted May 28th, 2007 at 10:29am by SuperDevy

Thanks for this! A lot has been re-written for Beta 4, but I will check against this.

Posted May 29th, 2007 at 12:20pm by ryan

Excellent.

Is the Beta 4 coming soon ? I'm very impatient to use it.

Posted June 11th, 2007 at 12:01pm by SuperDevy

Login or Register to Post