PDA

View Full Version : Random Glossary Term [vBa CMPS module]


RS_Jelle
03-31-2006, 10:00 PM
This vBadvanced CMPS module displays a random term of Mindestic GlosPro (https://vborg.vbsupport.ru/showthread.php?t=132632).

I tested it on vBulletin 3.5.4 with vBadvanced CMPS 2.1.0 and vBGlossary Basics 1.1.0.

It adds one query to a vBa page and it's fully phrased and 100% W3C XHTML 1.0 compliant.

https://vborg.vbsupport.ru/external/2010/10/30.jpg

================================================== ========================
Installation
================================================== ========================
Upload all files from the "upload" directory into your forum directory.
Create a new template called "adv_portal_glossary_random_term" with the following content:

<tr>
<td class="alt1">
<div align="center">
<a href="$vboptions[bburl]/glossary.php?$session[sessionurl]do=viewglossary&amp;term=$glossary_module_term_id"><img src="$vboptions[bburl]/images/question-mark.gif" border="0" alt="$vbphrase[glossary]" title="$glossary_module_term_name" /></a>
<br /><a href="$vboptions[bburl]/glossary.php?$session[sessionurl]do=viewglossary&amp;term=$glossary_module_term_id"><strong>$glossary_module_term_name</strong></a>
</div>
</td>
</tr>
<tr>
<td class="alt2">
<div align="center">
<span class="smallfont"><a href="$vboptions[bburl]/glossary.php?$session[sessionurl]">[$vbphrase[glossary]]</a></span>
</div>
</td>
</tr>

Create a new vBa CMPS PHP file module (AdminCP => vBa CMPS => Add Module => [PHP File]) with the following info:
- Title: Random Term (or choose another one)
- File to Include: glossary_random_term.php
- Identifier: glossaryrandomterm (or choose another one)
- Templates Used: adv_portal_glossary_random_term

================================================== ========================
Requirements
================================================== ========================
vBulletin 3.5.x or 3.6.x
vBadvanced CMPS
vBGlossary Basics (https://vborg.vbsupport.ru/showthread.php?t=111863) (now called Mindestic GlosPro)

================================================== ========================
History
================================================== ========================
- 1.0.0: Initial release
- 1.0.1: Fixed a little bug

The question mark graphic is made by Norke (Yannick De Smet) (http://norke.deviantart.com/).

If you use this add-on, please click install (https://vborg.vbsupport.ru/vborg_miscactions.php?do=installhack&threadid=111900) to say thanks and to receive updates.

SaN-DeeP
04-01-2006, 09:31 PM
this is way to quick addon release :)

louis_chypher
04-20-2006, 02:22 PM
I had to change the adv_portal_glossary_random_term template to:

<tr>
<td class="alt1">
<div align="center">
<a href="$vboptions[bburl]/glossary.php?$session[sessionurl]do=viewglossary&amp;term=$glossary_module_term_id"><img src="$vboptions[bburl]/images/question-mark.gif" border="0" alt="$vbphrase[glossary]" title="$glossary_module_term_name" /></a>
<br /><a href="$vboptions[bburl]/glossary.php?$session[sessionurl]do=viewglossary&amp;term=$glossary_module_term_id"><strong>$glossary_module_term_name</strong></a>
</div>
</td>
</tr>
<tr>
<td class="alt2">
<div align="center">
<span class="smallfont"><a href="$vboptions[bburl]/glossary.php?$session[sessionurl]">[$vbphrase[glossary]]</a></span>
</div>
</td>
</tr>

In order to get the path to correctly reflect the locations of My files.

Oh, Thanks!

RS_Jelle
04-20-2006, 03:08 PM
Thanks for reporting this issue, I fixed it ;)

dendrob
04-22-2006, 08:29 PM
any way to add a block like this to VBDrupal ?

RS_Jelle
04-26-2006, 06:43 PM
any way to add a block like this to VBDrupal ?
I'm sorry, but this isn't possible. I'm only using vBadvanced CMPS (and testing a bit with vbPortal), but I don't use vBDrupal.

Neutral Singh
05-14-2006, 02:36 PM
Hi I was trying to add glossary description as well in the module. so i edited the module php file as follows:

<?php

if (($permissions['glossarypermissions'] & $vbulletin->bf_ugp_glossarypermissions['canviewglossary']) AND $vbulletin->options['vbglossaryactive'])
{
$glossary_module_content = '';

$glossary_content_query = $db->query_read("SELECT glossaryid, glossaryname, glossarydescription
FROM " . TABLE_PREFIX . "glossary
WHERE glossaryvalid = 1
ORDER BY RAND()
LIMIT 1
");

$glossary_content_fetcharray = $db->fetch_array($glossary_content_query);

$glossary_module_term_id = $glossary_content_fetcharray['glossaryid'];
$glossary_module_term_name = $glossary_content_fetcharray['glossaryname'];
$glossary_module_description = $glossary_content_fetcharray['glossarydescription'];

$db->free_result($glossary_content_query);
}

eval('$home[$mods[\'modid\']][\'content\'] .= "' . fetch_template('adv_portal_glossary_random_term') . '";');

?>

Now, although the glossary description is also showing up it is also showing some garbage html along with it, how do i remove that garbage... thanks for the module.

Just have a look at top right side at my website: http://www.sikhphilosophy.net

Thanks

jaks
07-03-2006, 10:37 PM
I'd love to have the description with the html being parsed aswell but I would need it limited to a certain number of words.:cross-eyed:

RS_Jelle
07-05-2006, 08:10 AM
@Neutral Singh: Instead of your extra code, use this:
$glossary_module_description = strip_bbcode($glossary_content_fetcharray['glossarydescription'], false, false, false);
And to use this function, you need functions.php (put it in the beginning of the if statement):
require_once('./includes/functions.php');

@jaks: Have a look at Neutral Singh's post and this post. Then just put the $glossary_module_description variable where you want it in the template.
To limit the number of characters, add this after the strip_bbcode line:
$glossary_module_description = substr($glossary_module_description,0,20);
Change the 20 to the amount of characters you want :)

cookiepants
07-25-2006, 07:06 AM
Works perfect for us, thanks! It also helped me learn vBadvanced coding a little bit

:D

Megan
http://www.sewingmamas.com/b/

jaks
11-08-2006, 05:59 PM
Thank Neutral Singh and RS_Jelle not me for this.

Modified Module to include description:
<?php

if (($permissions['glossarypermissions'] & $vbulletin->bf_ugp_glossarypermissions['canviewglossary']) AND $vbulletin->options['vbglossaryactive'])
{
$glossary_module_content = '';

$glossary_content_query = $db->query_read("SELECT glossaryid, glossaryname, glossarydescription
FROM " . TABLE_PREFIX . "glossary
WHERE glossaryvalid = 1
ORDER BY RAND()
LIMIT 1
");

$glossary_content_fetcharray = $db->fetch_array($glossary_content_query);

$glossary_module_term_id = $glossary_content_fetcharray['glossaryid'];
$glossary_module_term_name = $glossary_content_fetcharray['glossaryname'];
$glossary_module_description = strip_bbcode($glossary_content_fetcharray['glossarydescription'], false, false, false);
$glossary_module_description = substr($glossary_module_description,0,150);


$db->free_result($glossary_content_query);
}

eval('$home[$mods[\'modid\']][\'content\'] .= "' . fetch_template('adv_portal_glossary_random_term') . '";');

?>

Add this where you want it to show in your adv_portal_glossary_random_term template:
$glossary_module_description

Enjoy

MDK-Indy
08-12-2007, 09:36 PM
Works fine with vBulletin 3.6.7 PL1, vBadvanced CMPS 3.0 RC1 and Mindestic GlosPro 1.2.2

greeting Indy

chick
04-29-2008, 08:37 PM
vb 3.6.8 with mindestic gloss.

Maybe a little help.

I managed to get it working on cmps but the.... ? image goes to a blank page /glossary.php?do=viewglossary&term=

though the [glossary] link does go to the correct page, the question mark goes to a blank page. Do I have something that needs changing in the code.

I had to turn it off for now.