vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   CSS If Condtion? (https://vborg.vbsupport.ru/showthread.php?t=224563)

TheInsaneManiac 10-04-2009 07:20 PM

CSS If Condtion?
 
Is it possible to use if conditionals in CSS? Like template conditions, profile field conditionals, ect?

luki 10-05-2009 07:56 AM

I don't think so, but you can try to make two ids, #first_user, #second_user and then use if in template.

Code:

<if condition="something == 0">
 <sometag id="first_user"/> 
<else />
    <sometag id="second_user"/> 
</if>


TheInsaneManiac 10-05-2009 09:13 AM

Quote:

Originally Posted by luki (Post 1895062)
I don't think so, but you can try to make two ids, #first_user, #second_user and then use if in template.

Code:

<if condition="something == 0">
 <sometag id="first_user"/> 
<else />
    <sometag id="second_user"/> 
</if>


Well I wanted to make it so that a profile field containing a background image link could be used in the CSS. This way the USER can decide the background.

Lynne 10-05-2009 03:44 PM

Have you tried it? I would think that if you add the css inline - style="background: xxxxx"

TheInsaneManiac 10-05-2009 05:45 PM

Quote:

Originally Posted by Lynne (Post 1895193)
Have you tried it? I would think that if you add the css inline - style="background: xxxxx"

Yea I sent to the CSS manager and added $userinfo[field15] to the background url($userinfo[field15]), but it didn't work. It just made the url to http://www.website.com/$userinfo[field15]

Lynne 10-05-2009 07:26 PM

Add it *inline*.

HTML Code:

<div style="background: url($userinfo[field15])"> etc....

TheInsaneManiac 10-06-2009 12:13 AM

Quote:

Originally Posted by Lynne (Post 1895325)
Add it *inline*.

HTML Code:

<div style="background: url($userinfo[field15])"> etc....

This is the overall background though. Like the forum body background.

EX:
Code:

body
{
        background: #080B1C url(banner.jpg) no-repeat top center fixed;
        color: #007DDA;
        font: 11px verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif;
        margin: 0px;
        padding: 0px;
        height: 100%;


Lynne 10-06-2009 03:34 AM

OK, so try it inline in the body tag. Just try it inline as opposed to putting it in the css area.

TheInsaneManiac 10-06-2009 04:11 AM

Quote:

Originally Posted by Lynne (Post 1895481)
OK, so try it inline in the body tag. Just try it inline as opposed to putting it in the css area.

What do you mean? Wouldn't this mean I would have to edit the body tag on EVERY template?

Lynne 10-06-2009 01:14 PM

I was trying to figure out if it would work that way. If it does, then you can figure out how to go about it.

I think I'm not understanding what you are doing. You have a User Profile Field, and the user enters a color for the background? adn then you want that to effect the background on all your pages? What is the name of your background class that you need to change or is your background actually part of the body tag as you said above? If so, have you tried just seeing if it works inline for the body tag, or tried adding the class/css in the headerinclude template?

TheInsaneManiac 10-06-2009 03:46 PM

Quote:

Originally Posted by Lynne (Post 1895648)
I was trying to figure out if it would work that way. If it does, then you can figure out how to go about it.

I think I'm not understanding what you are doing. You have a User Profile Field, and the user enters a color for the background? adn then you want that to effect the background on all your pages? What is the name of your background class that you need to change or is your background actually part of the body tag as you said above? If so, have you tried just seeing if it works inline for the body tag, or tried adding the class/css in the headerinclude template?

Every single page I have has a background for it. Hence:
background: #080B1C url(banner.jpg) no-repeat top center fixed;

I want the members to be able to enter their background url into the profile field and them be able to see their background.

Lynne 10-06-2009 03:51 PM

OK, so have you tried adding something to the headerinclude template like I suggested?
HTML Code:

<style type="text/css">
body {
    background: #080B1C url($bbuserinfo['fieldx']) no-repeat top center fixed;
}
</style>

Put it at the end, of course, to overwrite the css in the css file.

TheInsaneManiac 10-06-2009 04:47 PM

Code:

syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /public_html/forum/includes/adminfunctions_template.php(3950) : eval()'d code on line 3
Got that after trying:
Code:

<style type="text/css">
body {
    background: #080B1C url($bbuserinfo['field85']) no-repeat top center fixed;
}
</style>


Wayne Luke 10-06-2009 04:50 PM

Can't use quotes between [] for variables in templates. Parsing issue.

Lynne 10-06-2009 06:22 PM

Whoops, I knew that. Thanks, Wayne.

TheInsaneManiac 10-07-2009 01:24 AM

Thanks guys! It works now.


All times are GMT. The time now is 06:00 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.01841 seconds
  • Memory Usage 1,751KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (5)bbcode_code_printable
  • (3)bbcode_html_printable
  • (5)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (16)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete