views:

228

answers:

1

Greetings all helpers!

I have been reading and testing Drupal features recently and I find this CMS very scalable and interesting. I began working with themes, views, content types and ect... but I am looking for something I cannot find on the internet.

Context : I am creating a new website for one non-profit organization of mine for the 10th anniversary. Mainly, this site is for a game that has different abilities within it's rules. I would like to create a glossary for the different abilities. That is not a great challenge.

This is what I want to archive : With this glossary, I would like to like to the ability description each time it is encountered in a content.

Ability glossary (list) : http://conflitseternels.net/index.php?id=habiletes

Each time one ability is encountered in the content, it links to it's description.

If you can guide me through the accomplishment of this ask, I would be greatly happy !

Thank you, Will

A: 

I have found one module that seems to do something like that: Glossify (http://drupal.org/project/glossify). I have never used it myself, but it's worth a try. If Glossify doesn't work for you, consider helping to improve the module, or write a custom module yourself.

Theoretically, there are two methods to convert the words to links: when the node is saved or when the node is displayed. In both cases, you will be checking every word in a node and see if it matches one of the abilities. Both solutions have advantages and disadvantages. When choosing a solution, you have to keep an eye on performance because search-and-replace actions can take a lot of system resources, especially if you have many users, long texts and lots of abilities.

Altering content when a node is saved can be done in Drupal by implementing hook_nodeapi ($op=presave). Just before the content is written to the database, your nodeapi function does its magic. Advantage: the search-and-replace is performed only once for each node. Disadvantage: no new links will be added in existing nodes when you add a new ability (unless you re-save the node).

Altering content when a node is viewed can be done by implementing hook_nodeapi ($op=view) or hook_filter. The links will not saved in the database, but added on-the-fly every time a user views a node. Advantage: new abilities will also be linked in node saved earlier. Disadvantage: performance, the search-and-replace has to run on every node view (although caching would probably solve this partially).

marcvangend
Thanks, I'll take a look at the Glossify module, didn't know it existed. If it does not work, ill do a module myself, but that implies longer developpement. I'll let you know.
wiooz
You're welcome. I'd like to read about your experiences with Glossify, so thanks in advance.As said, if it is not exactly what you need, please consider contributing to the module before going the custom route. That way, you're not only solving your own problem, but also giving back to the community.
marcvangend
Thank for your comment, I finally just let Drupal down and i'm coding the site my own way. Drupal is a good scalable and relatively good CMS, but sometimes, custom and home made is the path to follow ! :)
wiooz
Ok, thanks for the follow-up.
marcvangend