Want to do basically add programatic logic to pages, based on passing parameters.
Say page 1 has a link to page to like http://.....page2?custom_param=value
Page 2 I want to get that parameter, and display only parts of the page that I want (basically hacking the macros include page and include excerpt to be more powerful). Would involve getting the parameter, and being able to do conditional logic as well.
Anyone know how? Seems like there were some questions asked in the forum but no answers.
If not, is there a way to write a custom macro to do parameter retrieval, and conditional display logic?
Are you writing an Atlassian Connect add-on? If so can you be more explicit in what you are trying to do?
Since you are on Confluence Cloud there is not much you can do. With the server version you could do this easily with a user macro.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
How would you do it as a macro? Do you have sample code? What about conditional logic, if x then display y?
Thx so much!!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Are you indeed using confluence cloud? If so you cannot do what you are asking. If you have the server version it is possible, but the cloud version is locked down.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Davin - I am using Confluence Server and would be interested in a code example for how to do this in a User Macro.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sure, here is an example of a user macro I created that when the macro is put on a page and the url ends with ?frameable=true then the page will be displayed without all the Confluence navigation and will only show the content of the page. The key part is on line 5 where it checks the URL querystring for the parameter "frameable".
## Developed by: Davin Studer ## Date created: 04/02/2015 ## @noparams #if($req.getParameter('frameable') == "true") #set ($p = '#') <style> ${p}header, ${p}footer, .ia-splitter .ia-splitter-left, ${p}labels-section, ${p}comments-section, ${p}sidebar-container, ${p}main-header, ${p}content .page-metadata {display: none !important;} ${p}main {margin-left: 0 !important; border: 0 !important; padding: 0 !important;} html, body, ${p}full-height-container .ia-splitter, ${p}main, ${p}content, ${p}main-content {height: 100% !important; padding: 0 !important; margin: 0 !important; box-sizing: border-box !important; position: absolute !important; top: 0 !important; left: 0 !important; width: 100% !important;} body {background: ${p}FFFFFF !important;} ${p}main-content {padding: 0px 10px 0px 10px !important;} </style> #end
If you wanted the pass a varible into a user macro through the querystring you could do this. You now have a variable called $myVar that can be used in your user macro.
#set $myVar = $req.getParameter('parameter')
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.