The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
str_replace help please
Ok, this is my 1st time playing around with str_replace and I'm obviously doing SOMETHING wrong as my code isn't working lol
Basically what I'm trying to do, is turn this into an automatic template edit, and eventually do the same with most of my personal modifications which haven't and won't be released here. So no need to worry about if user x installs on a custom style, he/she may run into problems later. Anyway, on with the codes Currently, I have this in a plugin PHP Code:
Now, with the code above, I've tried using the hook locations: Quote:
So, my next question is, what's wrong with it? / str_replace noob |
#2
|
||||
|
||||
Templates get compiled when you save into actual PHP code, and evaluated before it gets to global_shutdown.
global_start (or vb4 equivalent) PHP Code:
PHP Code:
Alternatively, you could probably do it all in PHP. Once you've rendered it once, set $post['signature'] = ''; |
#3
|
||||
|
||||
Quote:
Quote:
|
#4
|
||||
|
||||
Move that first plugin to global_complete (for example's sake). I always forget that the global_start one has output buffering which would give you the blank page.
Once you see the output from a compiled template, it will give you an idea on how to actually figure out what to put in $find and $replace. For the alternate method, upon successfully displaying the signature once, you can empty that variable so it won't display again, rather than relying on the template edit. postbit_display_start PHP Code:
|
#5
|
||||
|
||||
Quote:
Quote:
|
#6
|
||||
|
||||
Look how I did it here:
https://vborg.vbsupport.ru/showthread.php?t=259687 I did the mod for this for vb4. |
#7
|
|||
|
|||
I don't think that:
Code:
$output = str_replace($find,$replace.$find, $output); Code:
$mynewreplace = $replace.$find; $output = str_replace($find,$mynewreplace, $output); |
#8
|
||||
|
||||
In vb4, find doesn't work with if conditions very well. That is why your code below didn't work.
Code:
$find = '<vb:if condition=\"$post['signature']\">'; |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|