Page 2 of 3

Re: Display last topics with first topic's post image

Posted: Sun May 13, 2018 10:25 am
by axew3
... we will see to create a shortcode function that will grab the first post img tag and display it into a grid like the one suggested ... on 1.9.0?

Re: Display last topics with first topic's post image

Posted: Sun May 13, 2018 11:36 pm
by grifon
Oh..
Thank you so much. So nice plan :)

But what plan ? when to estimate ?

i am waiting for you...

Re: Display last topics with first topic's post image

Posted: Sat May 19, 2018 7:14 pm
by grifon
Hi. When this uptade ? 1.9.0

Re: Display last topics with first topic's post image

Posted: Wed May 23, 2018 9:21 am
by axew3
just to update this: i've +- already do this thing, i've expend last night little time to check it.
But i've come over a problem: how to extract data within a single query, instead then use two queries to achieve the result?
i'm waiting for some ninja answer that at moment isn't coming out.
Doing this with two queries is very easy, but i would like to produce the result with one single (even if 1 or 2 queries like these, affect + nothing about general execution time).
So i just hope you're not in trouble if i will take little time more to check how this joke can be achieved at best.
The easy 'on the wild' with two queries is +- ready, i only have to adjust the part about output, and file will be:
views/phpbb_last_topics_withimage_output_shortcode.php
this should be easy to edit, adding custom html/css for shortcode output.
Please be patient, the joke will be done asap!

Re: Display last topics with first topic's post image

Posted: Wed May 23, 2018 8:01 pm
by grifon
Thank you so much

Re: Display last topics with first topic's post image

Posted: Sat May 26, 2018 9:22 am
by axew3
...to update on this, that is on the way bite by bite ...
All has already done, except the more easy output html/css part. Let me write right now what the shortcode will do (so i will paste this explain into documentation as the shortcode has been added and will be ready) ...

Little hard for my Eng to say all what i would like about this, but i will try with a practical example ...
The result can be achieved in various ways, but the fact i said we want all latest updated topics grabbed by the phpBB database in one single query, and with the first attached file on this topic, to display, the new shortcode will be like this:

Code: Select all

[w3allastopicswithimage cat_id="1" topics_number="5" post_text="1" text_words="30" columns_number="2"]
and will produce this result:
Retrieve all latest topics from sub forums which belongs to the specified Forum Cat with ID 1
Retrieve last 5 updated topics/posts
With post text
With 30 words
In two columns

The columns_number param is useful to show more columns per row.
and behind the scene, the code require:
The topic need to have almost an attachment: the query search for all latest updated topics WITH ALMOST ONE ATTACHMENT ON HIS POSTS. Only the first attachment added into the topic will be retrieved to be used as image to display into the WP shortcode output. The attach can be added into any post, BUT ONLY THE ONE THAT WILL RESULT AS THE FIRST ONE ATTACHED (based on related attachments time value) will be retrieved to display. That so, could be inserted into any topic's posts and not only into the first.

the query will return any kind of attach that is the first inserted on topic, so we need to check also this aspect maybe? If the first attach that belong to the topic isn't an image for example? Or we could assume that using this kind of shortcode, we will go to attach to the topic, ever, for first, an image to display and not some other kind of mime like a .zip or something else. But could be useful any mime, with a file to download, if it is a zip or something else.

... i will follow improving for a more complicate query as i can.

At moment, resuming with another example, this is the result:
Suppose there are forums with ID-5 and ID-9, that are sub-forums and belongs to the Forum Category with ID-1.
Then will be retrieved all latest updated topics from forums with ID-5 and ID-9, that will contain ALMOST one attachment into any of their posts.
ONLY the first inserted attachment will be retrieved to be used and that will display for the post/topic into the WordPress w3allastopicswithimage shortcode.

As soon i can i will adjust the new file phpbb_last_topics_withimage_output_shortcode.php to display results in a (i hope) nice way. I will try to make this file easier to be modified for own scopes.