Acronym Replacer User Defined Tag

Do something cool with CMS? Show us ...
This board is for 'Answers', and the discussion of answers... Not for questions.
Post Reply
westis

Re: Acronym Replacer User Defined Tag

Post by westis »

Excellent! I'll try it out.

In 1.0 I suppose Events can be used for this, which, if so, makes it unnecessary to replace the {content} tag.

Good job!
westis

Re: Acronym Replacer User Defined Tag

Post by westis »

I don't think there's anything in the wiki about Events yet. It's been discussed on IRC.

I agree a module for acronyms would be great. That module would then "attach to the SmartyCompilePost event and modify the output based on it's internal list of acronyms". The latter was a quote from Ted on IRC. That is, when the SmartyPostCompile event runs the module is modifying the code output.

For example, the new Search module (still only in svn, will come with 1.0): "during the installation the function RegisterEvents is called". In that function there is for example $this->AddEventHandler( 'Core', 'EditTemplatePost', false );

"Then when one of those events gets called, it calls the DoEvent method of the module. So there is a small corresponding handler there for EditTemplatePost there..."

Again, I was quoting from Ted.


The TagRep module does something similar, replacing strings. But it's not ideal for a long list of acronyms. And it hasn't been updated to the module API for 1.0, so it may not work.

But indeed, an acronym replacer module with a form for acronyms and their respective definitions would be great!
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: Acronym Replacer User Defined Tag

Post by calguy1000 »

The events functionality is in 1.0, in brief here's how it works:

a) A module, or the core, can register, and then Send Events such as "newNews", or "newFronteEndUser" or "fileUploaded",  "editPage", etc, etc, etc.  there's some 50 events in the core at the moment, and then uploads and frontend users have been configured to send events, I still have to do selfreg, etc, etc, etc.

b) there are pages in the admin to allow you to specify which modules, and/or user tags should handle those events, and the order that each of those handlers should be called in.

c) if one of the handlers of an event is a module, then.... the modules DoEvent method is called with the name of the event, and whatever data it wants to send.  Each triggered event needs to be documented, but as of this moment, most are.

that's it in a nutshell.

I've tested this and it works for example with Uploads module.  when a new file is uploaded, the "onFileUpload" or some similarly named event is sent.  I then wrote a user defined tag that would add a news article with information from the newly uploaded file (summary, description, author, etc, etc). 

This functionality allows anybody with a bit of php knowledge, and the ability to look through the cms source, etc. to write their own workflows.  for example, it should be easy now to write a bridge between frontendusers and any forum software that you want to keep users and groups updated in the forum.

The search module also uses events, and now because of this mechanism, the content submitted with the uploads module, i.e.: the summary, and the description, are searchable with the search module.  and a link is provided to the detail report of the file, and then you have the ability to download the file.

Hope this helps.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Post Reply

Return to “Tips and Tricks”