PDA

View Full Version : How can I get this to work?


07-11-2000, 05:22 PM
In the showthread.php file you have

if ($threadinfo[posts]>$perpage) {

$totalpages=$threadinfo[posts]/$perpage;
if ($totalpages!=intval($totalpages)) {
$totalpages=intval($totalpages)+1;
}

if ($pagenumber=="lastpage") {
$pagenumber=$totalpages;
}

eval("\$pagenav = \"".gettemplate("showthread_numpages")."\";");

To get it to say "This thread is XX pages long", etc.

I created a new template for saying "This thread is one page long"

and change the above to:

if ($threadinfo[posts]>$perpage) {

$totalpages=$threadinfo[posts]/$perpage;
if ($totalpages!=intval($totalpages)) {
$totalpages=intval($totalpages)+1;
}

if ($pagenumber=="lastpage") {
$pagenumber=$totalpages;
}

if ($totalpages==1){
eval("\$pagenav = \"".gettemplate("showthread_numpage")."\";");
}else{
eval("\$pagenav = \"".gettemplate("showthread_numpages")."\";");
}

I have not been able to get this to display on single pages. I know the template is working because if I change the showthread_numpages to numpage it will say it is One page long.

So any ideas? Obviously it is not counting anything and just jumping to the second in line in the if else line.

Thanks,

Parker

07-11-2000, 05:52 PM
Try changing:
if ($totalpages==1){

To:
if (!$totalpages) {

$totalpages only gets set if ($threadinfo[posts]>$perpage), which won't happen if there's only one page.

07-11-2000, 07:00 PM
Ed:

No good. It is still not seeing the value of 1.

Hmm...

Parker

[Edited by Parker Clack on 07-11-2000 at 04:01 PM]

07-11-2000, 07:16 PM
how about


if (!isset($totalpages)) {


[Edited by rangersfan on 07-11-2000 at 04:16 PM]

07-11-2000, 10:41 PM
Well, I looked at my code real quick, and we all missed one thing - one VERY important thing.

eval("\$pagenav = \"".gettemplate("showthread_numpages")."\";"); is inside the
if ($threadinfo[posts]>$perpage) { code block :)

So, scroll down and find:
} else {

if ($pagenumber=="lastpage") {
$pagenumber=1;
}

Under the } else { line, add:
eval("\$pagenav = \"".gettemplate("showthread_numpage")."\";");

* crosses fingers...

07-12-2000, 01:26 AM
Ed:

Simply solution to something that I was pulling my hair out about. And I don't have that much hair left to pull out anymore. :)

Thanks,

Parker