• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Phil Sturgeon's Template Library?

#31
[eluser]Bart v B[/eluser]
Sorry to bump this topic up. :red:

Ok i finely have the template library working.
I was thinking to difficult.

But now i want to set some breadcrumbs.

What i read is that i put in my layout.php

Code:
<html>
<head>
<title><?php echo $template['title']; ?></title>
<?php echo $template['metadata']; ?>
</head>

<body>
<div class="container">
&lt;?php echo $template['breadcrumbs']; ?&gt;
&lt;?php echo $template['body']; ?&gt;
</div>
<div id="footer">Copyright &lt;?php echo date('Y');?&gt;</div>
&lt;/body&gt;
&lt;/html&gt;

Now i have an array() as output.
Sounds fair, because there is nothing to display.

Where do i put this piece of code?
Code:
$this->template->set_breadcrumb('Blog', 'blog/index')
->set_breadcrumb($article->category->title, 'blog/category/'.$article->category->id)
->set_breadcrumb($article->title, 'blog/article/'.$article->id);

Has some one the breadcrumbs working?
Maybe a static example how this is working?

#32
[eluser]liri[/eluser]
[quote author="Bart v B" date="1283095176"]Sorry to bump this topic up. :red:

Where do i put this piece of code?
Code:
$this->template->set_breadcrumb('Blog', 'blog/index')
->set_breadcrumb($article->category->title, 'blog/category/'.$article->category->id)
->set_breadcrumb($article->title, 'blog/article/'.$article->id);

Has some one the breadcrumbs working?
Maybe a static example how this is working?[/quote]

That should go into your controller.

#33
[eluser]gangsar[/eluser]
[quote author="Phil Sturgeon" date="1268136398"]Thanks for the props Devon.

Muser: I forgot to mention the $teplate['body'] key which is probably the most important! I just updated the documentation.

Code:
&lt;?=doctype()?&gt;

&lt;html &gt;
    &lt;head&gt;
        &lt;title&gt;&lt;?php echo $template['title']; ?&gt;&lt;/title&gt;

            &lt;?=link_tag("content/css/form.css");?&gt;
            
            &lt;?=link_tag("content/css/blueprint/screen.css");?&gt;            
            &lt;?=link_tag( array(
          'href' => 'content/css/blueprint/print.css',
          'rel' => 'stylesheet',
          'type' => 'text/css',
          'media' => 'print'
))?&gt;
            
            &lt;?=link_tag("content/css/custom-theme/jquery-ui-1.7.2.custom.css");?&gt;  

            &lt;?php echo $template['metadata']; ?&gt;                    
&lt;/head&gt;
    &lt;body&gt;
        <div class="container">
               &lt;?php echo $template['body']; ?&gt;
        </div>
        <div id="footer">Copyright 2008</div>
    &lt;/body&gt;
&lt;/html&gt;
[/quote]

yeah... you should add this point to build() section of your documentation.
it must be:
Code:
build()

Build the entire HTML combining partials, layouts and views. Whatever the content of this view will flushed to $template['body'] of your layout.

:cheese:

#34
[eluser]tieungao[/eluser]
User
Gravatar
Joined: 2012-05-18
Posts: 3
Hi,

I create a custom theme with name "uni" in addons/default/themes. Ok this work because i can see it in CP.

Next i create a custom module with code :
Code:
class Server extends Public_Controller
{
public function __construct()
{
parent::__construct();

}
public function index()
{
$this->template->title($this->module_details['name'])->set_theme('uni')->build('test');

}
}
But when i browser this module, theme still is active theme on CP, so set_theme in module controller does not work.

Any way to make module using custom them instead of change the active theme in CP?


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.