Magic Data (c5.6)
Powerful token display and symbol processing integrated to core blocks and many other addons.
Have you ever thought:
- 'I want that block to show a user/file/page attribute'
- 'I want to use a stack as a template'
- 'I want blocks in user profiles to show user specific information'
- 'I want to welcome visitors personally'
- 'I want to change the style of a block depending on who is viewing it'
These are just some of the simplest uses of Magic Data. Magic Data provides a new way of enhancing the content of your web site. A way to personalise it to each visitor. A way to make it massively more adaptive and dynamic. A way to increase functionality while cutting the work involved on building and maintaining content. You can use Magic Data in a small way to pull information into a content block, or in a big way to build custom lists and interactions.
Many requirements that used to need custom block development can now be solved easily by using Magic Data within existing blocks.
Using Magic Data symbols, your website can show and adapt to information from:
You can get started with some page content as simple as
Contact the author [%PAGE OWNER EMAIL AS_LINK%]
and there are plenty of other simple uses. But it doesn't stop there. Read on and then see the comprehensive documentation for more of the many varied things you can do with Magic Data.
The Technical Bits
At the core of Magic Data is a flexible and expandable token and symbol processing engine. This engine is integrated with core blocks through templates and used by other addons to enhance functionality. The list of addons that integrate with Magic Data is growing every week, as are inventive ways to use it!
In its simplest form, the output of a block can be processed for tokens in the block template. The addon Magic Data Templates provides a selection of templates for commonly used blocks, or with a bit more flourish the templates in Enlil Transparent Content are all Magic Data enabled. Cache Free Content provides Magic Data enabled clones of core blocks without the cahce, useful if you are showing data that changes. Magic Data Templates also provides Magic Data integrated variants of the core Text and Text Area attributes that you can use with any block that handles attributes.
As a very basic example, within a regular content block you can write: "This page is provided by [%PAGE OWNER USERNAME%]. If you have any questions, please write to [%PAGE OWNER EMAIL AS_LINK%]."
If you are developing your own block template, integrating Magic Data is as simple as loading a helper and a single function call.
Stacks with Parameters
By using Magic Data Templates for blocks within a stack it can become a powerful template used across many pages to be filled from user and page attributes.
For even greater flexibility, using Magic Data with Universal Content Puller extends this to any block within the stack and any pulled content source, whatever it contains and wherever it is pulled from. Universal Content Puller also enables Magic Data to pull stacks and other content directly.
Uber List provides the ultimately flexible list block, using Magic Data to decide what to list and to format each list item.
Third party addons such as Pro Blog, the top concrete5 blogging platform, now integrate Magic Data token processing directly with the addon.
For eCommerce sites, the Special Instructions email formatting addon processes Magic Data tokens. Magic Data Commerce provides integration with the eCommerce addon and Similar & Recently Purchased Products. If you want to pull in the result of votes for pages or products, Up Down Vote Lister provides symbols to access vote data and results.
For the ultimately flexible list, Uber List uses Magic Data first to build lists of absolutely anything, then format each item using a stack with Magic Data as a template for each list item. List pages, users, products, files, marketplace information and more. Combined with Magic Data Forms, list can be shown for form results and any data uploaded in a csv file.
Want rich media? Magic Data integrates with Oembed to embed rich media literally anywhere you can place a Magic Data token. Want site-wide parameters? Magic Data integrates with the Tokens addon (not to be confused with Magic Data tokens) so you can show or use Tokens from anywhere you can use Magic Data.
Want to format the date or time in a freindly way? Last Updated provides Magic Data symbols for formatting any date/time and reading the last updated time. The Flags addon provides a symbol for showing flags.
Front End File Uploader can use Magic Data to both make access decisions and to decide where files are uploaded. Front End Fileset Tools similarly uses Magic Data to extend its capabilities for managing filesets. Both these blocks provide plenty of functionality used alone or together, but add Magic Data and the functionality escalates to another level.
Sorcerer's Map uses Magic Data to locate a Google map and provides symbols for Geo-location and MaxMind IP-GeoLoc provides symbols to locate site visitors from their IP addresses. Blocks by AJAX allows ajax loaded blocks to respond to request parameters through Magic Data.
Socerer's Gallery similarly integrates with Magic Data to provide an ultimately configurable and reactive image gallery and image slider block.
For develoeprs seeking finely controlled integration between their own sites and the concrete5.org marketplace, Magic Data Developer brings marketplace and concrete5 user profile information into Magic Data.
The Magic Data symbol engine can also be used with Universal Content Puller for conditional display of pulled sources. A Magic Data token is evaluated as true or false to determine if pulled content is shown.
This illustrates another way of using Magic Data, by intepreting symbols to make decisions within a block.
The symbols in Black Magic Data take this a step further, allowing Magic Data expressions to set attributes, create filesets, create pages, add content and make other small changes to the database.
For more conventional interaction, you can use Magic Data Forms to show the result of form submissions and with Magic Data Forms CSV Interface you can pull in data from any CSV file. The forms interface is pluggable, so can be extended to integrate with other forms packages. Magic Data Forms also provides a Magic Data enabled email extension and some nifty mechanisms for embellishing forms with other blocks in amongst the questions.
The Magic Data On Block Load addon extends the capability of Magic Data to intercept and manipulate block parameters as they are retrieved from the database.
This goes further than templating by enabling the complete replacement of any block parameter. Through Magic Data On Block Load you can do things like:
- Change the file-set displayed by a gallery or slider depending on who is viewing a page. e.g. [%UID ATTRIBUTE my_favourite_fileset %], where my_favourite_fileset is a user attribute.
- Change the file-set displayed by a gallery depending on a page attribute. e.g. [%PAGE ATTRIBUTE gallery_set %], where gallery_set is a page attribute.
- Change which stack is displayed according to a page or user attribute.
Taking template integration a step further, Magic Data compatibility can also be built into a theme.
In a Job
Build Magic Data into a Job and you have a basic report generator. A job can use Magic Data to take current information from your site and add it to a file, the site log or any place you direct cron output to.
Magic Job provides a dashboard interface for setting up Magic Data expressions and a regular Job and a Queueable Job that evaluate Magic Data and appends the outcome to a file.
Interconnection and Communication
Black Magic Data also extends Magic Data with an API for communicating between sites using Magic Data expressions.
Client sites can send Magic Data for evaluation on server sites to access information available through Magic Data symbols and even to make updates on the server.
A comprehensive permission system can be used to protect what can be done through this API.
This Magic Data addon provides the extendable symbols engine with an associated symbol tester. To help you easily develop and test Magic Data expressions, an easy to use symbol tester popup is integrated with the concrete5 toolbar, edit dialogs and the symbols dashboard page.
A symbols set for use with Magic Data should be installed from Magic Data Symbols. As with token processing, a growing list of third party addons also extend the symbols available through Magic Data and you can easily add your own symbols. See Developing Symbols for further information on extending the symbols available. If you want to provide deeper integration of Magic Data within a block or addon, you can even embed the Symbol Evaluation Tester within your block or dashboard page!
From version 2.11 this addon is compatible with php7. To update a site to php7 you will need to make core updates (at time of writing only on github and not released). You will also need to ensure that other addon packages are php7 compatible.
See more addons by JohntheFish.
Last updated: over a year ago