[All Adaptavist Apps]

Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

{move-to} Macro

Description

The move-to macro is

Excerpt

used to move a chunk of content from one place on the screen to another.

Why would you want to do this? Well, it allows you to move content stored on a page in to a Builder panel, that's why! (smile) Now you can add page specific content to sidebars such as a list of "see also" links, etc.

You can also use this macro to place less important content at the bottom of a page and then move it in to the desired position once the page loads - this allows you to have the most important content output near the top of the page resulting in better search engine rankings.

Warning

The move-to macro is incompatible with javascript driven macros

Usage

Code Block
{move-to:targetId|hidesource=false|showtarget=false}
stuff to move
{move-to}

{move-to:target=targetId|hidesource=false|showtarget=false}
stuff to move
{move-to}

Parameters

Property

Required

Default

Notes

default

(tick)

 

The HTML Id of the target

target

(tick)

 

Alternative way of specifying the target

hidesource

(error)

true

Whether the source should be hidden while the page is loading

showtarget

(error)

true

Whether the target should be revealed once the content has been moved over

Note:
The default and target parameters are essentially the same thing so you only need to specify one of them.

Examples

Defining the target

Before you can move content in to a target, you first need to define the target! The target can be any HTML element with an "id" attribute, but we recommend using a <span> or <div> element as shown below:

Code Block
{div:id=target1}You can even have default content in the target - stuff to show should nothing get moved to the target :){div}

Which results in:

Div
idtarget1
You can even have default content in the target - stuff to show should nothing get moved to the target (smile)

Note: The "id" needs to be unique on the page - never use the same id more than once per page! We recommend using descriptive names for id's such as "target-see-also-links", but for this tutorial we're going to be really lazy and just call them target1, target2, etc.

As you can see, it looks just like normal content, but that "id" means that you can move stuff in to it, which we'll disuss more further down this page. But before that, let's look at a few other things you can do with targets...

You can customise your target, for example:

Code Block
{div:id=target1|style=background-color:yellow;}
whoo! yellow background
{div}

Which gives:

Div
stylebackground-color:yellow;

whoo! yellow background

You get the general idea. (smile) In many cases, you will also want to hide the target until it has something moved in to it:

Code Block
{div:id=target1|style=background-color:yellow;display=none;}
this will only appear when something is moved here
{div}

The "dislay=none" bit hides the target.

Moving content to a target

 

Wiki Markup
Now we've got our target defined, we need to move some content in to it as follows:

{code}
{div:id=target2|style=background-color:yellow;}
this is my target
{div}

{move-to:target2}this is my stuff to move{move-to}
{code}

Which results in:

{div:id=target2|style=background-color:yellow;}
this is my target
{div}

{move-to:target=target2}this is my stuff to move{move-to}

 

Moving to a hidden target

 

As we mentioned earlier, you can define hidden targets that only appear when something is moved in to them:

Code Block
{div:id=target3|style=background-color:yellow;display:none;}
this will only appear when something is moved here
{div}
{div:id=target4|style=background-color:blue;display:none;}
this will only appear when something is moved here
{div}

{move-to:target=target3}make target 3 appear!{move-to}

As you can see, our "target4" (with the blue background) doesn't appear because nothing has been moved to it.

 

CSS Customisation

Not applicable for this macro.

Hints and Tips

None at present.

Frequently Asked Questions

None at present.

See Also