简体   繁体   中英

Changes to forum logo in vBulletin template

The title of my question may be unclear, so let me explain what's the problem I'm facing.

I'm new to vBulletin system, but I have some work to do on an existing forum. The given forum has a logo on the top header. The forum should be accessible from different domains which are locale based, and in each case the logo must be different.

As I figured it out, the vBulletin system holds all it's templates in the DB (a table called "template"). I found the line with the header content, where the logo is inserted. It looks like this:

$final_rendered = '<div class="above_body"> <!-- closing tag is in template navbar -->
<div id="header" class="floatcontainer doc_header">
    ' . ''; 
if (vB_Template_Runtime::fetchStylevar('titleimage')) {
   $final_rendered .= '<div><a name="top" href="' . vB_Template_Runtime::linkBuild("forumhome") . '" 
     class="logo-image"><img src="' . vB_Template_Runtime::fetchStylevar("titleimage") . '" 
     alt="' . vB_Template_Runtime::parsePhrase("x_powered_by_vbulletin", '' . $vboptions['bbtitle'] . '') . '" /></a></div>';
} else {
    $final_rendered .= '';
}
 ...

The key part here is src="' . vB_Template_Runtime::fetchStylevar("titleimage") . '" which actually sets the image source. The source itself is held in the DB again and is set in the admin tool of vBulletin. Now what I need is to change the source according to the domain.

I know of course hoe to do that, but I'm not sure where to do that. I think it's not right to do changes in the DB manually. As I understood, the system generates each page template using these DB rows, so I might better do some changes in the place it is done?

The thing is, I cant find the right place where the actual templates are constructed, or the place where these lines from DB are first loaded .

Can anyone give me a clue where or how to achieve this?

Note that I need to make changes not only to the header image, but also to some other tings in footer, sidebar, etc... So it would be better to find some final "variable" or something and make changes to it by just replacing strings.

The solution doesn't need to be a perfect idea, just a rough and fast one will be satisfying...

Create a plugin that uses the "global_bootstrap_init_start" hook so it will be available in the various areas you need.

Have the plugin determine which domain is serving the page and then set a global variable that you can check wherever you need it. Put something like this in your plugin:

$GLOBALS[yourDomainNameVariable] = "yourKeywordForParticularDomain";

Intersting discussion here: HTTP_HOST vs. SERVER_NAME


You'll need to to modify each template that has an item you want to change based on the domain. If you have a distinct ID, class, etc. from looking at the HTML source, the easy way to find and update the template is this:
Admin Control Panel -> Styles and Templates -> Search in Templates

I tried searching for " <div class="above_body"> " and found the header template quickly. Here's the code for the image:

`<img src="{vb:stylevar titleimage}" alt="{vb:rawphrase x_powered_by_vbulletin, {vb:raw vboptions.bbtitle}}" />`

It seems like the easiest thing would be to have a separate folder with the images for each domain and use the same name for each image across the domains. Then you can replace the default image path with yours. For example:

`<img src="/images/{vb:raw GLOBALS.yourDomainNameVariable}/title.png" alt="{vb:rawphrase x_powered_by_vbulletin, {vb:raw vboptions.bbtitle}}" />`

I just looked closely at the code you posted and I suspect that you're working with vBulletin 3.x. I'm guessing because I've only worked with 4.x. I'm not sure how much if any of what I've written will be of use to you.

OPTION 1 replace with your logo at

forum\\images\\misc\\vbulletin3_logo_white.gif


OPTION 2: Go to Admin Panel an follow the steps

-Admin CP
-Expand Styles and Templates
-Style Manager
-Select StyleVars from the menu for the style you using. Click Go.
-In the search box type titleimage. It should show up under ImagePaths.
-In the Url textbox set the location to your new logo.
-Click on Save 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM