Concerns about the framework

I am developing a template right now, i has been a pretty neat experience, just a few things I don’t like.

Some widgets like Cmenu or Cbreadcrumbs are setting class names or ids by default. htmlOptions is intended for this, so avoiding it is prefered and cleaner.

I just got a markup like this:


                    <!-- Breadcrumbs -->

                    <div id="breadcrumbs">

                        <h1>Hello World.</h1>

                        <span>

                            <div class="breadcrumbs">


<a href="/yii/demos/demo/index.php">Home</a> » <span>Hello World</span></div>                        </span>

                        

                    </div>



not nice.

Also, indentation is not clear to me, I still not getting it, I like to have a visual cascade for readability, I have it on plain html, for some reason I am not getting it in php. Not even are you in the demo application.

Let’s say we have a clearly separated layout like this


<html>

    <head>

    </head>


    <body>

        <!-- Header -->

        <div id="header">

            <h1>simple header</h1>

        </div>


        <!-- Body -->

        <div id="body">

            <h2>

                simple body

            </h2>

        </div>


        <!-- Footer -->

        <div id="footer">

            <h3>simple footer</h3>

        </div>

    </body>

</html>

we then decompose it to


<html>

    <head>

    </head>


    <body>

        <!-- Header -->

        <div id="header">

            <h1>simple header</h1>

        </div>


        <!-- Body -->

        <div id="body">

            <?php $content; ?>

        </div>


        <!-- Footer -->

        <div id="footer">

            <h3>simple footer</h3>

        </div>

    </body>

</html>





<h2>

    simple footer

</h2>

and rendered we’ll get something like


<html>

    <head>

    </head>


    <body>

        <!-- Header -->

        <div id="header">

            <h1>simple header</h1>

        </div>


        <!-- Body -->

                <div id="body">

            <h2>

                simple footer

            </h2>

        </div>


        <!-- Footer -->

        <div id="footer">

            <h3>simple footer</h3>

        </div>

    </body>

</html>

not that bad, but gets worse at more templating levels.

As you said, you can override it if needed, so there’s no problem with it

the 2nd complaint, I see no problem at all in the code you posted

the second is about indentation, the cascade gets lost

Most of nowadays IDEs have a plugged source code automated Indentation and beautifiers, and if not, get one of the zillion online beautifiers.

We cannot ask Yii to do everything for ourselves… Even though it makes it really easy for us… don’t you think?

Cheers

Well for me, indentation ,or even the overall generated HTML is the least of my concern. I’m looking into the HTML source code once in a while to check what happened in my layout, and I must agree with you that some of the codes generated there, especially the codes generated by Yii’s functions and classes, are not indented properly. But I also have to agree with Antonio Ramirez : not everything will be given to us – or actually, should be given to us – by Yii (or by anyone in that matter, right?). I see framework-developer relation like this: framework will generate the codes, developer will validate the generated codes and edit it to taste. Yii already generated the codes, just edit it.

Maybe you have already used a framework that generates codes just the way you want it, and just comparing it to Yii, perhaps?

I am not a professional Yii user,I am a beginner. And one of the many things I like about Yii is that it does not babysit beginners. Makes me feel I’m intelligent. :D

But then again, its just me. :)

cpucpu, macinville

Try using firebug. It shows HTML source is a well structured manner no matter how it’s really formatted. So there will be not problem debugging.

If this is just from aesthetic point of view, I can agree it does not look right but making it right will add additional (not very useful) overhead and logic.

I have to toss in my vote that the final indentation doesn’t matter. Now, if it were to spit out the entire page on one line or something, that would be a problem. But as it stands, generally no one should be looking at the page source to begin with except maybe to track a bug real quick. And if you’re using Chrome to do so, it does all the indentation its self, rendering it a moot point.

Thanks for pointing that out. Yup, I’ve been using firebug for javascript debugging, and inspecting HTML and modifying it real-time so I know what to put in my css file/s. But there are times when it is easier for me to check things if I’m just looking at the page source, but still I don’t find indentation bothering. With our previous web applications (wherein we typed in everything – no framework or MVC involved), my codes render <table>…</table> in one line only. Now that’s really poor indentation! But I don’t care since none of my colleagues care, none of our clients care, and my boss doesn’t care. :D

I actually don’t care how the page source is rendered, as long as it will behave like what is expected from it when opened from browsers. :)

I couldn’t agree more! B)