Go Back   Pligg CMS Forum > Pligg Development > Pligg Modules > Module Support

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-26-2008, 10:38 AM
popsantiago's Avatar
Pligg Donor
Pligg Version: 9.9
 
Join Date: May 2007
Posts: 32
Thanks: 0
Thanked 4 Times in 3 Posts
Featured Story with radom id

Hi,

I want to know how can put a random id in the featured story...

Code:
	{php}
	
		$link = new Link;
		
		// Edit this line here to change the story
		// to figure out what number a story is, hover your mouse over the votebox for the story
		// you'll see   javascript:vote(A, B, C, 'D', E)
		// the 2nd number (B) will be the number you enter below
		// a better version of this module will come with Pligg V1.0
		
		
		$link->id=Random ID;

		
		
		$link->read();
		$link->print_summary('summary');
	{/php}
What's the query ?

Thx.
Reply With Quote
  #2 (permalink)  
Old 04-30-2008, 06:26 PM
Banned
Pligg Version: 9.9.5
 
Join Date: Oct 2007
Location: Canada
Posts: 914
Thanks: 169
Thanked 17 Times in 17 Posts
I would like to know this too, changing it sucks!
Reply With Quote
  #3 (permalink)  
Old 04-30-2008, 07:21 PM
popsantiago's Avatar
Pligg Donor
Pligg Version: 9.9
 
Join Date: May 2007
Posts: 32
Thanks: 0
Thanked 4 Times in 3 Posts
hi brian,
It's ok for me i did it ^^
I tell you the solution tomorrow
pop

It's late in FRANCE...
See you.
__________________
My pligg under construction : Bbuzz.fr home page | Bbuzz.fr News
It's not a pligg vote, but it's helping me Vote For me Thx
Reply With Quote
  #4 (permalink)  
Old 05-01-2008, 07:51 AM
ashishhbti's Avatar
Coder
Pligg Version: 9.8
Pligg Template: yget
 
Join Date: Jul 2007
Location: India
Posts: 38
Thanks: 0
Thanked 9 Times in 5 Posts
Check this.



{php}

$random_row = mysql_fetch_row(mysql_query("SELECT link_id FROM ".table_links." WHERE link_status='published' ORDER BY rand() LIMIT 1"));
$randomLinkId = $random_row['link_id'];

$link = new Link;

// Edit this line here to change the story
// to figure out what number a story is, hover your mouse over the votebox for the story
// you'll see javascript:vote(A, B, C, 'D', E)
// the 2nd number (B) will be the number you enter below
// a better version of this module will come with Pligg V1.0


$link->id=$randomLinkId ;



$link->read();
$link->print_summary('summary');

{/php}
Reply With Quote
  #5 (permalink)  
Old 05-01-2008, 09:22 AM
popsantiago's Avatar
Pligg Donor
Pligg Version: 9.9
 
Join Date: May 2007
Posts: 32
Thanks: 0
Thanked 4 Times in 3 Posts
hi,
Like that it's ok :
Code:
	{php}
	$link = new Link;
		$randomQ = mysql_query("select * from " . table_links . " where link_status='queued' order by RAND() ASC limit 0,1");
		while($random = mysql_fetch_array($randomQ))
		{
			$link_title = $random[link_title];
			$link_url = $random[link_url];
			$link_id = $random[link_id];
				
		
		$link->id=$link_id;
		
		
		$link->read();
		$link->print_summary('summary');
		}

	
	
	
	{/php}
pop
__________________
My pligg under construction : Bbuzz.fr home page | Bbuzz.fr News
It's not a pligg vote, but it's helping me Vote For me Thx
Reply With Quote
The Following 2 Users Say Thank You to popsantiago For This Useful Post:
  #6 (permalink)  
Old 05-01-2008, 09:40 AM
Banned
Pligg Version: 9.9.5
 
Join Date: Oct 2007
Location: Canada
Posts: 914
Thanks: 169
Thanked 17 Times in 17 Posts
popsantiago do I replace what I have in my featured_story.tpl with this or do I add this before or after something in specific?

thanks
Reply With Quote
  #7 (permalink)  
Old 05-01-2008, 10:53 AM
popsantiago's Avatar
Pligg Donor
Pligg Version: 9.9
 
Join Date: May 2007
Posts: 32
Thanks: 0
Thanked 4 Times in 3 Posts
Quote:
Originally Posted by bbrian017 View Post
popsantiago do I replace what I have in my featured_story.tpl with this or do I add this before or after something in specific?

thanks
You need to remplace the code between {php} {/php}
Code:
	{php}
		require_once(mnminclude.'link.php');
		$link = new Link;
		
		// Edit this line here to change the story
		// to figure out what number a story is, hover your mouse over the votebox for the story
		// you'll see   javascript:vote(A, B, C, 'D', E)
		// the 2nd number (B) will be the number you enter below
		// a better version of this module will come with Pligg V1.0
		
		$link->id=1;
		
		
		$link->read();
		$link->print_summary('summary');
	{/php}
I don't know if you see it but you can put (in the request) published or queued ...

pop
__________________
My pligg under construction : Bbuzz.fr home page | Bbuzz.fr News
It's not a pligg vote, but it's helping me Vote For me Thx
Reply With Quote
The Following User Says Thank You to popsantiago For This Useful Post:
  #8 (permalink)  
Old 05-02-2008, 08:50 PM
Designer
Pligg Version: 9.9.
 
Join Date: Mar 2007
Posts: 159
Thanks: 1
Thanked 15 Times in 11 Posts
Send a message via MSN to skins4webs
Great job.. Wonder if there is an easy way to make it only show random stories after a certain date.. For me I would not want a random story from a year ago.
__________________
http://www.illestlyrics.com, hip-hop site
http://www.qkin.com, Web development site
Reply With Quote
The Following User Says Thank You to skins4webs For This Useful Post:
  #9 (permalink)  
Old 05-02-2008, 10:00 PM
ashishhbti's Avatar
Coder
Pligg Version: 9.8
Pligg Template: yget
 
Join Date: Jul 2007
Location: India
Posts: 38
Thanks: 0
Thanked 9 Times in 5 Posts
Quote:
Originally Posted by popsantiago View Post
hi,
Like that it's ok :
Code:
	{php}
	$link = new Link;
		$randomQ = mysql_query("select * from " . table_links . " where link_status='queued' order by RAND() ASC limit 0,1");
		while($random = mysql_fetch_array($randomQ))
		{
			$link_title = $random[link_title];
			$link_url = $random[link_url];
			$link_id = $random[link_id];
				
		
		$link->id=$link_id;
		
		
		$link->read();
		$link->print_summary('summary');
		}

	
	
	
	{/php}
pop
Can you tell me what the use of while loop here ?and whats the use of linktitle and link url ?
Reply With Quote
  #10 (permalink)  
Old 05-02-2008, 10:10 PM
Banned
Pligg Version: 9.9.5
 
Join Date: Oct 2007
Location: Canada
Posts: 914
Thanks: 169
Thanked 17 Times in 17 Posts
Quote:
Originally Posted by skins4webs View Post
Great job.. Wonder if there is an easy way to make it only show random stories after a certain date.. For me I would not want a random story from a year ago.
This is a great idea!

WOOT good thinking! Can this be done?
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 On
[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
how to pass variable from releated story to featured story? jackyu General Help 1 03-01-2008 06:20 AM
Featured Story Template jacksparrow General Help 0 02-26-2008 12:57 PM
Featured Story Geoserv General Help 2 01-18-2008 06:49 AM
Featured Story Geoserv Modification Tutorials 0 12-23-2007 11:46 PM
Featured Story Module - Multiple Stories spartacus Modification Tutorials 4 10-07-2007 07:20 PM


Search Engine Friendly URLs by vBSEO 3.2.0