• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

how to use $thread in bb_code_tag_attach ?!

TBDragon

Active member
#1
hi i just wondering how i can use $thread in bb_code_tag_attach ?!

so i can use the {$thread.title} for example as alt for attachment !??

i tried many times but i dono y its not called !!

even i try
{xen:helper dump, $thread} just to see if any thing related to $thread is called or used or any thing that let me know if its possible to know
but its says NULL !!

so any one have an idea about this ?!

our big saver @Chris D do u know any thing about it ?!


thanks
 

Chris D

XenForo developer
Staff member
#2
The thread title probably wouldn't be appropriate for alt text on an image, anyway.

Try {$attachment.filename}

That should be available there (at a guess).
 

TBDragon

Active member
#3
The thread title probably wouldn't be appropriate for alt text on an image, anyway.

Try {$attachment.filename}

That should be available there (at a guess).
i know that {$attachment.filename} will work there but what if i want the alt of the attachments be the title thread !!

the alt of attachment can be changed i try other things ( dummy ) and its change but y with $thread doesnt !!

is this how its implementing ?!
 

Chris D

XenForo developer
Staff member
#6
The $thread parameter isn't available to the bb_code_tag_attach template.

In fact, attachments don't really have any concept of what thread they are in. Attachments are attached to posts. They aren't attached to threads.

You would need to extend some code to get that information.
 

TBDragon

Active member
#7
The $thread parameter isn't available to the bb_code_tag_attach template.

In fact, attachments don't really have any concept of what thread they are in. Attachments are attached to posts. They aren't attached to threads.

You would need to extend some code to get that information.
so this mean i need to overwrite the attach bbcode in way that i use the way its done the normal job + grab other data i want to do like the $thread ?!
 

Chris D

XenForo developer
Staff member
#8
Yeah.

But I'd actually recommend extending XenForo_Model_Post::getAndMergeAttachmentsIntoPosts...

Don't quote me on this but I *think* that is how the attachment record gets into each post record. At this point you have a view of all posts in a thread and all their attachments. So you can loop through that, get the thread ID and do a single query for the full thread record. Then merge that into each $post['attachments'] array.

By the end of it you should be able to use $attachment.thread['thread_id'] or whatever you want.