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 02-22-2010, 02:18 AM
smartkidbk5 smartkidbk5 is offline
 
Join Date: May 2009
Location: NJ
Posts: 101
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default User Can Choose Background Image

Well I am trying to make it where a user can choose their own background image.
I have a profile field set up where the user can enter a link to the image.

Then in the vbulletin.css file, instead of stylevar, I just did this:
Code:
html {
	background:rgb(0, 0, 0) url({vb:raw post.field17}) no-repeat  fixed center top;
}
But for some reason it isnt working. Is the variable wrong? Or is there another way to do this?

Thanks.
Reply With Quote
  #2  
Old 02-23-2010, 05:51 PM
smartkidbk5 smartkidbk5 is offline
 
Join Date: May 2009
Location: NJ
Posts: 101
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Anyone know?
Reply With Quote
  #3  
Old 02-25-2010, 09:18 PM
AliMadkour's Avatar
AliMadkour AliMadkour is offline
 
Join Date: Dec 2004
Location: Egypt
Posts: 116
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

{vb:raw post.field17}
it should be
{vb:raw bbuserinfo.field17}

nice Idea hope its work!
Reply With Quote
  #4  
Old 02-26-2010, 01:24 AM
smartkidbk5 smartkidbk5 is offline
 
Join Date: May 2009
Location: NJ
Posts: 101
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by AliMadkour View Post
{vb:raw post.field17}
it should be
{vb:raw bbuserinfo.field17}

nice Idea hope its work!
Thanks, but it still doesnt work. When I look at the page source, the css appears with nothing in the url box:
This is in the css template:
Code:
background:rgb(0, 0, 0) url({vb:raw bbuserinfo.field17}) no-repeat  fixed center top;
This is what appears in page source:
Code:
background:rgb(0, 0, 0) url() no-repeat  fixed center top;
Reply With Quote
  #5  
Old 02-26-2010, 03:39 PM
DaRK mAN306's Avatar
DaRK mAN306 DaRK mAN306 is offline
 
Join Date: Aug 2008
Location: Bahrain
Posts: 37
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hello there smartkidbk5,

Well, I don't think that it's possible to add template variables into the CSS templates except for the "{vb: stylevar <stylevar name>}" .!

To solve that problem, we're going to move the "html" CSS code from "vbulletin.css" to "headinclude" if it's OK with you !!

In order to do that you can follow these step-by-step instructions:
  1. First of all, sign into your Admin CP ..
  2. Then, go to "Styles & Templates >> Style Manager" ..
  3. After that, choose "Edit Templates" option from your defined vB Style drop-down menu ..
  4. Then, Expand the template groups and look for "vbulletin.css" template and edit it ..
  5. Once you enter the template, look for:
    Code:
    html {
        background:{vb:stylevar doc_background};
    }
    Then delete it from the template and don't forget to "save" it .!
  6. After doing that, go to "headinclude" template and add this code in the end of it:
    Code:
    <style type="text/css">
    <!--
    html {
        background:rgb(0, 0, 0) url({vb:raw bbuserinfo.fieldX}) no-repeat  fixed center top;
    }
    -->
    </style>
    Don't forget to change the text in RED(X) to your field ID which is 17 as you posted .!
  7. "Save" the template and go check out your custom BG background .!
That should do the trick .!
BTW, I've already tested the method and it works like CHARM !!
Reply With Quote
  #6  
Old 02-26-2010, 04:44 PM
smartkidbk5 smartkidbk5 is offline
 
Join Date: May 2009
Location: NJ
Posts: 101
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thank you so much Dark man! It worked perfectly.
Reply With Quote
  #7  
Old 04-16-2010, 07:43 PM
JohnMcClane JohnMcClane is offline
 
Join Date: Jan 2010
Posts: 15
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Could anyone help me have this change the header_background rather than the background?

Thank you

John
Reply With Quote
  #8  
Old 04-17-2010, 09:22 AM
DaRK mAN306's Avatar
DaRK mAN306 DaRK mAN306 is offline
 
Join Date: Aug 2008
Location: Bahrain
Posts: 37
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by JohnMcClane View Post
Could anyone help me have this change the header_background rather than the background?

Thank you

John
Hi John,

In order for you to make the header_background change rather than the background you should follow these step-by-step instructions:
  • First: Creating the Profile field:
  1. First of all, sign into your Admin CP ..
  2. Then, go to "User Profile Fields >> Add New User Profile Field" ..
  3. After that, choose "Single-Selection Menu" option from the "Profile Field Type" drop-down menu and click "Continue" ..
  4. Next, take a look at this (Screenshot) and edit the configuration to suit your needs (You can change the title,description, options and the display page) ..
  5. Finally, don't forget to save the field number (e.g 17) ..
** P.S. If you changed the "options" field, then you'll need to change the code in (Point 7 in the second section) ..
** P.S.2. Each option should be in a separate line, the screenshot shows (Background_1 & 2 & 9 &10) in the same line just to reduce it's size .!
  • Second: Editing the style:
  1. First, go to "Styles & Templates >> Style Manager" ..
  2. After that, choose "Edit Templates" option from your defined vB Style drop-down menu ..
  3. Then, Expand the template groups and look for "vbulletin-chrome.css" template and edit it ..
  4. Once you enter the template, look for:
    Code:
    .above_body {
        background:{vb:stylevar header_background};
        _background-image: none;
        margin: {vb:stylevar header_padding};
        width: 100%;
        -moz-border-radius-bottom{vb:stylevar left}:{vb:stylevar border_radius};
        -moz-border-radius-bottom{vb:stylevar right}:{vb:stylevar border_radius};
        -webkit-border-bottom-{vb:stylevar left}-radius:{vb:stylevar border_radius};
        -webkit-border-bottom-{vb:stylevar right}-radius:{vb:stylevar border_radius};
    }
    Then delete it from the template and don't forget to "save" it .!
  5. After doing that, go to "headinclude" template and add this code in the end of it:
    Code:
    <style type="text/css">
    <!--
    .above_body {
            background: #2f4456 url(images/gradients/gradient-grey-down.png) repeat-x;
        _background-image: none;
        margin: {vb:stylevar header_padding};
        width: 100%;
        -moz-border-radius-bottom{vb:stylevar left}:{vb:stylevar border_radius};
        -moz-border-radius-bottom{vb:stylevar right}:{vb:stylevar border_radius};
        -webkit-border-bottom-{vb:stylevar left}-radius:{vb:stylevar border_radius};
        -webkit-border-bottom-{vb:stylevar right}-radius:{vb:stylevar border_radius};
    }
    .bg_default {
            background: #2f4456 url(images/gradients/gradient-grey-down.png) repeat-x;
    }
    .bg_1 {
            background: #2f4456 url(images/gradients/gradient-grey-down.png) repeat-x;
    }
    .bg_2 {
            background: #2f4456 url(images/gradients/gradient-grey-down.png) repeat-x;
    }
    .bg_3 {
            background: #2f4456 url(images/gradients/gradient-grey-down.png) repeat-x;
    }
    .bg_4 {
            background: #2f4456 url(images/gradients/gradient-grey-down.png) repeat-x;
    }
    .bg_5 {
            background: #2f4456 url(images/gradients/gradient-grey-down.png) repeat-x;
    }
    .bg_6 {
            background: #2f4456 url(images/gradients/gradient-grey-down.png) repeat-x;
    }
    .bg_7 {
            background: #2f4456 url(images/gradients/gradient-grey-down.png) repeat-x;
    }
    .bg_8 {
            background: #2f4456 url(images/gradients/gradient-grey-down.png) repeat-x;
    }
    .bg_9 {
            background: #2f4456 url(images/gradients/gradient-grey-down.png) repeat-x;
    }
    .bg_10 {
            background: #2f4456 url(images/gradients/gradient-grey-down.png) repeat-x;
    }
    -->
    </style>
    Make sure that you change the text in RED to the color code you want to use AND the text in BLUE to the image URL .!
  6. "Save" the template ..
  7. After that, go to "header" template. look for:
    Code:
    <div class="above_body">
    Replace it with:
    Code:
    <div class="above_body <vb:if condition="$bbuserinfo['fieldX'] == Default_BG">bg_default</vb:if><vb:if condition="$bbuserinfo['fieldX'] == Background_1">bg_1</vb:if><vb:if condition="$bbuserinfo['fieldX'] == Background_2">bg_2</vb:if><vb:if condition="$bbuserinfo['fieldX'] == Background_3">bg_3</vb:if><vb:if condition="$bbuserinfo['fieldX'] == Background_4">bg_4</vb:if><vb:if condition="$bbuserinfo['fieldX'] == Background_5">bg_5</vb:if><vb:if condition="$bbuserinfo['fieldX'] == Background_6">bg_6</vb:if><vb:if condition="$bbuserinfo['fieldX'] == Background_7">bg_7</vb:if><vb:if condition="$bbuserinfo['fieldX'] == Background_8">bg_8</vb:if><vb:if condition="$bbuserinfo['fieldX'] == Background_9">bg_9</vb:if><vb:if condition="$bbuserinfo['fieldX'] == Background_10">bg_10</vb:if>">
    Make sure that you change the text in RED to your field ID AND if you changed the field options (from point 4 in the first section) then make sure that you change the text in BLUE to the options you entered .!
  8. "Save" the template and go check out your header custom BG .!
That should work for you .!
TESTED IN FF3 & IE8 !!

P.S. If you feel that this is so complicated, then you can provide me with the BGs you want and i'll be glad to help you. but unfortunately not before Thursday .!
Attached Images
File Type: jpg user_profile_confg.jpg (88.0 KB, 0 views)
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 08:59 PM.


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.03966 seconds
  • Memory Usage 2,266KB
  • Queries Executed 12 (?)
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
  • (9)bbcode_code
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (8)post_thanks_box
  • (8)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (8)post_thanks_postbit_info
  • (8)postbit
  • (1)postbit_attachment
  • (8)postbit_onlinestatus
  • (8)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_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
  • postbit_attachment
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete