Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // method render template engine
- function templates($content, $data = array(), $return = false)
- {
- foreach($data as $key => $value)
- $$key = $value;
- $content = array('template/header','template/topnav', $content, 'template/footer');
- ob_start();
- include 'template/header.php';
- $template = ob_get_contents();
- ob_end_flush();
- var_dump($template);
- if($return)
- echo $template;
- else
- return $template;
- }
- //logic request utk render
- function login()
- {
- $this->templates('view/login');
- }
- //bentuk html
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8">
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
- <title><?= $label_app_name ?></title> <======== <$label_app_name undefined>
- <!-- Bootstrap -->
- <link href="<?= asset_url('css/font-awesome.min.css') ?>" rel="stylesheet">
- <link href="<?= asset_url('css/bootstrap.min.css') ?>" rel="stylesheet">
- <link href="<?= asset_url('css/navbar.css') ?>" rel="stylesheet">
- //data yg mau dikirim
- return array(
- 'label_app_name' => "AntonSby",
- 'label_app_copyright' => "Dashboard © 2019",
- 'label_btn_login' => "Login",
- 'label_input_user' => "User",
- 'label_input_pass' => "Password",
- );
Advertisement
Add Comment
Please, Sign In to add comment