I was working on a heavily modified vBulletin forum installation last week and ran into an issue where the styles for the FORUMHOME template only worked when “Store CSS Stylesheets as Files?” was set to “NO”.
When setting it to ‘Yes’, so that the CSS data was written to the vbulletin_css folder, the forumhome-rollup.css file did not contain the correct styles. After a bit of checking, I determined that the css I needed was in-fact getting written to sidebar.css and blog.css, however, it was not included in the rollups.
When storing the css styles as templates, vBulletin includes several ‘rollup’ files, like ‘forumhome-rollup.css’ and , ‘main-rollup.css.’ The rollups are a combination of several different css files in the template.
What goes into these rollups is determined by several xml files, located in the ‘/public_html/includes/xml’ directory. For forumhome, the following file contains the rollup declaration:
'~/public_html/includes/xml/cssrollup_vbulletin.xml' includes the 'forumhome'
The quick fix, if you know what css files to include is to change the xml rollup section, to include the additional files. For example, if you needed the css that was in ‘sidebar.css’, you could add an
Default vBulletin 4.1.12 cssrollup_vbulletin.xml
<rollup name="forumhome-rollup.css"> <template>forumbits.css</template> <template>forumhome.css</template> <template>options.css</template> </rollup>
Modified cssrollup_vbulletin.xml, to include additional css files
<rollup name="forumhome-rollup.css"> <template>forumbits.css</template> <template>forumhome.css</template> <template>widgets.css</template> <template>sidebar.css</template> <template>options.css</template> <template>tagcloud.css</template> </rollup>
vBulletin stores the template files in the database, which can be modified using the “Styles & Templates” menu. Within specific templates, like the “FORUMHOME” template, you can define what css files you want to include. A declaration might look like this:
<vb:if condition="$vboptions['storecssasfile']"> {vb:cssfile forumhome-rollup.css} <vb:else /> {vb:cssfile forumbits.css,forumhome.css,widgets.css,sidebar.css,options.css,tagcloud.css} </vb:if>
The above if/else statement uses vb syntax and checks to see if CSS files are stored in files, storecssasfile, and if not, includes a list of css templates to use.
In this case of this forum, the correct css was in sidebar.css and widget.css, but the forumrollup declaration did NOT contain the same files. So, it begins to make sense why getting the css from the database worked, but storing it as a file did not.
While adding the required files to the rollup xml fixes the issue, as you can specify what files to include in the vb rollup, this is probably not the ideal solution.
A quick check of the code revealed where the rollups were created, in ‘/includes/adminfunctions_template.php’ , however I did not see an option to set them within the template itself.
The above fix is probably not best practices, but this particular forum is already heavily modified and that is, apparently, how they have been doing it for some time now. It would probably be better to include the required css separately from the rollup declaration and/or within one of the main forum files.
Add a Comment