| Author |
Message |
rats
Joined: 29 May 2006 Posts: 44
|
|
Including single post (with $id?) |
|
Hello
I know that in cutenews you need to define $id = 'postid' to include a single post, but I ran into an error while trying this in cutenews.ru: all includes below this particulary include using $id, doesen't work anymore.
|
|
| Tue Mar 13, 2007 4:45 pm |
|
 |
Guest
|
|
|
Please login to hide the ads.
|
|
|
|
 |
FI-DD
Admin

Joined: 22 Sep 2005 Posts: 2801 Location: Germany |
|
|
|
Try this:
 |  | <?php
$id = 36;
include('show_news.php');
unset($id);
?> |
|
|
| Tue Mar 13, 2007 7:35 pm |
|
 |
rats
Joined: 29 May 2006 Posts: 44
|
|
|
| Tue Mar 13, 2007 8:06 pm |
|
 |
FI-DD
Admin

Joined: 22 Sep 2005 Posts: 2801 Location: Germany |
|
|
|
Use $static on the following includes:
 |  | $id = 36;
include $cutepath.'/show_news.php';
$static['number'] = 5;
$static['category'] = 5;
include $cutepath.'/show_news.php'; |
|
|
| Tue Mar 13, 2007 8:16 pm |
|
 |
rats
Joined: 29 May 2006 Posts: 44
|
|
|
|
this seems to work... kinda... but when going on the next page with the static includes, the single post is showing "Post not found."
The code I'm working with:
 |  | <?php
$id='13';
$template='blank';
include '/home/on1x1/public_html/gtaro/news/show_news.php';
?>
<br/>
<?php
$static['number'] = 5;
$static['category'] = '1,2';
$template = 'stiri';
include '/home/on1x1/public_html/gtaro/news/show_news.php';
?> |
|
|
| Tue Mar 13, 2007 8:45 pm |
|
 |
FI-DD
Admin

Joined: 22 Sep 2005 Posts: 2801 Location: Germany |
|
|
|
Hmm, I don't know.
What about creating a special category and putting the single news in it. Then you can show it using the following code:
 |  | if($_GET['skip']){
$static['category'] = 99; //Special category
$static['template'] = 'blank';
}
else{
$category = 99; //Special category
$template = 'blank';
}
include '/home/on1x1/public_html/gtaro/news/show_news.php';
$static['number'] = 5;
$static['category'] = '1,2';
$static['skip'] = $_GET['skip'] ? $_GET['skip'] : '';
$static['template'] = 'stiri';
include '/home/on1x1/public_html/gtaro/news/show_news.php'; |
Going to the next page is working with this code.
|
|
| Tue Mar 13, 2007 9:06 pm |
|
 |
scottdallas

Joined: 04 May 2006 Posts: 1943 Location: US |
|
|
|
I know I always say this but.. iframe is a great solution.
_________________ www.scottdizzle.com uses cnr
last update: 07-22-08: 8:30 pm |
|
| Tue Mar 13, 2007 9:40 pm |
|
 |
twist
Joined: 05 Jan 2007 Posts: 28
|
|
|
|
I'm actually having similar issues right now. This doesn't seem to work
 |  | <?PHP
$id = 9;
$static['category'] = 1;
$static['template'] = 'secondplace';
$static['number'] = 1;
include("cnr/show_news.php");
?> |
I'm trying to dynamically update a page with the most voted on stories. I have 3 sections which show the avatars and titles of the top 3 with the most votes. So if a story gets more votes, then this section will be updated automatically. I'm running a SQL query in the background to determine the actual ID number, sorted by the most votes in the cute_news table. Granted, if I was able to sort all news by votes, I wouldn't need to specify a specific ID. So I'm trying to tweak everything to be able to pull what I want to display (again based on which articles has the most votes).
Any suggestions?
Do I need to adjust some code somewhere?
|
|
| Wed Apr 04, 2007 5:59 pm |
|
 |
FI-DD
Admin

Joined: 22 Sep 2005 Posts: 2801 Location: Germany |
|
|
|
 |  | Granted, if I was able to sort all news by votes, I wouldn't need to specify a specific ID. |
Just try this code:
 |  | $sort = array('votes', 'DESC'); |
|
|
| Wed Apr 04, 2007 7:47 pm |
|
 |
twist
Joined: 05 Jan 2007 Posts: 28
|
|
|
|
Yea per the other thread, sorting by votes does work. When I first tried it I was getting errors. Also sorting by votes only appears to work using $static and only if you've installed the ratings plugin and created the votes field in the news table.
Thanks!
|
|
| Wed Apr 04, 2007 10:30 pm |
|
 |
|