Iframe Navigation Macro

Last modified by Andreea Popescu on 2024/07/05 18:18

cogAllows you to add an iframe in the content of a page with links to change the website displayed in the iframe.
TypeDoc (Velocity Macro)
Category
Developed by

xwiki:XWiki.ThomasEveilleau

Rating
0 Votes
LicenseGNU Lesser General Public License 2.1

Description

Allows you to add an iframe in the content of a page with links to change the website displayed in the iframe (its an Iframe+ Macro)

Usage

#iframelink("URL" "Iframe Name" "Text displayed")
#iframelink("URL" "Iframe Name" "Text displayed")

#iframebox("Iframe Name" "Width" "Height")

Parameters definition

For the #iframelink Macro

NameOptionalAllowed valuesDefault valueDescription
URLnostringnoneURL of the website you want to display in your iframe
Iframe NameyesstringiframeName of the iframe you want to target
Text DisplayedyesstringlinkText displayed for the link

 

For the #iframebox Macro

NameOptionalAllowed valuesDefault valueDescription
Iframe NameyesstringiframeName of the Iframe
Widthyesint +px or percentage +%100%Width of the iframe
Heightyesint +px500pxHeight of the iframe

 

Example

* #iframelink("http://www.google.fr" "" "Google")
* #iframelink("http://www.yahoo.fr" "" "Yahoo")

----

#iframebox("" "100%" "500")

Result

iframeplusresult.png

Installation

This a Velocity macro. Since it's not bundled by default you'll have to copy/paste the following code to use it:

#macro(iframelink $url $target $text)
#if($target=="")
#set($target="iframe")
#end
#if($text=="")
#set($text="link")
#end
<a href="${url}" title="iframelink" target="${target}">${text}</a>
#end


#macro(iframebox $name $width $height)
#if($name=="")
#set($name = "iframe")
#end
#if($width=="")
#set($width="100%")
#end
#if($height=="")
#set($height="500px")
#end
<iframe name="${name}" width="${width}" height="${height}"></iframe>
#end

Get Connected