Welcome Guest, Not a member yet? Register   Sign In
COMPER Template Parser 2 (NEW 2.5 Beta is out!)
#31

[eluser]Tominator[/eluser]
I'm sorry. You are right, I just wanted to made it simple, so right syntax is:

Code:
$config['template_folder'] = '/%appdata%/views/';
$config['theme_folder']    = '/%appdata%/views/%theme%/tpl/'; //(where tpls should be stored)

$this->parser->parse('file', $data, $config);

You can set configuration using 'CI config' too (like you wrote).
#32

[eluser]InsiteFX[/eluser]
I use HMVC all the time, if you have a theme directory then HMVC should be able to use it.

HMVC allows for directory structure like this:
Code:
modules
  -- Module Name
  ---- config
  ---- controllers - controller name must match module name
  ---- helpers
  ---- libraries
  ---- views
etc

InsiteFX
#33

[eluser]Tominator[/eluser]
Will you made some tests for me, in HMVC enviroment?

I understand file structure, but I don't understand the way, how HMVC change the paths ...
#34

[eluser]InsiteFX[/eluser]
Yes, I am starting a new project now and will test for you using HMVC!

InsiteFX
#35

[eluser]wex69[/eluser]
Would it be hard to add in a search in module/controller/views?

As you guys said, this is a really good and simple Template Parser, but it dosent really work well with HMVC. Since it require the template(design/layout) and view(module) to be in the same directory.

Anyone got any ideas for us HMVC users? Big Grin

I would think something like this:
Code:
// LOAD LIBARY
$this->load->library('parser');

// SET THEME
$this->parser->theme('default');

// SET MODULE VIEW (search for Modules/A_Module/views/content_of_module.tpl
data['content'] = $this->parser->parse('content_of_module');

// GENERET LAYOUT
$this->parser->parse('template',$data);

Im using the following workaround, until a soloution is found (dont know how good it is! Tongue)
Code:
$this->load->library('parser');
$this->parser->theme('default');

$data = array
            (
                'head_title' => 'Some data',
                'sitetitle' => 'Some new exciting content',
                'content' => $this->load->view('users','',true)
            );

$this->parser->parse('template',$data);
#36

[eluser]Tominator[/eluser]
Hi wex69,

I'm trying hard to make Parser 2.1 compatible with HMVC. That's (in 2.1) why you can set directory 'on the fly'. In the moment, I hope InsiteFX is trying it Smile As sonn as it will work, new Parser will be released.

If you are interested in testing new version, there is no problem, I'll send you a copy Smile

By the way, the model you wrote is possible, test this:
Code:
// LOAD LIBARY
$this->load->library('parser');

// SET THEME
$this->parser->theme('default');

// SET MODULE VIEW (search for Modules/A_Module/views/content_of_module.tpl
// AND DO NOT SHOW RESULT
$data['content'] = $this->parser->parse('content_of_module', array(), array('show' => FALSE));

// GENERET LAYOUT
$this->parser->parse('template',$data);
Problem is, that it will try to find appdir/views/content_of_module.tpl. But I think that's the same, what $this->load->view does.

Tom.
#37

[eluser]wex69[/eluser]
$this->load->view tries to find it at the module location if you have the HMVC plugin.
This also makes it possible to use the helpers/libraries.

So right now i use your great template parser for the "Generel layouts", and then i have the views for each module, in its native module folder(modules/modulename/views) where i can use the different helpers etc.

Actually a pretty great combo imo Smile

Using this structure:
Code:
modules
  -- Module Name
  ---- config
  ---- controllers - controller name must match module name
  ---- helpers
  ---- libraries
  ---- views (using native CodeIgniter code)
views
  -- Default_template (using Comper Parser)
  ---- css
  ---- js
  ---- tpl
#38

[eluser]Tominator[/eluser]
Oh, I see Smile Pretty nice solution Smile
#39

[eluser]imamiscool[/eluser]
I'm sorry, but Is it possible to parse multidimensional array (nested array) ??

eg.

[0] =>
[name] => 'data 1',
[detail] =>
[0] => 'shirt 1',
[1] => 'shirt 2',
[2] => 'shirt 3',
[3] => 'shirt 4',

[2] =>
[name] => 'data 2',
[detail] =>
[0] => 'shirt 4',
[1] => 'shirt 8',
[2] => 'shirt 9',
#40

[eluser]Ocycath[/eluser]
hi,

I have the same problem. I want to include a cycle into another cycle, like this :
<!--- BEGIN Categorie_Cycle -->
Categorie : {categorie_name}
<!--- BEGIN Product_Cycle -->
Product : {product_name}
Quantity : {product_quantity}
<!--- END Product_Cycle -->
<!--- END Categorie_Cycle -->

I try an array "Product_Cycle" into my array "Categorie_Cycle" but it doesn't work.

Any solution ?

Thank !

(sorry for my bad english)




Theme © iAndrew 2016 - Forum software by © MyBB