Set Up An Infobox — default picture

Posted by Brunhilda on 20 Dec 2009 09:09, last edited by James Kanjo on 09 May 2010 06:00

Tags: infobox pictures

rating: +1+x

This HOWTO is based on these two threads:

The idea

Imagine you have a thousand articles in which you want to include an infobox with a specific picture and you want them to be included automaticaly.

How to do it

First upolad all the pictures to one page, lets say:

http://your-site.wikidot.com/pictures:friends

Each picture must have exactly the same name as the page in which the infobox will be included. For example, if the page in which we want to include the X picture is named peter then the X picture should be also named peter.

Then in infobox, we introduce the following module:

[[image pictures:friends/%%name%%.png]]

Once this module is introduced in the page http://community.wikidot.com/peter, the %%name%% will take the name from the URL of the page which is, of course, peter, and we shall obtain the link to the picture called peter. This is why is so important to name both picture and the page where you are going to include the infobox using the same name.

This system can help in cases you have a site that is a compilation of data of something, like the site on cities, or people who applied for a job in your company, or cake recepies, etc.. You can also have different groups of pictures and you all can include in the same page, naming them the same, all you need is to upload then to different page, and the name of that page will determine the destination of the picture.

Example

We have a site that is about animals. We want to include in each infobox the picture of an animal in question, but also a picture of baby animal. So, we create two pages for pictures:

http://your-site.wikidot.com/pictures:animals

http://your-site.wikidot.com/pictures:babies

Then upload all the pictures of adult animals to the first one,and all the pictures of baby animals to the other.

Let's say we write the article on bears. The image modules will be as follows:

[[image pictures:animals/%%name%%.png]]
[[image pictures:babies/%%name%%.png]]

Very important!

It is of utmost importance that the extension of the pictures is always the same. If you prefer jpg, then all the pictures must be in jpg, or if you prefer png, then all the pictures must be in png. But all the pictures must have the same extension. Because if not, not all pictures will appear, since your model calls for only one type of the picture (in our example, it is png).

Don't forget!

The picture and the page in which infobox will be included MUST have the same name.

Having this so automatized, you can even include these image modules in a live template, it will always show the correct animal. But remember: the name of the including page and the photo MUST be the same.

Similar HOWTO's

Author

BrunhildaBrunhilda. Please visit his/her userPage.

wikinetwikinet. Please visit his/her userPage.


Related articles

Comments

Add a New Comment
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-Share Alike 2.5 License.