Content Templates
started by: ubivisubivis
on: 1162177033|%e %b %Y, %H:%M %Z|agohover
number of posts: 8
rss icon RSS: new posts
summary:
Add the ability to template content in addition to entire pages.
Content Templates
ubivisubivis 1162177033|%e %b %Y, %H:%M %Z|agohover

I couldn't find discussions on this so forgive me if it's been brought up already. I think it would be useful to add a feature like in wikimedia where I can create a template for a chunk of a page.

Example.
Lets say I want all users of my website to use a consitent
format for creating glossary entries such as:

NOI - Net Operating Income

Is the gross operating income, less the operating expenses.

But I don't want them to have to write the code:

[[div style="width:500px;"]]

+++ NOI - **Net Operating Income**
[[div style="widht:500px;position:relative;top:-20px"]]
Is the gross operating income, less the operating expenses. 
[[/div]]

[[/div]]

Every time they need to make an entry. Instead I could define a template, and then use it like:

[template:glossaryEntry
|Accronym=NOI
|Full_Name=Net Operating Income
|Description=Is the gross operating income, less the operating expenses.
]

What do you think?

unfold Content Templates by ubivisubivis, 1162177033|%e %b %Y, %H:%M %Z|agohover
Re: Content Templates
michal frackowiakmichal frackowiak 1162196309|%e %b %Y, %H:%M %Z|agohover

Good idea, I was thinking about more or less the same. Unfortunately there is some "naming conflict" - the word "templates" is already used here and means "templates for newly created pages" which can be configured from the Site Manager and by creating pages like template:name-of-template.

I think however that I could easily extend the [[include]] tag to take parameters just as you have described. Perhaps the syntax might be a bit different but it should work ~ the same.

Ok, I have put it on the TODO list. Should be ready in a couple of days.

regards - michal


Michał Frąckowiak @ Wikidot Inc.
Visit my blog at michalfrackowiak.com

unfold Re: Content Templates by michal frackowiakmichal frackowiak, 1162196309|%e %b %Y, %H:%M %Z|agohover
Re: Content Templates
ubivisubivis 1162307667|%e %b %Y, %H:%M %Z|agohover

Wow, couple of days! Can't even get that kind of service when you pay for it most of the time ;-)

unfold Re: Content Templates by ubivisubivis, 1162307667|%e %b %Y, %H:%M %Z|agohover
Re: Content Templates
michal frackowiakmichal frackowiak 1162331354|%e %b %Y, %H:%M %Z|agohover

Done! :-D

http://www.wikidot.com/doc:wiki-syntax#toc32

MediaWiki offers some scripting elements but I have found it a bit complicated… What I have implemented is a simple substitution, without any extra options (yet?).
If you have any idea how to improve the [[include]] command (i.e. if there is anything you need, because I am trying to implement things that people actually need), just post it here!

michal

BTW: I really DO care about this project (i.e. Wikidot) and treat it both as a community project and a business project. And I have quit my current job to concentrate on Wikidot ;-) I hope that more and more people can benefit from this!


Michał Frąckowiak @ Wikidot Inc.
Visit my blog at michalfrackowiak.com

unfold Re: Content Templates by michal frackowiakmichal frackowiak, 1162331354|%e %b %Y, %H:%M %Z|agohover
Re: Content Templates
ubivisubivis 1162337194|%e %b %Y, %H:%M %Z|agohover

You are my HERO! It works as advertised ;-)

I'm just going to put in a bit of an example here for anyone interested, if you want you can just copy and paste it into the doc if you think it's useful (I'm an intermediate user with Wiki's so I could put it all together myself but I know some beginners may be scratching their heads).

Okay, to get common layouts and styles (which I will call content templates) to work follow these fairly simple steps:

  • Create a new page with a meaningful name for your content template
    Example: http://yourWiki.WikiDot.com/GlossaryEntry
  • Next populate that page with the content layout and styles that you
    want substituting the logical chuncks of content with variables like so:
+++ {$acronym} - **{$meaning}**
[[div style="widht:500px;position:relative;top:-20px"]]
{$definition}
[[/div]]

The {$someVar} are the variables.
  • Save this and GlossaryEntry page should look like this:

{$acronym} - {$meaning}

{$definition}


Now here comes the real magic. Go to the page where you want
to use your template, in this case it would be your glossary page
http://yourWiki.wikidot.com/glossary, and type the following code:
[[include GlossaryEntry acronym=GUI
|meaning=Graphical User Interface
|definition=Is a particular case of user interface for interacting with a computer which employs graphical images and widgets in addition to text to represent the information and actions available to the user. [Source: Wikipedia]
]]

When you save this and view it, you will see something like:

GUI - Graphical User Interface

Is a particular case of user interface for interacting with a computer which employs graphical images and widgets in addition to text to represent the information and actions available to the user. [Source: Wikipedia]

Happy Templating!

last edited on 1184170468|%e %b %Y, %H:%M %Z|agohover by gerdami + show more
unfold Re: Content Templates by ubivisubivis, 1162337194|%e %b %Y, %H:%M %Z|agohover
Re: Content Templates
GoonGoon 1162383401|%e %b %Y, %H:%M %Z|agohover

That's marvellous and works perfectly! Let's celebrate this HERO you talked about. :-)

unfold Re: Content Templates by GoonGoon, 1162383401|%e %b %Y, %H:%M %Z|agohover
Re: Content Templates
michal frackowiakmichal frackowiak 1162385661|%e %b %Y, %H:%M %Z|agohover

Wikidot users' meeting someday? ;-)


Michał Frąckowiak @ Wikidot Inc.
Visit my blog at michalfrackowiak.com

unfold Re: Content Templates by michal frackowiakmichal frackowiak, 1162385661|%e %b %Y, %H:%M %Z|agohover
Re: Content Templates
GoonGoon 1162387366|%e %b %Y, %H:%M %Z|agohover

Yeah, with all the bells and whistles - waffles, punch and funny hats … ;-)

unfold Re: Content Templates by GoonGoon, 1162387366|%e %b %Y, %H:%M %Z|agohover
new post
Unless stated otherwise Content of this page is licensed under Creative Commons Attribution-Share Alike 2.5 License.