Sumaleth's Coranto Help Pages.

How Do I Set Up Headlines?

So you want to set up Headlines? Maybe something a little like these?

Headline examples

Of course you do, headlines are great! But how do you set them up in Coranto?

There are literally dozens of ways you can use Coranto to handle headlines on a web page - any way that you might want to set up headlines is possible with Coranto - but the style we'll look at in this tutorial has the headlines linking to another page with a single news item.

There are actually two standard ways to do these types of headlines in Coranto; a simple way, best suited to small sites, and second way (using the Maginot addon) more suited to sites with lots of news and high daily hit counts.

Note: This is a work-in-progress tutorial. If you spot errors, let me know.



  Headlines Examples ? 
The following are example headline codes using ViewNews or Maginot links. If you're not sure how to use these, read down further for indepth tutorials on setting up ViewNews or Maginot headlines.

ViewNews Headline Example

<strong><a href="http://your.site.com/path/to/viewnews.cgi?id=<Field: newsid>"><Field: Subject></a></strong> -- <Field: Month_Name> <Field: Month_Day>, <Field: Hour>:<Field: Minute> <Field: AMPM><br>

Maginot Headline Examples

<strong><a href="<MaginotURL: {maginot_news_profile}>"><Field: Subject></a></strong> -- <Field: Month_Name> <Field: Month_Day>, <Field: Hour>:<Field: Minute> <Field: AMPM><br>

<strong><a href="/path/to/<MaginotFile: {maginot_news_profile}>"><Field: Subject></a></strong> -- <Field: Month_Name> <Field: Month_Day>, <Field: Hour>:<Field: Minute> <Field: AMPM><br>

<strong><a href="/path/to/<Field: newsid>.html"><Field: Subject></a></strong> -- <Field: Month_Name> <Field: Month_Day>, <Field: Hour>:<Field: Minute> <Field: AMPM><br>


  Headlines Method #1: Using ViewNews ? 
This approach uses the ViewNews addon/script to link from headlines to single news items. The benefits and drawbacks of using the ViewNews method are:
  • (good) It's easy to set up.
  • (bad) If you have a large news database (newsdat.txt) or lots of daily visitors then it can tax your server.
  • (bad) It takes slightly longer for the news to display.

Step 1: Create A Headline Profile
  • In Administration->Manage Profiles enter a new profile called headlines and then click Create Profile.
  • When the page reloads, find the new headlines profile and click [Enable].
If you were to Build News right now you would get a headlines.txt file in your News directory, but since we haven't configured it yet lets not do that.

Step 2: Edit The Profile
  • Click on [Edit General Settings] for your new headlines profile.
  • Start by deleting the default number in Filter By Time.
  • Put in how many headlines you want in Filter By Number. 8? 10?
  • If you're using Categories you can select which Categories should be included in the headlines. If you haven't created any categories you won't even see a Categories choice.
  • Change the News Style to be Default Headline Style.
  • And finally, turn Display Coranto Link off.
  • You can leave the rest of the settings as they are, so scroll down to the bottom and Save Settings.

Astutue observers will have noticed that I didn't mention the Headlines sub-section of the Profile. It looks like it's there for headlines, right? Well it is, and the truth is that it would give you exactly the same output as what we've just set up, but the way we did it is better in the long run.

If you Build News now (yes, you can do it!) and check out the new headlines.txt file in your News directory you'll find it has built something that already looks a lot like headlines, but they don't link anywhere. How do you make them link? You edit the Style.


Step 3: Edit The Style
  • Go to Administration->Edit News Styles.
  • Find the Default Headline Style in the list and click on Edit.
The default headline code looks like this;

<strong><Field: Subject></strong> -- <Field: Month_Name> <Field: Month_Day>, <Field: Hour>:<Field: Minute> <Field: AMPM><br>

A close comparison between this code and what you're seeing in headlines.txt should be all that's needed to figure out what's going on. But the question was how to make it link to a News item using ViewNews? ViewNews is used like this:

<a href="http://your.site.com/path/to/viewnews.cgi?id=<Field: newsid>">...</a>

So if we add that to the headlines Style we end up with:

<strong><a href="http://your.site.com/path/to/viewnews.cgi?id=<Field: newsid>"><Field: Subject></a></strong> -- <Field: Month_Name> <Field: Month_Day>, <Field: Hour>:<Field: Minute> <Field: AMPM><br>

And that's it! You can change the rest of the HTML code to suit your site stylings if you want, but then click on Save Changes and then do a Build News. Voila! Your headlines now link to individual news items - all you need to do is include the headlines.txt file into your web page.


Step 4: What's Left?
Some things to note:
  • If you don't know how to use the headlines on your page, then the answer is usually SSI or PHP includes.
  • ViewNews uses the viewnews.tmpl Template (in your Coranto directory) to build the resulting news page, so you need to edit it with a text/HTML editor if you want it to match your site.
  • ViewNews uses the Default News Style Style to build the resulting news page, so you need to edit that Style if you want a specific appearance of the resulting news.


  Headlines Method #2: Using Maginot Line (addon) ? 
The benefits and drawbacks of using the Maginot Line method are:
  • (Good) It's much easier on the server if your site has lots of visitors and/or a large news database (newsdat.txt).
  • (Good) The news is displayed quickly.
  • (bad) It's more involved to set up.
This approach uses the Maginot Line addon's 'Static Pages' feature to save out every news item as a separate file in your News directory. The headlines then link to these separate news files.
Step 1: Create A Template
There are many ways to use Maginot Line news files, but the easiest method is the one we'll use here; a Template.
  • In your Coranto programs directory is a file called viewnews.tmpl - make a copy of that file and call the copy news.tmpl.
You'll have to edit this news.tmpl Template later to match the style of your site, but for now this simple Template will work fine.

Step 2: Install The Maginot Line Addon
  • Download the Maginot Line addon from the Coranto Addons page.
  • Upload the cra_maginot.pl script into the Coranto program directory on your web site.
  • Go into Administration->Addon Manager, find Maginot Line in the list and click on [Enable].
That is Maginot Line up and running. When creating new Profiles now there will be several different Profile types available. Let's go and make one!

Step 3: Create A Maginot News Profile
  • Go into Administration->Manage Profiles and down the bottom of the window enter a new profile name: maginot_news.
  • Set the Profile Type to Maginot Static and then click Create Profile.
  • When the page reloads, find the new maginot_news profile and click on [Enable].
So what have we done here? We've created a Maginot Static Profile that we're going to use to build individual News items - one file per item. Lets get in there and edit it a bit.

Step 4: Edit The Profile
  • Click on [Edit General Settings] for your new maginot_news profile.
Configuring Maginot profiles is a little different to Standard profiles, although a lot of the options will be familiar. Keep in mind that at this stage we're setting up the news items - the headlines will come later.
  • The first option to consider is Filter By Number - type in the number of headlines you plan to have. 8? 10?
  • If you're using Categories you can select which Categories should be included. If you haven't created any categories you won't even see a Categories choice.
  • Fill in the Directory URL field with the URL to where your News directory. (I'm not sure if this is needed, but it can't hurt)
  • Change the News Style to be Default News Style.
  • In the Advanced Profile Settings section, set HTML Template to news.tmpl which should now be in the pulldown menu.
  • You can leave the rest of the settings as they are, so scroll down to the bottom and Save Settings.

If you Build News now (yes, do it!) and check your News directory you'll find several files with crazy filenames like: EpkZuulZpkajFRcChV.html. These are the individual news items, all ready to be linked to from the headlines. The headlines? I guess we can make them now.


Step 5: Create A Headline Profile
  • Go into Administration->Manage Profiles and down the bottom of the window enter a new profile name: headlines
  • Set the Profile Type to: Standard :and then click Create Profile.
  • When the page reloads, find the new headlines profile and click on [Enable].
We're using a Standard profile for the headlines, not a Maginot profile. Maginot Line is designed to split news up into multiple files - in a variety of ways - whereas we want all the headlines together.

Step 6: Edit The Profile
  • Click on [Edit General Settings] for your new headlines profile.
  • Start by deleting the default number in Filter By Time.
  • Put in however many headlines you chose to have in Filter By Number. 8? 10?
  • If you're using Categories you can select which Categories should be included in the headlines. If you haven't set any new categories up, don't sweat over it.
  • Change the News Style to be Default Headline Style.
  • And finally, turn Display Coranto Link off.
  • You can leave the rest of the settings as they are, so scroll down to the bottom and Save Settings.

Curious observers will have noticed that I didn't mention the Headlines sub-section of the Profile. It looks like it's there for headlines, right? Well it is, and the truth is that they'd give you exactly the same outputp, but the way we did it is better in the long run.

Next we need to edit the headlines Style.


Step 7: Edit The Style
  • Go to Administration->Edit News Styles.
  • Find the Default Headline Style in the list and click on Edit.
The default headline code looks like this;

<strong><Field: Subject></strong> -- <Field: Month_Name> <Field: Month_Day>, <Field: Hour>:<Field: Minute> <Field: AMPM><br>

A close comparison between this code and what you're seeing in headlines.txt should be all that's needed to see the correlation. But the question was how to make it link to a News item using Maginot Line? Maginot Line is used like this:

<a href="<MaginotURL: {maginot_news_profile}">...</a>

So if we add that to the headlines Style we end up with:

<strong><a href="<MaginotURL: {maginot_news_profile}>"><Field: Subject></a></strong> -- <Field: Month_Name> <Field: Month_Day>, <Field: Hour>:<Field: Minute> <Field: AMPM><br>

And that's it! You can change the rest of the HTML code to suit your site stylings if you want, but then click on Save Changes and then do a Build News. Voila! Your headlines now link to individual news items - all you need to do is include the headlines.txt file into your web page.


Step 8: What's Left?
Some things to note:
  • If you don't know how to use the headlines on your page, then the answer is usually SSI or PHP includes.
  • We made that news.tmpl Template (in your Coranto directory) to build the resulting news pages, and you will need to edit it with a text/HTML editor if you want it to match your site.

<< How ViewNews/SearchNews Work · Tutorials · Maginot Line >>