PDA

View Full Version : How would I do this?


06-07-2000, 12:51 AM
In showthread.php you have the variable.

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

So it will show the number of pages a thread is long.

I have set up another template called showthread_numpages2
and I want it to call on this template when the number of pages is one.

How would I set up an if else statement here to either pull up showthread-numpages2 if the page count is 1 or showthread-numpages if it is greater than 1?

Thanks,
Parker

06-08-2000, 09:27 AM
Ok,

This is what I have written and it doesn't work.

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

showthread_numpages2 is a second template that I have written that says.

This thread is 1 page long.

So now no matter how many pages long it is it goes to this variable instead of showthread_numpages.

Any ideas?

Parker

06-08-2000, 09:52 AM
Try

Find:


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


Replace with:

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

Originally posted by Parker Clack
Ok,

This is what I have written and it doesn't work.

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

showthread_numpages2 is a second template that I have written that says.

This thread is 1 page long.

So now no matter how many pages long it is it goes to this variable instead of showthread_numpages.

Any ideas?

Parker

06-08-2000, 02:35 PM
Moonwolf:

Thanks

Parker

06-09-2000, 01:22 PM
Moonwolf:

I tried that and it didn't work. This is what I have.

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_numpages2")."\";");
} else {
eval("\$pagenav = \"".gettemplate("showthread_numpages")."\";");
}

It still does not dispaly the template showthread_numpages2
when there is only one page.

Parker