How to format?

Having trouble installing serendipity?
Post Reply
piscitella
Regular
Posts: 9
Joined: Mon Jun 19, 2006 7:40 am

How to format?

Post by piscitella »

I was tring to create a home page that was simply an intro page for our family blog with categories for individual blogs for each family member. Seems simple.

I used categories to create each persons own blog but when I go to the home page (index page) I see all the blog entries from all the categories. I can live with that if there isn't a choice, but would prefer to not show all the blog entries on the home page. I really just want the home page to be an intro page.

I also wanted to be able to personalize the sidebar to have a picture and brief description of the person who's blog was being shown (by the category). The sidebar plug does not seem to be able to do such a thing. I am only able to display 1 picture in the side bar and this same picture shows for every category.

I have looked over all the documents and spent some time trying things out and was hoping for a few suggestions/pointers. My site is http://www.piscitella.com/serendipity/. Yes- its very slow. I apologies in advance.

thanks for any help.
jhermanns
Site Admin
Posts: 378
Joined: Tue Apr 01, 2003 11:28 pm
Location: Berlin, Germany
Contact:

Post by jhermanns »

for the front page, you could create a static page that displays exactly what you want.

for the rest, i don't know all the plugins, but your question sounds familiar... have you looked through all the plugins?
judebert
Regular
Posts: 2478
Joined: Sat Oct 15, 2005 6:57 am
Location: Orlando, FL
Contact:

Post by judebert »

You can add images for each category in Admin. I believe they're called "Category Icons", but I'm not sure. You can also put the bio data in the category description.

Then, just edit your index.tpl and put {$category_info.category_description} and {$category.category_icon} wherever you want it. I'd put it in the header, but you could make it the first entry in the sidebar or something.
Judebert
---
Website | Wishlist | PayPal
piscitella
Regular
Posts: 9
Joined: Mon Jun 19, 2006 7:40 am

Post by piscitella »

could you please point me to some documentation that might help or provide me with more insight. I would really like to understand your software better and learn how to properly use it. I have made no progress at all. I am hoping this isn't really that hard.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

I'll try to put this more verbosely:

Serendipity is very flexible through it's templating system using Smarty and the plugin API.

The plugin API consists of two types: Sidebar plugins and Event plugins. Sidebar plugins only are plugins that show something in your sidebar. Event plugins are those that change/enhance the functionality of your blog. Plugins are always written in PHP code.

You can create your own plugins by just creating a new subdirectory in the plugins directory, inventing a directory+filename and then take the foundation of some other plugin to customize it to your needs. But PHP skills are required for that.

This leads me to the Templating System: Templates consist of specific files in your templates/XXX/ directory, where XXX is the name of your template. All files that are possible to be changed can be found in the templates/default/ directory. If your theme does not have a, say "entries.tpl" template file for changing the output of entries, the default entries.tpl file will be used. So if you want to customize that file, copy entries.tpl from the default template into your own template directory and modify it.

Smarty files are basically just HTML markup together with some variables (like {$serendipityBaseURL} to indicate the URL to your blog) plus some control structures (like {if ...}). Using this markup (see http://smarty.php.net/) you can achieve a quite flexible change of HTML code on your blog.

Now on to the thing you want to achieve.

In the admi niterface, as Judebert noticed, there is the "Categories" menu item where you can add category images and descriptions for each category. This input is usually used to put images into your entries that belong to that category.

Now, once you filled that value and look at your blog, Serendipity's code will fetch the correspondig category information in the background and set it as a smarty variable {$category_info}. This variable is an array that holds further keys (see http://www.s9y.org/102.html#A33).

Once you view a specific category of your blog, those variables will be set. You then only need to put them into your template files where you want.

The easiest way to see this would be to open your index.tpl file and look for the {$CONTENT} variable. Just before that, you can add a code like this:

Code: Select all

{if $category_info}
The current category is "{$category_info.category_name}". 
{if $category_info.category_icon}
It also has an icon. Look at here: <img src="{$category_info.category_icon}" />.
{/if}
{/if}
This will fill in category information if it is available. Of course you don't need to put it into your index.tpl; if you want to have it in the sidebar, you could edit the sidebar.tpl file.

HTH a bit, and tell me if you have further questions!

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
piscitella
Regular
Posts: 9
Joined: Mon Jun 19, 2006 7:40 am

Post by piscitella »

Thank you for all the great information. From what you have posted I have figured out how to create the static home page and where to plug in the code to get CATEGORY images and description to appear in the sidebar for the approprite category.

The final thing I am tring to do is to be able to also use the sidebar plugins to be specific to Categories. So if I can get the contents of the sidebar plugins (Quicklinks, Guestbook, Bookmarks, and Archives) to be specific to the category I would have achived multiple blog within one copy of the software. Do you have any suggestions on how would you accomplish this?

Again thanks for all your help and I am hoping to take this learning and apply it to other websites that I work on.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi Piscitella!

For what you describe there, you should use the plugin "Toggle sidebar state" (serendipity_event_sidebarhider). There you can configure in a new menu item in which category you want to show which sidebars. :)

HTH,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Post Reply