This site features how you can use a live _template, combined with data-forms that restructurize your data AND in one go set the tags of that page.
How does it work?
Step1: Setting up your API-access
This functionality makes use of the wikidot API. This API can give an authorization to a script to alter things on a wikidot page by means of a program or script. This API can be used by people that requested an API-key by the wikidot staff. Everything (also possible abuse) can be traced back to the key and thus the owner being me.
However to do these funky things yourself, you need a key and you need to be able to do some programming… So to spear you… I offer you the use of my key. So the adjustments of the tags will be done by my key and thus in my name.
Which brings me to the following:
1) I NEED TO BE A MEMBER OF YOUR SITE
2) YOU NEED TO ENABLE API ACCESS IN YOUR SITE MANAGER
If you are not willing to do this… well my solution stops here.
Step2: Adding stuff to your _template
So you invited me (normally I answer within 24H) and you set the API-access correctly. The question posed on the forum: "Is it possible to put your tags in together with filling out your data-form?" implies that data-forms are used.
So here are the adjustments that you need to do to your _template of a certain category:
Normally your _template has a form like this:
wikidot code to format how users will see the page
====
[[form]]
the whole form in wikidot syntax
[[/form]]
Your form has different fields and settings, let's say one of your fields is named "tags", and for obvious reasons this will be the field that holds the tags (separated by a space, if you wish to have tags consisting out of multiple words use a dash between the words like-so).
If your _template is done, save it. and add the tag "_autotagdone" manually to the template…this will prevent the page being redirected after saving the next time.
Now edit your _template again and add above the "====" this to your template
[[iftags -_autotagdone]]
[[module redirect destination="http://artizen.be/wikidot-api/autotag/field-to-tags.php?site=%%site_name%%&page=%%fullname%%&tagfield=tags"]]
[[/iftags]]
In this case replace the "XXXXX" in the code by the word "tags" since that is the name of the field we choose for the field that holds the tags.
Step3: Refreshing your tags after edits
You could stop here and it will work, if you would create a page the first time, the tags will be set automatically, however if you would decide to edit your page and change the content of the tag-field inside the form… the tags will not update. This is due to the tag _autotagdone… if you would remove it… the tags will be updated automatically.
Since this is a drag and since it is possible to use a button to set or unset tags you can add the following code to create that button. So clicking on the button will delete the tag _autotagdone, which will cause the page to redirect and to reset the tags.
Here is the basic code for the "button":
[[iftags _autotagdone]]
[[button set-tags -_autotagdone text="Tag update"]]
[[/iftags]]
That does not look like a button in most wikidot themes so if you would also add the following CSS code … you are set
[[module css]]
.mybutton{
background: #F4F4F4 url(http://themes.wikidot.com/local--files/rainbow-base/button_2.png) repeat-x;
border: 1px solid #DDD;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius: 5px;
padding:5px 5px;
margin:15px 5px 5px 0px;
font-weight:600;
}
.mybutton a{color:#333}
[[/module]]
Autotagging in Action
You can find a _template here
You can create any new page in that "autotag"-category here
Share the knowledge
You know a member from the wikidot community that might be interested in this… send him/her an invitaion to this site
I am always open to suggestions on perfecting this.
A - S I M P L E - P L A N by ARTiZEN a startingpoint for simple wikidot solutions.
hello
/* KC's Notebook */
Great 👌