luxinterior
08-25-2012, 05:37 AM
Hi
LATEST PROBLEM
I was able to replace the code between my custom tags using...
$text = preg_replace("/\[flow-rtmp\](.*)\[\/flow-rtmp\]/Usi", $replacement, $text);
but now the problem is if I assign the return to $text the html object I have created shows as text on the page but if I assign it to $parsedtext the object displays correctly but all the other text in the post is not parsed and all the formatting is removed.
Any suggestion?
Lux
I need to replace a custom bbcode on the page NOT in the custom bb page. The code I'm putting in will be re-generated every time the page is loaded with different return values each time.
I've started writing a simple plugin that will replace the custom bbcode but the problem I'm having is how to identify the tag by name, extract it's param and then replace it with new code.
If anybody has an example of doing something like this it would be great. I've bee looking at loads of articles and other plugins for hours but no luck. All the code I've found so far relates to changing the bbcode when users are posting and not when the post is displayed which is what i'm trying to do.
Thanks
Lux
--------------- Added 1345885381 at 1345885381 ---------------
I came up with a solution in the end but I'm sure it's not the most elegant way of doing it. If anybody does have the correct solution please let me know.
I ended up doing this to find the tag and extract the param/text
foreach($this->tag_list as $tag_item => $tag){
if($tag['flow-rtmp']){
preg_match('/\[flow-rtmp\](.*?)\[\/flow-rtmp\]/i',$text,$match);
if($match){
and then assigned a value to $parsedtext to change the value.
Like I said it's not the best solution but it's all I could come up with. Hopefully somebody has a more elegant/correct solution.
Thanks
Lux
--------------- Added 1345945424 at 1345945424 ---------------
Well while my solution seemed to have worked I noticed some problem with it.
The code replaces ALL the text in the post and not just the text in between the custom bbcode which is not really what I want.
I'll continue trying to find a solution but if anybody can shed some light on this I'd appreciate it.
Thanks
Lux
LATEST PROBLEM
I was able to replace the code between my custom tags using...
$text = preg_replace("/\[flow-rtmp\](.*)\[\/flow-rtmp\]/Usi", $replacement, $text);
but now the problem is if I assign the return to $text the html object I have created shows as text on the page but if I assign it to $parsedtext the object displays correctly but all the other text in the post is not parsed and all the formatting is removed.
Any suggestion?
Lux
I need to replace a custom bbcode on the page NOT in the custom bb page. The code I'm putting in will be re-generated every time the page is loaded with different return values each time.
I've started writing a simple plugin that will replace the custom bbcode but the problem I'm having is how to identify the tag by name, extract it's param and then replace it with new code.
If anybody has an example of doing something like this it would be great. I've bee looking at loads of articles and other plugins for hours but no luck. All the code I've found so far relates to changing the bbcode when users are posting and not when the post is displayed which is what i'm trying to do.
Thanks
Lux
--------------- Added 1345885381 at 1345885381 ---------------
I came up with a solution in the end but I'm sure it's not the most elegant way of doing it. If anybody does have the correct solution please let me know.
I ended up doing this to find the tag and extract the param/text
foreach($this->tag_list as $tag_item => $tag){
if($tag['flow-rtmp']){
preg_match('/\[flow-rtmp\](.*?)\[\/flow-rtmp\]/i',$text,$match);
if($match){
and then assigned a value to $parsedtext to change the value.
Like I said it's not the best solution but it's all I could come up with. Hopefully somebody has a more elegant/correct solution.
Thanks
Lux
--------------- Added 1345945424 at 1345945424 ---------------
Well while my solution seemed to have worked I noticed some problem with it.
The code replaces ALL the text in the post and not just the text in between the custom bbcode which is not really what I want.
I'll continue trying to find a solution but if anybody can shed some light on this I'd appreciate it.
Thanks
Lux