You are here: start » newsboxes

Newsboxes

A feature of CMSimple_XH is the possibility to display the content of another CMSimple page (the “news page”) as a so called “newsbox”, e.g. in a sidebar outside the regular contents area.

Since the page which provides the content of the newsbox should usually not be listed in the navigation, it is possible to “hide” it from the navigation.

Using a newsbox is basically the same as inserting the contents of the newsbox directly in the template; the advantage of using a newsbox is, that the contents can be edited more easily afterwards. If you want to show different content in a newsbox for each page, you may want to use Coco_XH.

Creating a News Page

Create a CMSimple page, e.g. named “News02”. Insert all the content that you want to appear in the newsbox as usual. From CMSimple_XH 1.5 onwards it is even possible to use CMSimple Scripting in newsboxes.

Hiding the News Page

Hide the content page (=newspage) of the newsbox from the navigation by choosing:

  • Page ⇒ Pageparameters ⇒ Show in menu? ⇒ no.

Alternatively you can put the following code anywhere on the page, preferably directly below the heading:

#CMSimple hide#

Adding the Newsbox

Integrate the newsbox into your template by entering the following code just where you want the newsbox to appear:

<?php echo newsbox('News02');?>

If you want to syle your newsbox(es) via CSS, you can embed the newsbox in HTML divs with CSS classes:

<div class="news">
<div class="newsin">
<?php echo newsbox('News01');?>
</div>
</div>
 
<div class="news">
<div class="newsin">
<?php echo newsbox('News02');?>
</div>
</div>
 
<div class="news">
<div class="newsin">
<?php echo newsbox('News03');?>
</div>
</div>

Define the classes .news and .newsin in the stylesheet.css of your template with the desired CSS attributes.

Note that the double <div>s are meant to cater for the different box model in old versions of IE (< 6). Setting widht/height for the outer, and border/padding only for the inner <div> will make your newsbox look the same in different browsers. Nowadays it seems IE 5.5 is gone, so probably you can do with a single <div>.

Deleting the Newsbox

Simply delete the code for the newsbox in the template together with all surrounding divs. Depending on your template the code may look different, the above code being just an example.

And don't forget to delete the related newspage from the content (except when you're planning to reuse it).

 
You are here: start » newsboxes
Except where otherwise noted, content on this wiki is licensed under the following license: GNU Free Documentation License 1.3
Valid XHTML 1.0 Valid CSS Driven by DokuWiki