The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
str replace into forumhome_forumbit_level2_post
I have read the other threads about this but none had helped me.
I have added an option in the editing/creating a forum page. My option variable is $forum[var]. When I place the variable {vb:raw forum.newoption} directly into forumhome_forumbit_level2_post it works, it displays the data. So I'm trying to do this via plugin with the following code: PHP Code:
After this, I did try using a template, with the variable in it. Then I registered and rendered the template y used that to str replace. PHP Code:
I must say that I'm new creating plugins, maybe I'm missing something. |
#2
|
||||
|
||||
Code:
{vb:raw forum.newoption} It would be more like the following: Code:
$find = '<p class="theclass">'; $insert = $forum[var]; $vbulletin->templatecache['forumhome_forumbit_level2_post'] = str_replace($find,$find.$insert , $vbulletin->templatecache['forumhome_forumbit_level2_post']); |
#3
|
||||
|
||||
That works as my template approach.
The variable ouput get repeated into the next forum, even is the next has its own value. The second forum shows its value, but the value from the previous forum. I'm looking into the vBulletin files to see how they do that, I'm not good at this but i'm learning |
#4
|
||||
|
||||
can you paste more of your code
Did you set your own variable for $forum or $forum[newoption] I am not totally understanding what it is you want to do. I think you want to grab the postid for each post. add this in your code towards the bottom: Code:
var_dump($forum[newoption]); |
#5
|
||||
|
||||
You probably need to zero it out prior to setting it. That way, if you don't set it for that particular forum, it won't show the previous setting.
|
#6
|
||||
|
||||
$forum[newoption] is from the options when editing a forum. I've added a new option there:
hook: forumadmin_edit_form PHP Code:
hook: forumdata_start PHP Code:
Now using the variable directly into my template it works as spected too: $forum[iconlocation] as {vb:raw forum.iconlocation} The problem is trying to insert that variable using a plugin: PHP Code:
Also the output for var_dump($forum[iconlocation]); is Code:
string(31) "images/misc/skype_voicemail.gif" string(32) "images/misc/skype_addcontact.gif" string(0) "" |
#7
|
||||
|
||||
try this:
Code:
$insert = '<img src="$forum[iconlocation]" alt="$forum[title]" />'; Code:
var_dump($forum[iconlocation]); |
#8
|
||||
|
||||
No, that isn't the problem. If I use that I get printed the variable names, not the data.
Thank you for your help, I'm going to release the plugin as it is, and ask the user to make a template edit to insert the html code. I can't make it work. |
#9
|
||||
|
||||
When you release it I will take a look and see if I cant make it work the way you want.
|
#10
|
||||
|
||||
It's been released. Actually without automatic template edit the product is useless since the same icon can be added into the forum description without having to modify templates
https://vborg.vbsupport.ru/showthread.php?p=1925448 |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|