NewPage Button

By GoVeganGoVegan

Description

Quite similar to the built-in NewPage Module, this snippet provides a way for you to create (or jump to) new pages.

The built-in module has three limitations:

  1. The inability to create hidden pages;
  2. The inability to display a button only;
  3. The inability to create new pages on other wikis.

These limitations don't exist with the NewPage Button, which allows the use for a more powerful Wikidot applications.

This button comes with one shortage of the inbuilt NewPage Module: the ability to specify static templates.

Attributes

The NewPage Button extends upon the NewPage module — therefore, it has identical attributes to the built-in NewPage Module:

attribute required allowed values default description
name yes if new page uses a dataform, no if it doesn't any string none adds a default page name. If the category is autonumbered the pagename will be changed to the next number when the dataform is saved
category no name of a page category none forces the given page category by prepending the page name by the categoryname:
size no em, % or px 200px width of the displayed button
tags no space-separated list of tags none automatically adds given tags to created pages
parent no name of a page or category:page none automatically adds parent page to created pages
button no any string Create Page text which appears on the button
Extended Attributes
mode no manual none allows you to nest the NewPage Button within other modules (read more)
window no new, false false allows you to open the page in a new window
text no any string Create Page text which appears on the button (overrides button variable)
site no full site name (i.e. http://www.wikidot.com/) current site creates new pages to the given website
edit no true, false true if false, will jump to the page without force editing it
title no any string or false page name sets the page title. If “false”, the /title/ code will be removed from the URL
url_end no any string none appends the string you specify to the end of the URL (for advanced users)

Note: to use the / character in the new page's title, you must type %252F (escaped version of an escaped /).

Code

This code will attempt to create the page "wikidot". The page's title must contain the word "smile" in it.

[[include :snippets:newpage-button
|name=wikidot
|title=Smile
]]

In action

Create Page

Manual Mode

The NewPage Button uses technologies from the CSS Module to automatically apply the button's appearance. Sadly, Wikidot doesn't yet allow nesting modules (such as having a CSS Module inside a ListPages Module). This means that under normal circumstances, you can't use the NewPage Button inside of a ListPages Module.

However! You CAN use the NewPage Button inside other modules, but only through the use of “Manual Mode”. Manual Mode removes the inbuilt CSS Module from the NewPage Button. Doing this means that you need to manually apply the button's CSS by using the CSS module outside of the ListPages Module:

[[include :snippets:npb-css |custom=]]

[[module ListPages ListPages attributes here]]
[[include :snippets:newpage-button
|mode=manual
|name=wikidot
|title=Smile
]]
[[/module]]


Thanks to tsangk for this great snippet: conditional-blocks


text above inserted with:

[[include :snippets:if START |unique=1|type=equal|var1=%%name%%|var2=conditional-blocks]]
**##red|Thanks to tsangk for this great snippet:##** [[[code:conditional-blocks]]]
[[include :snippets:if END]]



Other snippets posted by GoVegan

MP3 Player - 06 Jun 2021 03:45
Extended NewPage Module - 15 Jul 2014 15:08
Specific Users Only Include - 24 Jul 2013 06:16
iframe Redirect - 30 Jul 2012 22:41
Per Category CSS Module - 06 Mar 2012 03:38
Video Player - 16 Feb 2012 01:50
Remove Duplications - 16 Feb 2012 01:39
RegExp Date Wizard - 16 Feb 2012 01:39
"Random Page!" link - 16 Feb 2012 01:35
Quoted Blockquotes - 16 Feb 2012 01:33
JavaScript Addition - 16 Feb 2012 01:14
iframe embed - 16 Feb 2012 01:08
Random Page - 18 May 2011 09:50
Redirect - 11 Feb 2010 10:00


Rate this solution

If you think this solution is useful — rate it up!

rating: +14+x
Add a New Comment
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License