News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Help finding where to place code in smf

Started by Tiberion, May 19, 2009, 08:59:19 PM

Previous topic - Next topic

Tiberion

Hello, I've used smf for a few years now, but never did actual code changes that couldn't be auto installed thru an uploadable package.
I want to start getting more creative on the sites.  I'm currently using bloc's wonderfull tolkein theme, and want to add some
usuage from Lotro.  I just can't find where to insert the code in the theme based on the instructions given, and was wondering if someone could point me in the direction of where the following would go.  Thank you all very much!


How to use the onering.js code to create Tooltips on your site.

If you're comfortable editing your own HTML and/or forum headers then all you need to do is grab the code from this page and drop it into either your forum Skin's header block or the head section of your page's HTML.

The following code is everything you need to get started. Make sure you copy everything between the <script> tags.  You don't need to edit or change anything. You can drop this code into your site as is.

<script type="text/javascript" src="hxxp:content.level3.turbine.com/sites/lorebook.lotro.com/js/onering.js [nonactive]">

</script>

The script works with all of the following entry types:

Weapon
Armour
Item
Quest
Deed
Trait
Skill
Perk
It does not currently work with area, tool, region, and several other tags.

Once the JS code is placed on the page, creating the tool tip is simply a matter of placing a supported link in your html somewhere.

Text link: <a href="hxxp:lorebook.lotro.com/wiki/Weapon:Dagger [nonactive]">I'm a piece of text</a>

Image link: <a href="hxxp:lorebook.lotro.com/wiki/Weapon:Dagger [nonactive]"><img src="hxxp:content.turbine.com/path/to/some/image.png [nonactive]" /></a>

In both cases the script will find the lorebook URL and generate a tooltip when you mouse over either the link text or the image.

If that was all Greek to you, read on and I'll walk you through adding the script to a forum.

Tooltips in your forums

This example uses VBulletin as its basis however, it will work much the same on any forum software. You'll just need to find the corresponding header section of your template.
Note for Invision users: Invision's template system is a bit different. You'll want to put the code at the top of the header and outside of any other call routines. Otherwise you can end up generating weird things in weird places.

Getting started

Grab the code above (the one with the <script> tags around it) and paste it into notepad or some other text editor.  You want to do this to make sure all any formatting tags are cleaned before pasting it into your site. Nothing says kaboom like stray tags.

Log into your forum's admin panel and Click the "Styles & Templates" link on the left side menu(remember, this example assumes you are using Vbulletin).
In the drop down menu choose, "Style Manager"
With the style manager open you'll see all of the styles (skins) your forum is currently using. If you are using more than one skin on your forum you'll need to repeat this for each one.
Click the << >> button to open the  style
The list on the left is all of the scripts that make up your VBulletin skin. Find the 'header include" and hit edit in the right hand menu.
The scary thing you are looking at is the code that calls all of the includes for your forums. Mess it up and your forums will break. So we won't mess it up, right?
Scroll all the way to the bottom of the code.  There should be a </if> at the very end. (See image)
Copy the code out of notepad and paste it into the admin window just after the last </if>. You should place it on a new line.
Once the code is pasted in just hit SAVE at the bottom of the editing area.
You're done. The code will now take any link it sees to the lorebook and try to parse it. If it finds a hit you'll get a tooltip; If it doesn't you'll get a 'not found' box.

Tiberion

or would someone know the way to make this mod: http://custom.simplemachines.org/mods/index.php?mod=621
work with the tolkein them from bloc?
Thanks again!

Advertisement: