템플릿으로보기를 표시하는 데 문제가 있습니다. 내 템플릿은 다음과 같습니다 : 잘못된 위치에 의해CI 템플릿 - 요소가 잘못된 위치에 표시됩니다.
<?php
$this->load->view('includes/header');
if($this->session->userdata('is_loggedin')!=1) //check if logged in
{
$this->load->view('includes/not_loggedin'); //includes this when not logged in
}
else //includes all this when is logged in
{
if(isset($content)) //check if content variable isnt empty
{
$this->load->view($content); //THIS IS MY CONTENT WHIC IS DISPLAYED IN WRONG POS
}
$this->load->view('includes/is_loggedin'); //
}
$this->load->view('includes/footer');
?>
, 나는 내 양식은 HTML 구조의 외부 상단 좌측 모서리에 표시되고 있음을 의미한다. 다음은 inspect 요소 창에서 복사 한 것입니다. div 위치를 주목하십시오. 헤드 태그는 비어 있습니다. 머리 정보는 본문에 있습니다.
<html lang="en">
<head></head> //head tags are empty
<body>
<div id="settings">...</div> //this is my loaded div
<meta charset="utf-8">
<title>Sludinājumu lapa</title> //head info outside tags
<link href="/assets/css/style.css" type="text/css" rel="stylesheet">
<div id="wrapper">....</div> //i need settings div inside wrapper div
</body>
</html>
해당보기를로드하지 않고도 HTML 구조가 좋습니다. 뷰에 is_loggedin 및 not_logged를로드해도 아무런 문제가 없습니다.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Sludinājumu lapa</title>
<link rel="stylesheet" type="text/css" href="/assets/css/style.css">
</head>
<body>
<div id="wrapper">
을 그리고 바닥 글에는 다음이 포함됩니다 :
내 헤더가 포함
$data['content'] = $this->load->view('vchangeinfo');
$this->load->view('template', $data);
어떤 아이디어가 모든 이유 :이 같은 데이터를 전달하고 컨트롤러에서
<foter>
<p>developed by kriss</p>
</foter>
</div> //End of "wrapper" div
</body>
</html>
그래서 엉망이 됐어?
예, 감사합니다. $ this-> load-> view ($ content) 뷰를로드하면 echo $ content가 작동합니다. 이 코드 줄 아래의 모든보기가 작동하지 않지만 위의 모든보기가 잘로드 중입니다 ..... 궁금한 이유는 ... – Merkley
아마도 $ this-> load-> view ($ content) ; 컨트롤러에서 한 번만 실행하고 다른 시간은보기에서 수행합니다. (확실하지는 않지만 어쩌면 설명 할 수 있음) – Simon