Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 05-16-2010, 02:55 PM
Jacob_ITAPros Jacob_ITAPros is offline
 
Join Date: Apr 2010
Posts: 27
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Conditional Plugin for additional.css

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))
If there is a way that I can have the array in this plugin display each element I think this would work. The goal in this particular experiment would be, if specfic forum ID's are matched, add these lines to additional.css. Obviously what I have here isn't working.

I'm completely new to PHP and vBulletin so be nice. :-)
Reply With Quote
  #2  
Old 05-16-2010, 03:02 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #3  
Old 05-16-2010, 03:06 PM
Jacob_ITAPros Jacob_ITAPros is offline
 
Join Date: Apr 2010
Posts: 27
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Lynne View Post
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.
So in your suggested scenario, the condition would be added at the bottom of the header inlcude, and the css that is in that file would successfully override the css that I'm attempting to reassign values to?

***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.
Reply With Quote
  #4  
Old 05-16-2010, 03:55 PM
Zachery's Avatar
Zachery Zachery is offline
 
Join Date: Jul 2002
Location: Ontario, Canada
Posts: 11,440
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Add your code to the bottom of the head include and be done with it as a normal conditional.
Reply With Quote
  #5  
Old 05-16-2010, 04:04 PM
Jacob_ITAPros Jacob_ITAPros is offline
 
Join Date: Apr 2010
Posts: 27
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Zachery View Post
Add your code to the bottom of the head include and be done with it as a normal conditional.
Since the condition is based on $foruminfo['forumid'], and this condition would be added to header include per your suggestion, when I encounter a page in which this variable is not recognized, won't I get an error? That's why I thought that maybe adding this particular conditional in FORUMHOME and FORUMDISPLAY just under the {vb:raw headinclude_bottom} statement might be appropriate. I'm only desiring to override a few structures in forumbit.css for certain forums and subforums.

I appreciate the help and advice so far!
Reply With Quote
  #6  
Old 05-16-2010, 04:05 PM
Zachery's Avatar
Zachery Zachery is offline
 
Join Date: Jul 2002
Location: Ontario, Canada
Posts: 11,440
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

$GLOBALS[forumid]
Reply With Quote
  #7  
Old 05-16-2010, 04:15 PM
Jacob_ITAPros Jacob_ITAPros is offline
 
Join Date: Apr 2010
Posts: 27
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Zachery View Post
$GLOBALS[forumid]
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.
Reply With Quote
  #8  
Old 05-16-2010, 04:30 PM
Zachery's Avatar
Zachery Zachery is offline
 
Join Date: Jul 2002
Location: Ontario, Canada
Posts: 11,440
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That looks fine, give it a shot? what do you have to lose?
Reply With Quote
  #9  
Old 05-16-2010, 04:40 PM
Jacob_ITAPros Jacob_ITAPros is offline
 
Join Date: Apr 2010
Posts: 27
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Zachery View Post
That looks fine, give it a shot? what do you have to lose?
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.
Reply With Quote
  #10  
Old 05-16-2010, 04:51 PM
Zachery's Avatar
Zachery Zachery is offline
 
Join Date: Jul 2002
Location: Ontario, Canada
Posts: 11,440
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Just put it in the headinclude template, why are we being so complicated?
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 11:43 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.09123 seconds
  • Memory Usage 2,260KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_code
  • (4)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete