SimplePortal

Support => English Support => Topic started by: mepmep on October 02, 2008, 01:23:27 AM

Title: Problem on media gallery (more 1 image on block)
Post by: mepmep on October 02, 2008, 01:23:27 AM
Code: [Select]
global $sourcedir, $user_info, $ID_MEMBER, $context, $txt, $galurl, $galurl2, $scripturl, $settings, $db_prefix;

require_once($sourcedir . '/Subs-MGallery.php');
loadMGal_Settings();

if(loadlanguage('MGallery') == false)
loadLanguage('MGallery', 'english');

$request[num] = db_query("
SELECT m.id_media, m.id_member, IFNULL(mem.realName, m.member_name) AS member_name,  m.id_thumb, m.title, m.description, m.views, m.rating, m.voters,
a.id_album, a.name, IFNULL(lm.time, 0) <  m.log_last_access_time AS is_new, m.time_added, m.type
FROM {$db_prefix}mgallery_media AS m
INNER JOIN {$db_prefix}mgallery_albums AS a ON (a.id_album = m.album_id)
LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = m.id_member)
LEFT JOIN {$db_prefix}mgallery_log_media AS lm ON (lm.id_member = $ID_MEMBER AND lm.id_media = m.id_media)
WHERE $user_info[mgallery_query_see_album]
AND m.approved = 1
ORDER BY RAND()
LIMIT 5", __FILE__, __LINE__);
while ($row[num] = mysql_fetch_assoc($request[num])) {
$item = array(
'id' => $row[num]['id_media'],
'id_album' => $row[num]['id_album'],
'album_name' => $row[num]['name'],
'item_title' => $row[num]['title'],
'member_name' => $row[num]['member_name'],
'member_id' => $row[num]['id_member'],
'rating' => $row[num]['voters'] != 0 ? ($row[num]['rating']/$row[num]['voters']) : 0,
'voters' => $row[num]['voters'],
'id_thumb' => $row[num]['type'] == 'embed' ? 2 : $row[num]['id_thumb'],
'desc' => $row[num]['description'],
'time_added' => $row[num]['time_added'],
'is_new' => !empty($row[num]['is_new']) && !$user_info['is_guest'],
'views' => $row[num]['views']
);

echo '
    <td width="120" scope="col"><div class="smalltext" style="text-align: center; line-height: 1.4em; border: 1px #000000 solid; padding: 5px;">
<a href="',$galurl,'sa=viewitem;id=',$item['id'],'">',$item['item_title'],'</a><br />
<a href="',$galurl,'sa=viewitem;id=',$item['id'],'"><img alt="" width="100" src="',$galurl,'sa=getmedia;id=',$item['id_thumb'],'" /></a><br />
',$txt['mgallery_views'],' : ',$item['views'],'<br />
',$txt['mgallery_posted_by'],' : <a href="',$scripturl,'?action=profile;u=',$item['member_id'],'">',$item['member_name'],'</a><br />
',$txt['mgallery_in_album'],' : <a href="',$galurl,'sa=viewalbum;id=',$item['id_album'],'">',$item['album_name'],'</a>
',$item['is_new'] ? '<br /><img alt="" src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/new.gif" border="0" />' : '','
</div>';
}
echo '</td>';
mysql_free_result($request[num]);

Please help me. I'm sorry for my English
Title: Re: Problem on media gallery (more 1 image on block)
Post by: ???1031 on October 02, 2008, 05:41:13 AM
Code: [Select]
global $sourcedir, $user_info, $ID_MEMBER, $context, $txt, $galurl, $galurl2, $scripturl, $settings, $db_prefix;

require_once($sourcedir . '/Subs-MGallery.php');
loadMGal_Settings();

if(loadlanguage('MGallery') == false)
loadLanguage('MGallery', 'english');

$request[num] = db_query("
SELECT m.id_media, m.id_member, IFNULL(mem.realName, m.member_name) AS member_name,  m.id_thumb, m.title, m.description, m.views, m.rating, m.voters,
a.id_album, a.name, IFNULL(lm.time, 0) <  m.log_last_access_time AS is_new, m.time_added, m.type
FROM {$db_prefix}mgallery_media AS m
INNER JOIN {$db_prefix}mgallery_albums AS a ON (a.id_album = m.album_id)
LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = m.id_member)
LEFT JOIN {$db_prefix}mgallery_log_media AS lm ON (lm.id_member = $ID_MEMBER AND lm.id_media = m.id_media)
WHERE $user_info[mgallery_query_see_album]
AND m.approved = 1
ORDER BY RAND()
LIMIT 5", __FILE__, __LINE__);

echo '<table><tr>';

while ($row[num] = mysql_fetch_assoc($request[num])) {
$item = array(
'id' => $row[num]['id_media'],
'id_album' => $row[num]['id_album'],
'album_name' => $row[num]['name'],
'item_title' => $row[num]['title'],
'member_name' => $row[num]['member_name'],
'member_id' => $row[num]['id_member'],
'rating' => $row[num]['voters'] != 0 ? ($row[num]['rating']/$row[num]['voters']) : 0,
'voters' => $row[num]['voters'],
'id_thumb' => $row[num]['type'] == 'embed' ? 2 : $row[num]['id_thumb'],
'desc' => $row[num]['description'],
'time_added' => $row[num]['time_added'],
'is_new' => !empty($row[num]['is_new']) && !$user_info['is_guest'],
'views' => $row[num]['views']
);

echo '
<td width="120" scope="col"><div class="smalltext" style="text-align: center; line-height: 1.4em; border: 1px #000000 solid; padding: 5px;">
<a href="',$galurl,'sa=viewitem;id=',$item['id'],'">',$item['item_title'],'</a><br />
<a href="',$galurl,'sa=viewitem;id=',$item['id'],'"><img alt="" width="100" src="',$galurl,'sa=getmedia;id=',$item['id_thumb'],'" /></a><br />
',$txt['mgallery_views'],' : ',$item['views'],'<br />
',$txt['mgallery_posted_by'],' : <a href="',$scripturl,'?action=profile;u=',$item['member_id'],'">',$item['member_name'],'</a><br />
',$txt['mgallery_in_album'],' : <a href="',$galurl,'sa=viewalbum;id=',$item['id_album'],'">',$item['album_name'],'</a>
',$item['is_new'] ? '<br /><img alt="" src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/new.gif" border="0" />' : '','
</td>';
}
mysql_free_result($request[num]);

echo '</tr></table>';

I think that this will work better ;).

Bye
DIN1031
Title: Re: Problem on media gallery (more 1 image on block)
Post by: mepmep on October 02, 2008, 08:10:52 AM
Thank. It's good work.
Title: Re: Problem on media gallery (more 1 image on block)
Post by: Darnell on October 03, 2008, 07:42:47 AM
How can i do this edit, id like to display more then 1 image on the gallery block but i am unsure of what file to add that to and how to add it to it.

Thankyou.
Title: Re: Problem on media gallery (more 1 image on block)
Post by: ???1031 on October 03, 2008, 07:55:53 AM
How can i do this edit, id like to display more then 1 image on the gallery block but i am unsure of what file to add that to and how to add it to it.

Thankyou.
That is an gallery. And i think he/she insert it as a php block.

Bye
DIN1031
Title: Re: Problem on media gallery (more 1 image on block)
Post by: Nathaniel on November 13, 2008, 07:03:54 PM
Did you manage to get this to work Darnell? Do you still require assistance?
SimplePortal 2.3.8 © 2008-2024, SimplePortal