Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
No CSS stuff in Vanilla core files, please ;)
I started customizing Vanilla a few days ago. I need to completely rework it's theme and style because I want to base it on a specific extisting XHTML/CSS-Framework. I was surprised to find "hardcoded" CSS-classes in Vanilla's sources given that it's promoted as highly extensible and customizable. It starts with the inclusion of "vanilla.css" in init_vanilla.php. There seems to be no easy way that each theme can have its own set of CSS'. Next I found this in Vanilla.Control.Menu.php:
This "TabOn" has to be renamed to "current" for my framework. But I don't want to hack around in core files and rewriting this and that function seems to be less than optimal to me.
So I suggest to put each and every single bit of CSS into the themes folder. You never know, what somebody wants to do and what his reason might be to rename CSS-classes and the like.
I have to state that I'm not a php-coder and possibly lacking knowledge to fully understand the concepts behind Vanilla. In this case I would be thankfull if somebody could clear these things up a little for me.
Ciao,
Doc SoLo
function TabClass($CurrentTab, $ComparisonTab) {
return ($CurrentTab == $ComparisonTab) ? ' class="TabOn"' : '';
}
This "TabOn" has to be renamed to "current" for my framework. But I don't want to hack around in core files and rewriting this and that function seems to be less than optimal to me.
So I suggest to put each and every single bit of CSS into the themes folder. You never know, what somebody wants to do and what his reason might be to rename CSS-classes and the like.
I have to state that I'm not a php-coder and possibly lacking knowledge to fully understand the concepts behind Vanilla. In this case I would be thankfull if somebody could clear these things up a little for me.
Ciao,
Doc SoLo
0
This discussion has been closed.
Comments
Try to add this extension:
<?php /* Extension Name: TabOnName Extension Url: http://lussumo.com/community/discussion/3388/no-css-stuff-in-vanilla-core-files-please-/ Description: Allow to change in your theme the class name of the active tab Version: 0.1 Author: Dinoboff Author Url: dinoboff at hotmail dot com */ if (in_array($Context->SelfUrl, array("categories.php", "comments.php", "extension.php", "index.php", "post.php", "search.php", "settings.php"))) { require($Configuration['LIBRARY_PATH'] . '/Vanilla/Vanilla.Control.Menu.php'); class menuWithoutCSS extends menu { function TabClass($CurrentTab, $ComparisonTab, $ClassName = 'TabOn') { return ($CurrentTab == $ComparisonTab) ? ' class="' . $ClassName . '"' : ''; } } $Context->ObjectFactory->SetReference("menu", "MenuWithoutCSS"); } ?>
now, to get back around to your issue of your existing framework needing particular markup in place in order to function properly. Without being real familiar with the code I'd suggest that that particular function could be made more intelligent by accepting on and off strings for overriding the default class values, and that would be one way of solving the issue with HTML in core files...
But that still doesn't solve your immediate issue... but you can just get around that in the short term by ignoring the function all together and testing CurrentTab inline right in the template code.
if ($Context->SelfUrl != "people.php") {
;-)
echo '<li'.$this->TabClass($this->CurrentTab, $Tab['Value'], 'current').'><a href="'.$Tab['Url'].'" '.$Tab['Attributes'].'>'.$Tab['Text'].'</a></li>';
Doc, if you find other little css annoyance like this, Mark might be able to fix them before Monday and the release of Vanilla 1.0.1
I think this is the perfect opportunity where you would create not just a new style, but a new YAML compliant theme. This would mean going in and changing the theme files' code directly (make a copy of the files you need to alter and put them in the first level of your theme (not style) directory), but it would be self-contained and not affect the "core" operation of Vanilla. Yeah, you have to check for changes with new Vanilla releases, but so does every Vanilla add-on.
For the inclusion of vanilla.css and vanilla.print.css, what is the problem? Couldn't you empty them?
@Mini: You are probably right, but I am too vanilla and php noob to be sure.
function TabClass($CurrentTab, $ComparisonTab, $CssClass = '') { if ($CssClass == '') $CssClass = 'TabOn'; return ($CurrentTab == $ComparisonTab) ? ' class="'.$CssClass.'"' : ''; }
So now you can use your own class name and it will just default to TabOn. If you find anything else like this, feel free to report it and it will be changed. Rome wasn't built in a day.
I'd hate to try and "zero out" a CSS doc as big as vanilla.css.
I'm noticing some CSS height issues that is interfering with layout, could be the overuse of floating I see in Vanila, I also try to avoid floating if I can as well unless really necessary. To float every freaken thing in the stylesheet is just abuse lol