I just started using the Yii framework and I’m having some trouble with it. I’ve got my layout and views set-up, when I render my view in the controller it works fine, the output appears inside the layout and etcetera, but when I view the source nothing is indented. Is there any way I can indent the final output of my HTML so it’s easier to read and find errors…
controllers/SchedulingController.php
<?PHP
class SchedulingController extends CController
{
public function actionStaffCalendar($calendarID)
{
$this->render('staff_calendar');
}
}
views/layouts/main.php
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Website - <?PHP echo $this->pageTitle; ?></title>
<script type="text/javascript" src="<?PHP echo Yii::app()->params['webRoot'] . '/assets/js/jQuery.js'; ?>"></script>
</head>
<body>
<?PHP echo $content; // views/scheduling/staff_calendar.php ?>
</body>
</html>
views/scheduling/staff_calendar.php
staff calendar test....
EDIT
For some reason, when I view source in google chrome, all my HTML seems to be on one line, but as soon as I copy it into a text editor it is properly indented. The source appears fine in mozilla firefox.
No, it is not possible (and even not reasonable for performance reasons) to format your output HTML source because
Or if you really want then something like that: