Pyplate uses HTML templates to fill in parts of each web page. These templates are snippets of HTML stored in the template directory (by default this is in /usr/share/pyplate/templates), and they're used to fill in the page banner, and footer. You can edit these templates by going to your site's Admin area and clicking on 'Site Settings'.
The banner needs to contain an HTML div with a class attribute "banner". Inside the div, you can add a title wrapped in h1 tags, followed by a subtitle for your site wrapped in h2 tags. If you want you can go further than this and have several divs inside the banner. In this site, I've used the banner div to contain one div for the left side of the banner, and another div for the contents of the right side of the banner.
The footer field can be used to create a page footer. This field needs to contain an HTML div with the class attribute "footer". Again this can contain more than one div if you wish.
By default, the navigation bar is generated by Pyplate. When Pyplate generates this part of the page, it accesses the database to get a list of all the top level categories in your site
(categories whose parent is the root category), and prints links to those categories as an unordered list as follows:
Sometimes you might want to use a handwritten navigation bar. Using code in Pyplate to generate the navigation bar every time a page is served uses up quite a lot of CPU cycles. It's faster to use a template file instead. Another reason to use a template is that you might want to customize the navigation bar. For example, if I wanted to include a link to another site in my navigation bar, I would just add another li tag containing a link like this:
This code needs to be pasted into the navigation bar field on the Site Settings page. The code in layouts.py needs to be modified so that Pyplate uses the navigation bar template instead of generating the navigation bar from the database. On the Site Settings page, scroll down to the Layout field. Scroll down until you see a function called getLayout, and look for the following line of code:
Comment out this line by putting a '#' symbol in front of it. Add the following code:
Don't forget the comma at the end of this line. You need to make this change anywhere that you see a call to pyplate.get_navbar in getLayouts.
Share this page: