The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Which hook to use?
Hi,
I added a new column to "thread" table and performed a plugin to fill it with a particular data relative to each thread and everything went well, but what I'm stacking on is Where to show this column on "showthread.php", I used this tag: HTML Code:
{vb:raw threadinfo.my_new_column} Regards. |
#2
|
|||
|
|||
I'm not sure I understand what you mean. If you pasted it in the SHOWTHREAD template and it works, why not just paste it where you want it? If you mean that you want it to be inserted by your plugin code so that you don't have to edit the template manually, then it can be done but it gets a little tricky. You basically need to do a str_replace() on the cached template before it's used. Also you can't put in template "curly brace" tags that way, you would need to insert a string.
|
#3
|
|||
|
|||
Quote:
Quote:
Quote:
Thank you kh99, waiting forward... |
#4
|
|||
|
|||
Quote:
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 Code:
$find = "some string"; $replace = "other string"; $vbulletin->templatecache['SHOWTHREAD'] = str_replace($find, $replace, $vbulletin->templatecache['SHOWTHREAD']); 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 Code:
$fp = fopen("showthread.txt", "wb"); fwrite($fp, $vbulletin->templatecache['SHOWTHREAD']); Then I open that file in my editor so I can refer to it. I hope that makes some sense. |
#5
|
|||
|
|||
Well, where to put these lines please?
And, why would it be difficult? if I could do it with a hook 'showthread_getinfo', I thought I can do it with another, I just don't know what is it, I saw couple of products with double of what I want, so I still believe it's not that difficult Thanks deeply Mr kh99. |
#6
|
|||
|
|||
Put those lines in a plugin using hook location 'showthread_getinfo'.
Maybe 'difficult' is the wrong word, maybe 'tricky' is better. Because like I said you might look at the template and try to match a certain string, but that string might not exist in the compiled template so you need to look at the compiled string to be sure. |
#7
|
|||
|
|||
We did a good progress till now, just one thing to know is where are they these compiled strings?
|
#8
|
|||
|
|||
The compiled string in the "template" database table, in the "template" column. The fopen and fwrite lines above are meant to be a "one-time" thing to print the compiled string to a file so you could look at it more easily.
--------------- Added [DATE]1324244228[/DATE] at [TIME]1324244228[/TIME] --------------- OK, based on the PM you sent me, I guess I misunderstood and your problem is that you can't find the place in the template to insert your change. So I looked but the problem is that I can't find anything that looks like your picture. What version of vb are you running, and what style are you using? |
#9
|
|||
|
|||
Well, it's not exactly alike, I just put the image to make you know the place (the date and time above the post like the first post: "Yesterday, 21:32" and above any other post also).
I'm using (vBulletin 4.1.5), and the basic style. Regards. |
#10
|
|||
|
|||
Oh..lol, I see now, it's actually *this* site. But if you want to put it there, the reason you can't find it in SHOWTHREAD is because that's part of the postbit template (or maybe postbit_legacy if you're using that). So look at postbit, and if you want it to only be in the fist post you can use a condition like:
Code:
<vb:if condition="$post['isfirstshown']">your html</vb:if> |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|