top

Newsboxes

CMSimple_XH offers the possibility to display any page within another page, in the form of a so-called Newsbox. This can be done by a call in the template on all pages (for example, in a sidebar) – or by a plugin call only on a single page.

Examples

Newsbox in a sidebar

<?php echo newsbox('[Sitename]');?>

Let's assume that an association website is (classically) divided into three columns. For example, the navigation menu on the left, the actual page content in the middle, and a column on the right that should contain additional information. In this example, we want to announce the next meeting date of the association in the right column. This announcement should be visible on all pages.

The meetings are held every three months – so the announcement needs to be updated relatively frequently. Here it is a good idea to place this announcement on its own content page, this way it can be updated as easily as any other content. Since the information on this page will always be visible everywhere anyway, this page does not need to appear in the navigation menu – so we will hide it.

  • Create a new page named “Meetings”.
  • Switch to the Edit mode and open the new page “Meetings”.
  • Design this page as you like. Save your input.
  • In the Page tab (above the editor), uncheck the Show in menu? checkbox. Save!

We have now created a page that is not displayed anywhere because it is hidden. We now need to make this page appear on the right side column.

 

For this, it is necessary that we edit the file /templates/[current template]/template.htm. Editing can be done online directly in the system or offline with an external editor.

 

Now we look for the right sidebar in the source code of this file and insert the call for the newsbox with the name “Meetings” there.

(The following code is only exemplary, with you everything could look completely different.)

...
<div class="leftSidebar">
    ...
</div>
<div class="middleContent">
    ...
</div>
<div class="rightSidebar">
    <?php echo newsbox('Meetings');?>
</div>
...

The result corresponds to our wish: the page “Meetings” appears in the right column.

Newsbox in the content of a page

{{{newsbox('[Sitename]')}}}

Newsboxes can be used in different ways. You can also have several newsboxes on one page, no problem. For illustration purposes, let’s stay with the example from above.

This time our wish is not to show the dates permanently in the right sidebar, but only when this is appropriate somewhere on any page.

This can be realized quite easily with a plugin call – exactly at the position in the page text where the newsbox should appear. It is recommended to always insert plugin calls in the editor source view and wrap them in <div> ... </div>. Example:‍­

...
<h1>Headline</h1>
<p> ... Text ... </p>
<div>{{{newsbox('Meetings')}}}</div>
...

What’s in it for us?

Well, not much at first glance. The appointment announcement could have been written directly into the page. But if we imagine that we want to display it on many other pages, then the advantage becomes clear. We only have to change the page “Meetings” once – and automatically all other occurrences are changed as well. This can save a lot of typing.

Newsbox

A Newsbox is a page that can be displayed within another page.

Templates

Templates are design patterns for websites that behave like masks. They determine the place where elements appear and influence their appearance.