collapse

* Simple Portal Archived Forum

This is an Archive Forum.

The content in this forum may be out-of-date or have been superseded by newer information, and links in forum pages to other sites may not work.
This forum contains archives for future reference.

Visit our thread at Simple Machines Forum for current support.

SMF 2.1 users: EhPortal is a ported version of Simple Portal specifically designed for the SMF 2.1 branch.
Please visit web-develop.ca to download EhPortal and for its support.

* User Info

 
 
Welcome, Guest. Please login or register.

* Who's Online

  • Dot Guests: 407
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.

* Shoutbox

Refresh History
  • Shoutbox is not for support!
  • {OCS}MasterSeal: Yup, Still adore SP
    April 21, 2019, 07:08:06 PM
  • {OCS}MasterSeal: STILL love SP :)
    November 24, 2018, 05:05:50 AM
  • ♦ Ninja ZX-10RR ♦: <3 aegersz
    September 13, 2018, 03:36:09 PM
  • aegersz: I STILL <3 LOVE SimplePortal
    September 13, 2018, 07:11:39 AM
  • aegersz: o LOVE you guys - Simple Portal rocks !
    May 09, 2018, 05:18:59 AM
  • Chen Zhen: our apologies for the site being down.. please read server issues topic
    March 22, 2018, 05:32:38 AM
  • {OCS}MasterSeal: LOL PLEASE forget I just posted that. I found the answer in my own dang post back in 2015. lol sorry!
    July 04, 2017, 10:47:55 PM
  • {OCS}MasterSeal: I know this SB isnt' for support, but I just have a general question. Who would I contact to find out where SP stores its block info? Is it DB driven or files? I searched the site but came up with nothing. probably my fault any insight is appreciated.
    July 04, 2017, 10:43:36 PM
  • ♦ Ninja ZX-10RR ♦: Excuse me but what does Simpleportal have to deal with that?
    February 05, 2017, 08:21:14 PM
  • WhiteEagle: of course IMHO that site appears to be dead :(
    February 04, 2017, 01:08:05 PM
  • WhiteEagle: If I can get that, then I'll use it for that site...
    February 04, 2017, 01:07:35 PM
  • WhiteEagle: decided to not use SMF for any projects, unless I can get a copy of the premium version of the fanfiction archive plugin
    February 04, 2017, 01:06:54 PM
  • expertdecisions: cloudflare
    January 28, 2017, 08:01:47 AM
  • aegersz: SM release 2.0.13 !
    January 12, 2017, 06:00:13 AM
  • raffo: Tks Emanuele, even if I didn't understand the fix :D
    November 07, 2016, 02:01:20 AM
  • emanuele: [link]
    November 01, 2016, 12:43:50 PM
  • emanuele: raffo: the English support board is a good place. ;)
    November 01, 2016, 12:43:38 PM
  • raffo: Where can I find the fix for the shoutbox?
    November 01, 2016, 05:06:09 AM
  • {OCS}MasterSeal: To the SP team, I make a point to come here and thank you as much as possible for your work.  so again, THANK YOU!
    October 28, 2016, 10:38:05 AM
  • emanuele: That's indeed funny, the limit is present only in the patch and not the full install.
    October 22, 2016, 06:14:58 PM

* Recent Posts

Adding Forums Button to Nav bar by jirapon
[August 01, 2019, 09:07:12 AM]


Re: Board Icons by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 04:03:41 PM]


MOVED: Czech translation???? by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 03:04:51 PM]


Board Icons by jirapon
[July 30, 2019, 07:28:44 AM]


Re: Thankyou Simpleportal, by ♦ Ninja ZX-10RR ♦
[July 29, 2019, 09:41:29 AM]

Welcome to SimplePortal.net! You can download SimplePortal from the Downloads Area!

Author Topic: SMF Gallery Block problem and help request  (Read 4560 times)

0 Members and 1 Guest are viewing this topic.

Offline fotografo74

  • Jr. Member
  • **
  • Posts: 51
  • SMF Version: 2 RC1-1
  • SP Version: 2.3
SMF Gallery Block problem and help request
« on: February 19, 2009, 07:03:09 PM »
Hi,
i'm Antonio from Rome, Italy...sorry for my poor english.
I'm testing SMF 2RC1 + SimplePortal 2.1.1...great combination! Thanks!
Also i have SMF Gallery Pro installed.
It's possible display 4 pics from Gallery ? ( now only one )
I changed LIMIT 1 to LIMIT 4 in SPortal2.php
Code: [Select]
$dbresult = $smcFunc['db_query']('', "
SELECT p.id_picture
FROM {$db_prefix}gallery_pic as p
ORDER BY id_picture DESC
LIMIT 4");
but not works!
Help me please, it's important, now only EzPortal works ok with recent images from SMF Gallery, but SimplePortal is better for me.
Thanks !
antonio
« Last Edit: February 25, 2009, 11:15:44 AM by fotografo74 »

Offline fotografo74

  • Jr. Member
  • **
  • Posts: 51
  • SMF Version: 2 RC1-1
  • SP Version: 2.3
Re: SMF Gallery Block problem and help request
« Reply #1 on: February 22, 2009, 06:06:17 AM »
:-(
Help please... :-)

Offline [SiNaN]

  • Mr. SimplePortal
  • Developer
  • *
  • Posts: 6782
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: SMF Gallery Block problem and help request
« Reply #2 on: February 22, 2009, 07:05:19 AM »
Try these codes in a PHP block:

Code: [Select]
global $smcFunc, $context, $modSettings, $scripturl;
global $sourcedir, $txt, $settings, $boardurl, $galurl;
static $mod, $GD_Installed;

$limit = 4;
$type = 1
$direction = 0;

if (!isset($mod))
{
if (file_exists($sourcedir . '/Gallery2.php'))
$mod = 'smf_gallery';
}

if (empty($mod))
{
echo '
', $txt['error_sp_no_gallery_found'];
return;
}
elseif ($mod == 'smf_gallery')
{
loadLanguage('Gallery', sp_languageSelect('Gallery'));

if (!isset($GD_Installed))
$GD_Installed = function_exists('imagecreate');

if (empty($modSettings['gallery_url']))
$modSettings['gallery_url'] = $boardurl . '/gallery/';

$request = $smcFunc['db_query']('','
SELECT
p.id_picture, p.commenttotal, p.filesize, p.views, p.thumbfilename,
p.filename, p.height, p.width, p.title, p.id_member, m.member_name,
m.real_name, p.date, p.description
FROM {db_prefix}gallery_pic AS p
LEFT JOIN {db_prefix}members AS m ON (m.id_member = p.id_member)
WHERE p.approved = {int:is_approved}
ORDER BY {raw:type}
LIMIT {int:limit}',
array(
'is_approved' => 1,
'type' => $type ? 'RAND()' : 'p.id_picture DESC',
'limit' => $limit,
)
);
$items = array();
while ($row = $smcFunc['db_fetch_assoc']($request))
{
$items[] = array(
'id' => $row['id_picture'],
'title' => $row['title'],
'views' => $row['views'],
'poster_id' => $row['id_member'],
'poster_name' => $row['real_name'],
'poster_link' => empty($row['id_member']) ? $txt['gallery_guest'] : '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['real_name'] . '</a>',
'thumbfilename' => $row['thumbfilename'],
'filename' => $row['filename'],
'src' => $modSettings['gallery_url'] . ($GD_Installed ? $row['thumbfilename'] : $row['filename'] . '" width="120'),
);
}
$smcFunc['db_free_result']($request);
}

if (empty($items))
{
echo '
', $txt['error_sp_no_pictures_found'];
return;
}

echo '
<table style="margin: 0 auto;">', $direction ? '
<tr>' : '';

foreach ($items as $item)
{
  echo !$direction ? '
<tr>' : '', '
<td>
<div class="smalltext">';

if ($mod == 'smf_gallery')
{
echo '
<a href="', $scripturl, '?action=gallery;sa=view;id=', $item['id'], '">', $item['title'], '</a><br />
<a href="', $scripturl, '?action=gallery;sa=view;id=', $item['id'], '"><img src="', $item['src'], '" alt="" /></a><br />
', $txt['gallery_text_views'], $item['views'], '<br />
', $txt['gallery_text_by'], ' ', $item['poster_link'], '<br />';
}

echo '
</div>
</td>', !$direction ? '
</tr>' : '';
}

echo $direction ? '
</tr>' : '', '
</table>';

This is a default feature in 2.2, which is being tested currently.
And slowly, you come to realize... It's all as it should be...

Offline fotografo74

  • Jr. Member
  • **
  • Posts: 51
  • SMF Version: 2 RC1-1
  • SP Version: 2.3
Re: SMF Gallery Block problem and help request
« Reply #3 on: February 23, 2009, 11:17:11 AM »
Try these codes in a PHP block:

Code: [Select]
global $smcFunc, $context, $modSettings, $scripturl;
global $sourcedir, $txt, $settings, $boardurl, $galurl;
static $mod, $GD_Installed;

$limit = 4;
$type = 1
$direction = 0;

if (!isset($mod))
{
if (file_exists($sourcedir . '/Gallery2.php'))
$mod = 'smf_gallery';
}

if (empty($mod))
{
echo '
', $txt['error_sp_no_gallery_found'];
return;
}
elseif ($mod == 'smf_gallery')
{
loadLanguage('Gallery', sp_languageSelect('Gallery'));

if (!isset($GD_Installed))
$GD_Installed = function_exists('imagecreate');

if (empty($modSettings['gallery_url']))
$modSettings['gallery_url'] = $boardurl . '/gallery/';

$request = $smcFunc['db_query']('','
SELECT
p.id_picture, p.commenttotal, p.filesize, p.views, p.thumbfilename,
p.filename, p.height, p.width, p.title, p.id_member, m.member_name,
m.real_name, p.date, p.description
FROM {db_prefix}gallery_pic AS p
LEFT JOIN {db_prefix}members AS m ON (m.id_member = p.id_member)
WHERE p.approved = {int:is_approved}
ORDER BY {raw:type}
LIMIT {int:limit}',
array(
'is_approved' => 1,
'type' => $type ? 'RAND()' : 'p.id_picture DESC',
'limit' => $limit,
)
);
$items = array();
while ($row = $smcFunc['db_fetch_assoc']($request))
{
$items[] = array(
'id' => $row['id_picture'],
'title' => $row['title'],
'views' => $row['views'],
'poster_id' => $row['id_member'],
'poster_name' => $row['real_name'],
'poster_link' => empty($row['id_member']) ? $txt['gallery_guest'] : '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['real_name'] . '</a>',
'thumbfilename' => $row['thumbfilename'],
'filename' => $row['filename'],
'src' => $modSettings['gallery_url'] . ($GD_Installed ? $row['thumbfilename'] : $row['filename'] . '" width="120'),
);
}
$smcFunc['db_free_result']($request);
}

if (empty($items))
{
echo '
', $txt['error_sp_no_pictures_found'];
return;
}

echo '
<table style="margin: 0 auto;">', $direction ? '
<tr>' : '';

foreach ($items as $item)
{
  echo !$direction ? '
<tr>' : '', '
<td>
<div class="smalltext">';

if ($mod == 'smf_gallery')
{
echo '
<a href="', $scripturl, '?action=gallery;sa=view;id=', $item['id'], '">', $item['title'], '</a><br />
<a href="', $scripturl, '?action=gallery;sa=view;id=', $item['id'], '"><img src="', $item['src'], '" alt="" /></a><br />
', $txt['gallery_text_views'], $item['views'], '<br />
', $txt['gallery_text_by'], ' ', $item['poster_link'], '<br />';
}

echo '
</div>
</td>', !$direction ? '
</tr>' : '';
}

echo $direction ? '
</tr>' : '', '
</table>';

This is a default feature in 2.2, which is being tested currently.
Thanks for help!
I take sintax error PHP...   :(
I modifies '/Gallery2.php' to '/Gallery.php' ...in Sources i have Gallery.php...but always sintax errore PHP
Antonio

Offline [SiNaN]

  • Mr. SimplePortal
  • Developer
  • *
  • Posts: 6782
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: SMF Gallery Block problem and help request
« Reply #4 on: February 24, 2009, 09:19:26 AM »
Sorry.

Find:

Code: [Select]
   $type = 1
Replace:

Code: [Select]
   $type = 1;
in the codes above.
And slowly, you come to realize... It's all as it should be...

Offline fotografo74

  • Jr. Member
  • **
  • Posts: 51
  • SMF Version: 2 RC1-1
  • SP Version: 2.3
Re: SMF Gallery Block problem and help request
« Reply #5 on: February 24, 2009, 02:03:54 PM »
Sorry.

Find:

Code: [Select]
   $type = 1
Replace:

Code: [Select]
   $type = 1;
in the codes above.
Thanks Blue Dream, it works!!! :-)
I would shows Horizontally, not vertically....it's possible ? ( i put in top block )
Antonio

Offline [SiNaN]

  • Mr. SimplePortal
  • Developer
  • *
  • Posts: 6782
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: SMF Gallery Block problem and help request
« Reply #6 on: February 24, 2009, 03:32:25 PM »
Find:

$direction = 0;

Replace:

$direction = 1;
And slowly, you come to realize... It's all as it should be...

Offline fotografo74

  • Jr. Member
  • **
  • Posts: 51
  • SMF Version: 2 RC1-1
  • SP Version: 2.3
Re: SMF Gallery Block problem and help request
« Reply #7 on: February 25, 2009, 11:15:28 AM »
Find:

$direction = 0;

Replace:

$direction = 1;
Thanks Blue Dream !
Great support :-)
Antonio