{live-template}
Plugin: Scaffolding Plugin, from version 2.2.x
Imports and renders the current version of a template.
Description
Essentially, this macro takes the text content of a Page Template and render that text in the context of the current page. It doesn't matter if there is are any Scaffolding macros on that template or not, it just renders the text as wiki text. This is different than creating a page with a template as in the built-in system because that will copy-n-paste the text in once, but if you update the template, the page you created with the template will not get updated.
Usage
Parameters
| Name |
Required |
Default |
Description |
| [default]/name | | | The name of the page template to import and render. |
Examples
You have a set of products and want all the product pages to have a similar structure. Here are the steps:
Create the template
- First, create a new Page Template (Browse Space > Advanced > Templates > Add new template)
- Then put something like this as the template content:
- Save the template with a name of 'Product Template'
Create the product page
- Now, add a new page
- As the page contents, put the following:
 | Note! This is the name of the template, not the scaffold! |
- Save the page (as, for example, 'Widget 1')
- Once it's saved, you'll be asked to enter the details for the 'Title', 'Cost' and 'Shipping' fields.
- Repeat ad-nausium for all of your products.
Update the original template
After a while, you decide you really want the costs to be listed before the summary. Also, you'd like to specify a release date.
- Edit the 'Product Template' template (Browse Space > Advanced > Templates > Edit)
- Change the text to the following:
- Save your changes and check your product pages. You will need to edit them and fill in the release date for each.
Recipes
I'm getting
with the live-template macro under Confluence 2.3.1, Scaffolding Plugin 2.3-dr4. Any idea how to fix/debug that?
the exception i'm getting is
"Error formatting macro: live-template: java.lang.IllegalStateException: zip file closed"
This is due to a bug in Confluence itself relating to plugin loading. It was fixed in 2.4.3, so upgrading would be the best solution.
If you can't do that at the moment, try the following:
These may help. Upgrading the the best long-term solution however.
installing atlassian-plugins-2007-01-24.jar did the trick as well (see [http://jira.atlassian.com/browse/CONF-7725])
Hi
I get an intermittent error (getting often) "Page Not Found" everytime I save a page that has a live-template macros (more than one within page). These live templates also have other scaffolding macros in it like text-data, number-data, date-data, etc.
Hope you can help me out.
Thanks,
Mel
PS: I'm new to this and I'm not really tech savy so please help
Hi Mel,
I haven't seen that particular problem before. Could you create a bug report here and put as much detail as possible about the problem. Screenshots, server log files and the actual macro code being used is very helpful.
Thanks,
David
Hi David
I have created the issue SCAFF-141 for this. Hope you find it useful.
Looking forward with great anticipation
Thanks
Mel
I'm using this functionality in a situation where new pages are created using a template that just has a live-template macro in it. The live-template calls on a template with scaffold data. It works great, but whenever a change is made to scaffold data, there is no way to see the change. The page change history just shows the live-template code, and there are no visible changes.
Below is the template code used for new pages.
{live-template:Engagement Template - Scaffold} {HTMLcomment} ****** Instructions ****** When Creating a New Page, enter a Page Title above in the "New Page" field and click "Save". You will then be able to enter your project information. ************************** {HTMLcomment}Long story short, how can I see the change history of the scaffold data fields?
Thanks!
Shawn
The change history is displayed through the standard 'view page history' link, but as you noted, you won't see any changes listed if you view the 'diff' of the changes, since the actual page text doesn't change. Currently there isn't any way to highlight changes explicitly (essentially, it would require an HTML diff of some sort, and there simply hasn't been time to try to implement one).
Ah ha! I didn't even notice that link before. Thanks for the quick response!
Shawn
We are using confluence as a application framework ... and we'd like to remote deploy our "application" programmatically.
That includes pages and templates. We use this (the live-template) macro to do most everything. The problem is that I can't remotely deploy Global or Space templates. What I'd like to do have live-template be able to reference (and use) a page as a template. What's important is that the end-user cannot see the "template page".
Let me know if you think this is a reasonable addition to live-template, and I will create a feature request. I believe that I can code it up myself if you approve.
Ki
At first, it would seem that letting live-template pull it's markup from any regular page is a simple thing, however it quickly becomes a security risk. If you can use {live-data} to grab the content of any page, in any space, even if the current user doesn't have permission to use it, it could be used to pull secure data from any location, if the user knows the space key and page name...not great.
I think that your 3rd point is actually the simplest and most secure option - creating a SOAP service to let you create a space or global template.
I am in the unfortunate position of being relatively new to confluence and very new to the scaffold plug-in so my apologies if this falls into the "stupid newbie" category.
I am trying to create a live-template for a Product and part of that template will list the know issues (held in JIRA) for that Product. As each Product will have a different JIRA URL I was trying
to get the following to work:
{jiraissues:url={text-data:JIRAURL|type=line}{text-data}}But to noavail.
Can Scaffolds feed text-data into other macros? If not, are there alternative mechanisms to achieve my requirements?
Thanks in advance,
N.
Hi neil,
I had to use the replace-and-render macro to acheive this:
{replace-and-render} {replace-item:%jiraid%}{get-data:customer-jiraID}10021{get-data}{replace-item} {replace-body} {jiraissues:url=https://www.myjira.com/jira/sr/jira.issueviews:searchrequest-xml/temp/SearchRequest.xml?pid=%jiraid%&type=5&type=7&type=3&status=1&status=3&status=10000&status=10002&status=10003&status=10005&status=10006&status=10007&status=10008&status=10010&status=10011&sorter/field=priority&sorter/order=DESC&sorter/field=issuekey&sorter/order=ASC&tempMax=1000&os_username=xxxx&os_password=xxxx|columns=priority;status;summary;assignee;updated| cache=off} {replace-body} {replace-and-render}Hope this helps.
You can also use the report-on macro, like so:
{text-data:JIRAURL} {report-on:injected=true}{jiraissues:url=%data:JIRAURL%}{report-on}Is there a way to specify a global template in live-template? The idea is that I could create a single global scaffolding template that could be used by many people in many spaces. If there were any problems or changes needed, I would only have to make a template change in a single place, instead of in many spaces.
Thanks!
It's supposed to allow you to specify a global template. There was a bug in a couple of versions which prevented that, however, but I believe it has been resolved with the latest.