01-19-2005 04:33 AM by SrNupsen
On this page... (hide)
In Coranto, you can have your news presented in as many different ways as you like. Later on, we'll look at how you can use styles to customize the way your news are shown, but now we'll talk about PROFILES. A rule of thumb in Coranto is that profiles control WHICH items are output, and styles control HOW they're output.
Profiles will be increasingly interesting when you start making use of different categories. In fact, the News Categories addon comes bundled with Coranto, so let's make a category right now!
From the main page, click "Administration" and then "Addon Manager". On the addons page, you'll see that News Categories is currently disabled. Click "Enable" to enable it (!), and then return to the Administration page. You'll notice that a new option has been added: "News Categories". Go there! The one category present is the boring (Default) category, so create a new one and name it whatever you want by typing in it's name in the "Category name:" field and clicking "Create Category".
Upon returning to the Submit News page, you'll notice that you can now put your news in your new category if you want to. This work being accomplished, it will now be easy to grasp the use of profiles.
As stated earlier, profiles control which items are output in Coranto. You can filter your items in many ways, the most common ones include filter by time, filter by number and - of course - filter by category. In the latest version of Coranto, you also have enhanced options for filtering your news by any field you specify, but this will not be discussed here.
To make your first profile, do the following:
Go to Administration from the main page. Then click on "Manage Profiles". This is where you will be doing your profile work. You will see one profile; it's the default "news". Type in a suitable name for your new profile in the "Profile Name" box and click "Create Profile". When your new profile shows up on the list, click "Edit General Settings" to configure it.
You will now be presented with several options. Most of them are explained on the page, but pay attention to the "Categories" field. Do you see your newly created category? In this field you can select which categories will be included in the text file generated by this profile (yes, you can specify both the path and the file name for the output file at the top of this page). You will perhaps have a sports profile, creating a file called sports.txt only based on the sports category? Or even a "General Latest News" category, including news from many categories but only from the last 5 days?
Further down, you will see a drop-down menu called "News style". That's where you tell Coranto which STYLE to use when building this profile, and styles are exactly what we will be talking about in the next chapter.
But first, return to the Manage Profiles page and click "enable" on the profile you just created.
You probably asked yourself how Coranto knew that you wanted your news to appear with the subject first in bold types, then the date and so on. Or perhaps you think that layout is rather ugly? STYLES is what decides what your news items will look like on your page, and every style can be hand-carved by you. Try clicking on "Administration", and then on "Edit News Styles". This will bring up a list of the styles currently in use.
Coranto comes pre-packed with 3 default styles: Default, Default Headline and Archive Default. For the moment, we'll concentrate on the Default style, so click on the "edit" link beneath it. This will bring up the style editor window. Editing styles in quite a lot like working with HTML, and you'll probably recognize several HTML commands in the Default Style on screen. In addition to that (to create dynamic content), Coranto offers a set of meta-commands that you can use to insert different parts of your news content wherever you want. You'll see the most common field names in the white box over your editor window. Also try clicking on the link to the fuller documentation for your pleasure, it contains some useful tips.
Try doing small changes in your style and clicking "Build news". Then reload your index.shtml or index.php file to see the effect on your news page.
A few things to keep in mind when working with styles:
- Your style is applied to EVERY SINGLE item. This means that if you want to perform operations on your whole news page (like applying a special font to it), you don't want to put the appropriate commands in your style. Instead you would put them in the HTML file where you will be including your news. An example (using PHP):
<font face="Courier" size="2"> <php include "news.txt"; ?> </font>
- If you edit your style and then your news don't look the way you wanted them to, try examining the source of your HTML page from your browser (normally done by right-clicking the page and selecting "View source" from the pop-up menu). If you can see your fields in the source (like <Fielld: Text>), it means that Coranto for some reason didn't recognize and parse them. In the example just mentioned, Field was misspelled.
Your content is first processed by the STYLE you assigned to it in the profile's settings.
This concludes part 3 of the tutorial. I recommend that you create some new categories, post some news in each category and then try creating different profiles. Just remember that you have to change the file name in the include command if you want to include the result of a different profile! Also, if you see no change on your site you may need to build news for your changes to become visible.
You may freely distribute this text, provided that the information header at the top is left intact. Neither the author of this document nor the makers of any part of Coranto shall be held responsible for any damage caused by following (or not following) the instructions in this article.