So I'm trying to do something along the lines of:
#set($paramversion = {include:globalpages:_TemplateVersionCurrent})
I want the contents of the page "_TemplateCurrentVersion" to be set as a variable so that I can use it throughout the macro.
I have tried merely using {include:globalpages:_TemplateVersionCurrent} in the places that I want it, which works to an extent, except that it also includes the <p> tags, which is no good if I am using it for a URL (as it returns "<p>v10</p>" rather than "v10"). This gets me http://mydomain.com/latesttemplates/<p>v10</p> instead of http://mydomain.com/latesttemplates/v10.
So I want to know if it's possible to strip the <p> tags out and store it is a variable.
Thanks
If you want to remove the HTML tags, you could try something like this:
#set( $html = "<p>xxx</p>" ) #set( $plain = $html.replaceAll("\\<.*?>","") ) $plain ## should give just "xxx"
...or similar.
This is clearly not foolproof but might be almost good enough.
Hey David,
You are on to something. Technically what you've written is correct but it seems that when it comes to stripping out the code, it does not recognise the <p> tags when it's doing the .replaceAll function and so doesn't strip it out. This means that when it comes to putting in the URL, it still has the <p> tags in. I think it's because it doesn't see it as plain text until it reaches the URL.
Does that make sense?
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.