|
#1
|
|||
|
|||
|
Tutorial: making templates
Since I'm not qualified to start new topics in the Pixelpost 101
I'm posting it here... Guess this is only the first in a line of tutorials on making templates from me This tutorial was made with the aim of helping you folks in the forum creating your own templates from scratch… I’ll be explaining it through a step-by-step list of things I do from the beginning till the end.. You’ll also find some explaining pictures… Lets get started! First of all, you’ll need an editor. Wordpad and notepad will do, but if you’ve got dreamweaver or some other html-editor with color coding that’s the best… As you probably know, the templates of Pixelpost is divided into folders, and that each and every folder contains some files… The standard files are: • about_template.html • browse_template.html • comment_template.html • image_template.html • referrer_template.html The template file used for the main page (where your image is showed) is named image_template.html, and we’ll start with creating that one… The “basecode” for a HTML document looks like this: Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta content="text/html; charset=UTF-8" http-equiv="content-type"> <title>Untitled Document</title> </head> <body> </body> </html> To make this code look a bit more like a template we’ll add some tags, every tag is described in this post: http://pixelpost.org/forum/viewtopic.php?t=844, so I won’t describe it… It might be a good thing to print it so you have it at hand when you need it. Step 1 – Create the document and your first <div> tag The first thing we’ll do is to create simple grey line at the very top of the page to hold some information like visitors and stuff. To do that, we’ll use the HTML tag <div> and give it color and stuff in CSS (Cascading Style Sheets). Now, take the code above and copy it into your editor. When you’ve done that, we’ll add another line to the code. The things written between <body> and </body> is the things that will appear on the page, just felt OK to mention it so you know why it’s written between those… The code you’re supposed to add between the body tags are: Code:
<div class=”top-line”>This is just some dummy text to show the top line</div> Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta content="text/html; charset=UTF-8" http-equiv="content-type"> <title>Untitled Document</title> </head> <body> <div class="top-line">This is just some dummy text to show the top line</div> </body> </html> Step 2 – Link the CSS file to the template document The whole point of the div tag is that we’ll give it class in CSS to style it. So you could actually make a <div> tag look like whatever you like We’re about to make a CSS document to hold the classes for styling the template, but first of all we have to make a link from the template to the CSS document so that the template document is able to find it and style the divs. The code for the link is quite simple, just like this: Code:
<link href="style.css" rel="stylesheet" type="text/css" /> Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta content="text/html; charset=UTF-8" http-equiv="content-type"> <link href="style.css" rel="stylesheet" type="text/css" /> <title>Untitled Document</title> </head> <body> <div class="top-line">This is just some dummy text to show the top line</div> </body> </html> Step 3 – Make your first classes and style the top-line Now, first of all, open a blank document for the CSS classes. This document is separate from the template file, but will be loaded simultaneous.. Every class written will be in this form: Code:
classname {
somevariable: value;
anothervariable: anothervalue;
}
We’ll write this as a start: Code:
body {
margin:0px;
padding:0px;
background-color:#CCCCCC;
font-family:"Times New Roman", Times, serif;
font-size:14px;
}
The color “#CCCCCC” is the code for grey in the hexademical system, which is the system used to define colors in both CSS and HTML. A list of colors here: http://www.techbomb.com/websafe/. Now the time has come to style the top-line… We want to make the line in a darker shade of grey and with white text… We also want the content of the top-line to be left aligned. To do that, we’ll make another class like the one for the body apart from the small detail that this class will be named with a dot (.) before the name, that’s what we do for classes for div’s and other similar ones. The code will be like this: Code:
.top-line {
background-color:#333333;
text-align:left;
padding-top:3px;
padding-bottom:3px;
margin:0px;
width:100%;
color:#FFFFFF;
}
Hopefully your template doc now looks about the same as the picture below in your browser: ![]() Step 4 – Let’s get the picture into the template! This is where the fun begins! We’re going to put the picture tag and some more styling into the document. The picture is quite essential in a photoblog, so I’m sure some of you might have though of it already… The tag we’re going to put in looks a bit more complicated than it really is, and looks like this: Code:
<a href="index.php?showimage=<IMAGE_PREVIOUS_ID>"><img class="image" id="image" src="images/<IMAGE_NAME>" alt="<IMAGE_TITLE>" title="Click for previous image (<IMAGE_PREVIOUS_TITLE>)" /></a> Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta content="text/html; charset=UTF-8" http-equiv="content-type" /> <title>Untitled Document</title> <link href="style.css" rel="stylesheet" type="text/css" /> </head> <body> <div class="top-line">This is just some dummy text to show the top line </div> <a href="index.php?showimage=<IMAGE_PREVIOUS_ID>"><img class="image" id="image" src="images/<IMAGE_NAME>" alt="<IMAGE_TITLE>" title="Click for previous image (<IMAGE_PREVIOUS_TITLE>)" /></a> </body> </html> We want the picture to be aligned on the middle of the screen (horizontally) and just a little below the top-line… So I’ll add the following lines to the CSS file: Code:
.center {
text-align:center;
}
Code:
.image {
text-align:center;
margin-left:auto;
margin-right:auto;
vertical-align:middle;
margin-top:20px;
margin-bottom:auto;
padding:6px;
background-color:#FFFFFF;
border: 2px solid #333333;
}
![]() NOTE! I’ve inserted an image into the template, only to be able to see what it looks like when it’s done… Step 5 – Adding some PP tags to finnsih the image_template.html Now that you have most of your template done, at least the layout part, it’s time to add the pixelpost tags to make pixelpost able to put in some content… We’ll put in something for the title bar of your browser, and some links for the top-line… First of all, the title bar… Since we won’t show the image title anywhere in the image_template, we’ll include it in the title bar. We’ll be replacing this line: Code:
<title>Untitled Document</title> Code:
<title><SITE_TITLE> >> <IMAGE_TITLE></title> Code:
<div class="top-line">This is just some dummy text to show the top line </div> Code:
<div class="top-line"><IMAGE_PREVIOUS_LINK> <a href="index.php">Current</a> <IMAGE_NEXT_LINK> >> <IMAGE_COMMENTS_NUMBER> <COMMENT_POPUP> >> <a href="<SITE_BROWSELINK>">Archive</a> <a href="http://doffer.net/index.php?x=about">About + Info</a></div> Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta content="text/html; charset=UTF-8" http-equiv="content-type" /> <title><SITE_TITLE> >> <IMAGE_TITLE></title> <link href="templates/tutorial/style.css" rel="stylesheet" type="text/css" /> </head> <body> <div class="top-line"><IMAGE_PREVIOUS_LINK> <a href="index.php">Current</a> <IMAGE_NEXT_LINK> >> <IMAGE_COMMENTS_NUMBER> <COMMENT_POPUP> >> <a href="<SITE_BROWSELINK>">Archive</a> <a href="http://doffer.net/index.php?x=about">About + Info</a></div> <div align="center"><a href="index.php?showimage=<IMAGE_PREVIOUS_ID>"><img src="images/<IMAGE_NAME>" alt="<IMAGE_TITLE>" class="image" id="image" title="Click for previous image (<IMAGE_PREVIOUS_TITLE>)" /></a></div> </div> </body> </html> Tutorial for making templates for comment page, referers and browse page will be up in a few days, but the last part of this tutorial will be up this evening I think… Have a nice day
|
|
#2
|
|||
|
|||
|
Wow! This is amazing. I am planning to make a template for my site and I'm sure this will help me a lot. Thanks again.
Vlad
__________________
Sirius Concept, photography by Vlad M. |
|
#3
|
|||
|
|||
|
You're welcome Vlad
|
|
#4
|
|||
|
|||
|
There is some great info in here for html/css noobs like me. Thanks a lot! (should be sticky right?)
|
|
#5
|
|||
|
|||
|
Is it enough?
In the first place I was going to make a tutorial for the comments and archives pages to... But is it neccesary?
|
|
#6
|
|||
|
|||
|
Thanks for the step by step instructions! Great post!
__________________
Cheers, Entact |
|
#7
|
||||
|
||||
|
Hey doffer cool tutorial...I was wondering how you get the numbers of each category up on your archive page. Thanx...
|
|
#8
|
|||
|
|||
|
It's showed automagically by the PP system
Use: Code:
<CATEGORY_LINKS_AS_LIST_PAGED> Code:
<BROWSE_MONTHLY_ARCHIVE_AS_LINK_PAGED> Good luck! |
|
#9
|
||||
|
||||
|
yeah I found that 5 minutes after I posted the question...oops! Thanks for the help anyway...
|
|
#10
|
||||
|
||||
|
right rail pics
Ok doffer here's another one..
I have a right rail in my template, in which I would like to post the first picture from each category going vertically downwards. I assume I could make a modified version of the <THUMBNAILS> tag to accomplish this. Any suggestions? The URL is http://208.56.67.67/juneauphotoblog/ Sometimes this wil resolve to shopjuneau.com b/c we haven't registered the domain yet, if it does that just substitue the shopjuneau.com with the IP address... thanks! |
| Post Reply |
| Thread Tools | |
|
|