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: 537
  • 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]

Blocks speak! Do you have an interest in getting more blocks - or even making your own? The Blocks Board is for you!

Author Topic: Ayuda con bloque de la galería  (Read 5706 times)

0 Members and 1 Guest are viewing this topic.

Offline DaRKeN

  • Jr. Member
  • **
  • Posts: 50
  • SMF Version: 2 RC5
  • SP Version: 2.3.3
Ayuda con bloque de la galería
« on: November 22, 2010, 12:40:30 PM »
Hola, que tal. A ver si me podéis ayudar con esto.

Me gustaría que me ayudarais con un par de bloques parecidos al que viene con SP por defecto, que puede mostrar lo último añadido, o al azar de mi galería... pues me gustaría crear uno que muestre lo último añadido pero de diferentes categorías de la galería. No se si me explico.

En definitiva quiero un bloque para X categoría de la galería de Aeva Media, mostrando lo último que se añadió y que solo muestre lo de esa categoría. Y así otra más con otra categoría y que solo muestre de esa categoría especificada.

Espero que se me entienda y sobre todo que se pueda hacer jeje, gracias.

Mi página: www.darken.es (En el index muestro arriba y en el centro, el bloque de galería que muestra lo último añadido. Pero me sale de todas las categorías y no solo de una galería en concreto.)

Offline 130860

  • Super Handsome Language Coordinator
  • Board Moderators
  • *
  • Posts: 1769
  • Gender: Male
  • You and I are not the same class of pirate!
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Ayuda con bloque de la galería
« Reply #1 on: November 22, 2010, 01:20:01 PM »
por categoria te refieres a un album en especifico?

Offline DaRKeN

  • Jr. Member
  • **
  • Posts: 50
  • SMF Version: 2 RC5
  • SP Version: 2.3.3
Re: Ayuda con bloque de la galería
« Reply #2 on: November 22, 2010, 01:20:43 PM »
Exacto. Gracias por tu respuesta.  ;)

Offline 130860

  • Super Handsome Language Coordinator
  • Board Moderators
  • *
  • Posts: 1769
  • Gender: Male
  • You and I are not the same class of pirate!
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Ayuda con bloque de la galería
« Reply #3 on: November 22, 2010, 01:34:07 PM »
copia y pega esto en un bloque php:

Code: [Select]

function show_aeva_media_block()
{
   global $sourcedir;
// Set amount visible
$visible = "4";
   // Load the language file
   loadLanguage('Aeva');

   // Grab the file.
   if (file_exists($sourcedir . '/Aeva-Subs.php'))
      require_once($sourcedir . '/Aeva-Subs.php');
   // If it doesn't exist, tell them this and stop running.
   else
   {
      echo '<b>You don\'t have Aeva installed! Unable to continue!</b>';
      return;
   }

// Use aeva functions to show the media.
$images = aeva_listItems(aeva_getMediaItems(0, $limit, $type ? 'RAND()' : 'm.id_media DESC', true, array(), 'a.id_album IN (1, 2, 3)');
$show = '<center><div id="aeva_pics" style="width: 75%;" overflow="visible" >'. $images. '</div></center>';
echo $show;
return;
}   
// show the contents
show_aeva_media_block();
 

donde 1,2,3   son los id de los albums que quieres mostrar, este bloque msotrara 4 imagenes de los albums que tu especifiques.

Offline DaRKeN

  • Jr. Member
  • **
  • Posts: 50
  • SMF Version: 2 RC5
  • SP Version: 2.3.3
Re: Ayuda con bloque de la galería
« Reply #4 on: November 22, 2010, 01:48:47 PM »
Hola! Muchas gracias por tu ayuda, te comento:

Me da este error: Parse error: syntax error, unexpected ';' in /homepages/38/d283347434/htdocs/enlaces/Sources/PortalBlocks.php(3474) : eval()'d code on line 20
y bueno me hiciste recordar que había probado una cosa y es de este código que no recuerdo ahora de donde lo saque :(

El código es:
Code: [Select]
function show_aeva_media_block()
{
   global $sourcedir;
// Set amount visible
$visible = "7";
   // Load the language file
   loadLanguage('Aeva');

   // Grab the file.
   if (file_exists($sourcedir . '/Aeva-Subs.php'))
      require_once($sourcedir . '/Aeva-Subs.php');
   // If it doesn't exist, tell them this and stop running.
   else
   {
      echo '<b>No tienes instalado Aeva Media! No se puede mostrar!</b>';
      return;
   }

   // Use aeva functions to show the media.
   $images = aeva_listItems(aeva_getMediaItems(0, $visible, 'RAND()'), true, '',1);
$show = '<div id="aeva_pics" style="width: 100%;" overflow="visible">'. $images. '</div>';
echo $show;
return;
}   
// show the contents
show_aeva_media_block();


Pues bien, este funciona y puedo configurar los ítems a mostrar pero los muestra en vertical y al azar, yo quiero en horizontal y de álbumes específicos jeje, se puede hacer?

EDITO: También me los muestra encerrados con un marco, y me muestra las opciones del tipo, veces visto, etc, me gustaría dejarlo como la modificación que le hice al bloque por defecto de SP, que es el que uso en el index de mi página. Que muestra arriba la caratula y debajo el nombre y sin los marcos. Se me había olvidado decirlo, lo siento.

Saludos.

EDITO 2: Ehm... los códigos son los mismos :S Dios me estoy quedando loco, el tuyo no me funciona y el otro no, voy a comprobar :S ahora lo comento.

EDITO 3: Confirmado, el que puse si funciona y el otro no. Que raro, los veo iguales :S
« Last Edit: November 22, 2010, 01:55:00 PM by DaRKeN »

Offline 130860

  • Super Handsome Language Coordinator
  • Board Moderators
  • *
  • Posts: 1769
  • Gender: Male
  • You and I are not the same class of pirate!
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Ayuda con bloque de la galería
« Reply #5 on: November 22, 2010, 01:57:17 PM »
a tu bloque cambia esto:

aeva_listItems(aeva_getMediaItems(0, $visible, 'RAND()'), true, '',1);

por esto:

aeva_listItems(aeva_getMediaItems(0, $visible, '', false, array(1,2,3)), true, '',1);



ahora no pudo probarlo, mas tarde me fijare si funciona  o no.

Offline DaRKeN

  • Jr. Member
  • **
  • Posts: 50
  • SMF Version: 2 RC5
  • SP Version: 2.3.3
Re: Ayuda con bloque de la galería
« Reply #6 on: November 22, 2010, 02:33:18 PM »
El bloque se muestra vació, parecía que ya jeje pero nada, y como te comente, si también quita ese recuadro que lo cubre y se muestra tan simple como el que se ve en el index osea, arriba caratula, abajo nombre  :)

Saludos.


EDITO:

Mira, he creado el bloque así:
Code: [Select]
global $db_prefix, $context, $modSettings, $scripturl;
global $sourcedir, $txt, $settings, $boardurl, $galurl;
static $mod, $GD_Installed;

$block_parameters = array(
'limit' => 'int',
'type' => 'select',
'direction' => 'select',
);

if ($return_parameters)
return $block_parameters;

$limit = empty($parameters['limit']) ? 3 : (int) $parameters['limit'];
$type = empty($parameters['type']) ? 0 : 1;
$direction = empty($parameters['direction']) ? 1 : 1;

if (!isset($mod))
{
if (file_exists($sourcedir . '/Aeva-Media.php'))
$mod = 'aeva_media';
elseif (file_exists($sourcedir . '/MGallery.php'))
$mod = 'smf_media_gallery';
elseif (file_exists($sourcedir . '/Gallery.php'))
$mod = 'smf_gallery';
}

if (empty($mod))
{
echo '
', $txt['error_sp_no_gallery_found'];
return;
}
elseif ($mod == 'aeva_media')
{
require_once($sourcedir . '/Aeva-Subs.php');

$items = aeva_getMediaItems(0, $limit, $type ? 'RAND()' : 'm.id_media DESC');
}
elseif ($mod == 'smf_media_gallery')
{
require_once($sourcedir . '/Subs-MGallery.php');

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

$items = getMediaItems(0, $limit, $type ? 'RAND()' : 'm.id_media DESC');
}
elseif ($mod == 'smf_gallery')
{
if (loadLanguage('Gallery', '', false) === false)
loadLanguage('Gallery', 'english', false);

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

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

$request = 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.memberName,
m.realName, 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 = 1
ORDER BY " . ($type ? 'RAND()' : 'p.ID_PICTURE DESC') . "
LIMIT $limit", __FILE__, __LINE__);
$items = array();
while ($row = mysql_fetch_assoc($request))
{
$items[] = array(
'id' => $row['ID_PICTURE'],
'title' => $row['title'],
'views' => $row['views'],
'poster_id' => $row['ID_MEMBER'],
'poster_name' => $row['realName'],
'poster_link' => empty($row['ID_MEMBER']) ? $txt['gallery_guest'] : '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MEMBER'] . '">' . $row['realName'] . '</a>',
'thumbfilename' => $row['thumbfilename'],
'filename' => $row['filename'],
'src' => $modSettings['gallery_url'] . ($GD_Installed ? $row['thumbfilename'] : $row['filename'] . '" width="120'),
);
}
mysql_free_result($request);
}

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

echo '
<table class="sp_auto_align">', $direction ? '
<tr>' : '';

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

if ($mod == 'aeva_media')
{
echo '
<a href="', $galurl, 'sa=item;id=', $item['id'], '"><img src="', $galurl, 'sa=media;id=', $item['id'], ';thumb" alt="" /></a><br />
                                                <a href="', $galurl, 'sa=item;id=', $item['id'], '">', $item['title'], '</a><br />
', $item['is_new'] ?
'<br /><img alt="" src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/new.gif" border="0" />' : '';
}
elseif ($mod == 'smf_media_gallery')
{
echo '
<a href="', $galurl, 'sa=item;id=', $item['id'], '">', $item['title'], '</a><br />
<a href="', $galurl, 'sa=item;id=', $item['id'], '"><img src="', $galurl, 'sa=media;id=', $item['id'], ';thumb" alt="" /></a><br />
', $txt['mgallery_views'], ': ', $item['views'], '<br />
', $txt['mgallery_posted_by'], ': <a href="', $scripturl, '?action=profile;u=', $item['poster_id'], '">', $item['poster_name'], '</a><br />
', $txt['mgallery_in_album'], ': <a href="', $galurl, 'sa=album;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" />' : '';
}
elseif ($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>';


Resulta que saque el código del /Sources/PortalBlocks.php y funciona, se ve sin marco y sin ninguna información extra, la caratula arriba, el nombre abajo, hasta ahí perfecto... jeje el problema está en que sigue mostrando los artículos al azar. Se podría dar algún cambio para quitar código que sobre y que muestre Albúmes específicos?

Perdonad las molestias, gracias de antemano.
« Last Edit: November 22, 2010, 02:44:02 PM by DaRKeN »

Offline DaRKeN

  • Jr. Member
  • **
  • Posts: 50
  • SMF Version: 2 RC5
  • SP Version: 2.3.3
Re: Ayuda con bloque de la galería
« Reply #7 on: November 24, 2010, 12:58:17 PM »
Up!  :)

Offline 130860

  • Super Handsome Language Coordinator
  • Board Moderators
  • *
  • Posts: 1769
  • Gender: Male
  • You and I are not the same class of pirate!
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Ayuda con bloque de la galería
« Reply #8 on: November 24, 2010, 01:03:21 PM »
no he tenido tiempo de probar ese bloque, mi prioridad es mi foro y la documentación de simplePortal en español, lo siento, tendrás que esperar o rpeguntar en el foro de soporte de ese mod.

Offline DaRKeN

  • Jr. Member
  • **
  • Posts: 50
  • SMF Version: 2 RC5
  • SP Version: 2.3.3
Re: Ayuda con bloque de la galería
« Reply #9 on: November 24, 2010, 01:49:39 PM »
No te preocupes, era por sí algún otro se tomaba las molestias de ayudarme con esto.  A ver si con suerte aparece alguien, igualmente seguiré indagando y preguntaré donde me has dicho a ver si hay suerte.

Saludos y gracias por todo.  ;)

Offline davidjms

  • Semi Newbie
  • *
  • Posts: 13
  • Gender: Male
  • I[L]SP2
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Ayuda con bloque de la galería
« Reply #10 on: November 26, 2010, 06:36:35 PM »
copia y pega esto en un bloque php:

Code: [Select]

function show_aeva_media_block()
{
   global $sourcedir;
// Set amount visible
$visible = "4";
   // Load the language file
   loadLanguage('Aeva');

   // Grab the file.
   if (file_exists($sourcedir . '/Aeva-Subs.php'))
      require_once($sourcedir . '/Aeva-Subs.php');
   // If it doesn't exist, tell them this and stop running.
   else
   {
      echo '<b>You don\'t have Aeva installed! Unable to continue!</b>';
      return;
   }

// Use aeva functions to show the media.
$images = aeva_listItems(aeva_getMediaItems(0, $limit, $type ? 'RAND()' : 'm.id_media DESC', true, array(), 'a.id_album IN (1, 2, 3)');
$show = '<center><div id="aeva_pics" style="width: 75%;" overflow="visible" >'. $images. '</div></center>';
echo $show;
return;
}   
// show the contents
show_aeva_media_block();
 

donde 1,2,3   son los id de los albums que quieres mostrar, este bloque msotrara 4 imagenes de los albums que tu especifiques.

Ami tambien me da error

Parse error: syntax error, unexpected ';' in
/public_html/Sources/PortalBlocks.php(3351) : eval()'d code on line 20

He intentado tratar de corregirlo, pero la verdad no logro ke funcione de antemano les agreadesco si alguien pudiera ayudar.


Offline AngelinaBelle

  • Comrade
  • *
  • Posts: 4870
  • Gender: Female
  • SMF Version: 2 RC3
  • SP Version: 2.3.2
Re: Ayuda con bloque de la galería
« Reply #11 on: January 30, 2014, 05:59:02 PM »
Code: [Select]
function show_aeva_media_block()
{
   global $sourcedir;
// Set amount visible
$visible = "4";
   // Load the language file
   loadLanguage('Aeva');

   // Grab the file.
   if (file_exists($sourcedir . '/Aeva-Subs.php'))
      require_once($sourcedir . '/Aeva-Subs.php');
   // If it doesn't exist, tell them this and stop running.
   else
   {
      echo '<b>You don\'t have Aeva installed! Unable to continue!</b>';
      return;
   }

// Use aeva functions to show the media.
$images = aeva_listItems(aeva_getMediaItems(0, $limit, $type ? 'RAND()' : 'm.id_media DESC', true, array(), 'a.id_album IN (1, 2, 3)'));
$show = '<center><div id="aeva_pics" style="width: 75%;" overflow="visible" >'. $images. '</div></center>';
echo $show;
return;
}   
// show the contents
show_aeva_media_block();
 
Please to keep this website running, if you like SimplePortal, make a
one-time subscription. Thank you for your support.

Have you tried the SimplePortal documentation?