I'm using html-include to call a small php script and embedd the output into a confluence page (following the desctiption on https://confluence.atlassian.com/confkb/how-to-use-php-inside-confluence-pages-317197666.html).
It works fine and I see the output of the php script.
But is there a possibility to pass parameters from the URL of the confluence page (?variable=content) through to the embedded php script?
Have you looked at creating a user macro that holds the PHP script? That would give you the ability to have parameters/settings, plus access to page objects.
Thanks a lot. Since I'm totally new to Confluence I think I need a push in the right direction. I just checked the documentation of user macros and the examples from the documentation. The point which is not yet clear to me is, how to call the php script from within a user macro. Can I use the html-include macro within a user macro (if yes, how?) or is there a different way to do it?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I solved the problem. Found a posting in the community which explained how to call a macro from within a user macro and some other helpfull postings to solve the remaining poroblems.
Here is the summary just in case someone else has the same question:
I got the GET parameters from the url with
#set($foobar = $generalUtil.urlEncode($req.getParameter("foobar")))
Then I added the html-include macro pointing to my php script into a temporary page. Got the saved source for this temporary page and pasted it into my user macro where I then added ?foobar=$!foobar to the URL.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User macros are your friends, and very powerful. I have macros that also call Javascript to provide action buttons on the page while in view mode.
I wrote this article some time back, and need to add more:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Did you catch the news at Team ‘25? With Loom, Confluence, Atlassian Intelligence, & even Jira 👀, you won’t have to worry about taking meeting notes again… unless you want to. Join us to explore the beta & discover a new way to boost meeting productivity.
Register today!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.