Welcome Guest, Not a member yet? Register   Sign In
Ocular Issue
#1

[eluser]dkenzik[/eluser]
I'm evaluating template/layout libraries and have encountered a strange issue with Ocular -- hoping that someone else has encountered it before and resolved it, or can offer a suggestion.

I haven't modified the stock Ocular configuration (aside from changing the OCU_site_name, nor changed any of the pathing in the configuration.

Loading the following: http://localhost/welcome/ocular

controllers/welcome.php
Code:
<?php

class Welcome extends Controller {

    function Welcome()
    {
        parent::Controller();    
    }
    
    function index()
    {
    }

    function ocular() {
        $this->template->render('application');
    }    
}


And my views/welcome/ocular.php:
Code:
This is my view that should be inserted where yield is called.


The rendered view will place the content from the ocular.php at the top of the resultant render of views/layouts/application.php. It looks like:
Code:
This is my view that should be inserted where yield is called.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
&lt;html &gt;
&lt;head&gt;
    &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
    &lt;title&gt;Site Title&lt;/title&gt;
&lt;/head&gt;

&lt;body&gt;
<p>This is the body start</p>    
<p></p>
<p></p>
<p>Page rendered in 0.0312 seconds using 4.51MB.</p>
<p>This is the body end </p>
&lt;/body&gt;
&lt;/html&gt;


And the views/layouts/application.php file:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
&lt;html &gt;
&lt;head&gt;
    &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
    &lt;title&gt;&lt;?php echo $site_name ?&gt;&lt;/title&gt;    
&lt;/head&gt;
&lt;body&gt;
<p>This is the body start</p>          
<p>&lt;?php echo $this->template->message(); ?&gt;</p>
<p>&lt;?php echo $this->template->yield(); ?&gt;</p>
<p>Page rendered in {elapsed_time} seconds using {memory_usage}.</p>
<p>This is the body end </p>
&lt;/body&gt;
&lt;/html&gt;

Notice that the $this->template->yield() function doesn't echo/print the ocular.php content, either. And, if I remove $this->template->yield() from the application.php layout, it still renders it at the top of the page.

I've also tried it with and without Ocular's MY_Loader.php placed in libraries.

Strange indeed. I hope I'm missing something simple.

Anyway, would like some guidance before I dig further.




Theme © iAndrew 2016 - Forum software by © MyBB