phpBB2Refugees.com Logo
Not affiliated with or endorsed by the phpBB Group

Register •  Login 

Continue the legacy...

Welcome to all phpBB2 Refugees!Wave Smilie

This site is intended to continue support for the legacy 2.x line of the phpBB2 bulletin board package. If you are a fan of phpBB2, please, by all means register, post, and help us out by offering your suggestions. We are primarily a community and support network. Our secondary goal is to provide a phpBB2 MOD Author and Styles area.

Return Attach ID of 1st picture attachment of 1st topic post


 
Search this topic... | Search phpBB2 Discussion... | Search Box
Register or Login to Post    Index » phpBB2 Discussion  Previous TopicPrint TopicNext Topic
Author Message
JLA
Board Member



Joined: 30 Apr 2009

Posts: 310
Location: U.S.A


flag
PostPosted: Wed Aug 17, 2011 12:05 am 
Post subject: Return Attach ID of 1st picture attachment of 1st topic post

Trying to figure an easy way to return the 1st attachment ID number of the 1st picture attachment (if exists) of the 1st topic post.

Trying to do this with the already existing ran queries.

Need the ID returned to a variable in the viewtopic body template

Any ideas?

_________________
http://www.jlaforums.com
Back to top
Dog Cow
Board Member



Joined: 18 Nov 2008

Posts: 378


flag
PostPosted: Mon Aug 22, 2011 9:33 pm 
Post subject: Re: Return Attach ID of 1st picture attachment of 1st topic

JLA wrote:

Need the ID returned to a variable in the viewtopic body template

Any ideas?

So you want to show an attachment (picture, I presume?) on every page of a topic?

Well, I'd suggest making a new column in the topics table to store the attach_id, but first you need to get it.

I suggest cheating. We will assume that someone will eventually look at the first page of a topic. I would suggest intercepting the $attachments array when $start = 0, and grabbing the first element. That should be the first attachment of the first post of the topic. You can then store this attach_id in the topic's row in the topics table, if the existing value was non-zero.

_________________
Moof!
Lincoln's Tomb, Oak Ridge Cemetery, Springfield IL Mac 512K Blog Mac GUI
Back to top
JLA
Board Member



Joined: 30 Apr 2009

Posts: 310
Location: U.S.A


flag
PostPosted: Tue Aug 23, 2011 2:39 am 
Post subject: Re: Return Attach ID of 1st picture attachment of 1st topic

Dog Cow wrote:
JLA wrote:

Need the ID returned to a variable in the viewtopic body template

Any ideas?

So you want to show an attachment (picture, I presume?) on every page of a topic?

Well, I'd suggest making a new column in the topics table to store the attach_id, but first you need to get it.

I suggest cheating. We will assume that someone will eventually look at the first page of a topic. I would suggest intercepting the $attachments array when $start = 0, and grabbing the first element. That should be the first attachment of the first post of the topic. You can then store this attach_id in the topic's row in the topics table, if the existing value was non-zero.


Actually looking to do a couple of things (a bit different than what you mentioned)

On view topic there is a Facebook OG meta-tag where you can specify an image when someone uses the share or like function. We want to specify (when exists) the 1st picture (type) attachment of a post (picture attached to the post via attachment mod) If we could get the attachment ID number up to the view topic page header (we used different page headers for different areas of the site) then it is solved. We do similar things for topic keywords, etc that are used in the viewtopic header by passing them from viewtopic.php.

2nd thing is we also want to show on view forum in a new column in each post row (again without extra queries)

* A thumbnail of the 1st picture attachment for the post (when exists) This will entail somehow grabbing the attachment id for the 1st picture attachment of each post and a bit more involved then just passing the id number in viewtopic.

_________________
http://www.jlaforums.com
Back to top
Display posts from previous:   
Register or Login to Post    Index » phpBB2 Discussion  Previous TopicPrint TopicNext Topic
Page 1 of 1 All times are GMT
 
Jump to:  

Index • About • FAQ • Rules • Privacy • Search •  Register •  Login 
Not affiliated with or endorsed by the phpBB Group
Powered by phpBB2 © phpBB Group
Generated in 0.0268 seconds using 15 queries. (SQL 0.0022 Parse 0.0009 Other 0.0237)
phpBB Customizations by the phpBBDoctor.com
Template Design by DeLFlo and MomentsOfLight.com Moments of Light Logo