Register Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools
  #1  
Old 19 Dec 2011, 20:33
Scanu's Avatar
Scanu Scanu is offline
 
Join Date: Nov 2010
"Compiled template"

Hi everybody! Let's start
Here what kh99

Originally Posted by kh99 View Post
Unfortunately it's difficult, I could write pages and still not explain everything (partly because I don't fully understand it myself). But in this case I happen to have a mod that changes the SHOWTHREAD template. It uses the showthread_getinfo hook location and has code like this

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


but, $vbulletin->templatecache contains compiled templates so it doesn't look like what you see in the template editor. That makes it tricky to know what you can search for and match. You could look in the template table in the database, the "template" column shows the compiled template. Or what I usually do is put in temporary code to write the cached template string to a file, like


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


Then I open that file in my editor so I can refer to it.

I hope that makes some sense.
i need to know what's the code of the compiled template "forumhome_forumbit_level2_post"

I tried your code (FOR SHOWTHREAD) and it gets me a blank text file, so nothing

This is the code that i need to "convert"


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

how can i do?
thanks in advance

--------------- Added 19 Dec 2011 at 20:56 ---------------

I see the database and i've tried this code

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

But didn't work

--------------- Added 19 Dec 2011 at 21:04 ---------------


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

This code would be delete the title of the forum but doesn't work! This code instead that would be delete the text "test" without variables works D:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


Last edited by Scanu; 20 Dec 2011 at 12:06.
Reply With Quote
  #2  
Old 19 Dec 2011, 21:10
kh99 kh99 is offline
 
Join Date: Aug 2009
Real name: Kevin
The reason the code using the showthread hook didn't work for you is that not every template is loaded on every page, and the forumbit templates aren't loaded on the showthread page. But as you figured out, you can look in the database and find the same info.

I'm not sure if you're saying you figured it out or you still have a problem.

Last edited by kh99; 19 Dec 2011 at 21:23.
Reply With Quote
  #3  
Old 19 Dec 2011, 21:20
Scanu's Avatar
Scanu Scanu is offline
 
Join Date: Nov 2010
ok i try the code of the showthread for the showthread exactly as you said just for see, but doesn't work. then yesy i see the code in the databse and i tried this code

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

and so i'm asking to me why? :S
Reply With Quote
  #4  
Old 19 Dec 2011, 21:23
kh99 kh99 is offline
 
Join Date: Aug 2009
Real name: Kevin
OK, try this:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


Edit: well, the replace code there isn't right, but the point is that you need to escape all single quotes in the string you're trying to match. You seem to have escaped the quotes in the string you're adding, but not in the string you got from the compiled template.
Reply With Quote
  #5  
Old 20 Dec 2011, 09:48
Scanu's Avatar
Scanu Scanu is offline
 
Join Date: Nov 2010
What!? The code didn't worked but i've changed this
' . $forum['title'] . '
in this:
' . $forum[\'title\'] . '
And it worked just this code with this code

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Now i will try all the first code

--------------- Added 20 Dec 2011 at 11:23 ---------------

Everything work but there is a problem: This is my code

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

If i change this

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

in this

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

doesn't work! Why?
Reply With Quote
  #6  
Old 20 Dec 2011, 13:09
kh99 kh99 is offline
 
Join Date: Aug 2009
Real name: Kevin
I believe html attributes need to have " and not '.
Reply With Quote
  #7  
Old 20 Dec 2011, 13:53
Scanu's Avatar
Scanu Scanu is offline
 
Join Date: Nov 2010
No that's a choice of the coder (as php) in fact in normal html works but in this code not. As i change " to \' it delete all the template o.o. I need that is ' and not "
In php syntax this would be work That's strange

Last edited by Scanu; 20 Dec 2011 at 15:44.
Reply With Quote
  #8  
Old 20 Dec 2011, 14:03
kh99 kh99 is offline
 
Join Date: Aug 2009
Real name: Kevin
Oh, OK - I don't do enough html to keep that stuff straight. But I think then the reason it doesn't work is that it ends up producing a php string where the quotes are unmatched (or matched but not the way you intended). This stuff gets really confusing and hard to keep track of in my mind, but I think if you did this is might work:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Reply With Quote
  #9  
Old 20 Dec 2011, 14:18
Scanu's Avatar
Scanu Scanu is offline
 
Join Date: Nov 2010
Originally Posted by kh99 View Post
Oh, OK - I don't do enough html to keep that stuff straight. But I think then the reason it doesn't work is that it ends up producing a php string where the quotes are unmatched (or matched but not the way you intended). This stuff gets really confusing and hard to keep track of in my mind, but I think if you did this is might work:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.
That's the same for me, anyway it doesn't work Very strange!
I tried " and it worked but not as i want
I tried \' and it doesn't work
Now i tried \\' and it still doesn't work

Now the last thing i can do is change this

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

on

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

and so i can leave title = 'etc...' without problems, i have just to place a \ before the "

--------------- Added 20 Dec 2011 at 14:30 ---------------

Worst! Damn this code is perfect!

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Why i can't change " to \' ?
Reply With Quote
  #10  
Old 20 Dec 2011, 15:24
kh99 kh99 is offline
 
Join Date: Aug 2009
Real name: Kevin
Maybe try using "heredoc" syntax for the replacement string: http://us2.php.net/manual/en/language.types.string.php
Reply With Quote
  #11  
Old 20 Dec 2011, 16:19
Scanu's Avatar
Scanu Scanu is offline
 
Join Date: Nov 2010
Well that's a little more difficult i'm thinking about this code

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

what would be the hook location?
*replace the " with the '

--------------- Added 20 Dec 2011 at 17:35 ---------------

Ok this is driving me insane o.o! I can't put a ' in a string!!
Is vbulletin?! Why this code doesn't work?

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

If i write " all is ok but if i write \' it delete all the template! This is impossible..

--------------- Added 20 Dec 2011 at 21:02 ---------------

Ok i'm thinking that this template doesn't accepts apostrophe i tried this code and it works

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Then i tried this code but doesn't works!

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

What i mean with "doesn't work" it delete the template

Last edited by Scanu; 20 Dec 2011 at 21:38.
Reply With Quote
  #12  
Old 20 Dec 2011, 21:44
kh99 kh99 is offline
 
Join Date: Aug 2009
Real name: Kevin
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 ' ?
Reply With Quote
  #13  
Old 20 Dec 2011, 21:57
Scanu's Avatar
Scanu Scanu is offline
 
Join Date: Nov 2010
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
Reply With Quote
  #14  
Old 20 Dec 2011, 22:02
kh99 kh99 is offline
 
Join Date: Aug 2009
Real name: Kevin
I think you need to figure out the right 2 levels of "escaping". Maybe try this:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Reply With Quote
  #15  
Old 20 Dec 2011, 22:06
Scanu's Avatar
Scanu Scanu is offline
 
Join Date: Nov 2010
Nothing, i think that is a problem of vbulletin, because in php all it's right and works
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


New To Site? Need Help?

All times are GMT. The time now is 01:44.

Layout Options | Width: Wide Color: