Welcome Guest, Not a member yet? Register   Sign In
[1.5.1 RELEASED] COMPER Template Parser
#31

[eluser]Tominator[/eluser]
Of course, it's possible:

Code:
$data = array();

$content = $this->parser->parse('content', $data, array('show' => FALSE));

$this->parser->parse('main', array('content' => $content));

Or .. if you will not parse anything between them, you can use:
Code:
$data = array();

$this->parser->parse('content', $data, array('show' => FALSE));
$this->parser->parse('main', array('content' => $this->parser->content));

Because $this->parser->content contains last parsered template.

In TPL, it's simple (main.tpl:

Code:
<!-- INCLUDE overall_header -->

  {content}

<!-- INCLUDE overall_footer -->

Enjoy!
#32

[eluser]-[/eluser]
hi everyone, help me .. give one example of a package;
I use codeignitor_reactor2

1. controller / controller_themes.php
2. views / controller_views.tpl

I am confused to make his controller ...

thanks, good jobs 'COMPER Template Parser'

sorry I'm not good at all with English, ...
#33

[eluser]Tominator[/eluser]
Do you mean you are using CI 2.0?

If yes continue reading.

In docs I am using:
/application/controller/controller_file.php
/application/library/Parser.php (it's library, you have downloaded it)
/application/views/template_file.tpl

Enjoy!

(If you are not using CI 2.0 please send a link for CI reactor 2, I'll try to help you ...)

Tom
#34

[eluser]-[/eluser]
I use CodeIgniter-reactor-v2.0.0.zip (https: / / bitbucket.org / ellislab / CodeIgniter-reactor / downloads)

please give an example for the controller and view ...

I still try and error on localhost PC ...


Thanks. I Hope you can do.....

Smile
#35

[eluser]-[/eluser]
I have Parser_CI.php (libraries), do? should I rename it with Parser.php


(sourcefile:http://parser.comper.sk/en/download/)
#36

[eluser]-[/eluser]
themes.php
---------------------------------------------
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Themes extends Parser_CI {

function __construct()
{
parent::__construct();
}

function themes()
{
$this->load->library('parser');
$this->parser->parse('themes');
}
}

/* End of file themes.php */
/* Location: ./application/controllers/themes.php */

themes.tpl
---------------------------

<html>
<head>
<title>Testing</title>
</head>
<body>
Static Content
</body>
</html>


--------------------------------
??...........

help me...

404 Page Not Found

The page you requested was not found.

;using' CodeIgniter-reactor-v2.0.0.zip (https: / / bitbucket.org / ellislab / CodeIgniter-reactor / downloads)
#37

[eluser]Tominator[/eluser]
No ... Big Grin

1, I'm sorry you really have to rewrite Parser_CI.php to Parser.php ... I'm sorry, my mistake
2, Themes are not working this way, because:
A, you don't need to make special file for theme
B, you have to specify theme

So:
/application/controllers/controller_file.php
Code:
<?php

class controller_file extends CI_Controller {

    function controller_file()
    {
        parent::__construct();    
    }
    
    function index()
    {        
        $this->load->libary('parser');
        
        $this->parser->theme('default'); // default is name of our theme
        $this->parser->parse('template_file');
    }
}

/* End of file controller_file.php */
/* Location: ./system/application/controllers/controller_file.php */

?>

/application/views/default/tpl/template_file.tpl

Code:
<html>
<head>
<title>Testing</title>
</head>
<body>
Static Content
</body>
</html>

That's all. Hope it's working! More informations on docs, here or helpdesk.

Enjoy!
#38

[eluser]Tominator[/eluser]
My question is: Do you really need themes? It's additional or optional feature. I'm just making sure, you know about it ...
#39

[eluser]-[/eluser]
"My question is: Do you really need themes? It’s additional or optional feature. I’m just making sure, you know about it ... "

@Tominator : thanks,... yes I'm trying to create themes, just learning, I'm a beginner, thank you 'script', above, are able to walk,,... im happy... running....
#40

[eluser]Tominator[/eluser]
You are welcome! Smile (I've solved it there so I won't answer on helpdesk)




Theme © iAndrew 2016 - Forum software by © MyBB