Insert Source File
Access
{{reader}}
Favourite Pages
{{pageEntry.pageName}}
Signed in as {{currentUser}} {{avatar}}
Sign Out
Sign In as Different User
{{currentUserExtraOptions}}
OpenForum
Extensions
InsertSourceFile
Inserts a files contents into the page
Parameters
pageName - The page where the file is attached (optional. default = current page name)
fileName - The file to insert
Usage:
[{InsertSourceFile pageName="/OpenForum/Extensions/InsertSourceFile" fileName="data.json"}]
//OpenForum/Extensions/InsertSourceFile/data.json
{ "pageName": "/OpenForum/Extensions/InsertSourceFile", "title": "InsertSourceFile", "pageParent": "https://open-forum.onestonesoup.org" }
//OpenForum/Extensions/InsertSourceFile/renderer.sjs
var sourcePageName = extension.getAttribute("pageName"); if(sourcePageName===null) { sourcePageName = pageName; } var fileName = extension.getAttribute("fileName"); var data = ""+file.getAttachment( sourcePageName,fileName ); data = data.replace(/(xmp)/g,"((xmp))"); var editLink = "/OpenForum/Editor?pageName="+sourcePageName+"&fileName="+fileName; pageData = "[/"+sourcePageName+"/"+fileName+"]
<(xmp) class=\"panel\">$contents$(xmp)>"; pageData = js.getObject("/OpenForum/Javascript/Renderer","DefaultRenderer.sjs").render(pageName,pageData); pageData = pageData.replace("$contents$",data); return pageData;
An error has occurred.
{{OpenForum.errorMessage}}
See technical details
×
Error details.
{{OpenForum.error}}
×
{{OpenForum.alert.title}}
{{OpenForum.alert.message}}
×