• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to use LayoutView with parser?

#1
Hi guys Smile

I looked everywhere but I still haven't found ways to use the layout system when I render my pages through Parser ...

The pages created by the parser simply ignore the php codes responsible for using ViewLayout ...

Example:
Code:
echo $this->parser->setData($data)->render('website/pages/indexPage');

not work:
Code:
<?php $this->renderSection('css') ?>

not work:
Code:
{ $this->renderSection('css') }

Does anyone know how I can use them together?  Huh
Reply

#2
I do not think it will work because they are two different entities.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply

#3
Sad 
(08-14-2020, 11:49 AM)InsiteFX Wrote: I do not think it will work because they are two different entities.

Confused  It makes no sense...

It's as if we couldn't use the layout system with Blade in Laravel ...

I still hope that this is possible ... Sad
Reply

#4
This really important feature. I'll want use LayoutView with parser cuz uncomfortable use native php code.
Reply

#5
The View Parser:

Using the Parser, in your view templates are processed only by the Parser itself, and not like a conventional view PHP script. PHP code in such a script is ignored by the parser, and only substitutions are performed.

This is purposeful: view files with no PHP.

So maybe it would work if you ran the Parser on the Layout using:


PHP Code:
$parser = \Config\Services::parser();

$newView $parser->setData($data)
             ->render('layout');

echo 
view($newView); 

I do not have the time to play with this but you may like to give it a try.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply

#6
(08-16-2020, 08:17 AM)InsiteFX Wrote: The View Parser:

Using the Parser, in your view templates are processed only by the Parser itself, and not like a conventional view PHP script. PHP code in such a script is ignored by the parser, and only substitutions are performed.

This is purposeful: view files with no PHP.

So maybe it would work if you ran the Parser on the Layout using:


PHP Code:
$parser = \Config\Services::parser();

$newView $parser->setData($data)
             ->render('layout');

echo 
view($newView); 

I do not have the time to play with this but you may like to give it a try.

Unfortunately it doesn't. And this impossibility is really demotivating ...
It seems very obvious that both features can work together as it is in Laravel ...
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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