Difference between revisions of "Code"

From StarMade Wiki
(Created page with "== html == You can use most of html and css flags in pages of mediawiki, except <a> . <div> are depreciated. You aren't supposed to use html when you make page or almost templ...")
 
m
Line 29: Line 29:
  
 
==== transculion ====
 
==== transculion ====
To transclude any source page within another target page, include the following code:
+
[[file=inclusion.png|left]]To transclude any source page within another target page, include the following code:
  
{{SOMEPAGE}}
+
<pre>{{SOMEPAGE}}</pre>
  
 
Whenever the target page A with this code is rendered, the engine will include in that place not the code itself, but the entire content of the source page B, SOMEPAGE.
 
Whenever the target page A with this code is rendered, the engine will include in that place not the code itself, but the entire content of the source page B, SOMEPAGE.

Revision as of 00:38, 29 July 2018

html

You can use most of html and css flags in pages of mediawiki, except <a> .

are depreciated.

You aren't supposed to use html when you make page or almost template.


Mediawiki function and variables

If

This function evaluates a test string and determines whether or not it is empty. A test string containing only white space is considered to be empty.

value if test string is not empty second parameter

switch

This function compares one input value against several test cases, returning an associated string if a match is found.

default result


Variable

transculion

leftTo transclude any source page within another target page, include the following code:

{{SOMEPAGE}}

Whenever the target page A with this code is rendered, the engine will include in that place not the code itself, but the entire content of the source page B, SOMEPAGE.

parameters =

If you write a template with :

'''A little thank you...'''
for {{{1}}}.
hugs, {{{2}}}

On the page you write : Template:Thankyou

you will get : A little thank you... for Me. hugs, all your effort


All of this are copy/past of https://www.mediawiki.org/ (google it !)


The Database code

It is the main scrpits i used for the database : the database is write in

  1. switch :
  |block1 #switch :
             |type 1
             |type 2
             |type 3
             |type 4
             ...
  |block2 #switch :
             |type 1
             |type 2
             |type 3
             |type 4
             ...
  |block3
  ...

With an adittionnal switch for first letter (because less than 100 cases in switches are expected) There is 2 file main and sub because you can't loop in the request : If i request what is controlling this block, sometimes i need to request at the same time icons of this returns. the Sub database are parameters of block who can request secondary info (uch controlling, controlle,) and too heavy parameters (descrption) (only allowed if name, icon , etc.. arn't in same Db : Main)

So , there is Main and Sub (ie tempalte:Db/Version/0.201.133/Main tempalte:Db/Version/0.201.133/Sub ) And 2 similar tempalte to query on it (to avoid loop in double request) : Db and DbSub Dbparser make some preformating ( ie 0 >>> No or --- ) and choose the good sub template (Db or DbSub) following the type requested.

If you make template, you can use Dbparser for classic (no pain) request, Or if you need "request on request" you have to use specifcally Db or DbSub and format the parameter returned yourself.