Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 05-02-2013, 10:45 PM
Simon Lloyd's Avatar
Simon Lloyd Simon Lloyd is offline
 
Join Date: Aug 2008
Location: Manchester
Posts: 3,481
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Sprite addition help

Hi all, i'm trying to replace all my forum images with a sprite reference, most of my images are on forumhome, could someone help with how i'd present the css instead of this
HTML Code:
<td><img src="$stylevar[imgdir_statusicon]/$forum[imageprefix]forum_$forum[statusicon].gif" alt="" border="0" height="46px" width="46px" id="forum_statusicon_$forum[forumid]" />
</td>
here's a snippet of my sprite css
Quote:
.Accessforum_new{ background-position: 0 0; width: 47px; height: 47px; }
.Accessforum_old{ background-position: 0 -97px; width: 47px; height: 47px; }
.Excelforum_new{ background-position: 0 -194px; width: 47px; height: 47px; }
.Excelforum_old{ background-position: 0 -291px; width: 47px; height: 47px; }
.Outlookforum_new{ background-position: 0 -388px; width: 47px; height: 47px; }
.Outlookforum_old{ background-position: 0 -485px; width: 47px; height: 47px; }
HTML Code:
#td {
    background: url(forumsprite.png) no-repeat top left;
}
So, not being any good whatsoever with css i'm assuming i'd reference the actual sprite like the code snippet above in my additional css? and how would i address the actual css references in the code snippet at the very top?

Any help is appreciated

EDIT: the image names in the css i.e Accessforum_old are the names of the prefixes as they are currently in use.
Reply With Quote
  #2  
Old 05-03-2013, 02:52 AM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You basically tell it where the upper left point is via x y position and then give the height and width from there.

http://www.w3schools.com/css/css_image_sprites.asp
Reply With Quote
  #3  
Old 05-03-2013, 02:55 AM
Simon Lloyd's Avatar
Simon Lloyd Simon Lloyd is offline
 
Join Date: Aug 2008
Location: Manchester
Posts: 3,481
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I've had limited success using <td id="td"> but it just shows the entire sprite, even if i then do <td id="td" class="$forum[imageprefix]forum_$forum[statusicon]"> i cant get it to show that particular part of the sprite, just using $forum[imageprefix]forum_$forum[statusicon] in the template shows the correct name for the sprite portion but no image?

--------------- Added [DATE]1367557259[/DATE] at [TIME]1367557259[/TIME] ---------------

i've made further modifications and have much better success although some of the images aren't showing correct and i think thats down to the generated image and css, i'll have a play now that i can actually see whats going on - thanks Lynne
Reply With Quote
  #4  
Old 05-03-2013, 01:46 PM
darnoldy darnoldy is offline
 
Join Date: Dec 2004
Posts: 234
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Part of the problem may be that IDs have to be unique on a page. It appears that you're trying to have a <td id="td"> for each row in your forumhome table.

Put the {background: url(forumsprite.png) no-repeat top left;} into each of the class definitions and eliminate the #td selector altogether.

You might also try putting some content into the td— like a &nbsp; Table cells act weirdly when they are empty.

--don
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:28 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03379 seconds
  • Memory Usage 2,192KB
  • 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
  • (2)bbcode_html
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (4)post_thanks_box
  • (4)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (4)post_thanks_postbit_info
  • (4)postbit
  • (4)postbit_onlinestatus
  • (4)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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete