01-01-2001, 10:42 PM
first of all my 'beginning' code might be a bit different, my board is really hacked up. anyways,...
to get a 'Next Page >' button in your multi-page threads, so people dont need to remember what page they're on:
in showthread.php replace
while ($curpage++<$totalpages) {
if (($curpage<$pagenumber-$pagenavpages or $curpage>$pagenumber+$pagenavpages) and $pagenavpages!=0) {
if ($curpage==1) {
$pagenav.=" <a href=\"showthread.php?threadid=$threadid&pagenumber=$curpage".iif($perpage==$maxposts,"","&perpage=$perpage")."\"><font color=\"#afa3c5\" class=thtcolor><< First Page</font></a> ... ";
}
if ($curpage==$totalpages) {
$pagenav.=" ... <a href=\"showthread.php?threadid=$threadid&pagenumber=$curpage".iif($perpage==$maxposts,"","&perpage=$perpage")."\"><font color=\"#afa3c5\" class=thtcolor>Last Page >></font></a> ";
}
} else {
if ($curpage==$pagenumber) {
$pagenav.=" <font color=\"#afa3c5\" class=thtcolor>$curpage</font> ";
} else {
$pagenav.=" <a href=\"showthread.php?threadid=$threadid&pagenumber=$curpage".iif($perpage==$maxposts,"","&perpage=$perpage")."\"><font color=\"#afa3c5\" class=thtcolor>$curpage</font></a> ";
}
}
}
} else {
with
while ($curpage++<$totalpages) {
if (($curpage<$pagenumber-$pagenavpages or $curpage>$pagenumber+$pagenavpages) and $pagenavpages!=0) {
if ($curpage==1) {
$pagenav.=" <a href=\"showthread.php?threadid=$threadid&pagenumber=$curpage".iif($perpage==$maxposts,"","&perpage=$perpage")."\"><font color=\"#afa3c5\" class=thtcolor><< First Page</font></a> ... ";
}
if ($curpage==$totalpages) {
$twrat_nextpage = ($pagenumber)+1;
$pagenav.=" ... <a href=\"showthread.php?threadid=$threadid&pagenumber=$twrat_nextpage".iif($perpage==$maxposts,"","&perpage=$perpage")."\"><font color=\"#afa3c5\" class=thtcolor>Next Page ></font></a> <a href=\"showthread.php?threadid=$threadid&pagenumber=$curpage".iif($perpage==$maxposts,"","&perpage=$perpage")."\"><font color=\"#afa3c5\" class=thtcolor>Last Page >></font></a> ";
}
} else {
if ($curpage==$pagenumber) {
$pagenav.=" <font color=\"#afa3c5\" class=thtcolor>$curpage</font> ";
} else {
$pagenav.=" <a href=\"showthread.php?threadid=$threadid&pagenumber=$curpage".iif($perpage==$maxposts,"","&perpage=$perpage")."\"><font color=\"#afa3c5\" class=thtcolor>$curpage</font></a> ";
}
}
}
$twrat_nextpage = ($pagenumber)+1;
$pagenav.=" <a href=\"showthread.php?threadid=$threadid&pagenumber=$twrat_nextpage".iif($perpage==$maxposts,"","&perpage=$perpage")."\"><font color=\"#afa3c5\" class=thtcolor>Next Page ></font></a> ";
} else {
excuse the weird var names, i prefix my stuff generally w/ tw_ or twrat_ so i can find it easier before i go back and comment it :D
to make your template.php create instantly useable templates from the form (instead of having to go into global.php and register them) open /admin/template.php and find
$DB_site->query("INSERT INTO template (templateid,title,template) VALUES (NULL,'".addslashes("$title")."','".addslashes("$template")."')");
under it add
# added template code
# echo "title is $title <br>"; # debugging
$filename = "rattemp.php";
$str = '<?php eval("\$';
$str .= $title;
$str .= ' = \"".gettemplate("';
$str .= $title;
$str .= '")."\";"); ?>';
$fp=fopen($filename, 'a+');
fwrite($fp,"$str \n");
fclose($fp);
# end
then open up global.php and find
eval("\$fivelinks = \"".gettemplate("fivelinks")."\";");
and under it add
require ("admin/rattemp.php");
now create an empty file called /admin/rattemp.php and upload it, make sure its CHMOD-ed to 666, and you're set. also note if you delete custom templates, this wont remove the reference from the rattemp.php file, you'll have to do that manually, but i did this for my design guy who isnt really one to go trekking through code when he wants to make a template :)
anyways, thats all stuff ive been meaning to do for 3 months and never got around to it, so i figured maybe i'd share it :o
also im not really a mega-php programmer, my bag is perl, so if you find my code is weird (or just plain bad) thats why :)
[Edited by Ratorasniki on 01-01-2001 at 07:45 PM]
to get a 'Next Page >' button in your multi-page threads, so people dont need to remember what page they're on:
in showthread.php replace
while ($curpage++<$totalpages) {
if (($curpage<$pagenumber-$pagenavpages or $curpage>$pagenumber+$pagenavpages) and $pagenavpages!=0) {
if ($curpage==1) {
$pagenav.=" <a href=\"showthread.php?threadid=$threadid&pagenumber=$curpage".iif($perpage==$maxposts,"","&perpage=$perpage")."\"><font color=\"#afa3c5\" class=thtcolor><< First Page</font></a> ... ";
}
if ($curpage==$totalpages) {
$pagenav.=" ... <a href=\"showthread.php?threadid=$threadid&pagenumber=$curpage".iif($perpage==$maxposts,"","&perpage=$perpage")."\"><font color=\"#afa3c5\" class=thtcolor>Last Page >></font></a> ";
}
} else {
if ($curpage==$pagenumber) {
$pagenav.=" <font color=\"#afa3c5\" class=thtcolor>$curpage</font> ";
} else {
$pagenav.=" <a href=\"showthread.php?threadid=$threadid&pagenumber=$curpage".iif($perpage==$maxposts,"","&perpage=$perpage")."\"><font color=\"#afa3c5\" class=thtcolor>$curpage</font></a> ";
}
}
}
} else {
with
while ($curpage++<$totalpages) {
if (($curpage<$pagenumber-$pagenavpages or $curpage>$pagenumber+$pagenavpages) and $pagenavpages!=0) {
if ($curpage==1) {
$pagenav.=" <a href=\"showthread.php?threadid=$threadid&pagenumber=$curpage".iif($perpage==$maxposts,"","&perpage=$perpage")."\"><font color=\"#afa3c5\" class=thtcolor><< First Page</font></a> ... ";
}
if ($curpage==$totalpages) {
$twrat_nextpage = ($pagenumber)+1;
$pagenav.=" ... <a href=\"showthread.php?threadid=$threadid&pagenumber=$twrat_nextpage".iif($perpage==$maxposts,"","&perpage=$perpage")."\"><font color=\"#afa3c5\" class=thtcolor>Next Page ></font></a> <a href=\"showthread.php?threadid=$threadid&pagenumber=$curpage".iif($perpage==$maxposts,"","&perpage=$perpage")."\"><font color=\"#afa3c5\" class=thtcolor>Last Page >></font></a> ";
}
} else {
if ($curpage==$pagenumber) {
$pagenav.=" <font color=\"#afa3c5\" class=thtcolor>$curpage</font> ";
} else {
$pagenav.=" <a href=\"showthread.php?threadid=$threadid&pagenumber=$curpage".iif($perpage==$maxposts,"","&perpage=$perpage")."\"><font color=\"#afa3c5\" class=thtcolor>$curpage</font></a> ";
}
}
}
$twrat_nextpage = ($pagenumber)+1;
$pagenav.=" <a href=\"showthread.php?threadid=$threadid&pagenumber=$twrat_nextpage".iif($perpage==$maxposts,"","&perpage=$perpage")."\"><font color=\"#afa3c5\" class=thtcolor>Next Page ></font></a> ";
} else {
excuse the weird var names, i prefix my stuff generally w/ tw_ or twrat_ so i can find it easier before i go back and comment it :D
to make your template.php create instantly useable templates from the form (instead of having to go into global.php and register them) open /admin/template.php and find
$DB_site->query("INSERT INTO template (templateid,title,template) VALUES (NULL,'".addslashes("$title")."','".addslashes("$template")."')");
under it add
# added template code
# echo "title is $title <br>"; # debugging
$filename = "rattemp.php";
$str = '<?php eval("\$';
$str .= $title;
$str .= ' = \"".gettemplate("';
$str .= $title;
$str .= '")."\";"); ?>';
$fp=fopen($filename, 'a+');
fwrite($fp,"$str \n");
fclose($fp);
# end
then open up global.php and find
eval("\$fivelinks = \"".gettemplate("fivelinks")."\";");
and under it add
require ("admin/rattemp.php");
now create an empty file called /admin/rattemp.php and upload it, make sure its CHMOD-ed to 666, and you're set. also note if you delete custom templates, this wont remove the reference from the rattemp.php file, you'll have to do that manually, but i did this for my design guy who isnt really one to go trekking through code when he wants to make a template :)
anyways, thats all stuff ive been meaning to do for 3 months and never got around to it, so i figured maybe i'd share it :o
also im not really a mega-php programmer, my bag is perl, so if you find my code is weird (or just plain bad) thats why :)
[Edited by Ratorasniki on 01-01-2001 at 07:45 PM]