Display last topics with first topic's post image

Post a reply


This question is a means of preventing automated form submissions by spambots.
Smilies
:D :) ;) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :!: :?: :idea: :arrow: :| :mrgreen: :geek: :ugeek:

BBCode is ON
[img] is ON
[url] is ON
Smilies are ON

Topic review
   

If you wish to attach one or more files enter the details below.

Maximum filesize per attachment: 1 MiB.

Expand view Topic review: Display last topics with first topic's post image

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

by axew3 » Tue May 29, 2018 7:57 am

Shortcode added ... it is so tricky (and could be rewrite into several different ways)
Shortcode: display phpBB last topics grid in Wordpress with first topic's attached image

how to use: [EDITED] added hint add wp_w3all.php file, missed before, and parameter for gap space between columns

a simple/basic working example is here:
phpbb-grid-list-of-latest-topics-with-attachments

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

by axew3 » Sat May 26, 2018 9:22 am

...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.

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

by grifon » Wed May 23, 2018 8:01 pm

Thank you so much

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

by axew3 » Wed May 23, 2018 9:21 am

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

by grifon » Sat May 19, 2018 7:14 pm

Hi. When this uptade ? 1.9.0

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

by grifon » Sun May 13, 2018 11:36 pm

Oh..
Thank you so much. So nice plan :)

But what plan ? when to estimate ?

i am waiting for you...

Top