Random newsbox in content?

About the template and stylesheet - and changing the menu
Post Reply
markus.leder
Posts: 9
Joined: Sun Sep 14, 2008 3:47 am

Random newsbox in content?

Post by markus.leder » Mon Nov 10, 2008 1:17 pm

Hi everyone,
I found this great random newsbox script:

<?php
$newsBoxList=array();
foreach ($h as $possibleNews)
if (!(strpos($possibleNews,"News_")===FALSE)) array_push($newsBoxList,$possibleNews);
echo newsbox($newsBoxList[mt_rand(0,count($newsBoxList)-1)]); ?>

I want to show it ONLY in the index... so I guess I need to put it in the content area... but how?

Holger
Site Admin
Posts: 3470
Joined: Mon May 19, 2008 7:10 pm
Location: Hessen, Germany

Re: Random newsbox in content?

Post by Holger » Mon Nov 10, 2008 3:03 pm

markus.leder wrote:so I guess I need to put it in the content area... but how?
... with CMSimple Scripting.
Be sure to put the code in a single line, enclosed between #CMSimple and #.
Or RTFM ;) : http://www.cmsimple.com/?Installer%27s_ ... _Scripting

Holger

markus.leder
Posts: 9
Joined: Sun Sep 14, 2008 3:47 am

Re: Random newsbox in content?

Post by markus.leder » Tue Nov 11, 2008 2:39 am

Problem... even though I got the script working random thnks to your great advice,
I am not able to get it into the content area where it is supposed to be.
The random newsbox is NOT SHOWING INSIDE THE CONTENT AREA but ON TOP OF THE PAGE...
HELP

Holger
Site Admin
Posts: 3470
Joined: Mon May 19, 2008 7:10 pm
Location: Hessen, Germany

Re: Random newsbox in content?

Post by Holger » Tue Nov 11, 2008 6:47 am

markus.leder wrote:The random newsbox is NOT SHOWING INSIDE THE CONTENT AREA but ON TOP OF THE PAGE...
Try with the following code:

Code: Select all

#CMSimple $output=preg_replace("/".chr(35)."CMSimple.*".chr(35)."/",HERE YOUR SCRIPT CODE,$c[$s]);#
Holger

Post Reply