The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#11
|
||||
|
||||
![]()
Well that's a little more difficult i'm thinking about this code
Code:
$forum['title'] = str_replace('"', "'", $forum['title']); *replace the " with the ' --------------- Added [DATE]1324406159[/DATE] at [TIME]1324406159[/TIME] --------------- Ok this is driving me insane o.o! I can't put a ' in a string!! Is vbulletin?! Why this code doesn't work? ![]() Code:
$find = '<h2 class="forumtitle"><a href="\' . vB_Template_Runtime::linkBuild("forum", $forum) . \'">\' . $forum[\'title\'] . \'</a></h2>'; $replace = ' \' '; $vbulletin->templatecache['forumhome_forumbit_level2_post'] = str_replace($find, $replace, $vbulletin->templatecache['forumhome_forumbit_level2_post']); --------------- Added [DATE]1324418531[/DATE] at [TIME]1324418531[/TIME] --------------- Ok i'm thinking that this template doesn't accepts apostrophe i tried this code and it works Code:
$find = 'test'; $replace = <<<DH DH; $vbulletin->templatecache['forumhome_forumbit_level2_post'] = str_replace($find, $replace, $vbulletin->templatecache['forumhome_forumbit_level2_post']); Code:
$find = 'test'; $replace = <<<DH ' DH; $vbulletin->templatecache['forumhome_forumbit_level2_post'] = str_replace($find, $replace, $vbulletin->templatecache['forumhome_forumbit_level2_post']); |
#12
|
|||
|
|||
![]()
To be honest, I'm not sure what you're trying to do exactly. Are you tryig to delete the entire $find string? And why are you trying to replace it with a ' ?
|
#13
|
||||
|
||||
![]()
No these are test for see what's the problem, and the problem is that if i put a ' in the template, all the template is eliminated, so the problem is why i can't put a ' in a template!? Is a vbulletin problem
|
#14
|
|||
|
|||
![]()
I think you need to figure out the right 2 levels of "escaping". Maybe try this:
Code:
$replace = "\\'"; |
#15
|
||||
|
||||
![]()
Nothing, i think that is a problem of vbulletin, because in php all it's right and works
|
#16
|
|||
|
|||
![]()
But the template string is php code, and if you change it so that the quotes are mismatched the template will go away because when it's evaluated it will produce an error. So I think it's just that you're not ending up with valid php code.
|
#17
|
||||
|
||||
![]()
Yes this is possible but the question is why the this is not a valid php code!? I mean why this works
Code:
$find = 'test'; $replace = " "; $vbulletin->templatecache['forumhome_forumbit_level2_post'] = str_replace($find, $replace, $vbulletin->templatecache['forumhome_forumbit_level2_post']); Code:
$find = 'test'; $replace = " ' "; $vbulletin->templatecache['forumhome_forumbit_level2_post'] = str_replace($find, $replace, $vbulletin->templatecache['forumhome_forumbit_level2_post']); |
#18
|
|||
|
|||
![]()
I guess it depends where test is in the template, but you're adding one single quote, so wouldn't it mess up the quote matching?
|
#19
|
||||
|
||||
![]()
Test can be located wherever, what do you mean with "you're adding one single quote, so wouldn't it mess up the quote matching"
The string is declared by " and so i can write " ' " |
#20
|
|||
|
|||
![]()
The templatecache string uses single quotes, so unless you are careful where you put it, you're probably creating mismatched quotes.
ETA: unless you're saying that test that you're replacing is in a double-quoted string? That's why I asked where it was. Do you have a way to print out the templatecache string so you can see it? I think if you print it out before and after your replace, you'll probably be able to see what the problem is. |
![]() |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|