PDA

View Full Version : Please take a look at this code I wrote up.


Jyaki
03-28-2001, 02:45 PM
I am trying to have certain template display only in forumid=5.
I don't know any php, but from the little experience that I do have from working with vB, I've created this:

if ($forumid=='5') {
$templatesused = "crnamail"; // Only one template used so load it when called
eval("\$crnamail .=\"".gettemplate("crnamail")."\";");
}

I've inserted the above code in forumdisplay.php
Now, the code actually did work, Woohoo! But the template does not show up when you start viewing individual threads that are under froumid 5.

What do I need to add so my $crnamail template will also show up in the threads of forumid 5?

Thanks guys!

03-28-2001, 08:57 PM
Where did you put the code at?

03-28-2001, 09:00 PM
I inserted it toward the bottom of forumdisplay.php
Does this answer your question?

This is the forum (http://www.anesthesiaforums.com/forums/forumdisplay.php?forumid=5)

The $crnamail template is the box in the upperleft that is asking for the email login

03-28-2001, 09:08 PM
yep...

You need to place it in showthread as well.

Also change the line:

$templatesused = "crnamail"; // Only one template used so load it when called


to

$templatesused .= "crnamail"; // Add one more template to the cache


Otherwise you wiped out the pre-cached templates and increase the resources needed by your system.

03-28-2001, 09:40 PM
OK, I changed the code like you said, and added it in showthread.php as well. I also added $crnamail in the showthread template.

It displays in forumid 5, but still doesn't show up in the threads under it.

What am I doing wrong?
thanks
-Hideki

03-30-2001, 01:34 AM
Is this legitimate PHP?


if ($thread[forumid]==5) {

$templatesused .= "crnamail"; // Add one more template to the cache
eval("\$crnamail .=\"".gettemplate("crnamail")."\";");

} else {
eval("\$forumrules .=\"".gettemplate("forumrules")."\";");
}


any PHP experts, please help!!
Thanks
:)
-Hideki

03-30-2001, 02:05 AM
Yes that's "legitimate" :D PHP. I'm not sure why it wouldn't display, though, if you've put it in both the template and the PHP file.

03-30-2001, 12:50 PM
Hey tubedogg, it worked! :D

I added that last code into forumdisplay.php and it worked perfectly. I wanted to make sure that it was legitimate PHP before attempting to use it.
I basically looked around other PHP files, saw some similar code, changed it a bit and came up with it. It sounded like it would work, but since I just pulled it out of my a$$, I wasnt' sure.

Thanks for your help though!
-Hideki