PDA

View Full Version : Change showthread by showthread_2 in some forums


chicote
06-28-2008, 09:39 PM
I am creating a product that depending on the forum he changes the Showthread, ah I would like to know, how do I get in the forum that I've chosen, instead of Showthread he shows a template Showthread_2?

Someone could give me a tip for that plugin, I created a plugin with the following code:
if ($this->forum['forumnumber'])
{
$vbulletin->templatecache['showthread'] = $vbulletin->templatecache['showthread_2'];
}
But is not working, I could fix that indicate how plugin, recalling that forumnumber is an option that I created empowered the manager of forums, to define which will use the forum shothread_2;

If I can help.

Opserty
06-29-2008, 10:15 AM
The data manager only controls the data during adding/editing/deleting.

It would be best to look at the showthread.php PHP code and see what is happening and what variables are involved.

You probably want a condition like if($forum['forumid'] == X) or something.

Amenadiel
06-29-2008, 05:23 PM
I believe you could do pretty much everything just by calling another template. I mean, I was using both postbit and postbit legacy depending on the forum using a condition like the one Opserty told you.

You could do the same for showthread template.

Opserty
06-29-2008, 05:30 PM
Postbits are created using a class, showthread is done by procedural code.

Amenadiel
06-30-2008, 12:03 PM
yes, but even so, his showthread template could have a condicional


<if condition="in_array($forumid, array(1,2,3))">

showthread2 template

<else />

normal showthread template

</if>



of course, I know what you mean, the showthread.php will be the same, but manipulating the template should allow to change pretty much everything about the way the data is displayed.

You see that in the first post his concern is how to display the showthread 2 template, he doesn't want to change the core.

Opserty
06-30-2008, 12:33 PM
There is no need to change the core... this could probably be done using the Plugin System.

Using that conditional would mean the showthread template would be extremely long (twice the length of what it normally). It is probably more efficient to create a second separate template and overwrite the original one at runtime, as suggested by the OP.