Photo Block in Ezportal

Du hast Probleme beim Einbau oder bei der Benutzung eines Mods? In diesem Forum bist du richtig.
Forumsregeln
phpBB 2.0 hat das Ende seiner Lebenszeit überschritten
phpBB 2.0 wird nicht mehr aktiv unterstützt. Insbesondere werden - auch bei Sicherheitslücken - keine Patches mehr bereitgestellt. Der Einsatz von phpBB 2.0 erfolgt daher auf eigene Gefahr. Wir empfehlen einen Umstieg auf phpBB 3.0, welches aktiv weiterentwickelt wird und für welches regelmäßig Updates zur Verfügung gestellt werden.
Antworten
Benutzeravatar
Doc Lecter
Mitglied
Beiträge: 377
Registriert: 13.12.2003 16:24

Photo Block in Ezportal

Beitrag von Doc Lecter »

HI! Ich habe soeben folgenden MOD ins EZPORTAL eingebaut:

Code: Alles auswählen

############################################################## 
## Title: Photo Album Addon Block for Smartor's ezPortal v2.x 
## MOD Version: 1.0.1 
## Author: Kooky < kooky06@hotmail.com > - http://planetsport.nasov.net 
## 
## Description: This file explains you how to create a block for Photo Album Addon on 
## ezPortal for a recent or a randomize pic 
## 
## Required Photo Album Addon v2.x Smartor < smartor_xp@hotmail.com > - http://smartor.is-root.com 
## 
## Installation Level: easy 
## Installation Time: 5-10 Minutes 
## Files To Edit: 3 
## portal.php 
## templates/subSilver/portal_body.tpl 
## language/lang_english/lang_main.php 
## 
## Included Files: N/A 
## 
## 
## History: 
## 0.9.0. - initial BETA release 
## 1.0.0. - fixed approval issue 
## 1.0.1. - fixed locked issue 
## 
############################################################## 
## This MOD is released under the GPL License. 
## Intellectual Property is retained by the MOD Author(s) listed above 
############################################################## 
## Authors Notes: 
## 
############################################################## 
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD 
## and the Database 
############################################################## 

# 
#-----[ OPEN ]--------------------------------------------- 
# 
portal.php 

# 
#-----[ FIND ]---------------------------------------- 
# 
// 
// END - Avatar On Index MOD 
// 

# 
#-----[ AFTER ADD ]----------------------------------- 
# 

// 
// Get Newest Pic 
// 
$Display = 'Recent'; // Replace 'Recent' with 'Random' 
$CategoryID = 0; // Replace 0 with a category ID. Otherwise, keep it as it is Example: http://www.yourdomain.com/phpBB2/album_cat.php?cat_id=3 
// Category ID is 3 

if ($Display == 'Random') 
{ 
if ($CategoryID != 0) 
{ 
$sql = "SELECT p.pic_id, p.pic_title, p.pic_username, p.pic_user_id, p.pic_time, p.pic_desc, p.pic_approval, u.username 
FROM ". ALBUM_TABLE ." AS p 
LEFT JOIN ". USERS_TABLE ." AS u ON p.pic_user_id = u.user_id 
WHERE pic_approval = 1 AND pic_lock = 0 AND pic_cat_id = $CategoryID 
ORDER BY RAND() 
LIMIT 0,1"; 
} 
else { 
$sql = "SELECT p.pic_id, p.pic_title, p.pic_username, p.pic_user_id, p.pic_time, p.pic_desc, p.pic_lock, p.pic_approval, u.username 
FROM ". ALBUM_TABLE ." AS p 
LEFT JOIN ". USERS_TABLE ." AS u ON p.pic_user_id = u.user_id 
WHERE pic_approval = 1 AND pic_lock = 0 
ORDER BY RAND() 
LIMIT 0,1"; 
} 
} 

else if ($Display == 'Recent') 
{ 
if ($CategoryID != 0) 
{ 
$sql = "SELECT p.pic_id, p.pic_title, p.pic_username, p.pic_user_id, p.pic_time, p.pic_desc, p.pic_approval, u.username 
FROM ". ALBUM_TABLE ." AS p 
LEFT JOIN ". USERS_TABLE ." AS u ON p.pic_user_id = u.user_id 
WHERE pic_approval = 1 AND pic_lock = 0 AND pic_cat_id = $CategoryID 
ORDER BY pic_time DESC 
LIMIT 0,1"; 
} 
else 
{ 
$sql = "SELECT p.pic_id, p.pic_title, p.pic_username, p.pic_user_id, p.pic_time, p.pic_desc, p.pic_lock, p.pic_approval, u.username 
FROM ". ALBUM_TABLE ." AS p 
LEFT JOIN ". USERS_TABLE ." AS u ON p.pic_user_id = u.user_id 
WHERE pic_approval = 1 AND pic_lock = 0 
ORDER BY pic_time DESC 
LIMIT 0,1"; 
} 
} 

if (!$result = $db->sql_query($sql)) 
{ 
message_die(GENERAL_ERROR, 'Could not query album information', '', __LINE__, __FILE__, $sql); 
} 

$picrow = $db->sql_fetchrow($result); 

$pic_poster = '<a href="'. append_sid("profile.$phpEx?mode=viewprofile&". POST_USERS_URL .'='. $picrow['pic_user_id']) .'">'. $picrow['pic_username'] .'</a>'; 
// 
// END: Get Newest Pic 
// 

# 
#-----[ FIND ]---------------------------------------- 
# 
'L_VOTE_BUTTON' => $lang['Vote'], 

# 
#-----[ AFTER ADD ]----------------------------------- 
# 

// Photo Album 
'L_NEWEST_PIC' => $lang['Newest_pic'], 
'PIC_IMAGE' => append_sid('album_thumbnail.'. $phpEx . '?pic_id=' . $picrow['pic_id']), 
'PIC_TITLE' => $picrow['pic_title'], 
'PIC_POSTER' => $pic_poster, 
'U_PIC_LINK' => append_sid('album_comment.' . $phpEx . '?pic_id=' . $picrow['pic_id']), 
'PIC_TIME' => create_date($board_config['default_dateformat'], $picrow['pic_time'], $board_config['board_timezone']), 
'PIC_DESCR' => $picrow['pic_desc'], 

'L_PIC_TITLE' => $lang['Pic_Title'], 
'L_POSTER' => $lang['Poster'], 
'L_POSTED' => $lang['Posted'], 

# 
#-----[ OPEN ]--------------------------------------------- 
# 
templates/subSilver/portal_body.tpl 

# 
#-----[ FIND ]---------------------------------------- 
# 
<a href="{U_INDEX}">{L_FORUM}</a><br /> 

# 
#-----[ AFTER ADD ]----------------------------------- 
# 

<a href="{U_ALBUM}">{L_ALBUM}</a><br /> 

# 
#-----[ FIND ]---------------------------------------- 
# 
<table width="100%" cellpadding="2" cellspacing="1" border="0" class="forumline"> 
<tr> 
<td class="catHead" height="25"><span class="genmed">{L_LOGIN}</span></td> 
</tr> 
<tr> 
<td class="row1"><span class="gensmall" style="line-height=150%"> 
<input type="hidden" name="redirect" value="{U_PORTAL}" /> 
{L_USERNAME}:<br /><input class="post" type="text" name="username" size="15" /><br /> 
{L_PASSWORD}:<br /><input class="post" type="password" name="password" size="15" /><br /> 
<input class="text" type="checkbox" name="autologin" />&{L_REMEMBER_ME}<br/> 
<input type="submit" class="mainoption" name="login" value="{L_LOGIN}" /><br /><br /><a href="{U_SEND_PASSWORD}" class="gensmall">{L_SEND_PASSWORD}</a><br /><br />{L_REGISTER_NEW_ACCOUNT}<br />&</span></td> 
</tr> 
</table> 
</form> 
<!-- END switch_user_logged_out --> 

# 
#-----[ AFTER ADD ]----------------------------------- 
# 

<table width="100%" cellpadding="2" cellspacing="1" border="0" class="forumline"> 
<tr> 
<th>{L_NEWEST_PIC}</span></th> 
</tr> 
<tr> 
<td class="row1"><span class="gensmall" style="line-height:150%"><center><a href="{U_PIC_LINK}"><img src="{PIC_IMAGE}" border="0" alt="{PIC_DESCR}"></a><br /></center> 
<table width="100%" align="center" border="0" cellpadding="2" cellspacing="1"> 
<tr> 
<td width="25%" align="left"><span class="gensmall">{L_POSTER}: {PIC_POSTER}</span></td> 
</tr> 
<tr> 
<td valign="top" align="left"><span class="gensmall">{L_PIC_TITLE}: {PIC_TITLE}</span></td> 
</tr> 
<tr> 
<td align="left"><span class="gensmall">{L_POSTED}: {PIC_TIME}</span></td> 
</tr> 
</table> 
<table border="0" cellspacing="0" cellpadding="2" align="center"> 
<tr> 
<td align="center"><span class="gensmall">[ <a href="{U_ALBUM}">{L_ALBUM}</a> ]<br />&</span></td> 
</tr> 
</table> 
</td> 
</tr> 
</table> 

<br /> 

# 
#-----[ OPEN ]--------------------------------------------- 
# 
language/lang_english/lang_main.php 

# 
#-----[ FIND ]---------------------------------------- 
# 
$lang['No_poll'] = 'No poll at the moment'; 

# 
#-----[ AFTER ADD ]----------------------------------- 
# 

// 
// Photo Album 
// 
$lang['Newest_pic'] = 'Newest Pic'; 
$lang['Pic_Title']= 'Pic Title'; 

# 
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------ 
# EoM 
Es funktioniert auch alles WUNDERBAR! Allerdings, wie bekomme ich hin das er anstatt nur EINER Kategorie mehrere anzeigt ? Also das ich dann einfach folgendes eintragen kann:

Code: Alles auswählen

$CategoryID = 1,2,3; // Replace 0 with a category ID. Otherwise, keep it as it is 
SO das er die Fotos aus den Kategorien 1,2,3 nimmt. Weiß einer ne Lösung?
Danke
Benutzeravatar
netzmeister
Ehemaliges Teammitglied
Beiträge: 1146
Registriert: 02.05.2003 20:59
Wohnort: Freiburg
Kontaktdaten:

Beitrag von netzmeister »

Hallo,
versuch mal folgendes:

Code: Alles auswählen

#----- [ FIND ] -----
WHERE pic_approval = 1 AND pic_lock = 0 AND pic_cat_id = $CategoryID

#-----[ REPLACE WITH ] -----
WHERE pic_approval = 1 AND pic_lock = 0 AND pic_cat_id IN $CategoryID
und das bei beiden Zeilen..

Gruß netzmeister
Gruß netzmeister
Die "Suche" ist euer Freund
PhilippK
Vorstand
Vorstand
Beiträge: 14662
Registriert: 13.08.2002 14:10
Wohnort: Stuttgart
Kontaktdaten:

Beitrag von PhilippK »

Du musst dann aber $CategoryID als String definieren:

Code: Alles auswählen

$CategoryID = '1,2,3';
Gruß, Philipp
Kein Support per PN!
Der Sozialstaat ist [...] eine zivilisatorische Errungenschaft, auf die wir stolz sein können. Aber der Sozialstaat heutiger Prägung hat sich übernommen. Das ist bitter, aber wahr. (Horst Köhler)
Meine Mods
Benutzeravatar
Doc Lecter
Mitglied
Beiträge: 377
Registriert: 13.12.2003 16:24

Beitrag von Doc Lecter »

Danke! ich probier das nachher mal aus und poste das Ergebnis!
Benutzeravatar
Doc Lecter
Mitglied
Beiträge: 377
Registriert: 13.12.2003 16:24

Beitrag von Doc Lecter »

Mist! Hat irgendwie nicht funktioniert! Folgende Fehlermeldung erscheint:

Code: Alles auswählen

Could not query album information

DEBUG MODE

SQL Error : 1064 You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '3 ORDER BY pic_time DESC LIMIT 0,1' at line 4

SELECT p.pic_id, p.pic_title, p.pic_username, p.pic_user_id, p.pic_time, p.pic_desc, p.pic_approval, u.username FROM phpbb_album AS p LEFT JOIN phpbb_users AS u ON p.pic_user_id = u.user_id WHERE pic_approval = 1 AND pic_lock = 0 AND pic_cat_id IN 3 ORDER BY pic_time DESC LIMIT 0,1

Line : 340
File : /is/htdocs/XXXXXXX/www.symphonicmetal.de/portal.php
Wat nu? :(
PhilippK
Vorstand
Vorstand
Beiträge: 14662
Registriert: 13.08.2002 14:10
Wohnort: Stuttgart
Kontaktdaten:

Beitrag von PhilippK »

Versuch mal:

Code: Alles auswählen

WHERE pic_approval = 1 AND pic_lock = 0 AND pic_cat_id IN ($CategoryID)
Gruß, Philipp
Kein Support per PN!
Der Sozialstaat ist [...] eine zivilisatorische Errungenschaft, auf die wir stolz sein können. Aber der Sozialstaat heutiger Prägung hat sich übernommen. Das ist bitter, aber wahr. (Horst Köhler)
Meine Mods
Benutzeravatar
Doc Lecter
Mitglied
Beiträge: 377
Registriert: 13.12.2003 16:24

Beitrag von Doc Lecter »

Boah Klasse! Hat gefunzt!! DANKEEE
stefan23
Mitglied
Beiträge: 184
Registriert: 16.08.2003 21:44
Wohnort: Osnabrück
Kontaktdaten:

Beitrag von stefan23 »

Hallöchen zusammen,

Ich habe heute auch diesem Mod mal Installiert, nun mein Problem ist es nun das mir kein Bild angezeigt wird ??? alles andere ist kein Problem , sprich ich bekomme keine Fehlermeldung oder sonstiges.

Hier mal meine bearbeiteten Datein :
http://www.reptilienseite.com/forum/portal.txt
http://www.reptilienseite.com/forum/portal_body.txt

Ich bedanke mich schon mal im vorraus .

MfG Stefan
http://www.die-reptilien-community.de das Reptilienportal für Jung und Alt :-)
Antworten

Zurück zu „phpBB 2.0: Mod Support“