We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28215
    • 4,149 Posts
    Hey guys,

    So as I’ve been working on some of the stuff, I’ve noticed a lot of invalid XHTML and inline styles in much of the manager code. Is there a standard to the CSS styles that we have? Are we trying to shoot for XHTML validity in the manager side?

    For example, I’ve seen a ton of different tables, and styles, for displaying data. Should this be standardized, and have maybe 2 or 3 standard table classes to use? And, moreover, should the CSS be so that all I have to do is put class="name" on my <table> tag for it to work, rather than specifying all sorts of idiosyncrasies to the rest of the table?

    Just some thoughts, especially as it seems MODx is moving toward more of an extensible manager interface - we probably want to get the CSS and XHTML up to par so it can support such extensibility on the front-end as well as the back.

    What do you all think?
      shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
      • 25663 MODX Staff
      • 12,272 Posts
      The plan is to completely redo the manager. What’s there is held together with twine and duct tape. smiley

      Suggestions and a new structure are greatly encouraged!
        Ryan Thrash, MODX Co-Founder
        Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
        • 2762
        • 1,198 Posts
        up! wink

        @splittingred I’ve some free time in next weeks, we can work together on it, if you want smiley
          Free MODx Graphic resources and Templates www.tattoocms.it
          -----------------------------------------------------

          MODx IT  www.modx.it
          -----------------------------------------------------

          bubuna.com - Web & Multimedia Design
          • 10487 MODX Staff
          • 1,535 Posts
          In my view, a move towards XHTML and CSS in the Manager is definitely an important priority - I know from my experience of implementing Right to Left language support in the Manager that the ton of inline styles we currently have is just evil.

          As for a new structure, I currently don’t have any firm ideas but I will give it some thought.



            Garry Nutting
            Senior Developer
            MODX, LLC

            Email: [email protected]
            Twitter: @garryn
            Web: modx.com
            • 28215
            • 4,149 Posts
            Well, how we do it here at work is pretty simple, try to keep it as simple and clean as possible.

            Since no one uses Netscape 4 anymore, we can separate the huge css file into separate files in a css/ subdirectory for the style, and then separate the files by their function, ie:

            structure.css (for the main structure of the layout)
            header.css (for all the top frame menu and options)
            leftnav.css (the tree menu)
            text.css (for h#/p/span/ul/etc tags)
            icons.css (for all the icons)
            tabs.css (for all tab features)
            tables/ (a directory of different css files, each pertaining to their own table style)
            etc...


            This makes managing different styles and sections of styles much easier than looking through a massive file.
            Also, when coding CSS styles, don’t do:

            table.grid { ...styles...}
            td.gridHeader { ....styles for thead td's...}
            td.gridCell { ....etc...}


            But rather do:

            table.grid { }
            table.grid thead td, table.grid thead th { }
            table.grid tbody td, table.grid tbody td { }


            and etc...as long as you’re using valid XHTML, this makes development of tables quick and easy, and eliminates inline tags and lots of superfluous class="" attributes. It’s also semantically correct. smiley

            As for the HTML...

            Don’t use it if it isn’t valid XHTML 1.0t, at least, which means no:
            - width=""
            - align=""
            - border=""
            - bgcolor=""
            - <b>,<i>,<u> or other depreciated tags
            - and use onclick,onload instead of onClick,onLoad, etc


            That’s some suggestions just based on what I’ve learned trying to develop a framework at my job. Any other suggestions?

            And of course, a lot of this could change should we ever move to a templating style...
              shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
              • 25663 MODX Staff
              • 12,272 Posts
              For a manager, I think splitting the CSS into multiple files is fine, though that might be a bit too fine grained for my personal preference. You’re dead on on your tables structures, too. I typically inject thead and tbody as well as it’s another hook that works well.
                Ryan Thrash, MODX Co-Founder
                Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
                • 23491 ☆ A M B ☆
                • 1,056 Posts
                I definitely agree with the need for dropping the inline styles and preventing unnecessary class references, etc. I personally separate my styles into

                (nevermind the naming convention)

                html.css - all syntax based styling ( html, body, a, h#, p, input, select, textarea, etc....)

                css.css - everything else wink ...you’ll usually find ID declarations at the top, broken out by sub-sections (comments), with solitary class declarations towards the bottom of my file.

                style.css - @imports html, css, etc (in an as-needed order)

                Then, of course, I leave room for my ieX.css stylesheets, as/if necessary...

                Granted, not quite as organized as above, but could an alternate approach to consider if over-organization becomes a factor.

                  Mike Reid - www.pixelchutes.com
                  MODx Ambassador / Contributor
                  [Module] MultiMedia Manager / [Module] SiteSearch / [Snippet] DocPassword / [Plugin] EditArea / We support FoxyCart
                  ________________________________
                  Where every pixel matters.
                  • 25663 MODX Staff
                  • 12,272 Posts
                  I like to group my css by function which typically follows the document flow, and always with a cross-browser baseline reset at the top and basic overall layout stuff pretty much right after that. I also use indentation to make it easier to follow the cascade. I find it a bit easier work on a site personally as everything that can potentially override is all in one spot, but that doesn’t mean it’s the right way smiley. Side benefit of one file on busy sites is a lot fewer server requests needed. Think digg or slashdot.

                  See http://collabpad.com/assets/site/site.css for an example.
                    Ryan Thrash, MODX Co-Founder
                    Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
                    • 30223
                    • 1,010 Posts
                    I :hover in between a bit. Structure is very important but I find too many different files, beside multiple requests issues, not all that clarifying either. I usually have 2 or three different css files, one for basic layout, one for (text) styling and one for scripted elements (when using a js framework) as for instance tabs and the like. I find splitting the latter convenient when swapping to another js framework which I do on occasion.
                      • 25663 MODX Staff
                      • 12,272 Posts
                      Actually now that you mention it, I do use different CSS files for JS Framework bits. See http://www.datumengineers.com/ and http://omniplan.com/ for examples. smiley
                        Ryan Thrash, MODX Co-Founder
                        Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me