Forum Index
RegisterSearchFAQMemberlistUsergroupsLog in
Including single post (with $id?)

 
Reply to topic    Forum Index » Bugs and errors View previous topic
View next topic
Including single post (with $id?)
Author Message
rats



Joined: 29 May 2006
Posts: 44

Post Including single post (with $id?) Reply with quote
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 View user's profile Send private message
Guest








Please login to hide the ads.

FI-DD
Admin


Joined: 22 Sep 2005
Posts: 2801
Location: Germany

Post Reply with quote
Try this:

Quote:
<?php

$id = 36;

include('show_news.php');



unset($id);

?>

Tue Mar 13, 2007 7:35 pm View user's profile Send private message
rats



Joined: 29 May 2006
Posts: 44

Post Reply with quote
sorry, it isn't working Sad
Tue Mar 13, 2007 8:06 pm View user's profile Send private message
FI-DD
Admin


Joined: 22 Sep 2005
Posts: 2801
Location: Germany

Post Reply with quote
Use $static on the following includes:

Code:
$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 View user's profile Send private message
rats



Joined: 29 May 2006
Posts: 44

Post Reply with quote
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:

Code:
<?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 View user's profile Send private message
FI-DD
Admin


Joined: 22 Sep 2005
Posts: 2801
Location: Germany

Post Reply with quote
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:

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 View user's profile Send private message
scottdallas



Joined: 04 May 2006
Posts: 1943
Location: US

Post Reply with quote
I know I always say this but.. iframe is a great solution.

_________________
www.scottdizzle.com uses cnr Smile
last update: 07-22-08: 8:30 pm
Tue Mar 13, 2007 9:40 pm View user's profile Send private message Visit poster's website AIM Address
twist



Joined: 05 Jan 2007
Posts: 28

Post Reply with quote
I'm actually having similar issues right now. This doesn't seem to work



Code:
<?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 View user's profile Send private message
FI-DD
Admin


Joined: 22 Sep 2005
Posts: 2801
Location: Germany

Post Reply with quote
twist wrote:
Granted, if I was able to sort all news by votes, I wouldn't need to specify a specific ID.


Just try this code:

Code:
$sort = array('votes', 'DESC');

Wed Apr 04, 2007 7:47 pm View user's profile Send private message
twist



Joined: 05 Jan 2007
Posts: 28

Post Reply with quote
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 View user's profile Send private message
Display posts from previous:    
Reply to topic    Forum Index » Bugs and errors All times are GMT + 1 Hour
Page 1 of 1

 
Jump to: 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum



Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Music Lyrics.