This is version . It is not the current version, and thus it cannot be edited.
[Back to current version]   [Restore this version]

The insert page plugin allows you to insert the contents of one page into another.

This short plugin started as a way to simplify a complicated page. Our home wiki has a schedule at the top, my links in the middle and my girlfriend's across the bottom. Each section is a table and between the tables we have some animated gifs. Needless to say, this made the page confusing to edit. With this plugin I can now do something like this:

[{INSERT com.hurlbert.jspwiki.plugin.InsertPagePlugin pageToInsert=HomeSchedule}]
[{INSERT com.hurlbert.jspwiki.plugin.InsertPagePlugin pageToInsert=HisLinks}] \\ \\
[{INSERT com.hurlbert.jspwiki.plugin.InsertPagePlugin pageToInsert=HerLinks}] \\

Enjoy - Scott Hurlbert

Very good. I will rewrite the syntax a bit, but expect to see something like this in the next release.

-- JanneJalkanen

Hey great! As for the syntax, I'm relatively new to java and this is my first public offering to the JSPWiki so I look forward to seeing the changes. I'm still at that stage where I'm learning everyday. Thanks

-- ScottHurlbert

There's now a InsertPagePlugin in 2.1.37. Thanks, Scott (and AlainRavet, who also suggested the same thing). You can see an example of it running at my weblog.

What is the basic syntax ?? -- OlivierVit

[{INSERT InsertPagePlugin pageToInsert=EditUserHelp}] this doesn't work, how can I use it? -- SebastianPetzelberger

I'm having problems with the 2.1.37 plugin and getting it to include some pages. I can't get it to include my Main or About pages or my FosterSchucker page. It seems to have something to do with including a plugin. Has anyone else seen this? -- FosterSchucker

package com.hurlbert.jspwiki.plugin;

import com.ecyrd.jspwiki.*;
import com.ecyrd.jspwiki.plugin.*;

import java.util.*;

 *  Inserts a WikiPage into another WikiPage.
 *  <P>
 *  <B>Parameters </B>
 *  <UL>
 *    <LI>pageToInsert - The page to be inserted.
 *  </UL>

public class InsertPagePlugin implements WikiPlugin
	public static final String PARAM_NAME_OF_PAGE_TO_INSERT = "pageToInsert";

	public String execute( WikiContext context, Map params )
	throws PluginException
		WikiEngine engine = context.getEngine();
		//  Parse parameters.
		String nameOfPageToInsert = "";
		if( (nameOfPageToInsert = (String)params.get(PARAM_NAME_OF_PAGE_TO_INSERT)) == null )
		    return "no page found";
		// We should now have a page to insert.
		 WikiPage wpage = engine.getPage(nameOfPageToInsert);
		// Lets make sure we got a page
		if( wpage == null )
			return "'" + nameOfPageToInsert + "' page not found";
			return engine.getHTML( context, wpage );

Add new attachment

Only authorized users are allowed to upload new attachments.
« This particular version was published on 13-Oct-2004 18:41 by JanneJalkanen.