PDA

View Full Version : Next/Previous Mod


falarious
07-11-2006, 07:30 PM
This mod will place next/previous links on your media page.
Example: http://www.falarious.com/file/194-family-guy-homosexual-and-you.html

Open template/file.php
Paste this code on the very top of file.php


<?php
$query = mysql_query("SELECT file_id,title FROM `files` WHERE file_id>$id LIMIT 1 UNION SELECT file_id,title FROM `files` WHERE file_id<$id ORDER BY file_id DESC LIMIT 2");

while ($row = mysql_fetch_array($query)){
$data = '<a href="file/'.$row['file_id'].'_'.ereg_replace(' ','-', strtolower($row['title'])).'.html">';
if ($row['file_id'] < $id)
$previous = $data.'<b>Previous</b>';
else
$next = $data.'<b>Next</b></a>';
}
?>

Then place this code wherever you want the "Next" link to appear.


<?php echo $next; ?>

Last, place this code wherever you want the "Previous" link to appear.

<?php echo $previous; ?>


Save file.php

summerock1
01-21-2007, 01:02 AM
Thank you for the excellent mod.

I'm getting this error

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/mysite/public_html/videos/template/file.php on line 4

parisdns
01-22-2007, 07:13 AM
Thank you for the excellent mod.

I'm getting this error

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/mysite/public_html/videos/template/file.php on line 4




same error here, do we miss something !?!...

renier
01-22-2007, 01:24 PM
Change the file permissions in cpanel .I think this is the problem so change the template file and all the files in it to chomm 7 7 7 .

falarious
01-22-2007, 07:48 PM
I am not sure what the problem is. I am at school right now and everything is blocked : /
I will look into it later

parisdns
01-23-2007, 09:13 PM
Thanks for the update !... :cool:

hoots123
01-25-2007, 04:30 PM
if i want to add this above or below my emedded media file which is the file i open to put that next and previous in?
which is the actual file that loads the video frame into it?

i would like to ad a google banner above or to the right side of it.

falarious
01-26-2007, 03:38 AM
You would have to edit the file.php template

hoots123
01-28-2007, 06:30 AM
im getting an error and all my files are chmod to 777... any ideas..

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/vidbum/public_html/template/file.php on line 4

falarious
01-28-2007, 07:37 AM
<?php
$id = intval($_GET['id']);
?>add that to the beginning of the file.php template.

parisdns
01-28-2007, 11:38 AM
Thanks, for the hit up, but for some reason, it works a half.

Somethime, the link add this caracter "#" in the link so the server can't reach the correct page. :confused:

EX.:

he correct link is: http://www.humorarena.com/file/423-karaoke-27.htmlthe hack give me: http://www.humorarena.com/file/423-karaoke-#27.htmlSo, I did not put it on production yet.

falarious
01-28-2007, 03:07 PM
<?php
$id = intval($_GET['id']);
$query = mysql_query("SELECT file_id,title,filename FROM `files` WHERE file_id>$id LIMIT 1 UNION SELECT file_id,title,filename FROM `files` WHERE file_id<$id ORDER BY file_id DESC LIMIT 2");

while ($row = mysql_fetch_array($query)){
$data = '<a href="file.php?id='.$row['file_id'].'"';
if ($row['file_id'] < $id)
$previous = $data.'><img align="left" border="0" src="http://www.falarious.com/images/previos2.jpg" alt="previos" /></a>';
else
$next = $data.'><img align="right" border="0" src="http://www.falarious.com/images/next2.jpg" alt="next" /></a>';
}


?><?php echo $previous; ?><?php echo $next; ?>
That is exactly how i have the code. But it doesnt use SEF urls cause i also had a problem similar to yours

hoots123
01-28-2007, 07:16 PM
AWSOME! thanks that worked out! now if only i could get a toplist script working i keep getting errors when i place code, although the script is installed on my server fine.:D

parisdns
01-30-2007, 09:11 AM
Thanks, FALARIOUS ! :cool: