how to use $thread in bb_code_tag_attach ?!

TBDragon

Active member
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
 
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).
 
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 ?!
 
If say null because the variable $thread didn't assigned to `bb_code_tag_attach`. You need assign before use it :)
u say it , HOW to assign it or get the values of $thread
how i can grab/get/retrive the $thread.title /.id etc ...

in that template !!
 
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.
 
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 ?!
 
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.
 
Top Bottom