Welcome Guest, Not a member yet? Register   Sign In
Phil Sturgeon's Template Library?
#1

[eluser]NachoF[/eluser]
I just installed this library
but Im not sure how to use it.

It doesnt provide an example of what exactly should be at the layout file.

My_Controller
Code:
class MY_Controller extends Controller {
    public function __construct() {
        parent::Controller ();
        $this->template->set_layout('master');
        $this->template->enable_parser(FALSE);
    }

My layout
Code:
<?=doctype()?>

<html >
    <head>
        <title></title>

            <?=link_tag("content/css/form.css");?>
            
            <?=link_tag("content/css/blueprint/screen.css");?>            
            <?=link_tag( array(
          'href' => 'content/css/blueprint/print.css',
          'rel' => 'stylesheet',
          'type' => 'text/css',
          'media' => 'print'
))?>
            
            <?=link_tag("content/css/custom-theme/jquery-ui-1.7.2.custom.css");?>                      
</head>
    <body>
        <div class="container">
            //my main content should go here
        </div>
        <div id="footer">Copyright 2008</div>
    &lt;/body&gt;
&lt;/html&gt;
My Controller method
Code:
$this->template->build('users/create', $data);
#2

[eluser]Muser[/eluser]
If you want to use a well documented template library try this one from Collin Williams:

http://www.williamsconcepts.com/ci/codei...late/?v141
#3

[eluser]Devon Lambert[/eluser]
[quote author="Muser" date="1266626914"]If you want to use a well documented template library try this one from Collin Williams:

http://www.williamsconcepts.com/ci/codei...late/?v141[/quote]

I checked out that template library, but I didn't like the fact that it didn't take modules into consideration. It was also easy for me to get Phil's library to work with my multi - site theme setup. i.e. I can associate the a different theme for each site that I manage OR I can associate the same theme.

@NachoF:

Not sure what problem you're having. The library is very flexible in that your layout can contain whatever you believe will be used time and time again through out your site setup. However, you should try to keep logical items separated accordingly. For instance I make use of a header partial on some pages of my site, I also make use of a sidebar partial. I set my header and sidebar partials in my MAIN Controllers, but if I need to I can override those partials at the specific page level.

That may not provide any amount of clarity on the matter, but just play with it. Also take a look at what Phil has done in the latest version of PyroCMS. This is where I went for a ride on my bike equipped with shiny new training wheels.

I love the library for it's simplicity and ease of manipulation.

Hope this helps?
#4

[eluser]Muser[/eluser]
@Devon Lambert: The Template library from williamconcepts.com is compatible with modules.
I am using HMVC with it. Which improvement makes Phil Sturgeon's template library to the modules?
#5

[eluser]Devon Lambert[/eluser]
[quote author="Muser" date="1266631272"]@Devon Lambert: The Template library from williamconcepts.com is compatible with modules.
I am using HMVC with it. Which improvement makes Phil Sturgeon's template library to the modules?[/quote]

Phil's template library has a nice search function built in that takes modules into account when it's looking for your views/template files.

Not sure how this is actually handled with Colin Williams' library, but when I made my initial inspection of Colin's library it seemed a little convoluted for my liking. It could have been the timing though and I may re-consider it for another project I have in mind.

I will agree with you on the point you made earlier however, the documentation for Colin's library is significantly better than Phil's.

Should make it easy to get up and running if you do decide to dive in.
#6

[eluser]Muser[/eluser]
[quote author="Devon Lambert" date="1266634726"][quote author="Muser" date="1266631272"]@Devon Lambert: The Template library from williamconcepts.com is compatible with modules.
I am using HMVC with it. Which improvement makes Phil Sturgeon's template library to the modules?[/quote]

Phil's template library has a nice search function built in that takes modules into account when it's looking for your views/template files.

Not sure how this is actually handled with Colin Williams' library, but when I made my initial inspection of Colin's library it seemed a little convoluted for my liking. It could have been the timing though and I may re-consider it for another project I have in mind.

I will agree with you on the point you made earlier however, the documentation for Colin's library is significantly better than Phil's.

Should make it easy to get up and running if you do decide to dive in.[/quote]

I have understand you and I'll try Phil Sturgeon's library too. Thank you!
#7

[eluser]Phil Sturgeon[/eluser]
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;
#8

[eluser]umefarooq[/eluser]
Hi Phil for me no luck using this library, I'm just waiting for proper documentation of this library,i have use same html as it is above post i'm getting error

Code:
Message:  Undefined variable: template

help me.
#9

[eluser]umefarooq[/eluser]
no luck with this library anybody who can help me with some sample code or app.
#10

[eluser]Phil Sturgeon[/eluser]
Try the newest pushed version. I recently merged some fork commits which introduced a few bugs, but I have updated the version on GitHub.




Theme © iAndrew 2016 - Forum software by © MyBB