vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Can someone teach me how to do this? (https://vborg.vbsupport.ru/showthread.php?t=46024)

N9ne 11-23-2002 10:51 AM

Can someone teach me how to do this?
 
In showthread, there's the alternating colours...firstaltcolor secondaltcolor and they alternate on each post, now what I want to do is create a second variable...I have userinfo boxes, ie. boxes around Location, Posts, etc. and I want the bgcolor of the boxes to be the opposite of the backcolour of the post the boxes are in.

Example:

First post, the background colour of the post is firstaltcolor.

The boxes in the post, these should be secondaltcolor

And vice versa for a post with secondaltcolor as the background colour of the post...

In fact, maybe if someone has that much time on their hands, could teach me how to integrate this into the style setting page? Ie. add two extra options, asking for firstboxcolor and secondboxcolor?

Anyway, what should happen is, say I set something for firstboxcolor, in a post which has firstaltcolor, the box colour should be secondboxcolor and vice versa...

Hope that made sense and it would be really interesting and helpful if someone posted up some tips as to how I can create this..I have an ok-ish idea of how to add it into the style settings, as I know how to enter fields into a query, so it will update the settings, but things i'm unsure about are the fields to be created in the DB, etc. and how to do this alternating code...maybe I could look at the postbackcolor code and change it :D

Xenon 11-23-2002 11:45 AM

in admin/functions.php

you find this part in the getpostbitsection:
PHP Code:

    if ($counter%2==0) {
        
$post[backcolor]="{firstaltcolor}";
        
$post[bgclass] = "alt1";
    } else {
        
$post[backcolor]="{secondaltcolor}";
        
$post[bgclass] = "alt2";
    } 

just extend this if-construction :)

N9ne 11-23-2002 12:41 PM

looks easy :), thanks for the code, I'll look into it later when I have time...I might release it as a hack too...I could make it dynamic and people would be able to use it for anything they want...

A question: if some code is included in global.php, would it mean the variable would work in any template?

Xenon 11-23-2002 01:18 PM

not in every template.
it depends on where the template is called.
if you call it from within a function you have to globalize the variables before

Chris M 11-23-2002 01:19 PM

Header & Footer templates : Yes

Other templates : No idea;)

Satan

N9ne 11-23-2002 01:20 PM

Oh ok..thanks for the help :)


All times are GMT. The time now is 07:32 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.00914 seconds
  • Memory Usage 1,721KB
  • 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
  • (1)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (6)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