Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 General Discussions
  #1  
Old 11-08-2011, 02:48 PM
ExoticAgenda ExoticAgenda is offline
 
Join Date: Nov 2011
Posts: 74
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default How to reference forum IDs in additional.css

As the title suggests, I am trying to reference the forum ID in additional.css so that i can apply some custom background to different forums.
Reply With Quote
  #2  
Old 11-08-2011, 05:54 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well, you can't (I don't think) because when the CSS template is rendered it's running the css.php script and the forum isn't available. You may be able to edit the headinclude_bottom template to include different CSS files depending on the forumid (although I'm not sure what variable you'd check).

Or maybe you could put your CSS in <style type="text/css">...</style> tags in the template you're interested in changing (like SHOWTHREAD).
Reply With Quote
Благодарность от:
TheLastSuperman
  #3  
Old 11-08-2011, 06:47 PM
TheLastSuperman's Avatar
TheLastSuperman TheLastSuperman is offline
Senior Member
 
Join Date: Sep 2008
Location: North Carolina
Posts: 5,844
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

^ Yeap kh99, I've had to do that on a few custom styles now, I try to avoid it but due to how some CSS is called (Profiles in Dark Styles more so) it seems that is required on occasion.

You should be able to check the the forumid using:

Code:
<vb:if condition="$GLOBAL[forumid] == x">
Where x needs to be replaced w/ the forumid#

In some templates

Code:
<vb:if condition="$forum[forumid] == x">
Is not registered although

Code:
<vb:if condition="$thread[forumid] == x">
Would work in some instances however Global should always work .

Edit: OR actually you could simply whip up a plugin using the parse_templates hook location to render this in headinclude_bottom... something to the effect of:

Code:
if ($vbulletin->userinfo['usergroupid'] == '1'){
$forumbg = '<style type="text/css">
html {
background: rgb(0, 0, 0) url(images/mybackgroundfolder/blackbackground1.jpg) center fixed;
overflow:scroll;
}
</style>';
} else {
$forum = '<style type="text/css">
html {
background: rgb(0, 0, 0) url(images/mybackgroundfolder/blackbackground2.jpg) center fixed;
overflow:scroll;
}
</style>';
}

$template_hook[headinclude_bottom_css] .= $forumbg;
That's a rough example, it starts and shows background1 to guests otherwise (it uses the terminology else) it shows background2 to everyone else... you could also adjust that part to check for forumid etc etc . *Some adjustment will be required if you use this for example you may not want to use the css definition html, you may choose to overwrite something else instead and if you have any issues overwriting add in !important to the definition end .
Reply With Quote
  #4  
Old 11-08-2011, 07:22 PM
ExoticAgenda ExoticAgenda is offline
 
Join Date: Nov 2011
Posts: 74
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok, I was told that it needs to be references in the additional.css, basically I am trying to add images to the forum categories just like this website. Do you have any info regarding that? I am on 4.1.7 as well Thanks
Reply With Quote
  #5  
Old 11-09-2011, 01:03 AM
tonjohn tonjohn is offline
 
Join Date: Sep 2008
Posts: 27
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Inspecting the example you gave with Firebug, you see the following (one forum in the list used as an example...

Code:
<li class="forumbit_post old L2" id="forum61">
	<div class="forumrow table">
		<div class="foruminfo td">
			<img alt="" id="forum_statusicon_61" class="forumicon" src="images/statusicon/forum_old-48.png">
			<div class="forumdata">
				<div class="datacontainer">
					<div class="titleline">
						<h2 class="forumtitle"><a href="http://www.luxury4play.com/ferrari/">Ferrari</a></h2>
						<span class="viewing">(23 Viewing)</span>
					</div>
					

					

					

					
				</div>
			</div>
		</div>
        
		<h4 class="nocss_label">Forum Actions:</h4>
        	
		<ul class="forumactionlinks td">
			<li class="forumactionlink rsslink"><a title="View this forum's RSS feed" href="http://www.luxury4play.com/external.php?type=RSS2&amp;forumids=61" rel="nofollow">View this forum's RSS feed</a></li>
			
		</ul>
		
        <h4 class="nocss_label">Forum Statistics:</h4>
		<ul class="forumstats td">
			<li>Threads: 2,941</li>
			<li>Posts: 61,038</li>
		</ul>
		<div class="forumlastpost td">
			<h4 class="lastpostlabel">Last Post:</h4>
			<div>
				
	<p class="lastposttitle">
	<img border="0" alt="" src="images/icons/icon1.png">
	
	<a class="threadtitle" href="http://www.luxury4play.com/ferrari/93512-ferraris-sema.html">The Ferraris of SEMA</a>
	<a href="http://www.luxury4play.com/ferrari/93512-ferraris-sema-post1567167.html#post1567167"><img alt="Go to last post" src="images/buttons/lastpost-right.png" title="Go to last post"></a>
	</p>
	<div class="lastpostby">
	
		by <div class="popupmenu memberaction" id="yui-gen12">
	<a title="Phaster is online now" href="http://www.luxury4play.com/members/phaster.html" class="username online "><strong>Phaster</strong></a>
	
</div>

	
	</div>
	<p class="lastpostdate">Yesterday, <span class="time">11:23 PM</span></p>

			</div>
		</div>
        
	</div>
	
</li>
The corresponding CSS to draw the car logo is:
Code:
#forum61 .foruminfo {
    background-image: url("/images/l4p/forumheads/Ferrari.jpg") !important;
    background-position: right center;
    background-repeat: no-repeat;
}
The CSS doesn't need to compute the forumids. Rather, you simply need to create an id in your CSS file to correspond to every forum you wish to show a unique image for.

You then edit the correct templates (forumhome_forumit_), adding id=forum$forum[forumid] (not exactly sure) to the <li> tag.
Reply With Quote
Благодарность от:
ExoticAgenda
  #6  
Old 11-09-2011, 04:12 PM
ExoticAgenda ExoticAgenda is offline
 
Join Date: Nov 2011
Posts: 74
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

omg thank you! i think i love you haha, ive been trying to figure this out for several days
Reply With Quote
Reply

Thread Tools
Display Modes

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 12:17 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.04280 seconds
  • Memory Usage 2,216KB
  • 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
  • (6)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (6)post_thanks_box
  • (2)post_thanks_box_bit
  • (6)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (2)post_thanks_postbit
  • (6)post_thanks_postbit_info
  • (6)postbit
  • (6)postbit_onlinestatus
  • (6)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
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete