4images Forum & Community
International => Español / Castellano => Topic started by: ccsakuweb on May 11, 2007, 09:59:15 AM
-
COMENTARIO:
^o^ Mi primer mod!! Por supuesto con ayuda de ejemplos para ayudarme y no cometer errores.
Como es mi primer mod, agradeceria cualquier comentario, ayuda o correcion acerca de este mod, ya que seguramente es redundante y podra optimizarse.
DESCRIPCION:
Este mod permite ver todos los favoritos del usuario (todas las imagenes que tiene en la caja del lightbox) por paging en el perfil de usuario. Podremos elegir cuantas imagenes mostraremos en el perfil por pagina. Seran visibles tanto para usuarios registrados como invitados. No necesita el mod Multilightbox ni ningun otro (nunca he conseguido instalarlo).
DEMO: http://www.myart.es/perfil2.htm (al final de mi perfil)
ARCHIVOS A MODIFICAR:
- member.php
- includes/page_header.php
- lang/spanish/main.php
- templates/tus_plantillas/member_profile.html
PASOS A SEGUIR PARA LA INSTALACION:
1-. Abrir member.php
Buscar:
//-----------------------------------------------------
//--- Show Profile ------------------------------------
//-----------------------------------------------------
if ($action == "showprofile") {
$txt_clickstream = $lang['profile'];
if (isset($HTTP_GET_VARS[URL_USER_ID]) || isset($HTTP_POST_VARS[URL_USER_ID])) {
$user_id = (isset($HTTP_GET_VARS[URL_USER_ID])) ? intval($HTTP_GET_VARS[URL_USER_ID]) : intval($HTTP_POST_VARS[URL_USER_ID]);
if (!$user_id) {
$user_id = GUEST;
}
}
else {
$user_id = GUEST;
}
Añadir debajo:
//----------------------------------------------------------------------------------
//--- COMENZAR Favoritas en perfil por CCSAKUWEB http://www.myart.es ---------------
//----------------------------------------------------------------------------------
$imgtable_width = ceil(intval($config['image_table_width']) / $config['image_cells']);
if ((substr($config['image_table_width'], -1)) == "%") {
$imgtable_width .= "%";
}
$additional_sql = "";
if (!empty($additional_image_fields)) {
foreach ($additional_image_fields as $key => $val) {
$additional_sql .= ", i.".$key;
}
}
if ($user_row = get_user_info($user_id)) {
$sql = "SELECT *
FROM ".LIGHTBOXES_TABLE."
WHERE user_id = $user_id";
$user_favoritos_info = $site_db->query_firstrow($sql);
$num_rows_all = 0;
if (!empty($user_favoritos_info['lightbox_image_ids'])) {
$image_id_sql = str_replace(" ", ",", trim($user_favoritos_info['lightbox_image_ids']));
$sql = "SELECT COUNT(image_id) AS images
FROM ".IMAGES_TABLE."
WHERE image_active = 1 AND image_id IN ($image_id_sql)";
$result = $site_db->query_firstrow($sql);
$num_images = $result['images'];
$site_db->free_result();
$num_rows_all = (isset($num_images)) ? $num_images : 0;
$user_total_favorites = $num_rows_all;
$site_template->register_vars("user_total_favorites", $user_total_favorites);
unset($user_total_favorites);
$user_favorites = 3; // Indicar cuantas imagenes favoritas quiere mostrar
$link_arg = $site_sess->url(ROOT_PATH."member.php?action=showprofile&user_id=$user_id");
include(ROOT_PATH.'includes/paging.php');
$getpaging_favorites = new Paging($page, $user_favorites, $num_rows_all, $link_arg);
$offset = $getpaging_favorites->get_offset();
$site_template->register_vars(array(
"paging_favorites" => $getpaging_favorites->get_paging(),
"paging_favorites_stats" => $getpaging_favorites->get_paging_stats()
));
$sql = "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits".$additional_sql.", c.cat_name".get_user_table_field(", u.", "user_name")."
FROM (".IMAGES_TABLE." i, ".CATEGORIES_TABLE." c)
LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
WHERE image_active = 1 AND image_id IN ($image_id_sql) AND c.cat_id = i.cat_id AND i.cat_id NOT IN (".get_auth_cat_sql("auth_viewcat", "NOTIN").")
ORDER BY i.image_date DESC
LIMIT $offset, $user_favorites";
$result = $site_db->query($sql);
$num_rows = $site_db->get_numrows($result);
$lightbox_lastaction = format_date($config['date_format']." ".$config['time_format'], $user_info['lightbox_lastaction']);
if (empty($user_info['lightbox_lastaction'])) {
$lightbox_lastaction = "n/a";
}
$site_template->register_vars("lightbox_lastaction", $lightbox_lastaction);
unset($lightbox_lastaction);
}else{
$num_rows = 0;
}
if (!$num_rows) {
$user_profile_favorites = "<table width=\"".$config['image_table_width']."\" border=\"0\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\"><tr class=\"imagerow1\"><td>";
$user_profile_favorites .= $lang['lightbox_no_images'];
$user_profile_favorites .= "</td></tr></table>";
}
else {
$user_profile_favorites = "<table width=\"".$config['image_table_width']."\" border=\"0\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\">";
$count = 0;
$bgcounter = 0;
while ($image_row = $site_db->fetch_array($result)){
if ($count == 0) {
$row_bg_number = ($bgcounter++ % 2 == 0) ? 1 : 2;
$user_profile_favorites .= "<tr class=\"imagerow".$row_bg_number."\">\n";
}
$user_profile_favorites .= "<td width=\"".$imgtable_width."\" valign=\"top\">\n";
show_image($image_row, "lightbox");
$user_profile_favorites .= $site_template->parse_template("thumbnail_bit");
$user_profile_favorites .= "\n</td>\n";
$count++;
if ($count == $config['image_cells']) {
$user_profile_favorites .= "</tr>\n";
$count = 0;
}
} // fin while
if ($count > 0) {
$leftover = ($config['image_cells'] - $count);
if ($leftover >= 1) {
for ($f = 0; $f < $leftover; $f++) {
$user_profile_favorites .= "<td width=\"".$imgtable_width."\">\n \n</td>\n";
}
$user_profile_favorites .= "</tr>\n";
}
}
$user_profile_favorites .= "</table>\n";
} // fin else
$site_template->register_vars("user_profile_favorites", $user_profile_favorites);
unset($user_profile_favorites);
}
//----------------------------------------------------------------------------------
//--- FINALIZAR Favoritas en perfil por CCSAKUWEB http://www.myart.es --------------
//----------------------------------------------------------------------------------
2-. Abrir includes/page_header.php
Buscar:
"lang_lightbox" => $lang['lightbox'],
Añadir debajo:
"lang_favoritos_perfil" => $lang['favoritos_perfil'],
3-. Abrir - lang/spanish/main.php
Buscar:
$lang['delete_lightbox_confirm'] = "¿Esta seguro de eliminar su caja de favoritos?";
Añadir debajo:
//-----------------------
//--- Favoritas en perfil
//-----------------------
$lang['favoritos_perfil'] = "Ultimos Favoritos de ";
4-. Modifica el numero de la variable $user_favorites para indicar cuantos favoritos mostramos por pagina
- Abrir templates/tus_plantillas/member_profile.html
Añadir debajo o donde quieras que este tu tabla de favoritos:
<br><br>
<table width="100%" border="0" cellspacing="0" cellpadding="1">
<tr>
<td valign="top" class="head1">
<table width="100%" border="0" cellpadding="4" cellspacing="0">
<tr>
<table width="100%" border="0" cellpadding="4" cellspacing="0">
<tr>
<td valign="top" class="head1">{lang_favoritos_perfil}{user_name} ({user_total_favorites})<br>{lang_lighbox_lastaction} {lightbox_lastaction}<br>{lang_lighbox_lastaction} {lightbox_lastaction}</td>
</tr>
<tr>
<td class="row1">{user_profile_favorites}</td>
</tr>
</table>
</td>
</tr>
</table>{paging_favorites}
{lang_favoritos_perfil} es el texto del titulo de la tabla de los favoritos para que lo podais poner en varios idiomas
Si os fijais el paging de los favoritos sera: {paging_favorites}
Ademas podremos usar {user_total_favorites} para el numero total de favoritos del usuario.
Y {lightbox_lastaction} que da la fecha y hora de la ultima modificacion en la caja del usuario.
Si no tiene favoritos saldra el mensaje de no imagenes del lightbox ( $lang['lightbox_no_images']) diciendo que no tiene favoritos el usuario
Espero vuestros comentarios y que os sirva ^^
STEPS in ENGLISH (http://www.4homepages.de/forum/index.php?topic=17452.msg97043#msg97043)
-
Me parece un MOD interesante, puede que lo utilice más adelante.
Se supone que funciona con la ultima versión, no
Gracias
-
no creo que haya problemas.
^^ si quieres este fin de semana lo pruebo, pero seguramente ira bien, es un mod sencillo y rapido.
pruebalo y si tienes algun fallo ponlo aqui y enseguida acudire a ayudarte
-
Saludos,,,
Buen MOD (http://www.4homepages.de/forum/Themes/babylon/images/post/thumbup.gif) felicidades por la aportación.
excitex
-
:lol: Gracias!! Tenia muchas ganas de aportar algo a los foros ya que me han ayudado a tener un gran site
Y cuando me pongo pues... me tiro horas y horas hasta que me sale (sobre todo con la lista de amigos XD) aunque segurisimo que fallan en algo.
Gracias a ti excitex2 por todo ^^
-
Hello - very good, this i need for my page ;-) what about in english??? PLEASE ore German :oops: :oops:
-
DEMO: http://www.myart.es/perfil2.htm
FILES TO MODIFY:
- member.php
- includes/page_header.php
- lang/spanish/main.php
- templates/tus_plantillas/member_profile.html
1-. Open member.php
Search:
//-----------------------------------------------------
//--- Show Profile ------------------------------------
//-----------------------------------------------------
if ($action == "showprofile") {
$txt_clickstream = $lang['profile'];
if (isset($HTTP_GET_VARS[URL_USER_ID]) || isset($HTTP_POST_VARS[URL_USER_ID])) {
$user_id = (isset($HTTP_GET_VARS[URL_USER_ID])) ? intval($HTTP_GET_VARS[URL_USER_ID]) : intval($HTTP_POST_VARS[URL_USER_ID]);
if (!$user_id) {
$user_id = GUEST;
}
}
else {
$user_id = GUEST;
}
After add:
//----------------------------------------------------------------------------------
//--- COMENZAR Favoritas en perfil por CCSAKUWEB http://www.myart.es ---------------
//----------------------------------------------------------------------------------
$imgtable_width = ceil(intval($config['image_table_width']) / $config['image_cells']);
if ((substr($config['image_table_width'], -1)) == "%") {
$imgtable_width .= "%";
}
$additional_sql = "";
if (!empty($additional_image_fields)) {
foreach ($additional_image_fields as $key => $val) {
$additional_sql .= ", i.".$key;
}
}
if ($user_row = get_user_info($user_id)) {
$sql = "SELECT *
FROM ".LIGHTBOXES_TABLE."
WHERE user_id = $user_id";
$user_favoritos_info = $site_db->query_firstrow($sql);
$num_rows_all = 0;
if (!empty($user_favoritos_info['lightbox_image_ids'])) {
$image_id_sql = str_replace(" ", ",", trim($user_favoritos_info['lightbox_image_ids']));
$sql = "SELECT COUNT(image_id) AS images
FROM ".IMAGES_TABLE."
WHERE image_active = 1 AND image_id IN ($image_id_sql)";
$result = $site_db->query_firstrow($sql);
$num_images = $result['images'];
$site_db->free_result();
$num_rows_all = (isset($num_images)) ? $num_images : 0;
$user_total_favorites = $num_rows_all;
$site_template->register_vars("user_total_favorites", $user_total_favorites);
unset($user_total_favorites);
$user_favorites = 3; // Indicar cuantas imagenes favoritas quiere mostrar
$link_arg = $site_sess->url(ROOT_PATH."member.php?action=showprofile&user_id=$user_id");
include(ROOT_PATH.'includes/paging.php');
$getpaging_favorites = new Paging($page, $user_favorites, $num_rows_all, $link_arg);
$offset = $getpaging_favorites->get_offset();
$site_template->register_vars(array(
"paging_favorites" => $getpaging_favorites->get_paging(),
"paging_favorites_stats" => $getpaging_favorites->get_paging_stats()
));
$sql = "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits".$additional_sql.", c.cat_name".get_user_table_field(", u.", "user_name")."
FROM (".IMAGES_TABLE." i, ".CATEGORIES_TABLE." c)
LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
WHERE image_active = 1 AND image_id IN ($image_id_sql) AND c.cat_id = i.cat_id AND i.cat_id NOT IN (".get_auth_cat_sql("auth_viewcat", "NOTIN").")
ORDER BY i.image_date DESC
LIMIT $offset, $user_favorites";
$result = $site_db->query($sql);
$num_rows = $site_db->get_numrows($result);
$lightbox_lastaction = format_date($config['date_format']." ".$config['time_format'], $user_info['lightbox_lastaction']);
if (empty($user_info['lightbox_lastaction'])) {
$lightbox_lastaction = "n/a";
}
$site_template->register_vars("lightbox_lastaction", $lightbox_lastaction);
unset($lightbox_lastaction);
}else{
$num_rows = 0;
}
if (!$num_rows) {
$user_profile_favorites = "<table width=\"".$config['image_table_width']."\" border=\"0\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\"><tr class=\"imagerow1\"><td>";
$user_profile_favorites .= $lang['lightbox_no_images'];
$user_profile_favorites .= "</td></tr></table>";
}
else {
$user_profile_favorites = "<table width=\"".$config['image_table_width']."\" border=\"0\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\">";
$count = 0;
$bgcounter = 0;
while ($image_row = $site_db->fetch_array($result)){
if ($count == 0) {
$row_bg_number = ($bgcounter++ % 2 == 0) ? 1 : 2;
$user_profile_favorites .= "<tr class=\"imagerow".$row_bg_number."\">\n";
}
$user_profile_favorites .= "<td width=\"".$imgtable_width."\" valign=\"top\">\n";
show_image($image_row, "lightbox");
$user_profile_favorites .= $site_template->parse_template("thumbnail_bit");
$user_profile_favorites .= "\n</td>\n";
$count++;
if ($count == $config['image_cells']) {
$user_profile_favorites .= "</tr>\n";
$count = 0;
}
} // fin while
if ($count > 0) {
$leftover = ($config['image_cells'] - $count);
if ($leftover >= 1) {
for ($f = 0; $f < $leftover; $f++) {
$user_profile_favorites .= "<td width=\"".$imgtable_width."\">\n \n</td>\n";
}
$user_profile_favorites .= "</tr>\n";
}
}
$user_profile_favorites .= "</table>\n";
} // fin else
$site_template->register_vars("user_profile_favorites", $user_profile_favorites);
unset($user_profile_favorites);
}
//----------------------------------------------------------------------------------
//--- FINALIZAR Favoritas en perfil por CCSAKUWEB http://www.myart.es --------------
//----------------------------------------------------------------------------------
2-. Open includes/page_header.php
Search:
"lang_lightbox" => $lang['lightbox'],
After Add:
"lang_favoritos_perfil" => $lang['favoritos_perfil'],
3-. Open - lang/spanish/main.php
Search:
$lang['delete_lightbox_confirm']
Add after in a new line:
//-----------------------
//--- Favoritas en perfil
//-----------------------
$lang['favoritos_perfil'] = "Last favorites from ";
4-. Modify the number from the variable $user_favorites, it will show the last "number that you have chosen" favorites pics in the profile
- Open templates/tus_plantillas/member_profile.html
Add after or where you want:
<br><br>
<table width="100%" border="0" cellspacing="0" cellpadding="1">
<tr>
<td valign="top" class="head1">
<table width="100%" border="0" cellpadding="4" cellspacing="0">
<tr>
<table width="100%" border="0" cellpadding="4" cellspacing="0">
<tr>
<td valign="top" class="head1">{lang_favoritos_perfil}{user_name} ({user_total_favorites})<br>{lang_lighbox_lastaction} {lightbox_lastaction}<br>{lang_lighbox_lastaction} {lightbox_lastaction}</td>
</tr>
<tr>
<td class="row1">{user_profile_favorites}</td>
</tr>
</table>
</td>
</tr>
</table>{paging_favorites}
{lang_favoritos_perfil} is the title from the favorites table.
The paging from the favorites would bea: {paging_favorites}
And we could use {user_total_favorites} , it is the total favorites from the user.
And {lightbox_lastaction} is the last date and hour that the ligthbox was modified.
If you dont have favorites, it will show $lang['lightbox_no_images']
-
THANKS THANKS THANKS !!!!!!!!!!!!!
-
your welcome ;)