Topic: Show random news article?

Hi! I'm searching for some hack or some otherway to show a random full story article? I googled and found this, but it doesn't seem to work for me? (I've got Cutenews 1.4.7)

https://cutephp.com/forum/index.php?showtopic=4464

Re: Show random news article?

Perhaps...

$count = count(file("path/to/news.txt"));
$start_from = mt_rand(0, $count);
$number = 1;
include('path/to/show_news.php');
unset $start_from;
if(isset($_GET['start_from'])) $start_from = $_GET['start_from'];

Would work? This is, ofc, for active news...

Re: Show random news article?

that hack should still work
only
$cutepath = �__FILE__;
has this weird character that should be deleted.

4 (edited by 2013-03-16 03:28:09)

Re: Show random news article?

I am trying to show a random active news story from 1 category. I came across this post, but none of them seem to work for me? (I've got Cutenews 1.5.2)

I used with and without the strange special character and used as stated in Original Post and the web page just locked up while loading.

I think the problem might be that when I run the integration wizard it gives a strange path.
<div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:pre;overflow:auto'><?PHP
$number=1;
$template="hot_job";
$category=2;
$static=TRUE;
include("/home/hsphere/local/home/xxxxxx/my-site.com/cutenews/show_news.php");
?></div>

Is that path giving the hack issues? Any Suggestions?

I tried the suggestion by "Ifa" but was unsure how/where to put the code?

5 (edited by 2013-03-16 21:37:42)

Re: Show random news article?

I changed the line with the weird character from
<div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:pre;overflow:auto'>$cutepath = �__FILE__;</div>
to
<div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:pre;overflow:auto'>$cutepath = __FILE__;</div>
and now at least it does not lockup, but it is not display any news for this spot.
I have another news area displaying other news normally (not random) and that works.

In original post he mentions this is for full story only, I am using the active news template, and when adding news, only filling in the title, category, and short story. I assume if it was looking for a full story at least the title would show up. My active news template only calls for title and short story.

I finally got it to work, I am not sure what did it, but it works.