Quantcast
Channel: phpBB.com
Viewing all articles
Browse latest Browse all 2220

phpBB Custom Coding • Help: show latest 6 images of post

$
0
0
Greetings,
as the title suggests, I would like to create a scroll marquee of images to be shown in the forum index. This old code works with a php 5.6 version but doesn't seem to work with the new 8.2 version.

Code:

<?php/*** @ignore*/define('IN_PHPBB', true);$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';$phpEx = substr(strrchr(__FILE__, '.'), 1);include($phpbb_root_path . 'common.' . $phpEx);include($phpbb_root_path . 'includes/functions_display.' . $phpEx);// Start session management$user->session_begin();$auth->acl($user->data);$user->setup('viewforum');if (!defined('IN_PHPBB')){   exit;}global $output, $output0, $output1, $output2, $output3;if ($user->data['is_registered']){// Latest 6 e-Books$sql = 'SELECT min(p.post_id) as post_id, p.topic_id, topic_title, topic_first_poster_name, topic_views, topic_time, p.forum_id, p.post_textFROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' tWHERE p.forum_id LIKE "12"AND post_id = topic_first_post_idAND (post_text LIKE "%[img:%]%JPG[/img:%]%"OR post_text LIKE "%[img:%]%jpg[/img:%]%"OR post_text LIKE "%[img:%]%PNG[/img:%]%"OR post_text LIKE "%[img:%]%png[/img:%]%"OR post_text LIKE "%[img:%]%GIF[/img:%]%"OR post_text LIKE "%[img:%]%gif[/img:%]%")GROUP BY topic_id ORDER BY p.post_time DESC LIMIT 6';$result = $db->sql_query($sql);while($row = $db->sql_fetchrow($result)){foreach($row as $cell)$matches = null;$returnValue = preg_match('/\[img:(.*?)\](.*?)\[\/img:(.*?)\]/', $cell , $matches, 0);$post_link = append_sid($phpbb_root_path . 'viewtopic.' . $phpEx . '?f=12&t=' . $row['topic_id']);$user_post = 'Postato da: ' . iconv('UTF-8', 'UTF-8', $row['topic_first_poster_name']);$visite = 'Visitato da: ' . $row['topic_views'] . ' utenti';$the_date = 'In data: ' .  date('g:i A on D, M j Y', $row['topic_time']);$title = iconv('UTF-8', 'UTF-8', $row['topic_title']);if ($matches[2] == ""){$no_image = "{$phpbb_root_path}images/no-image.png";$output .= '<a href="' . $post_link . '" title="'. substr($title, 0, 60) .'"><img src="' . $no_image . '" width="100" height="140" title="' . substr($title, 0, 60) . '&#013;' . $user_post . '&#013;' . $visite . '&#013;' . $the_date . '" alt="' . substr($title, 0, 60) . '"></a>';}else{$output .= '<a href="' . $post_link . '" title="'. substr($title, 0, 60) .'"><img src="' . $matches[2] . '" width="100" height="140" title="' . substr($title, 0, 60) . '&#013;' . $user_post . '&#013;' . $visite . '&#013;' . $the_date . '" alt="' . substr($title, 0, 60) . '"></a>';}}}else{echo 'NOT REGISTERED USER!!';}echo $output;?>
Can someone help me? It could be a starting point for an extension :)
Best Regards

Salvo

Statistics: Posted by salvocortesiano — Fri Jun 14, 2024 9:06 am



Viewing all articles
Browse latest Browse all 2220

Trending Articles