Documentation

Introspection and Concrete5.org integration

Magic Data Developer provides symbols to gather information from installed packages, concrete5.org user profiles and marketplace items. To maximise responsiveness and minimise loading on concrete5.org, Magic Data Developer implements a lazy caching strategy. This means that no matter how old a cached user profile or marketplace item may be, it will always be retrieved from the cache. If it has expired, the cache entry will be marked for refresh. This cache is independent of your site cache and is only refreshed when Magic Data Developer's cache management jobs are run.

To get started, visit the Magic Data Developer dashboard page and enter your concrete5.org profile id. When you save this page, your profile will be retrieved from concrete5.org and cached locally.

Now go to the Automated Jobs dashboard page and run the 'Preload the Marketplace Cache' job. This will run through all your marketplace items and make local copies of the information.

This information is now locally available to the symbols provided by Magic Data Developer and will only be refreshed when the appropriate cache refresh jobs are run. For most uses, you will only need to run the jobs when there are changes to the concrete5.org data.  So perhaps run jobs to update users once per day and only bother to run jobs to update marketplace information when you have edited or added items to the marketplace.

The Magic Data Developer cache is deliberately not connected to the global cache flush event, so you can manage your site cache independently of data from concrete5.org.

Concrete5.org profile and marketplace symbols

Symbols that fetch concrete5.org user profile symbols do so by loading the page from concrete5.org and 'Screen Scraping' to extract data items from the number of forum posts to lists of showcase sites. Be aware that changes to the design of profile pages on concrete5.org could make this information unstable and require this addon to be revised.

Marketplace item symbols are less volatile because they use the marketplace integration API built into the concrete5 core.

You won't be using Magic Data Developer unless you have a reasonable idea of what you are doing, so rather than go into minutest detail, here are some expressions to try in the symbol tester. You will see screenshots of some of these on the marketplace page.

Your username

MY_C5_PROFILE C5_USERNAME

Your username and bio

MY_C5_PROFILE C5_USERNAME WRAP '<h3>' '</h3>' . ( MY_C5_PROFILE C5_PROFILE_BIO )

A quick list of certifications

MY_C5_PROFILE LIST_CERTIFICATIONS 20
APPLY_EACH
  CERTIFICATION_ICON
  WRAP '<DIV style="float:left;">' '</div>'
END_APPLY_EACH
IMPLODE ' '   WRAP '<div class="clearfix">'  '</div>'

See this example in action.

A similar list for badges

MY_C5_PROFILE LIST_BADGES 100
APPLY_EACH
  BADGE_ICON
  WRAP '<DIV style="float:left;">' '</div>'
END_APPLY_EACH
IMPLODE ' '   WRAP '<div class="clearfix">'  '</div>'

See this example in action.

A grid of marketplace items with links

MY_C5_PROFILE LIST_MARKETPLACE_ITEMS 100
APPLY_EACH
  MARKETPLACE_ICON_LINK
  WRAP '<DIV style="float:left;margin:3px;">' '</div>'
END_APPLY_EACH
IMPLODE ' '   WRAP '<div class="clearfix">'  '</div>'

See this example in action.

Your top 10 rated marketplace items

MY_C5_PROFILE LIST_MARKETPLACE_ITEMS 100
SORT_BY
  MARKETPLACE_RATING
END_SORT_BY
REVERSE
LIMIT 10
APPLY_EACH
  SAVE m1
  MARKETPLACE_NAME WRAP '<h3>' '</h3>'
  .  ( m1 RECALL MARKETPLACE_RATING AS_RATING  )
  .  '<br>' .  ( m1 RECALL MARKETPLACE_ICON_LINK   )
END_APPLY_EACH
HTML_OL

See this example in action.

Symbols for benchmarking Magic Data expressions

Magic Data Developer also provides symbols for a BENCHMARK of execution time during which you may want to set NO_DEBUG so that debug output does not corrupt the results. For example, to benchmark the above expression to list marketplace items.

NO_DEBUG BENCHMARK 10
MY_C5_PROFILE LIST_MARKETPLACE_ITEMS 100
APPLY_EACH
  MARKETPLACE_ICON_LINK
  WRAP '<DIV style="float:left;margin:3px;">' '</div>'
END_APPLY_EACH
IMPLODE ' '   WRAP '<div class="clearfix">'  '</div>'
END_BENCHMARK END_NO_DEBUG . ( BENCHMARK_RESULT )

Note how the BENCHMARK_RESULT is wrapped in parenthesis to enable the concatenation symbol '.' to append it to the output.

Use with Uber List

Magic Data Developer can be used with Uber List for massively flexible lists of marketplace items or other profile information.

For the list expression in Uber List

MY_C5_PROFILE LIST_MARKETPLACE_ITEMS 100

For the stack that Uber List uses as a template, the stack should contain a content or html block with

[% UBER_LIST_ITEM MARKETPLACE_ICON_LINK %]
<h5>[% UBER_LIST_ITEM MARKETPLACE_URL AS_NAMED_LINK ( UBER_LIST_ITEM MARKETPLACE_NAME ) %]</h5>
<p>[% UBER_LIST_ITEM MARKETPLACE_DESCRIPTION %]</p>

As usual with Uber List, you will need to create the stack before you add the Uber List block.

In Uber List on a full width page, this works well with a content wrapper floated left and given a width of 200px to 210px with 3px left/right margins and 6px bottom margin. I used a template from Enlil Transparent Content to provide the background.

See this example in action.

Blocks

The following blocks are only designed for one copy of each block type on any single page. If you add multiple copies of any block type, the javascript within them will break!

Magic Data Symbol Lister

A front-end list of symbols available for Magic Data. Simply add the block to any page and it tabulates all Magic Data symbols installed using the same display as the Symbols dashboard page.

See this block in action.

Magic Data Symbol Documentation

Simply add the block to any page for a documentation view of the symbols installed -for those who prefer textual documentation suitable for printing.

See this block in action.

Magic Data Symbol Tester

This block places a symbols evaluation tester for Magic Data on a page. For security the block will only be shown to users with appropriate permissions to view the full sitemap and list users.

Even so, you will still want to restrict symbol access to some of the more sensitive system information. In particular, the CONSTANT and CONFIG symbols could provide a security loophole if allowed to a front end user. You should probably define  MAGIC_DATA_RESTRICT_CONSTANTS and MAGIC_DATA_RESTRICT_CONFIG to be 'All' if you add this block to a site.

(You won't be seeing this block in action unless you put it on your own development site - I will not be giving away administrator access to any of my sites!)