By GoVegan
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:
- The inability to create hidden pages;
- The inability to display a button only;
- 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!
fi
woo
Packet Tracer showed steps to create,
Test
Hallo James!
I detecetd that I am not able to create automatically by click short pages with only title ( fixed-given), name(autonumbered), tags ( given) and parent.
And - important - the creator who has clicked on the button.
Ihave tested it on my home test site for the quiz/question problem :
http://helmuti-pdorf.wikidot.com/testq1:_start where i have testet the different ways to do so .
Target is to have a page created in the background and not to leave the "parent" ( or other button holding) page.
Is it possible to insert from the https://wikidot-proxy.obscurative.ru/doc:newpage-module the two extra attributes:
( the mode command could be difficult to solve.)
Attributes for AutoSave function
Service is my success. My webtips:www.blender.org (Open source), Wikidot-Handbook.
Sie können fragen und mitwirken in der deutschsprachigen » User-Gemeinschaft für WikidotNutzer oder
im deutschen » Wikidot Handbuch ?
Hey Helmuti!
I'll investigate it in the coming few weeks for you, things are a little busy at the moment.
Feel free to remind me if I forget :)
Hi James,
Thanks for the offer!
I tried to find out if there is an url-command (like the /tags/…/ or /parentPage/ ) /mode/save-and-refresh/ or so,….
but I am affraid - this is not possible to use.
Service is my success. My webtips:www.blender.org (Open source), Wikidot-Handbook.
Sie können fragen und mitwirken in der deutschsprachigen » User-Gemeinschaft für WikidotNutzer oder
im deutschen » Wikidot Handbuch ?
For attribute 'name', it says that it is required…
I can't see why using a dataform would change the need for a name to be defined or not. Is there any reason for this? :S
~ Leiger - Wikidot Community Admin - Volunteer
Wikidot: Official Documentation | Wikidot Discord server | NEW: Wikiroo, backup tool (in development)
Umm, according to the history, Rob changed it to say that… I don't understand it either.
Rob, could you please shed some light here for us?
Curiously I've only just noticed the last couple of posts.
Presumably you haven't tested this which is why you don't understand why I made the change. If you use this (brilliant) button to create a page in a category that uses a dataform it must have the name= with a value otherwise you just get the standard page editor. I have no idea why.
Example
On the page http://vineyard.wikidot.com/bands I have 3 newpage buttons which should create a page in the band category. Do try each of them.
This code using the name= with a value works fine:
This one without the name= just gives the standard page editor.
Even if you put name= in without a value it still just shows the standard page editor.
Rob Elliott - Strathpeffer, Scotland - Wikidot first line support & community admin team.
At the time of this post (392 days after the birth of NPB), there are 45 pages on Wikidot using this technology!
A couple of questions:
~ Leiger - Wikidot Community Admin - Volunteer
Wikidot: Official Documentation | Wikidot Discord server | NEW: Wikiroo, backup tool (in development)
Options » Backlinks on each page gives a list of all pages that include the current page. I'm pretty sure a live template only counts as one inclusion.
BMC Creative | RoaringApps | @brycecammo
Bryce is right, I went to the applicable include page, and clicked on the backlinks.
You could count each inclusion listed, but I just copy-pasted into a text editor, and did a search count on the number of “new line characters” in the document, plus 1 (for the first included page).
Fortunately for the purpose of this exercise, Live Templates and Top/Side Navigators count for one page each.
Ah, there's a new section of the Backlinks tool I've never seen before!
Cool! :)
So this counts CSIs too? That is AWESOME.
~ Leiger - Wikidot Community Admin - Volunteer
Wikidot: Official Documentation | Wikidot Discord server | NEW: Wikiroo, backup tool (in development)
I just starting using this and find it very useful. I have one suggestion for a minor CSS tweak. I prefer the button text to be centered in the button. If you would like this as well, add this to the page containing your include:
I was going to suggest that James make this change to his CSS, but that's a bit selfish if others prefer it the way it is. Adding it as a css module to your own site won't "break" the layout on existing sites that are using this very nifty snippet.
If you want full control over the button CSS, just copy James' entire framework above and place it in a css module on your site and make whatever other changes you like.
-Ed
Community Admin
Hi Ed, sorry for the late response!
I've just inserted the text-align: center code manually… It WAS supposed to be centred!
Thanks James, this is very useful.
Rob Elliott - Strathpeffer, Scotland - Wikidot first line support & community admin team.
It's a button??? (lol)
Not sure what you're laughing at… was my comment in the history funny, or did you have it right all along and I wasn't meant to edit it? xD Am confused. :)
~ Leiger - Wikidot Community Admin - Volunteer
Wikidot: Official Documentation | Wikidot Discord server | NEW: Wikiroo, backup tool (in development)
I'm laughing because I'm stupid!!!
Your comment in the history did make me laugh =D
LOL XD
~ Leiger - Wikidot Community Admin - Volunteer
Wikidot: Official Documentation | Wikidot Discord server | NEW: Wikiroo, backup tool (in development)