• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how to use template parser?

#1
I am following the docs but get white blank page.

following is my code


PHP Code:
<?php namespace App\Controllers;

use 
CodeIgniter\Controller;

class 
Home extends Controller
{
    public function 
index()
    {
        
        
$v = \Config\Services::parser();
        
$data['name']='jay';
        echo 
$v->setData($data)->render('template');
        echo 
'ok';
    }

    
//--------------------------------------------------------------------



it gives error of invalidargumentexception.

my template code is 


Code:
<!doctype html>
<html>
<head>
<title>Welcome to CodeIgniter</title>

<link rel="shortcut icon" type="image/png" href="/favicon.ico"/>
</head>
<body>
<h1>Testing parser class</h1>
{name}
</body>

</html>
          Heart  love codeigniter Heart
          Learning  best  practices
     Rate my post if you found it helpfull
Reply

#2
// this is the right way
PHP Code:
$v = \Config\Services::parser(); 


It could be that the parser is not completed yet...

Hope that helps.
What did you Try? What did you Get? What did you Expect?

Joined the CodeIgniter Community in 2009.          ( Skype: insitfx )
Reply

#3
The issue with the Parser has been resolved. You should be good now.
Practical CodeIgniter 3  • CodeIgniter 4 Foundations - Coming Soon • Vulcan - CLI Tools for CI4
Reply

#4
Thumbs Up 
(09-06-2017, 09:47 PM)kilishan Wrote: The issue with the Parser has been resolved.  You should be good now.

Thanks Smile
          Heart  love codeigniter Heart
          Learning  best  practices
     Rate my post if you found it helpfull
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


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