Published: May 14, 2012. Updated: May 29, 2012.
With a fresh installation of Onpub, the first article you create (Article 1) in the management interface automatically becomes the home page.
The Onpub home page Article is different from other Onpub Articles in that the Title is not automatically displayed on the page, only the Article's Content field is. This is so you can have full control of the layout of the home page of your Onpub-powered website.
The sections below describe the various configuration options you can use to tweak the look and feel of your Onpub home page.
If you don't want to use the default of Article ID 1 as your home page, you can easily re-configure this by adding the following frontend config option to your onpub_conf_local.php file:
<?php
// onpub_conf_local.php file
$onpub_disp_article = <ID of home page Article>;
// etc...
?>
Replace <ID of home page Article> in the above line of code with the actual Article ID of the desired home page article and save your onpub_conf_local.php file. Now reload the home page in your browser and it will display the content from the Article ID you specified.
Once you have more than 1 Article in your database, by default the News section will be generated on the home page, in addition to displaying the home page Article itself. The News section is configurable in several different ways, all of which are documented below.
If you don't want the News to be displayed at all on your Onpub home page, add the following line to your onpub_conf_local.php file:
<?php
// onpub_conf_local.php file
$onpub_disp_updates = false;
// etc...
?>
The above frontend config option, will automatically hide the News section from the home page. This will cause the configured home page Article to automatically take up the whole width of the home page. If you decide that you want to show the News section again, set the $onpub_disp_updates option back to its default value of true. Or simply remove the above config option from your onpub_conf_local.php file and the default option will automatically take effect again.
You can easily configure up to how many of your latest articles you want to display under the News section. The default is 5 of the most recent created articles. If you want to change this, add the following configuration option to your onpub_conf_local.php file:
<?php
// onpub_conf_local.php file
$onpub_disp_updates_num = 10;
// etc...
?>
If you use the above example, your News section will now display up to 10 of your latest articles. Articles only display under News if they are visible within one or more of your publicly visible Onpub Sections. Also, the home page Article itself will never be displayed under News. You can replace 10 with any valid positive number to control how many articles you want to output under News.
By default, the heading of the News section on the home page is literally called News. If you wanted to change this label to something else entirely, follow the steps below:
<?php
class OnpubFrontendCustom extends OnpubFrontend
{
function __construct()
{
parent::__construct();
$this->labelUpdates = 'Latest Updates';
}
}
?>
The above is an example of modifying the Onpub frontend layout via PHP object extension. The line $this->labelUpdates = 'Latest Updates'; is what will change the News heading from News to Latest Updates. You can change the 'Latest Updates' string to whatever you want the heading of your News section to be.