A couple more examples

midkemia - December 5, 2008 - 11:11
Project:Acronyms
Version:5.x-1.0
Component:Miscellaneous
Category:support request
Priority:normal
Assigned:Unassigned
Status:active
Description

I must admit I looked at the example a few times and am not 100% clear on how it works, maybe a couple more simple examples ?

#1

dellintosh - December 5, 2008 - 16:07

I've changed the description for the module a bit, hopefully that makes things easier to understand. If you still have questions please let me know. :)

#2

dellintosh - December 5, 2008 - 22:58
Status:active» closed

#3

ardugh - May 1, 2009 - 09:23
Status:closed» active

Hi, apologies for re-activating this thread.

(1)
I am also unclear as to the module's description. Maybe you could explain:
In the backend (admin/settings/acronyms) under "Add New Acronym" if I add for e.g WWW how does it know I mean World Wide Web?

(2)
Also, I've been running the module for days and I don't see any automatically created entries - I was waiting for some of these to help me understand how the module works.

Cheers,

#4

dellintosh - May 12, 2009 - 19:00

ardugh-

1.) this module does not define what acronyms mean (if you need that try something like Glossary), but instead about recognition of an acronym (or acronyms) within a text string. So this doesn't care what WWW stands for, only that it's an acronym which must be in ALL CAPS and the rest of the string is run through uc_words() (php's built-in function for handling string capitalization)

Example:

<?php
// Normally $string would be set programmatically, but this is just an example
$string = 'the USA has 48 contiguous states.';

// $parsed_string will be set as "The USA has 48 Contiguous States." (keeping the acronym "USA" and capitalizing the other words.  The word "has" is an exception listed in the module, future versions will possibly allow configurations of those "exceptions")
$parsed_string = acronyms_parse_string($string);

// now we can either use that $parsed_string somewhere (useful for modules), or just output the value to the screen (useful for blocks, themes, etc)
print $parsed_string;
?>

2.) This module works by calling the function acronyms_parse_string($string) where $string is a string you want to parse. So you would need to insert that callback into a theme, block, module, or anywhere you want to parse the acronyms from a string. Once you add the acronym_parse_string() to your module, block, or theme then it should start populating those acronyms accordingly. :)

I hope that explains it better; please let me know if you still have questions and I'll add this more detailed explanation to the description page.

Thank you,
-dellintosh

 
 

Drupal is a registered trademark of Dries Buytaert.