The Arcive of vBulletin Modifications Site. |
|
|
#1
|
|||
|
|||
|
I'm attempting to create a plugin that will check certain conditions before appending css to additional.css. Here is what I have for a plugin at hook: cache_templates.
Code:
if in_array($foruminfo['forumid'] == array(2,7)) {
$sp_css = array
(
".forumbit_post .foruminfo {;",
" width: 57%;",
" min-width: 30%;",
" float: {vb:stylevar left};",
" clear: {vb:stylevar right};",
" min-height: 85px;",
"}"
)
foreach ($sp_css as $value) {
echo $value;
}
vB_Template::preRegister('additional.css',array('sp_css' => $sp_css))
I'm completely new to PHP and vBulletin so be nice. :-) |
|
#2
|
||||
|
||||
|
Why not just create a new css template and just perform your condition and then decide to include the css template or not, rather than appending it to another css template.
|
|
#3
|
|||
|
|||
|
Quote:
***EDIT*** Actually I'm not sure that header include is the best place. I only need to override specific css elements that are in forum.php and forumdisplay.php. So I don't need this condition checked on every page. |
|
#4
|
||||
|
||||
|
Add your code to the bottom of the head include and be done with it as a normal conditional.
|
|
#5
|
|||
|
|||
|
Quote:
I appreciate the help and advice so far! |
|
#6
|
||||
|
||||
|
$GLOBALS[forumid]
|
|
#7
|
|||
|
|||
|
Syntax check...the css isn't being inlcuded.
<vb:if condition="in_array($GLOBALS[forumid], array(9,11))"> <link rel="stylesheet" type="text/css" href="/clientscript/vbulletin_css/myfolder/mycss.css" /> </vb:if> I'm sorry for the nickel and diming. |
|
#8
|
||||
|
||||
|
That looks fine, give it a shot?
what do you have to lose?
|
|
#9
|
|||
|
|||
|
No I mean I placed that code in the headinclude_bottom template just above the statement:
{vb:raw template_hook.headinclude_bottom_css} And the css file is not being included. I used firebug as well and can't find the inclusion of this file when hitting forum and forumdisplay.
|
|
#10
|
||||
|
||||
|
Just put it in the headinclude template, why are we being so complicated?
|
![]() |
|
|
| X vBulletin 3.8.12 by vBS Debug Information | |
|---|---|
|
|
More Information |
|
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|