Variable Newsbox

If you want to use a newsbox which shows specific news only in conjunction with specific pages, the newsbox() function is used in combination with a variable. The following code is added to the template at the place where the newsbox is wanted:

<?php if (isset($news)) echo newsbox($news); ?>

To a page content then a script is added like:

#CMSimple $news = "News1";#

or

#CMSimple $news = "News2";#

or

#CMSimple $news = "News3";#

etc.

“News1”, “News2”, “News3” etc. are created as hidden CMSimple pages (#CMSimple hide#). They will be shown inside the newsbox in connection only with the page which contains the specific CMSimple script.

It is possible to improve the function a bit. Let's say we don't have specific news for a specific page, but the place shouldn't be empty. Then we can show the “Main News”. To do this we change the code of the template.htm file. We say now:

<?php if (isset($news)){echo newsbox('mainNews');}else{echo newsbox($news);} ?>

To show these “Main News” a hidden page is created called “mainNews” and the CMSimple script on the page, which is supposed to show no specific news, is omitted.

~~DISCUSSION~~

tips_and_tricks/newsbox/variable_newsbox.txt · Last modified: 2018/04/05 14:49 (external edit)
Webdesign: NMuD chimeric.de = chi`s home Creative Commons License Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0