105: Advanced Parsing

From Uncyclopedia, the content-free encyclopedia
Jump to navigation Jump to search
AuntJemima.png
Welcome to Aunt Jemima's Templating Academy!

Your comprehensive guide to Templates on Uncyclopedia.

Perl is what makes this website go 'round.

Did you know that? Aren't you smart!


You can insert youtube videos with an XML template, butt videos should really be reserved for special occasions, like a presidential inauguration.

Magic Words

Magic Word templates are the wiki standard code for inserting frequently used information onto pages and templates.

Aside from signing your username and inserting a timestamp with the correct number of tildes, you can use Magic Words to insert variables determined by the server or URL.

For Example:

Remember the {{Nigga Please}} template?

It uses a Magic Word template to create an 'Edit This Page' button that works no matter what page you put it on by combining it with an external link.

The code looks like this:

[{{fullurl:{{FULLPAGENAME}}|action=edit}} <span style="color:#acf">add some actual "content" to it.</span>]

There is a better way to add a button like this with different code, but we just hate to spoil all of your fun.

Random Options

One Fierce Beer Coaster icon.jpg
This user wore velour flares until the late eighties.
One Fierce Beer Coaster icon.jpg

The magnum opus of wiki coding is the Random Generator.

{{User Bloodhound Gang Fan}} uses a random template to insert clever lyrics from Bloodhound Gang songs. You're welcome.


Crystalturd.jpg :: THE RANDOM POSTCARD ::

This template has its own Random Image Generator.
That's how you get a different image every time the page loads.
-Your Mom


Let's take a closer look, the Random Image Generator is located here: {{:User:Zana Dark/WAM}}

This is the code:

<choose><option>[[File:After.jpg|Sexy After|100px]]</option><option>[[File:Saget.jpg|God Saget|100px]]</option><option>[[File:Awesome.jpg|Just Awesome|100px]]</option><option>[[File:CrockettT.jpg|How I Know You're Gay|100px]]</option><option>[[File:BarbieFinger.jpg|Love is a 4-Letter Word|100px]]</option><option>[[File:CheesyJesus.jpg|Cheesus Chrust|100px]]</option><option>[[File:FrigginIdiot.gif|Friggen Idiot|100px]]</option><option>[[File:Hateyou.jpg|Even kittens in a basket hate you.|100px]]</option><option>[[File:Pornflakes.jpg|The best way to start your day...|100px]]</option><option>[[File:Unposter.PNG|You Want It. You know you do.|100px]]</option><option>[[File:Yourface.JPG|You're an ugly mofo!|100px]]</option><option>[[File:Hippiechicksmgif.gif|GIMME MY MONEY!!!|100px]]</option><option>[[File:Mr-t.jpg|I pity this template!|100px]]</option><option>[[File:Panda Mao.jpg|ROFLMAOPANDA!|100px]]</option><option>[[File:Aljolson.jpg|Saywhanah???|100px]] </option><option>[[File:Catthulhutar.jpg|OCTOPUSSY!!!|100px]]</option></choose>

And here is the simplest random generator you can use:

<choose><option>OPTION1</option><option>OPTION2</option></choose>

How to Design

You don't need to know anything about design principles, just copy the look of other famous websites.

Check It Out:

{{SN}} - Twitter

File:Twitter-logo.png AJTA/DTwitter (official) @twitter

{{SN|FB}} - Facebook

17 Likes   5 CommentsFacebook-Icon.png FacebookLogo.png
Mark-Zuckerberg.jpg
Mark Zuckerberg AJTA/D • Menlo Park, CA
FBiconLike.png Like   FBiconComment.png Comment   FBiconShare.png Share

{{SN|N}} - Newspaper

The New York Times
Volume 10, 3rd EditionTopic of the DayAJTA/D

{{SN|IG}} - Instagram

AnalRape.png
+ Follow
InstagramIcon.png instagram four months ago
❤ 54 likes   💬 27 comments
Instagramtextlogo.png

{{SN|YT}} - YouTube Templating/Y


Look at the {{Dude Abides}} template:

DudeAbides.jpg
Job Well Dude
Your rug really tied this room together. Thanks.nerd, lol

Can you tell the difference? We thought maybe you'd be sick of the other template by now so we made it all nice and 'ruggy' for you.

Theatrical Movie Poster
HarryPothead.jpg
Release DateSummer, 2009
GenreFamily
StarringRobert Downey Jr.
FeaturingWhitney Houston
DirectorDoug Liman
ProducerCourtney Love
Budget200 Pounds


{{#css: div #RUG{ background-color: #464646; 
background-image: linear-gradient(30deg, #555 12%, transparent 12.5%, transparent 87%, #555 87.5%, #555),
linear-gradient(150deg, #555 12%, transparent 12.5%, transparent 87%, #555 87.5%, #555),
linear-gradient(30deg, #555 12%, transparent 12.5%, transparent 87%, #555 87.5%, #555),
linear-gradient(150deg, #555 12%, transparent 12.5%, transparent 87%, #555 87.5%, #555),
linear-gradient(60deg, dimgray 25%, transparent 25.5%, transparent 75%, dimgray 75%, dimgray), 
linear-gradient(60deg, dimgray 25%, transparent 25.5%, transparent 75%, dimgray 75%, dimgray);
background-size:25px 65px; background-position: 0 0, 0 0, 20px 60px, 20px 60px, 0 0, 20px 60px;
} }}{{Info/CSS}}<div class="infobox" style="border: 5px dotted blanchedalmond; background:burlywood;padding:2px; margin: 10px auto; min-width:290px; max-width: 420px; border-radius:23px; float:{{{f|none}}}; margin: {{#if:{{{f|}}}|{{#ifeq:{{{f|}}}|none|5px|5px {{#ifeq:{{{f|}}}|right|0|1em}} 5px {{#ifeq:{{{f|}}}|left|0|1em}}}}|5px auto 5x auto}}; clear:{{{clear|{{{f|none}}}}}}">
{| cellspacing=0 cellpadding=0 style="margin:0 0; background: #300;background: linear-gradient(160deg, saddlebrown 0%, #300 40%, #111 70%, #000 100%); color: #{{X|PSM}}; border: 4px dashed sienna; padding: 2px; font-size: 100%; width: 100%;padding:4px"
| style="background: black; border: 5px dotted #444; padding: 3px" | [[File:DudeAbides.jpg|center|100px|border]] 
|style="width:4px"|
| id="RUG" style="text-shadow: 1px 1px 2px #000; border: 3px dashed darkslategray; padding: 8px; color: #{{X|DKW}}; font-size: 14px" |'''Job Well ''Dude'''''{{...}}
<div style="text-align: center; padding-top:3px; font-size:13px; color:#{{X|CP}}">Your rug really tied this room together.  '''Thanks.''' {{#if:{{{1|}}}|~ {{CL|#{{X|PYL}}|User:{{{1}}}|{{{1}}}}}| }}</div>
|}</div><noinclude>

This is not the same as {{tl|DudeAbides}}.

Use this template to thank your fellow users for helping with an article for which you're the primary author.

Also, if you just want to insert obscure Coen Brothers references into things for no apparent reason.

[[Category:Award templates|{{PAGENAME}}]]
</noinclude>
<insert name here>
JT-hair.jpg
All About Me
Birthday:
December 25th, 0
Gender:
Bizzee Beever
Orientation:
Left
Location:
Around here, somewhere
Occupation:
Editorial Engineer
Religion:
Digambara
Politics:
Green Party of Canada
My Blog:
Blogger
Email:
r0manf1ng3r@the.com
Chat Info:
Nerds-R-Us
Myspace:
MySpace
Facebook:
FaceBook
Twitter:
Twitter
Instagram:
Instagram
Flickr:
Flickr
Wickipedia:
Wikipedia
Throw another stick of butter
in there, BROTHERRR!!!
MoreButter.jpg

The IF Parser

The {{{#if}}} parser is a conditional statement function that you can implement when coding your templates.

The IF parser in the template above looks like this: {{#if:{{{1|}}}|<br>~ [[User:{{{1}}}|<font color=aliceblue>{{{1}}}</font>]]| }}.


IF we simplify the IF parser, it looks more like this: {{#if:{{{1|}}}|{{{1|}}}}}, which looks a bit like an ugly mug in ASCII.

IF we assign a default to the variable and add some text, it looks like this: {{#if:{{{1|}}}|~ {{{1|ALTERNATE}}} text/code.}} and now renders as text that only shows up if there is a parameter passed to the template.

This can be used to build advanced layouts that only show up depending on parameters and variables. I really hope you've been taking good notes, I just hate repeating myself.

For Example:

Check out the {{Info}} templates:

These templates use IF parsers to hide themselves when parameters are not needed and can be completely altered to suit your article's needs.

The documentation for these templates can be found on their respective pages.

Here is one that you can spork for your userpage:

{{Info/User
|name = USERNAME...
|image = 
|size = 
|caption =
|(birth)
|(gender)
|(orientation)
|(location)
|(occupation)
|(religion)
|(politics)
|(blog) 
|(email)
|(chat)
|(myspace)
|(facebook)
|(twitter)
|(instagram)
|(flickr)
|(tumblr)
|(Wikipedia)
|(website)
|name2 = 
|image2 = 
|size2 = 
|caption2 = 
| * note
}}

The Switch Parser

The {{{#switch}}} parser SWITCHES out entire templates based on parameters and variables.

{{{PN}}} is an award template that makes use of the SWITCH parser to be an infinite number of award templates in one, but they are super top secret!!!


CONGRATULATIONS!
You have been awarded the secret purple nurples for outstanding acts of uselessness!
[[{|]] [[|}]]


{{{PN|1}}} and {{{PN|2}}} display differently.

Note: We have ways of telling if you just start handing out awards to yourself and your friends without being qualified to do so. Just saying.

The simplest of SWITCH parsers bears an uncanny resemblance to the IF parser above:

{{#switch:{{{1|}}}| 1 = {{TEMPLATENAME/1}}| 2 = {{TEMPLATENAME/2}}}}

This parser looks for the first parameter passed to the template and then SWITCHES to a different template based on the number.

The default variable is always: #default = or 0, I hope that's not confusing for you.

Try It Yourself!

Sure, these concepts may seem simple at first but templating gets exponentially more complicated when you use both the IF and SWITCH parsers together, so enjoy!

There are probably a whole bunch more parsers around here somewhere, but those are really the only two that matter. Click the link below to continue:

106: 1337 Templating >>