I deleted all CSS files that come in with every auto-generated Yii application (CSS Blueprint Framework?) to design my new page completely from scratch. And either I’m missing something or right after that CMenu stopped working. Strange… does it rely on CSS files from that framework?
I mean… I know that there is a CSS code required to change menu structure build upon non-ordered list HTML tags into workable, functioning navigation system. But I was more then sure that it publishes necessary CSS or jQuery code just as any other widget or Yii class do.
AFIK, CMenu doesn’t have its own CSS, so you have to provide it by yourself when you don’t want to use the framework’s default CSSs.
I think that CMenu is and should be a very thin wrapper over unordered list containing links.
We all want it to be rendered very differently in various contexts. We may use it as the global menu bar, or as a navigation block in the side column. So I think it’s a good decision for the framework to leave CMenu without its own fixed style.
All your arguments are reasonable, and I agree with them, with one small excepion. CMenu without own CSS and separated from default CSS framework became completely useless! It is then nothing else than just unordered list generator - stops working. Take into consideration that other widgets and classes - like CGridView for example - when separated from CSS style looks differently (maybe works) but still working. Only on this I lay my doubts if this is correct decision of framework creator (Yii Dev Team)?
CSS styles are not hard-coded, nor hard to remove or exchange. Therefore, even if someone thinks that orignal look is not acceptable, can always change it as long as menu works. In my situation (current project) I removed all original styles and faced the fact that I have to look for another menu extension, because current one stoped working. Other widget however are working and can be used, except they look differently.
Taking all this into account I still think that this is wrong, and fact that CMenu stops working after removal of bulid-in framework is either a bug or need of changing this should be reported as feature request. But I wait with that for possible other voices in this discussion.
Maybe I messed up something else or maybe we misunderstand each other. What I’m trying to say is that, in original app (with CSS framework) menu looks like… menu! :] Has menu bar on which, you you may see main-menu (top-level) items, if you select any of it, you see nice hover effect, and if you have a submenu attached, you will also see it.
When I removed CSS framework from my app, and placed exactly the same CMenu widget code (or - to be even more precisely - done nothing with the code, it was in views, as it was before) I see just an unordered list - you know, bullets and text. Like a I would put ul and li tags directly to the code. No menu bar, not hover effect, not subitems being hidden and revealed, when top-level item is selected, no nothing! :] Just and simple, yet ugly looking, ordinary unordered list.
Does it now sounds more understable, what I’m trying to say? :]
But - as I said in the beginning - it is possible that I messed up something else.
Don’t have time right now to do any test, but I think that to test, what I mean you just need a few, simple, quick steps. Generate out-of-the-box Yii app with yiic webapp, see menu, then go to protected/layouts/main.php and remove or comment-out all lines in the head adding styles. Refresh page and see, if you still see menu (ugly looking but working) or do you see just ordinary unordered list?
You need to style the unordered list yourself if you want to remove the default styling provided by blueprint css. "Menu" is not an html/xhtml construct. Whether you beautify it with css or not, CMenu produces an unordered list.
@softark: Then we finally found an agreement that point is our different understanding of “menu” word or meaning. For me, what you presented in screenshot is not “an ugly looking but working menu”. For me it is an unordered list! :] It’s neither a menu nor it is working! :] It is a list. If you accept this as a menu, then you are right - with or without CSS, it is still a menu. For me it has no functionality of menu, because it is a list, not a menu! :] It could be hardly called a map, webpage map. But not a menu! :]
@jayrulez: I know that styling is required. This is obvious. The question is, what about mechanics of menu. Does the fact that menu hovers upon selection, opens subitems etc. comes purely from CSS or is there a little bit of jQuery magic behind it? I’m asking, because - to be honest - I don’t use CMenu at all. Ever since beginning of my journey with Yii (my very early posts) I found it not satisfying my needs and in every project build up until now I used MBMenu extension replacement. And this menu system has animation and mechanics powered by a small code in jQuery, therefore, removing it’s styles or changing them to a different one, won’t stop it from working.
Thanks, doodle (+1)! I’ll take a look at this at home, as I’m right now at work and this is for my private project. Anyway, to looks very surprising, what you’ve just done.
This discussion leads me to a new conclusion. You’re right. Current solution is best. I would only propose to Yii Dev Team to completely separate CMenu styles to a separate CSS file. This way one could remove whole CSS Blueprint Framework and design whole new application layout without loosing default CMenu functionality and seeing exactly what and where to change - so CSS newbies like me wouldn’t ask so dumb questions any more! :]