Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Glossary plugin?
#1
I apologize if this should go in plugins not feature requests -- but anyone working on a glossary plugin? I could certainly just do a page with a long glossary but would be nice to have a plugin to manage this. I.e. have a word or phrase, with the possibility of multiple definitions, and perhaps images of links to examples.

Thanks
Reply
#2
(2014-08-12, 02:48:24)atstarr Wrote: I apologize if this should go in plugins not feature requests -- but anyone working on a glossary plugin?  I could certainly just do a page with a long glossary but would be nice to have a plugin to manage this.  I.e. have a word or phrase, with the possibility of multiple definitions, and perhaps images of links to examples.

Thanks

Yes this should be in the Plugins/ General Questions subforum, as the scope is probably too broad to include in the core. 
Although not its primary purpose; you could do this with GS Custom Settings, eg create a tab named 'glossary', and create a setting for each word, set the description to the word description, and the lookup 'word_x' where x is a number. You can reorder them alphabetically in the UI in Edit mode. If you're going to frequently update the list, you need to first return the settings in a for loop, and sort them with PHP sort() to avoid having to reset the numbers. 

[Image: ZxZESZK.png]

In your PHP template you could do something like:

PHP Code:
<?php $amount_of_words 8
for (
$i 1$i $amount_of_words$i++) { 

  $word 
return_setting('glossary''gloss_' $i'label');
  if ($i 0)
    $wordPrev return_setting('glossary''gloss_' . ($i 1), 'label');
  if ($i === || ($i && strtolower($wordPrev{0}) !== strtolower($word{0}))) {
    if ($i 0) echo '</dl>';
    echo '<h3>' strtoupper($word{0}) . '</h3>';
    echo '<dl>';
  }
  echo '<dt>' $word '</dt><dd>' return_setting('glossary''gloss_' $i'descr') . '</dd>';
  if ($i === $amount_of_words-1) echo '</dl>';
?>



This script outputs an HTML definition list with subtitles for each letter (glossary data from http://pc.net/glossary/):


[Image: ccdWkek.png]
Reply
#3
Sooo fu@$#%ing pimp!
well done
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply




Users browsing this thread: 1 Guest(s)