Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7973363
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T08:04:50+00:00 2026-06-04T08:04:50+00:00

I just started using the Yii framework and I’m having some trouble with it.

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T08:04:51+00:00Added an answer on June 4, 2026 at 8:04 am

    No, it is not possible (and even not reasonable for performance reasons) to format your output HTML source because

    • Yii generated html controls doesnt know how deep they are in your html tree
    • You could format your own view files so that they are nested correctly withing your layout, but i would rather have it readable on source level because
    • You can use i.e Google Chromes Developer Tools (Ctrl-Shift-I) to view source code as formatted

    Or if you really want then something like that:

    $html = $this->render('index',array('model'=>$model,), true);
    echo formatHtml($html);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just started using a MVC framework, especially Codeigniter and i am having some
I just started using Rails a few days ago, and I'm having trouble with
I just started using Yii, coming from Codeigniter (CI). I'm trying to set up
I just started using the MVCContrib grid in a test project. I'm having a
I just started using the CakePHP framework, 2.0 to be precise. I read most
I just started using the chrome developer tools for some basic html websites and
Just started using CodeIgniter, loving it. Having enabled the database to be one of
We just started using jCarousel with our application and we're experiencing some strange UI
I have started using Yii framework and I have a -newbie- question about the
Just started using this technique and am having strange results on the PC side.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.