vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=33)
-   -   What style are we all using? (https://vborg.vbsupport.ru/showthread.php?t=63068)

Gary King 03-27-2004 10:00 PM

What style are we all using?
 
NOTE: Make sure all your styles have different display orders (only if they are in the same grouping). For instance, don't have 2 styles each with the display order of '1' otherwise this hack will just show 'Style: ' and no style shown.

This hack will show each users current selected style when viewing a post.
If you want to see how this looks, take a look at the screenshot attached.

The style system is a little more complex than the vBulletin 2 one, but it's still pretty simple and straightforward.

My apologies if this has already been released! I must also note that all of this code is original, meaning I made it all myself, I didn't look at someone else's code if anyone was wondering, so that we don't play the 'blame game' later on.

NOTE: For those who are wondering, this hack adds NO EXTRA QUERIES to your pages! Meaning the load and processing time are about the same as usual, they don't change much :)

Okay anyhow, here we go:

Instructions

Open includes/functions_showthread.php and find
PHP Code:

    static $gotrank$sigcache$sigperms$gotage$month$day$year$counter

Above, add:
PHP Code:

    global $stylechoosercache$vbphrase

Find
PHP Code:

    eval('$retval = "' fetch_template($maintemplatename) . '";'); 

Above add
PHP Code:

    // check what style the user is viewing
    
if (!$post['styleid'])
    {
        
$post['style'] = '(' $vbphrase['not_specified'] . ')';
    }
    else
    {
        
// loop thru the $stylechoosercache to see which style the user is using, has to loop thru a few times
        
foreach ($stylechoosercache as $parentstyle)
        {
            foreach (
$parentstyle as $innerstyleid)
            {
                if (
$innerstyleid[0]['styleid'] == $post['styleid'])
                {
                    
$post['style'] = '<a href="' $vboptions['forumhome'] . '.php?' $session['sessionurl'] . 'styleid=' $post['styleid'] . '">' $innerstyleid[0]['title'] . '</a>';
                    continue;
                }
            }    
        }
    } 

Open the postbit template (or postbit_legacy if you're using old-style postbits) and find
HTML Code:

                                        <div>$post[icqicon] $post[aimicon] $post[msnicon] $post[yahooicon]</div>
Above, add
HTML Code:

                                        <!-- user forum style -->
<div>$vbphrase[style]: <if condition="$post[style] == '$vbphrase[not_specified]'"><a href="$vboptions[forumhome].php?styleid=$vboptions[styleid]">Default Style</a><else />$post[style]</if></div>
                                        <!-- / user forum style -->

Now add the following phrase:

Phrase Type: GLOBAL

Title: not_specified
Text: not specified

Title: style
Text: Style

All done! :)

ryancooper 03-28-2004 03:41 PM

Alright first install. . . I love this hack!

Thanks!! :)

DarkJediKiller 03-28-2004 04:40 PM

Looks good. Excellent job ^_^

Mr. Brian 03-28-2004 05:32 PM

Well done!

BTW, is there any way that could be able to made that as a link? Whereby user can click on it ? Exactly like what Vb.org having now.

thanks

NuclioN 03-28-2004 05:46 PM

Ok :) It does not work with childstyles though :( How to do this?

ryancooper 03-28-2004 07:53 PM

strange i did everything and checked it twice but only get a ":" where it is suposed to go?

Gary King 03-28-2004 08:39 PM

Quote:

Originally Posted by ryancooper
strange i did everything and checked it twice but only get a ":" where it is suposed to go?

You need the phrases to add.

Gary King 03-28-2004 08:39 PM

Quote:

Originally Posted by NuclioN
Ok :) It does not work with childstyles though :( How to do this?

It works for me using child styles :) Show me a screenshot of the style manager so I can see all your styles and childs, etc.

ryancooper 03-28-2004 08:44 PM

Quote:

Originally Posted by Gary W
You need the phrases to add.

The phrase is definatly there. jsut tryed to add it again and got There is already a phrase named 'not_specified'. You may not create duplicate names

there is only 1 phrase correct?

Any other ideas?

NuclioN 03-28-2004 08:53 PM

Quote:

Originally Posted by Gary W
It works for me using child styles :) Show me a screenshot of the style manager so I can see all your styles and childs, etc.

Ok :)

Xenon 03-28-2004 08:55 PM

Quote:

Originally Posted by Matthew Lam
Well done!

BTW, is there any way that could be able to made that as a link? Whereby user can click on it ? Exactly like what Vb.org having now.

thanks

vb.org is using the quick and dirty way, like i call it.
the Style part is not generated, but it's a big if condition test in postbit, (as it was done during the Beta when we didn't want to hack where not needed)

Gary King 03-28-2004 09:02 PM

Quote:

Originally Posted by ryancooper
The phrase is definatly there. jsut tryed to add it again and got There is already a phrase named 'not_specified'. You may not create duplicate names

there is only 1 phrase correct?

Any other ideas?

Thanks for bringing this to my attention. I fixed it now, for upgrading, just replace global $stylechoosercache;

with global $stylechoosercache, $vbphrase;

ryancooper 03-28-2004 09:29 PM

Quote:

Originally Posted by Gary W
Thanks for bringing this to my attention. I fixed it now, for upgrading, just replace global $stylechoosercache;

with global $stylechoosercache, $vbphrase;

Oh good so i wasn't going nutz!! LOL Thanks for a great hack!

Updated but still get teh same thing??

NuclioN 03-28-2004 09:58 PM

Yes the same here. Or you see a : (when a child style whas chosen) or the phrase '(not_specified)' but if they choose a master style it's correct displayed.

Gary King 03-28-2004 10:43 PM

Sorry about that guys :)

Add the following phrase:

Title: style
Text: Style

NuclioN 03-28-2004 10:59 PM

Well...it's the same only now it;s: Style:

Mr. Brian 03-28-2004 11:05 PM

How about this? Is it possible or not?


Thanks. :)

Quote:

Originally Posted by Matthew Lam
Well done!

BTW, is there any way that could be able to made that as a link? Whereby user can click on it ? Exactly like what Vb.org having now.

thanks


Gary King 03-28-2004 11:23 PM

Quote:

Originally Posted by Matthew Lam
How about this? Is it possible or not?


Thanks. :)

Done, just replace the old code w/new code now.

Gary King 03-28-2004 11:24 PM

Quote:

Originally Posted by NuclioN
Well...it's the same only now it;s: Style:

Works fine for me.

NuclioN 03-28-2004 11:44 PM

:( I can't see the chosen styles (see attach)

Boofo 03-29-2004 12:05 AM

Quote:

Originally Posted by Xenon
vb.org is using the quick and dirty way, like i call it.
the Style part is not generated, but it's a big if condition test in postbit, (as it was done during the Beta when we didn't want to hack where not needed)

Any way I can get that from you or find out the code for it? ;) I like the template mods a lot better.

Gary King 03-29-2004 12:15 AM

Quote:

Originally Posted by NuclioN
:( I can't see the chosen styles (see attach)

What's the forum URL? I can't see the style in postbit in your profile URL.

Mr. Brian 03-29-2004 02:14 AM

Quote:

Originally Posted by Gary W
Done, just replace the old code w/new code now.

Got it! Thanks a lot. :)

uae 03-29-2004 09:31 AM

Pretty cool.

BarBeQue 03-29-2004 09:40 AM

This sounds like a greta hack.

Unfortunately i only have 1 style on my board so it's pretty obvious what style everybody uses :D

[high]* BarBeQue is too lazy to install multiple styles and apply have to apply template hacks to all the styles :([/high]

Gary King 03-29-2004 06:58 PM

Quote:

Originally Posted by BarBeQue
This sounds like a greta hack.

Unfortunately i only have 1 style on my board so it's pretty obvious what style everybody uses :D

[high]* BarBeQue is too lazy to install multiple styles and apply have to apply template hacks to all the styles :([/high]

Just make one parent style and then you only need to modify one template and it will affect all styles ;)

Mike_XBLW 03-29-2004 08:33 PM

I installed it...but for any style but the Parent, it leaves a blank space...no text...help

Gary King 03-29-2004 11:16 PM

Quote:

Originally Posted by Gary W
It works for me using child styles :) Show me a screenshot of the style manager so I can see all your styles and childs, etc.


Mike_XBLW 03-30-2004 02:06 AM

OK...here's the screenie for you to look at

BarBeQue 03-30-2004 05:35 AM

Quote:

Originally Posted by Gary W
Just make one parent style and then you only need to modify one template and it will affect all styles ;)

Hmm, going slightly off-topic here but....

How does that work if another style has slight changes in the hacks.. for example take vb.org here.. I noticed that the green style uses w ared /me line while the blue style has a yellow line

Gary King 03-30-2004 12:31 PM

Quote:

Originally Posted by BarBeQue
Hmm, going slightly off-topic here but....

How does that work if another style has slight changes in the hacks.. for example take vb.org here.. I noticed that the green style uses w ared /me line while the blue style has a yellow line

It still works fine if a style has changes :) This hack basically doesn't even know (and care) whether or not a style has changes or not :)

Vivi Ornitier 03-30-2004 05:50 PM

Ya this isn't working properly i think.

It says

Style:

But for some users, it will show the style for them because they choose a certain style which is the forum's default one that I specified in the vboptions. If they choose another style (not child of any style), it will not show it properly.

Gary King 03-30-2004 06:43 PM

Quote:

Originally Posted by Vivi Ornitier
Ya this isn't working properly i think.

It says

Style:

But for some users, it will show the style for them because they choose a certain style which is the forum's default one that I specified in the vboptions. If they choose another style (not child of any style), it will not show it properly.

Hmm most likely something wrong with the not_specified phrase then.

Replace
PHP Code:

$post['style'] = '(' $vbphrase['not_specified'] . ')'

with
PHP Code:

$post['style'] = '(not specified)'

and tell me if that fixes it.

Vivi Ornitier 03-30-2004 09:02 PM

no that didn't fix it,

some people have

Style: (not specified)

Some people have

Style: XXXXXXXX

Some peopel just straight up have

Style:

and that's it, lol. I don't understand this hack at all


www.squareultima.com if you wanna take a look at it. The Green style is the original style and the default one and if people choose that style, it will work nice and dandy but if you choose any others, it doesn't show up at all, very odd.

Vb-Hispano 03-31-2004 11:19 PM

It does not work with dependent styles

Gary King 03-31-2004 11:54 PM

Quote:

Originally Posted by Vb-Hispano
It does not work with dependent styles

Works for me for dependant styles.

Vivi Ornitier 04-01-2004 01:05 AM

something is most definitely wrong wiht the code in this hack. I installed it again and the exact same results, it's not even that confusing to instlal.

Mike_XBLW 04-01-2004 01:08 AM

Quote:

Originally Posted by Gary W
Works for me for dependant styles.

Perhaps, you could tell me why it's not working for mine....I copied the code and installed as your instructions...but, yet...not working :(

neocorteqz 04-01-2004 03:43 AM

Quote:

Originally Posted by Gary W
Works for me for dependant styles.

Works for me as well.

Dart1337 04-01-2004 02:18 PM

Quote:

Originally Posted by Gary W
Sorry about that guys :)

Add the following phrase:

Title: style
Text: Style

Well... I thought it was working for me. Then I started getting the "Style: " problem too.

[high]* Dart1337 clicks uninstall for now.[/high]


All times are GMT. The time now is 10:25 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.01498 seconds
  • Memory Usage 1,853KB
  • 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
  • (2)bbcode_html_printable
  • (6)bbcode_php_printable
  • (22)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete