A style defines how your blog appears to the users. There are some bundled themes with serendipity and are fully based on Cascading Style Sheets? (CSS) for customization.
To choose how your blog looks like, enter your Administration Suite and click on the Manage styles item. There you will see an overview of existing templates. You can see the original author of the theme and maybe even a small screenshot. Choose the radiobutton next to the style you want to have and click on Save. On the next page relead you'll see your blog in the desired layout.
If you want to leave it up to your visitor how your blog looks, consider using the Template Dropdown Sidebar plugin.
Yes, we know - we definitely need to work on our terminlogy. We are currently using all the three terms Template, Style and Theme to refer to actually the same thing. There's no difference in them, only that different developers used different terms.
It's very easy to create your own style. All the available styles are saved within the templates subdirectory of s9y. Each style has its own subdirectory there.
It is advised for creating a new style that you take an existing subdirectory, copy it to a new directory and then modify the files. Serendipity will always fall back to the default template file, if your theme doesn't have one. This way you can keep redundant code outside of your template, and only customize the files you really want to customize.
You can only use Smarty templating for the frontend. The look of the admin interface can only be affected via CSS. This is mainly because enhancing the admin interface with templates is a lot harder and would create more maintenance overhead. It would also hurt performance, and when your server has trouble with the Smarty application you will still have the opportunity to use the Admin interface.
Inside each style subdirectory, there are several files:
Most important, the CSS files which immediately define the look of your page.
This stylesheet contains all CSS definitions for both the frontend and backend pages of your weblog.
This stylesheet is applied to your RSS/XML syndication link, if users choose to view the Atom version. This stylesheet is cut cown to only a few elements which apply to given XML directives.
If you are using the WYSIWYG-editor for creating your entries, you may want to have the area look like on your homepage. You can modify all the CSS classes inside this file to tweak the look of that area.
Inside this file you can insert your credits, which are displayed in the s9y backend.
To easily see how your template looks like, you should later make a small screenshot of your layout and save it as preview.png file.
Those files are the bundled Yahoo UI components that are used for showing the media database drag+drop functionalities.
This layout.php file is a deprecated way of Serendipity prior to version 0.8, where no Smarty features existed yet. The layout.php mechanism is STILL avaiable to your themes, putting them in 'raw/backwards compatibility mode'.
Basically, you don't need to edit those layout.php files any more, they are no longer required. Most things are now done via specific Smarty .tpl files. The only upside the layout.php brings to your theme is that you can use PHP code in that file to control the "workflow" of your page. So you can have a look at the templates/newspaper/layout.php file for an example of how such a file can still look - but you don't really need to understand that part any more.
There are various *.tpl files that hold the smarty template code for display HTML and logic.
For various variables, refer to this documentation [1] or a Editing Tutorial [2].
This file controls the look of your comment form where visitors can comment on your entries.
This controls the basic HTML layout of the optional comment popup window.
This shows the available comments and trackbacks made to an entry.
This controls the layout of the functionality where comments by visitors are shown.
This is a master template that holds your page content area, and depending on the page type (entries overview, entry search, archive page, ...) emits different messages.
This file holds the display of entry archives (per month / year).
This file displays the overview of entry archives (per month/year).
These files hold the various RSS/Atom feed template files. Here you could add customization to those feeds.
This is the main template file that controls the general look of your page as well as HTML headers, meta tags, CSS embedding, sidebar locations etc.
This is the main logic file and it tells Serendipity how to format your entry overview, how to loop entries, where to show commentsforms etc.
Some plugins allow their own templating. Those files are prefixed with "plugin_" and can also come with certain plugins. Putting those files into your template directory will customize the look of that plugin within your theme. The files available by default for bundled plugins are for the Calendar and Categories sidebar plugins. You first need to enable the templating option in the configuration of those plugins, though!
When you create a preview from within the admin interface, this file controls the basic look of the embedded iframe holding the preview. You need to adapt this file of your preview looks odd/off.
This file controls how the list of sidebar plugins is displayed.
This master PHP file can customize options only available with PHP coding in your theme.
For a possible use of this, check these documents: Special Smarty Templating [3] and Configuration of Theme options [4].
The media manager is the only part of the admin interface that is Smarty customizable.
The files for this are in the admin/ subdirectory of your theme:
The main template file of the media manager popup window.
The display logic of the specific items in your media database overview.
The header/footer area of the media database overview.
The page which displays properties (keywords, exif-information etc.) of a selected image.
Used when displaying an image via the frontend of your blog to visitors.
The template file for uploading a single or multiple images.
The files responsible for "editing" an image. Currently still in development.
Inside the img subdirectory of your template directory you can place a list of common images:
This image is used for the calendar plugin as the back arrow
This image is used for the calendar plugin as the forward arrow
This image is used for indicating XML file links (like for the syndication and categories plugin)
Various emoticons which are used by the Emoticate Event Plugin to transform text-smilies into graphical representations. You may want to tweak those to match your template look.
To customize smilies with individual images from a theme, you can
create the file 'emoticons.inc.php' inside this template directory
and use an array like this:
[code]
<?php
$serendipity['custom_emoticons'] = array(
":'(" => serendipity_getTemplateFile('img/cry_smile.gif'),
':-)' => serendipity_getTemplateFile('img/regular_smile.gif'),
':-O' => serendipity_getTemplateFile('img/embaressed_smile.gif'),
':O' => serendipity_getTemplateFile('img/embaressed_smile.gif'),
...
);
?>
[/code]
This will override the default list of emoticons set inside the file plugins/serendipity_event_emoticate/serendipity_event_emoticate.php and use the ones you created for your template.
We use the <h1> element for the header of a page, the <h2> element for a subheader. <h3> elements are used for the entry dates and <h4> elements for the titles of each entry.
Sidebar plugins are used, depending on your layout.php, within either <table> elements or <div> containers. Depending on that, subcells are either <td>s or <div>s again.
All other HTML elements can be styled in context of either a surrounding element with a Class or an ID
A smily, created by the Emoticon Markup Event Plugin.
The top area of the page, containing your blog title (<h1>) and description (<h2>).
Surrounding anchor elements for your blog title (<h1>) and blog description (<h2>).
Surrounds the calendar plugin table (containing <td> and <tr>s).
Cell containing either the weekday or the header
(Empty) Day area.
This contains the main serendipity contents, including sidebars.
Contains the main serendipity entry list
Contains the full left sidebar area
Contains the full right sidebar area
Inside context of the Left Side Bar? or Right Side Bar?, this surrounds each plugin.
Inside context of serendipitySideBarItem, the title area of each plugin sidebar component.
Inside context of serendipitySideBarItem, the content area of each plugin sidebar component.
Wraps around all articles for a single day.
The date field header
The title of each entry.
Wraps around the complete articles contents
Wraps around the teaser text of the article. Only used in article overview, not in detail mode.
Wraps around the teaser text of the article. Only used in article detail mode, not in overview.
Wraps around the extended text of the article. Only used in article detail mode.
Contained within serendipity_entry this holds all detail information about the author (posting date, name, ...)
Title for the following commentarea
Comment area in detail view of an article. (per-comment)
Holds detail information about the comment author
Surrounds the form for entering a comment.
For the comments page, spans around the title of each input fields description.
For the comments page, spans around the value area of each input field.
The surrounding area on the single comment popup.
When using comments for images given in the s9y image manager. Inside .serendipity_entry, surrounding the whole comment box.
The nested parts within .serendipity_imageComment_* to seperate comment from the actual image.
Backend: The full page area for the Authoring Suite, the Image Manager and the Administration Suite.
Backend: Title of the backend page
Backend: Content area
Even though there are lots of combinations or variations possible with those IDs/classes, you may easily get confused when dealing with CSS. Try out Mozilla Firefoxes EditCSS [5] for seeing how easy that actually can be!
This page only described how you can easy Smarty/HTML code to mockup your blog.
If you want more features like distinct page HTML things, navigation items or custom functionality, you will need to get yourself familiar with the awesome Serendipity Plugin API [6] and the various Event Hooks [7].
Or have a look at all the already existing plugins and themes in the Spartacus repository [8].
Even though there are lots of combinations or variations possible with those IDs/classes, you may easily get confused when dealing with CSS. Try out Mozilla Firefoxes EditCSS [5] for seeing how easy that actually can be!
If your style is finished, why don't you contribute? it? :-)
URL of this document:
http://www.s9y.org/44.html
Links:
[1] http://www.s9y.org/102.html
[2] http://www.s9y.org/121.html
[3] http://www.s9y.org/78.html
[4] http://www.s9y.org/137.html
[5] http://editcss.mozdev.org/
[6] http://www.s9y.org/43.html
[7] http://www.s9y.org/116.html
[8] http://spartacus.s9y.org/