Welcome Guest, Not a member yet? Register   Sign In
how to use template parser?
#1

(This post was last modified: 09-06-2017, 05:56 AM by jaynarayan.)

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


Messages In This Thread
how to use template parser? - by jaynarayan - 09-06-2017, 05:48 AM
RE: how to use template parser? - by InsiteFX - 09-06-2017, 06:15 AM
RE: how to use template parser? - by kilishan - 09-06-2017, 08:47 PM
RE: how to use template parser? - by jaynarayan - 09-06-2017, 11:19 PM



Theme © iAndrew 2016 - Forum software by © MyBB