Форуми / Cotonti / Extensions / [Release] Widgets

Manage simple widgets

#1 14.12.2010 10:56
This plugin allows you to easily create plaintext or HTML widgets. You just enter the code through the admin panel, choose the preferred location for the widget and it will give you a tag which you can put in your template. Uses caching for improved performance.

Note: This is a Siena-only plugin. If you really want it to work in Genoa, it will need quite a few changes.

Right now it only supports plaintext and HTML, but I have plans to add options for showing contents from a page, the latest post in a topic, etc.

Download here
#2 14.12.2010 15:45
This uses every major hook, if there will be more plugins like this, then the
hooking system will have a lot of hooks to process.
I also use all hooks sometimes too.. ;)

Maybe we should think of a 'smarter' way to process hooks ???
(Only fire used hooks, in stead of looping all hooks and just try them)

For more advanced widgets there should also be a section that loads css and js files.
Maybe you can use my rloader plugin: http://code.google.com/p/rloader/
( I have developed it for widget stuff :) )

These were just some ideas.. ( I like widgets !! )

==- I say: Keep it EZ -==
#3 14.12.2010 18:53
It's not a problem, hooks are cached. The thing you're suggesting is what we call event handlers, and I think Trustmaster was working on something like that. Actually, we don't loop through all of them, we just loop through an array of plugin file paths which are to be included by that hook. All of them are used (assuming the plugin actually does something with the hook, but that's usually the case).

Widgets was designed to make simple things very easy to set up, if you're doing complex stuff it's better to write a separate plugin for it. For example you can use it to include 3rd party widget code, such as the Twitter widget, Google Analytics, AddToAny buttons etc. Mostly Javascript. Whether or not to use rloader is up to the site admin.
#4 14.12.2010 19:16
I don't get the idea of making plugins for Siena at least 4 months prior to the beta status.
Seditio.by - создание сайтов, разработка плагинов и тем для Котонти
#5 14.12.2010 19:30
Some sites run off the trunk, so why not? Also it's good to be prepared and have some plugins ready before the release, and Siena-only plugins can help people make the decision to upgrade.

Actually we've been creating a lot of plugins for Siena, because many core features are moved out of core into a plugin. For example the hidden groups and user avatar/photo are now in plugins.

Відредаговано: Koradhil (14.12.2010 19:39, 12 років тому)
#6 15.12.2010 02:00
I'm a little confused of what this plugin does... is this something similar to the freetext tags you can define in titles and menus section? Thought it hasn't been removed in siena.
#7 15.12.2010 04:08
Nifty idea, adds a lot of flexibility throughout. Nice one Koradhil, Siena is a bright future. I will download the latest trunk version from SVN and give it a whirl :)
[b]Know the question and you will be far more likely to get an answer.[/b]
#8 15.12.2010 04:18
Yes, right now it's basically the same as freetext/menuslots, with the difference that this one supports an unlimited number of fields and it can do plaintext as well (not really that useful, but you never know). Of course anything that you can do with this plugin (at the current version), you can also do by editing the template directly. The current version is supposed to be a framework for future expansion with other field types, so it becomes a platform which allows you to create simple 'plugins' from within the CMS itself.

Some ideas for widget types:
  • Table of contents (TOC)
  • Site navigation (structure)
  • Random page contents
  • Latest page in specified category
  • Social media
  • RSS reader
  • Simple forms

Відредаговано: Koradhil (15.12.2010 04:29, 12 років тому)
#9 15.12.2010 04:55
@Koradhil, The idea is superb, few questions, Will the plugin have a kind of Global hooks equivalent so that it can be used like a global var? similar to the menu configuration?
A useful feature would be to have a single tag which could define multi-part types, eg: Site Navigation, Latest Page etc.. wrapped up in a single tag {PLUGIN_WIDGETS} or multiple singular tags {PLUGIN_WIDGETS_RECENTPOSTS}
[b]Know the question and you will be far more likely to get an answer.[/b]
#10 15.12.2010 05:20
Sure it can have a 'global' location, it can support any hook you like actually, if you add the plugin files for them. Making them global isn't ideal though, because its less efficient. The currently supported locations should be enough in most cases (unless if you want it in a specific site area).

To make stuff more flexible I'll probably add the option to use XTemplate-style conditionals and variables.

I don't know what you mean by the 'single tag' and 'multi-part types', or what you would want it for.
#11 15.12.2010 06:22
Hi m8,

My request can sound strange and it's probably only me who uses it but it is sometimes useful, its called 'combination-tagging'

Lets say you have {EXTRA1},{EXTRA2},{EXTRA3} and {EXTRA4} but you want them all outputted in a singular form for whatever reason, thus I have created a tag called {EXTRA} which is the result of building all 4 tags into a single tag, it only works in some cases where fields are suited in pairs. One example is news. {NEWS_TITLE}, {NEWS_TEXT}, {NEWS_DATE}, {NEWS_POSTER} can all be combined to form {NEWS}.

Like the idea of XTemplate conditionals and variables, that adds huge scope for adding templates to fields which would be superb :)
[b]Know the question and you will be far more likely to get an answer.[/b]