Uploading Files to your Blog

07:30PM May 12, 2007 in category Apache Roller by Jesse Bethke

If you have a custom theme, you are likely going to need additional files not provided to you by Apache Roller.  You can upload things like additional images and CSS files by going to the "Create & Edit" tab under your administrator and then clicking File Uploads.  The file upload contains a file mangers for browsing, renaming, deleting, and uploading files.

Once you have uploaded a file, it can be accessed by your template, stylesheet, or from within a blog posting.

Accessing From Your Template Definitions

You can resolve the URL of an uploaded file by using the $url object.  Suppose you uploaded a custom stylesheet, the following example includes it in the head element of your template.

<head>
  <link rel="stylesheet" type="text/css" href="$url.resource('style.css')" />
</head> 

This example makes the assumption that the file style.css is in the root of your file resources. If you place it in a sub-folder, just include it in the path.  You could use this same technique to include an image in your template.  Just insert $url.resource() into the src attribute of the image.

Accessing From Your Stylesheet

If you are using an uploaded stylesheet, then just make sure that you use relative references from the stylesheet. It helps if you put the CSS file in the root of your resources directory and then your images in an "images" sub-directory.  That way you can reference them like this:

body 
    background:  url('images/background.jpg') repeat top left;
} 

Accessing From Elsewhere

From everywhere else, including your blog posts, you can use a full URL reference to the file. All your files are uploaded into a sub-folder called resources. For instance, a stylesheet in the root of your resources would be at http://blogs.usd.edu/blogname/resources/stylesheet.css.

Note that if you have many images it may be easier for you to host them on sunburst. Do so by placing them in Z:/www and then referencing them via http://www.usd.edu/~yourusername/images.

Comments:

Post a Comment:
  • HTML Syntax: Allowed

Calendar

« November 2009
SunMonTueWedThuFriSat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
     
       
Today
The views and opinions expressed in this page are strictly those of the page author. The contents of this page have not been reviewed or approved by The University of South Dakota.