Go Back   Pligg CMS Forum > Pligg Help > General Help

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 09-13-2006, 01:52 PM
Casual Pligger
 
Join Date: Feb 2006
Posts: 67
Thanks: 2
Thanked 0 Times in 0 Posts
Displaying all stories from 1 category

Hey
I'm not good at php at all and can't figure out how to code the following:
display ALL (all time) stories (queued, published, etc) from 1 given category, ordered by most votes.
I hope anyway could help me with this..
thank in advance
Reply With Quote
  #2 (permalink)  
Old 09-14-2006, 11:16 AM
savant's Avatar
Constant Pligger
 
Join Date: Apr 2006
Location: UK
Posts: 1,218
Thanks: 64
Thanked 207 Times in 148 Posts
what page are you planning to display the stories.

first you'll need to get the category id.

select category_id from categories where category_safe_name = 'pligg'

once you have the category id you can find all the stories
PHP Code:
$links $db->get_col("select link_id from links where link_category=$category_id order by link_votes desc");
if(
$links){
        
$story = new Link;
        foreach(
$links as $link){
            
$story->id $link;
            
$story->read();
                }

the read will retrieve all the story data, and you can assign the values to smarty.

maybe if you can say more about what the page is, i can give you some code snippets to play with
__________________
Anatomy of the Pligg template Help needed
Reply With Quote
The Following User Says Thank You to savant For This Useful Post:
  #3 (permalink)  
Old 09-15-2006, 05:57 AM
Casual Pligger
 
Join Date: Feb 2006
Posts: 67
Thanks: 2
Thanked 0 Times in 0 Posts
It does not seem to work when using this:

PHP Code:
$links $db->get_col("select link_id from links where link_category=1 order by link_votes desc");
if(
$links){
        
$story = new Link;
        foreach(
$links as $link){
            
$story->id $link;
            
$story->read();
                }

But(!) I forgot to mention that I am using Meneame, not sure if that will affect the coding?
Reply With Quote
  #4 (permalink)  
Old 09-15-2006, 06:09 AM
savant's Avatar
Constant Pligger
 
Join Date: Apr 2006
Location: UK
Posts: 1,218
Thanks: 64
Thanked 207 Times in 148 Posts
I'm sorry i haven't looked at the meneme code, and not sure if it has a database object.

Best advice is to contact one of their developers or support forum.
__________________
Anatomy of the Pligg template Help needed
Reply With Quote
  #5 (permalink)  
Old 09-15-2006, 06:10 AM
Casual Pligger
 
Join Date: Feb 2006
Posts: 67
Thanks: 2
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by savant View Post
I'm sorry i haven't looked at the meneme code, and not sure if it has a database object.

Best advice is to contact one of their developers or support forum.
Alright, thanks for the help anyway :)
Reply With Quote
  #6 (permalink)  
Old 09-26-2006, 12:36 PM
New Pligger
 
Join Date: Sep 2006
Posts: 3
Thanks: 2
Thanked 0 Times in 0 Posts
can it?

can this go in the index.php file or should it go in the index_center.tpl
Reply With Quote
  #7 (permalink)  
Old 06-14-2007, 04:36 PM
Constant Pligger
 
Join Date: Jun 2006
Posts: 109
Thanks: 75
Thanked 1 Time in 1 Post
has this been sorted out?

anyone solved this... ;)
Reply With Quote
Reply

Thread Tools
Display Modes
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Similar Threads
Thread Thread Starter Forum Replies Last Post
Control of meta description - categories Divisive Cotton Suggestions 64 11-23-2008 07:37 PM
"Top stories in category X" category some error trh792 Bug Report 0 05-06-2007 02:53 AM
Show Top Stories by Category in Sidebar - A How To TrailofDead Modification Tutorials 0 04-23-2007 09:30 PM
category related sidebar stories Andtony Modification Tutorials 0 04-07-2007 10:55 AM
Php code for displaying category (+only 5 items) Laurent General Help 0 12-29-2006 07:24 AM


Search Engine Friendly URLs by vBSEO 3.2.0