Great Ocean Media
website design - editorial & pr services - freelance journalism

adi_scripts – Script File Management

This plugin provides a system for managing external Javascript/jQuery script files from within TXP Admin.

There’s an admin tab, under Extensions, to organise your scripts and a tag to be used on your pages.

Quick start guide

  1. Install adi_scripts.
  2. Go to the “Scripts” admin tab, choose your directories & manage your scripts.
  3. Put the <txp:adi_scripts /> tag in the <head>...</head> section of your pages.

Scripts tab

Here you can:

Script directories

These are the directories where your script files are located.

In a new installation, certain directories are automatically listed – textpattern (TXP 4.5) or textpattern/vendors/jquery/jquery & textpattern/vendors/jquery/jquery-ui (TXP 4.6).

Enter new directories (path relative to website root directory, without leading “.” or “/”); or remove (i.e. “Forget”) directories which are no longer relevant.

Managing scripts

Script files have to be “managed” before they are included in pages. Script files, found in the directories selected above, are listed in the “Unmanaged scripts” section. Select (i.e. Manage) which scripts you want to be linked into your pages.

Markup to link your “managed” script files is generated by the <txp:adi_scripts /> tag.

You can restrict/tailor things if required:

Sorting

Drag & drop the scripts into whichever order you want & click “Save”.

Note that in TXP 4.5 drag & drop is implemented using a hosted version of jQuery UI, which requires a network connection. If you don’t see a “↕” symbol but do see a “Sort order” column don’t panic – you can still specify the order by tweaking the sort numbers.

Tagging

By default, <txp:adi_scripts /> will output links to all enabled scripts. You can modify this behaviour by assigning tags to scripts in admin and then using the ‘tags’ attribute in your code.

<txp:adi_scripts /> – will output all enabled scripts (i.e. tagging is ignored)
<txp:adi_scripts tags="tom" /> – will only output enabled scripts if they have been tagged with “tom”
<txp:adi_scripts tags="dick,harry" /> – will only output enabled scripts if they have been tagged with either “dick” or “harry”

To tag a script, add the tag into the mix and then assign it to a script. Unused tags will be removed.

Removing scripts or directories

“Forgetting” a script from the Managed List will delete it’s settings & relegate it to the Unmanaged List – i.e. it will not longer be included in pages by the <txp:adi_scripts /> tag.

The actual script files are not affected – they will still be present in the file system.

If you just want to temporarily disable a script, you can disable it in the admin tab.

HTML5

The <txp:adi_scripts /> tag is HTML5 aware & will output the <script>...</script> markup in the appropriate format.

Uninstalling adi_scripts

Simply delete the plugin & remove the <txp:adi_scripts /> tag from your pages.

Textpattern 4.6

adi_scripts v0.3 contains code to help you migrate from TXP 4.5 to 4.6:

Textpack

To install the Textpack, go to the plugin’s options page and click on “Install textpack”. This will copy & install it from a remote server. The number of language strings installed for your language will be displayed.

If the Textpack installation fails (possibly due to an error accessing the remote site), the alternative is to click the Textpack also available online link. This will take you to a website where the Textpack can be manually copied & pasted into the TXP Admin – Language tab.

Updates and corrections to the Textpack are welcome – please use the Textpack feedback form.

Additional information

Support and further information can be obtained from the Textpattern support forum. A copy of this help is also available online. More adi_plugins can be found here.

Version 0.3Download (Uncompressed) Textpack SupportTXP 4.5, 4.6