vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=4)
-   -   vBGlossary (https://vborg.vbsupport.ru/showthread.php?t=34385)

TWTCommish 01-22-2002 10:00 PM

I must pay homage to user/moderator wluke for this idea. I must also thank him for allowing me to run with it, and release it publicly. Thanks Wayne!

What's it do?
Simple: creates a glossary of terms. They're sorted alphabetically much in the same way the Memberlist is. I find this is extremely useful for most forums, which surely have a lot of their own lingo. For my site, it's a few acronyms and goofy phrases. My members get a kick out of referring newbies to the glossary to learn about the phrases. It's really helped the whole place seem less like a clique...because others can catch up easily with a reference like this.

Here's a live demo


What's it take?
This hack involves a MySQL command, the uploading of two files, the modification of one, and the creation of five templates. It also requires the modification of a second file, and of two templates, if you want to display a random glossary term on the New Reply/New Thread pages. It'll require a bit more still if you want to add the Glossary to your forum jump menu.

First off, run the following query in MySQL. This is the table that will store the glossary data.

Code:

CREATE TABLE `glossary` (
  `glossaryid` int(11) NOT NULL auto_increment,
  `text` text NOT NULL,
  `description` text NOT NULL,
  PRIMARY KEY  (`glossaryid`)
) TYPE=MyISAM;

Attched to the post right after this one is an archive: files.zip. This archive contains two files: glossary.php and admin_glossary.php. The first goes in your main forums directory. The second should be uploaded into your /admin/ directory.

Next, you'll need to create five templates. I've attached a text file containing all five to this post. Should be pretty straightforward. Mess with the formatting as you see fit, of course.

After that, you'll probably want to open (back it up!!!) your /admin/index.php file. Find the code below (around line 340):

Code:

makenavselect("Templates");
// ***

Right after that, add this:

Code:

makenavoption("Add", "admin_glossary.php?action=add", "|");
makenavoption("Edit", "admin_glossary.php?action=edit", "|");
makenavoption("Delete", "admin_glossary.php?action=delete");
makenavselect("Glossary", "<hr><br>");

There, it should work now! Now, on to the extras (well worth installing, in my opinion):

Display a random glossary term on new thread/new reply pages
Open newreply.php and find the following code (around line 468...it should be right near the end of the file):
Code:

getforumrules($foruminfo,$permissions);
Right after it, add this:

Code:

  $rand_term = $DB_site->query_first("SELECT text AS term_text, description AS term_description FROM glossary ORDER BY RAND()");
  extract($rand_term);
  $term_description = str_replace("'", "\\'", htmlspecialchars(strip_tags($term_description)));

Yeah, that last line is a little messy -- I like saving space, though. :)

Save and upload. Next, open newthread.php and find the same bit of code (duplicated below) around line 368 or so:

Code:

getforumrules($foruminfo,$permissions);
After that, add the same bit of code above.

Next: the templates. Find the below in both templates...

Code:

$vbcode_smilies</td>
...and in both templates, replace it with this:

Code:


        $vbcode_smilies<br><center><smallfont><b>Random Term: <a href="#" onclick="alert('$term_description'); return false;">$term_text</a></b></smallfont><br>

        <smallfont><a href="$bburl/glossary.php" target="_blank">More Glossary Terms!</a></smallfont><br></td>

There, you're done! :)


Add vBGlossary to the forum jump menu
Open forumdisplay.php in your main forums directory. Find this, near the top of the file (line 13 or so):

Code:

        case 'cp': $goto = 'usercp'; break;
Right after it, add this:

Code:

        case 'gl': $goto = 'glossary'; break;
Next (and last) step: open the forumjump template and add this bit of code somewhere amongst the other options...where you put it depends on where you want it in the menu.

Code:

                <option value="gl" $frmjmpsel[glossary]>The Glossary</option>
That's it! All done. Enjoy.

I hope you all enjoy this hack. It didn't take nearly as much time/effort as I thought it would...I really love it, though. :)

TWTCommish 01-23-2002 01:05 AM

Here's the archive. Enjoy. :)

TWTCommish 01-23-2002 01:08 AM

Another attachment: a small screenshot of what the random term display looks like. It's right under the clickable smilies. Clicking on the term (in this case, the word "Avatar") brings up a JavaScript alert message containing the description of the term. It's probably my favorite part of the hack.

SaintDog 01-23-2002 02:28 AM

I could not get this to work, it returned an internal server error when I went to add a term to the glossary. Below is what I did in order:

- Run the query
- Created the templates
- Added the makenav and options to /admin/index.php
- Uploaded glossary.php to base forum dir, the other to admin/

I click on "Add" under glossary, type in the term and description, click submit, an internal server error pops up.

Any ideas as to what is wrong?

Would be a nice hack if I could get it to work :supwink:

FWC 01-23-2002 02:59 AM

I'm getting a 404 error when I try to add a term. Everything else works. I added a term manually and it's there. It shows up on the glossary page. If I try to edit it, I also get a 404 error. I'm looking at the admin_glossary.php file trying to figure out what's wrong. No luck yet. I'd really like to get this working. We have an online dictionary for our board that's HTML and a pain to maintain. :)

TWTCommish 01-23-2002 03:25 AM

Odd. What does the email with the query error tell you?

Anyway, I think the problem may have had something to do with my use of the $PHP_SELF variable in the admin_glossary.php file. I've corrected this (I think), and am attaching the updated file. Please let me know if it works. :)

Lucky 01-23-2002 03:39 AM

I've been screwing with this since the time of release and I had to add the following in the glossary.php:

error_reporting(7);

after:

<?php

Good, so no errors now, or so I thought.

In both newreply.php and newthread.php you have to find:

getforumrules($foruminfo,$permissions);

Right after it, add this:

$rand_term = $DB_site->query_first("SELECT text AS term_text, description AS term_description FROM glossary ORDER BY RAND()");
extract($rand_term);
$term_description = str_replace("'", "\'", htmlspecialchars(strip_tags($term_description)));

Now when ever I add the above it get warning errors.

I can see the admin cp for adding a term, but when I click add term I get cgi errors

Any ideas how to squash these bugs?

Lucky 01-23-2002 03:42 AM

I have tried the new amin_glossary.php and I still get the errors.

Any more ideas?

FWC 01-23-2002 03:55 AM

Quote:

Originally posted by TWTCommish
I've corrected this (I think), and am attaching the updated file. Please let me know if it works. :)
I still get a 404 Page Not Found error if I try to add or edit an entry. :(

SaintDog 01-23-2002 04:40 AM

Nothing here either, still receiving errors when trying to add.

Lucky 01-23-2002 05:10 AM

Did any of you notice that the newreply.php and newthread.php get an error when you try to add what is said to be added to both?

Just wondering?

BTW:
I too am unable to add in admin cp.

FWC 01-23-2002 05:28 AM

Quote:

Originally posted by Lucky
Did any of you notice that the newreply.php and newthread.php get an error when you try to add what is said to be added to both?

Just wondering?

BTW:
I too am unable to add in admin cp.

I never went that far. I just ran the query, uploaded the files and modified admin/index.php. I wanted to test it out first. But, it doesn't work. I feel like a moron. I've been messing with it all night and I can't figure out what's wrong with the admin file. I can add entries manually using the exact same query that's in the admin file. I'm missing something totally obvious. :(

Lionel 01-23-2002 06:10 AM

I am also getting 404 with both admin. Never went past that.

Lionel 01-23-2002 06:16 AM

in doformheader you put glossary. It should be admin_glossary.

Lionel 01-23-2002 06:21 AM

thanks.
You should replace every instance of doformheader with admin_glossary, since this is what you are posting, not glossary. Now up to the second part.

FWC 01-23-2002 06:36 AM

Quote:

Originally posted by Lionel
in doformheader you put glossary. It should be admin_glossary.
You rule, Lionel! That did the trick. I'm still used to simple forms. Now I understand the vB admin ones a whole lot better. :)

Lionel 01-23-2002 06:36 AM

but you should fix your instructions in newthread and newreply templates. You should not replace the smilies code, but add next to it or you disappear smilies.... Great!
now up to last part

Lucky 01-23-2002 06:43 AM

Quote:

Originally posted by Lionel
thanks.
You should replace every instance of doformheader with admin_glossary, since this is what you are posting, not glossary. Now up to the second part.

Ok.

I have replaced every instance of doformheader with admin_glossary instead of glossary and I am still getting the following:

CGI Error
The specified CGI application misbehaved by not returning a complete set of HTTP headers. The headers it did return are:

Any ideas?

BTW:
Which admin_glossary were you using?
The one from the 1st post or the update?

Lionel 01-23-2002 06:43 AM

Installed on 2.21. Works great. Now we have to poulate it. Who is going to be nice and give us some texts startup boost? :supwink:

Lionel 01-23-2002 06:44 AM

I used the second one. After problems, I downloaded it and never replaced it.

Lucky 01-23-2002 06:49 AM

Thanks Lionel,

I used the 2nd one and all is good now.

Great hack!

This will really come in handy!

On another note I would hope that this will be incorporated in 2.2.2

Lionel 01-23-2002 06:55 AM

you are welcome Lucky.

Now I placed this on top of glossary.php

error_reporting(7);
require("./global.php");
if ($bbuserinfo[userid]==0)
show_nopermission();

and since I want to place a link out for glossary, it is protected. Only members can see it.

I love that vbulletin. I am beginning to understand it more and more.

For example, I placed that code above (with the proper path) in many other php and they are all protected. :)

Lucky 01-23-2002 08:45 AM

Quote:

Originally posted by Lionel
Installed on 2.21. Works great. Now we have to poulate it. Who is going to be nice and give us some texts startup boost? :supwink:
Would be nice.:)

Lesane 01-23-2002 10:24 AM

Great hack, gonna install this one later. Thanks.

TWTCommish 01-23-2002 12:07 PM

Whew, I'm back! Sorry guys, I'm on EST, so I just woke up. :) I've re-uploaded admin_glossary.php to post #6 of this thread and fixed the doformheader() values. My bad! :) Wasn't paying attention. I've also fixed the problems with the first post...re-uploaded files.zip and fixed the instructions. My apologies for the problems, guys.

I am flattered, though, that so many people are interested in this.

Quote:

Now when ever I add the above it get warning errors.
I don't know that anyone else is having problems with that code. Are you running PHP on a Windows box, or are you running an older version of PHP, by any chance? Don't forget everyone: upload admin_glossary.php to your /admin/ directory, too.

Quote:

but you should fix your instructions in newthread and newreply templates. You should not replace the smilies code, but add next to it or you disappear smilies.... Great!
I've fixed this in the original post. How could I have missed that? D'oh!

Quote:

On another note I would hope that this will be incorporated in 2.2.2
That'd be beyond cool. :)

Quote:

Who is going to be nice and give us some texts startup boost?
Here's a few all-purpose ones that should apply to most boards:
  • Avatar - The small image that some posters have underneath their username on each of their posts. This is available to all members with at least a certain number of posts.
  • bbCode - See "vBCode."
  • BTW - An acronym for "by the way."
  • BRB - An acronym for "be right back."
  • IMO - An ancronym for "in my opinion."
  • IMHO - An acronym for "in my humble opinion."
  • IRL - An acronym for "in real life."
  • Lurker - Someone, registered or not, who visits fairly regularly, but does not post.
  • LOL - An acronym for "laugh out loud."
  • Mod - See "Moderator."
  • Moderator - A forum member who has certain administrative powers, such as the power to open/close threads, move them to other forums, delete threads, edit posts, and other similar things.
  • PM - Short for "Private Message," a popular feature that allows forum members to send, well, private messages to each other.
  • ROFL - An acronym for "rolling on the floor, laughing."
  • Semi-Lurker - Someone who posts, yet chooses to remain "invisible" to other members viewing their Buddy Lists, or the "Who's Online?" page.
  • Smilie - A small image representing some emotion in the form of a little face.
  • Thread - Has the same basic meaning as "topic." A thread is a string of (hopefully) related posts placed in a forum. Any registered member can create new threads.
  • vBCode - A term describing the HTML-esque codes that people can use while posting on the forums to format text, quote others, create links, and do other such things.
There ya go -- that'll get ya started. :)

Lionel 01-23-2002 12:10 PM

Quote:

Originally posted by TWTCommish

Here's a few all-purpose ones that should apply to most boards:

There ya go -- that'll get ya started. :) [/B]
thanks

Lionel 01-23-2002 12:51 PM

I added it to my index.php and it shows for the registered users ;)

TWTCommish 01-23-2002 01:02 PM

Quote:

Originally posted by Lionel
I added it to my index.php and it shows for the registered users ;)
Yeah, I saw that...registered and it looks great on your site. Thanks for installing it. :) I just decided to have it "officially" on the reply/thread pages, though, since it makes sense to have it there while someone's posting, and the forum home page is so crowded already. D

xware 01-23-2002 02:55 PM

thanks.
but where is the five templates?I can't see it. ;)

TWTCommish 01-23-2002 03:02 PM

D'oh. Sorry. Ok, now the templates.txt file is attached to the original post, and the updated files.zip to the second. Sorry about that. I'm a bonehead today. :)

xware 01-23-2002 03:31 PM

works well.
thank you! :pleased:

SaintDog 01-23-2002 07:45 PM

Thank you for a great hack, I was just wondering if it would be possible for one addition to be added to the hack though?

You know when you go to edit/delete the terms, they are all grouped together? How about making it to where they are sorted under headers? (see below if you are not sure what I mean):

---------------------------------------------------------------------
A
---------------------------------------------------------------------
Animal
AOL
ect..

---------------------------------------------------------------------
B
---------------------------------------------------------------------
Bald
Bird
ect..

and so on.....

This would make it look a little nicer, imo. (note: this would be for admin_glossary.php).

Do you think you could do this or add it to the hack?

I think it would be a nice addition to the hack.

Again, thanks for a great hack!

TWTCommish 01-23-2002 07:52 PM

Yeah, give me a little bit of time. Doing some other work now. I can do that, though. Won't be long, I don't think. :)

TWTCommish 01-23-2002 08:56 PM

Here we go. Attached is the new admin_glossary.php file. It create the aforementioned headers for each letter/number/whatever, and even features a handy drop-down menu to quickly jump to various areas, as I'm sure some glossaries will get quite large!

I'll also be updating files.zip with this new file. Enjoy. :)

TWTCommish 01-23-2002 08:56 PM

Here's a screenshot to show you what the new format looks like.

Lionel 01-23-2002 09:12 PM

excellent. Admin has a good glance.

afterlab 01-23-2002 09:39 PM

For some reason, i'm getting this in newreply.php:

Warning: extract() expects first argument to be an array in /home/sites/site1/web/newreply.php on line 479

TWTCommish 01-23-2002 09:41 PM

My bad: I forgot to mention...if you want a random term to show up, you've got to add a term to the DB. Otherwise it can't find anything. :)

afterlab 01-23-2002 09:45 PM

Yeah.. I figured that out.. :o

SaintDog 01-23-2002 10:00 PM

Thanks for the speedy fix, imo, it looks nicer now and saves me some time. You even managed to save me some time by adding that drop down box to it with only the letters being used at the time.

Once again, thanks, great hack!


All times are GMT. The time now is 04:46 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.01654 seconds
  • Memory Usage 1,844KB
  • 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
  • (11)bbcode_code_printable
  • (11)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