If I know topic id, can I get at $topic['first_post'] and image array?

Started by roshaoar, May 06, 2015, 05:16:58 PM

Previous topic - Next topic

roshaoar

Hello,

I'm trying to write something for myself and my deplorable php shortcomings are letting me down. On boardindex, is there a way to grab the correct $topic['first_post'] and image array for a topic from knowing $board['last_post']['topic']? How do you do this?

Thank you for your time,

-Johan

margarett

Not directly. BoardIndex fetches only the topic ID of the last post. You need to gather the topic's first message ID in the process.

What do you mean by "and image array for a topic"?
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair


roshaoar

Thank you very much Margarett! I think I understand what you're saying, that in BoardIndex.template.php "$board['last_post']['topic']" isn't enough, I also need to find out the .msgXX part. My knowledge of php is really limited, but I assume (wrongly?) that this must be possible, isn't there something I can do to get the messages associated with one particular topic and work out what the first one is?

By the image, I mean an the info that's in <a href="', $topic['first_post']['href'], '"><img src="', $image['url'], '" width="', $image['width'], '" height="', $image['height'], '" alt="" class="jtest"/> in my messageindex.template. That's what SMFhacks' Thumbnail Topic calls on there, but I'd like to be able to call it at a higher level, ie on BoardIndex.template.php. I think this looks good and I'd like this to look good too. There's room for a little thumb to the right of last bost by.. in ... on .... :)

I can only very much apologise for posing a question that maybe very clueless and/or noddy. I don't really know where to look to help myself about information like this without bothering someone on a board like this :(.

Thank you very much

roshaoar

Quote from: Illori on May 06, 2015, 05:42:45 PM
i guess this is related to http://www.simplemachines.org/community/index.php?topic=536203

Sort of, same grand idea but a different thing. I couldn't progress with that and parked it for a bit because that makes a javascript popup of an image and that's not what I'm after at all. I didn't want to be rude to Kindred because that was barking up the wrong tree for me.

But it's all related, trying to show images where there's currently just text. I'ma photography nut and images get more traction than text on photography forums. Hence trying to make or find images for things, even to the extent that someone is making a paid plugin for me. But I'd also like to try some of this stuff and to understand it, hence the boring questions... sorry...

margarett

Ahhh now I see what you want :P

Well, that requires an extra JOIN in a query which is already a royal PITA ;D (just to get the first post ID, but that also allows to fetch the post content which is a good thing :) )

I'm sorry, today I don't have the time to do that for you :(
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

roshaoar

Thank you, that was very useful - join was the clue I needed. I switched on debug and it also looks, on first impression, if there are actually already queries running because of Subs-InlineAttachments that already have what I need. I'll root around with this a bit more, see if I can get out what I'm after.

Advertisement: