The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
[HELP] replace template with template plugin
i may have got it but it does not seem right to me, makes since, but doesnt seem right, can someone confirm this is the way or is there another way to do this.
Code:
$vbulletin->templatecache['forumhome_loggedinuser'] = fetch_template('drc_test'); --------- i am trying to completely replace the whole template (string) of forumhome_loggedinuser template i have my hook set to forumhome_start and about all i can manage to do is add to it, replacing is new to me. this is what i have currently Code:
$drcrb_cr = '$stylevar[dirmark]'; $vbulletin->templatecache['forumhome_loggedinuser'] = str_replace($drcrb_cr,$drcrb_cr.fetch_template('drc_test'),$vbulletin->templatecache['forumhome_loggedinuser']); |
#2
|
||||
|
||||
In one of my vB 3.8.x mods, I wanted to replace the output from the "newpost_threadmanage" template with the output from a custom template. The output from the default template is displayed in the "newreply" template in the variable $threadmanagement. So, what I did was create a plugin hooked at "newreply_form_complete" with the following PHP code:
PHP Code:
|
Благодарность от: | ||
Dr.CustUmz |
#3
|
||||
|
||||
ok so say i want to replace $activeusers on forumhome
with a template i define as $myTemplate would it be the same process? and would the code i have in $myTemplate be able to run in replace of $activeusers (which is the forumhome_loggedinusers template) i still want the same variables to work like $loggedin[musername] its mainly the hooks i get lost on i dont know what hooks i need to use for things i try to do so mainly i just try different ones untill it works right now im using with the hook (forumhome_loggedinuser) Code:
$vbulletin->templatecache['forumhome_loggedinuser'] = fetch_template('drc_act_av'); i want it to replace $activeusers on forumhome and load my template. im thinking Code:
eval('$drc_act_av = "' . fetch_template('drc_act_av') . '";'); $activeusers = $drc_act_av; |
#4
|
||||
|
||||
I would try the hook "forumhome_complete" hook location. See what you get...
|
#5
|
||||
|
||||
it works, but it breaks my other plugin, this is what i have
Code:
<plugin active="1" executionorder="5"> <title>DRC - Whos On Avatar</title> <hookname>forumhome_loggedinuser</hookname> <phpcode><![CDATA[require_once('./includes/functions_user.php'); $loggedin[avatarurl] = fetch_avatar_url($loggedin[userid]); if (!$loggedin[avatarurl]) { $loggedin[avatarurl] = $stylevar['imgdir_misc'] . '/noavatar.png'; } else { $loggedin[avatarurl] = $vbulletin->options['bburl'] . '/' . $loggedin[avatarurl][0]; }]]></phpcode> </plugin> <plugin active="1" executionorder="5"> <title>DRC - Whos On Avatar FH</title> <hookname>forumhome_complete</hookname> <phpcode><![CDATA[ eval('$drc_act_av = "' . fetch_template('drc_act_av') . '";'); $activeusers = $drc_act_av; ]]></phpcode> </plugin> the html is spitting out HTML Code:
<!-- BEGIN TEMPLATE: drc_act_av --> <a href="member.php?u="><img src="" height="40px" width="auto" border="0" alt=""></a> <!-- END TEMPLATE: drc_act_av --> Code:
<!-- BEGIN TEMPLATE: drc_act_av --> <a href="member.php?u=12"><img src="avatars/users/12.gif?dateline=1456633560" height="40px" width="auto" border="0" alt=""></a> <!-- END TEMPLATE: drc_act_av --> doing both plugins in one how i had does work but again not the desired way Code:
<plugin active="1" executionorder="5"> <title>DRC - Whos On Avatar</title> <hookname>forumhome_loggedinuser</hookname> <phpcode><![CDATA[require_once('./includes/functions_user.php'); $loggedin[avatarurl] = fetch_avatar_url($loggedin[userid]); if (!$loggedin[avatarurl]) { $loggedin[avatarurl] = $stylevar['imgdir_misc'] . '/noavatar.png'; } else { $loggedin[avatarurl] = $vbulletin->options['bburl'] . '/' . $loggedin[avatarurl][0]; } $vbulletin->templatecache['forumhome_loggedinuser'] = fetch_template('drc_act_av');]]></phpcode> </plugin> |
#6
|
||||
|
||||
Have you tried changing the execution order?
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|