![]() |
|
Thread Tools |
#1
|
||||
|
||||
![]()
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
Which probably isn't right, but a lot of the threads I've searched through for vB 4 str_replace are incomplete as far as an official WORKING answer. Now, with the code above, I've tried using the hook locations:
So, my next question is, what's wrong with it? ![]() / str_replace noob ![]()
__________________
"Our greatest weakness lies in giving up. The most certain way to succeed is always to try just one more time!"
"It's important to only think about what you desire, not what you fear to achieve your ultimate goal!! No members have liked this post.
|
#2
|
||||||||
|
||||||||
Templates get compiled when you save into actual PHP code, and evaluated before it gets to global_shutdown.
global_start (or vb4 equivalent)
See what that prints out, and you'll have to do str_replace() on that variable, rather than $output.
--------------- Added 05 Jul 2011 at 02:13 --------------- Alternatively, you could probably do it all in PHP. Once you've rendered it once, set $post['signature'] = '';
__________________
Sr Software Developer / Tech Lead No members have liked this post.
|
#3
|
||||||||
|
||||||||
Originally Posted by Adrian Schneider
That gave me a blank white page![]()
Originally Posted by Adrian Schneider
And you lost me there lol
![]()
__________________
"Our greatest weakness lies in giving up. The most certain way to succeed is always to try just one more time!"
"It's important to only think about what you desire, not what you fear to achieve your ultimate goal!! No members have liked this post.
|
#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
Not tested, but may work.
__________________
Sr Software Developer / Tech Lead No members have liked this post.
|
#5
|
||||
|
||||
Originally Posted by Adrian Schneider
Sorry, guess I should've mentioned I tried global_complete too, and that too gave a blank page.![]()
Originally Posted by Adrian Schneider
Just tested and this DOES work. Thanks. ![]()
![]()
__________________
"Our greatest weakness lies in giving up. The most certain way to succeed is always to try just one more time!"
"It's important to only think about what you desire, not what you fear to achieve your ultimate goal!! No members have liked this post.
|
#6
|
||||
|
||||
Look how I did it here:
http://www.vbulletin.org/forum/showthread.php?t=259687 I did the mod for this for vb4. No members have liked this post.
|
#7
|
||||||||
|
||||||||
I don't think that:
is correct. You evaluate an expression there which maybe will cause endless loop by having $find there, which is also the first argument. I haven't seen all your code, but if you want to use that expression is better to add another variable before. eg:
Maria No members have liked this post.
|
#8
|
||||
|
||||
In vb4, find doesn't work with if conditions very well. That is why your code below didn't work.
No members have liked this post.
|
![]() |
«
Previous Thread
|
Next Thread
»
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
|
|
New To Site? | Need Help? |
All times are GMT. The time now is 08:28.