Seite 2 von 11

Verfasst: 03.02.2004 23:41
von andreasOymann
portal.php:

suche:

Code: Alles auswählen

//
// Fetch Posts from Announcements Forum
//
füge davor ein:

Code: Alles auswählen

//
// Get Pics cat_id=1
//
include($album_root_path . 'album_common.'.$phpEx);

$cat_id = 1;
$start = 0;
$pics_per_page = 4;


	$sql = "SELECT p.pic_id, p.pic_title, p.pic_desc, p.pic_user_id, p.pic_user_ip, p.pic_username, p.pic_time, p.pic_cat_id, p.pic_view_count, p.pic_lock, p.pic_approval, u.user_id, u.username
			FROM ". ALBUM_TABLE ." AS p
			LEFT JOIN ". USERS_TABLE ." AS u ON p.pic_user_id = u.user_id
			WHERE p.pic_cat_id = '$cat_id'
			GROUP BY p.pic_id
			ORDER BY p.pic_time DESC
			LIMIT 0,12";
	if( !($result = $db->sql_query($sql)) )
	{
		message_die(GENERAL_ERROR, 'Could not query pics information', '', __LINE__, __FILE__, $sql);
	}

	$picrow = array();

	while( $row = $db->sql_fetchrow($result) )
	{
		$picrow[] = $row;
	}


	for ($i = 0; $i < count($picrow); $i += 3)
	{
		$template->assign_block_vars('picrow', array());

		for ($j = $i; $j < ($i + 3); $j++)
		{
			if( $j >= count($picrow) )
			{
				break;
			}

			$template->assign_block_vars('picrow.piccol', array(
				'U_PIC' => append_sid("album_page.$phpEx?pic_id=". $picrow[$j]['pic_id']),
				'THUMBNAIL' => append_sid("album_thumbnail.$phpEx?pic_id=". $picrow[$j]['pic_id']),
				'DESC' => $picrow[$j]['pic_desc'],
				)
			);

			$pic_poster = '<a href="'. append_sid("profile.$phpEx?mode=viewprofile&". POST_USERS_URL .'='. $picrow[$j]['user_id']) .'">'. $picrow[$j]['username'] .'</a>';

			$template->assign_block_vars('picrow.pic_detail', array(
				'TITLE' => $picrow[$j]['pic_title'],
				)
			);
		}
	}

$sql = "SELECT count(pic_id) as entries
		FROM ". ALBUM_TABLE . "
		WHERE pic_cat_id = '$cat_id'";

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

$template->assign_vars(array(
	'U_MORE_PICS_1' => ($total['entries'] > 4) ? '<a href="'. append_sid("album_cat.$phpEx?cat_id=". $cat_id) .'">'. $lang['more_pics'] .'</a>' : '',
));
Block für portal_body.tpl:

Code: Alles auswählen

		<table width="100%" cellpadding="2" cellspacing="1" border="0" class="forumline">
		  <tr>
			<td class="catHead" colspan="10" height="25" align="center"><span class="genmed"><b>Bilder</b></span></td>
		  </tr>
		  <!-- BEGIN no_pics -->
		  <tr>
			<td class="row1" align="center" height="50"><span class="gen">{L_NO_PICS}</span></td>
		  </tr>
		  <!-- END no_pics -->
		  <!-- BEGIN picrow -->
		  <tr>
		  <!-- BEGIN piccol -->
			<td align="center" width="{S_COL_WIDTH}" class="row1"><span class="genmed"><a href="{picrow.piccol.U_PIC}" {TARGET_BLANK}><img src="{picrow.piccol.THUMBNAIL}" border="0" alt="{picrow.piccol.DESC}" title="{picrow.piccol.DESC}" vspace="10" /></a><br />{picrow.piccol.APPROVAL}</span></td>
		  <!-- END piccol -->
		  </tr>
		  <tr>
		  <!-- BEGIN pic_detail -->
			<td class="row2"><span class="gensmall">
			{picrow.pic_detail.TITLE}<br />
			</td>
		  <!-- END pic_detail -->
		  </tr>
		  <!-- END picrow -->
			</td>
		  </tr>
		  <tr>
			<td class="row1" colspan="10" height="25" align="center"><span class="nav">{U_MORE_PICS_1}</span></td>
		  </tr>
		</table>
A.

Verfasst: 04.02.2004 17:57
von Bandito
Hallo Andreas

Danke für deine Hilfe und es hörte sich auch Vielversprechend an. Jedoch in meiner portal.php gibt es die Zeile

//
// Fetch Posts from Announcements Forum
//

schon garnicht(?). Kann ich die einfach dazufügen? Und wenn ja, wo?

MfG
Banditos

Verfasst: 04.02.2004 23:53
von andreasOymann
Verlinkst du bitte mal deine portal.php als Textdatei...

A.

Verfasst: 05.02.2004 00:06
von Bandito
... kein Problem > portal.txt.

Danke für deine Mithilfe !

MfG
Bandito

Verfasst: 05.02.2004 00:58
von andreasOymann
sorry, ich dachte, du hättest auch das Portal von Smartor... mmmh, ich schau mir das awsw-Portal mal näher an, melde mich, wenn ich was gefunden habe.

A.

P.S.: Unter http://www.awsw.de/viewtopic.php?t=39 gibt es eine Anleitung, wie ein neuer Block hinzugefügt werden kann, vielleicht hilft dir das in Verbindung mit meinem Code ja schon weiter... wenn du es nicht hinbekommst, schrei einfach :wink:

Verfasst: 09.02.2004 06:48
von Bandito
Hallo Anderas

... so, phpbb.de hat nun seine Festplatteprobleme behoben und ich habe wieder die Zeit gefunden, um wieder eine Antwort schreiben zu können. :wink:

Also, ich habe nun eine Extrabox (nach der Anweisung von awsw.de) erstellt. Wenn ich jedoch über den Adminbereich diese Box aktivieren will, dann funktioniert das irgendwie nicht. Bei desen Übernahme ist sie wieder auf Deaktiviert gesetzt. Ich habe mir auch die Einträge nochmals vorgenommen und sie stimmen nach wie vor nach der Anweisung. Aber vielleicht muss ich ja zuerst den Code für Photo Album Block hinzufügen, das sie auf Aktiviert bleibt. Und wie mach ich das nun genau bzw. wo überall muss ich die entsprechenden Codes des Album Blocks hinzufügen? Sorry, ich bin kein PHP-Profie, eher ein Amateur der untersten Klasse, auch wenn ich das eine oder andere ändern kann an PHP, so ist mir das nun eine Nummer zu gross. :grin:

Vielen Dank für deine Mithilfe !

MfG
Bandito

Verfasst: 10.02.2004 23:28
von Bandito
ANDREAS.....!!!!

... sorry, aber du sagtest ja, ich soll einfach nach dir schreien ! :wink:

Verfasst: 11.02.2004 00:59
von andreasOymann
jau, bin schon da, war ja nicht zu überhören... :wink:

Ich mach dir das ganze mal als Mod fertig... schick dir ne PN, wenn ich´s habe!

A.

Verfasst: 11.02.2004 01:21
von andreasOymann
##### SQL #####

++ In phpMyAdmin ausführen / Run in phpMyAdmin:

Code: Alles auswählen

INSERT INTO phpbb_introportalmod VALUES ('albumpics_active', '1') 
##### portal.php #####

++ Suche / Find:

Code: Alles auswählen

// TURN OFF BOXES FROM ACP END 
++ Vorher anfügen / Add before:

Code: Alles auswählen

// SWITCH ALBUMPICS START 
if( $introportalmod_config['albumpics_active'] == "1" ) 
{ 
// PHP CODE START 

include($album_root_path . 'album_common.'.$phpEx); 

$cat_id = 1; 
$start = 0; 
$pics_per_page = 4; 


   $sql = "SELECT p.pic_id, p.pic_title, p.pic_desc, p.pic_user_id, p.pic_user_ip, p.pic_username, p.pic_time, p.pic_cat_id, p.pic_view_count, p.pic_lock, p.pic_approval, u.user_id, u.username 
         FROM ". ALBUM_TABLE ." AS p 
         LEFT JOIN ". USERS_TABLE ." AS u ON p.pic_user_id = u.user_id 
         WHERE p.pic_cat_id = '$cat_id' 
         GROUP BY p.pic_id 
         ORDER BY p.pic_time DESC 
         LIMIT 0,12"; 
   if( !($result = $db->sql_query($sql)) ) 
   { 
      message_die(GENERAL_ERROR, 'Could not query pics information', '', __LINE__, __FILE__, $sql); 
   } 

   $picrow = array(); 

   while( $row = $db->sql_fetchrow($result) ) 
   { 
      $picrow[] = $row; 
   } 


   for ($i = 0; $i < count($picrow); $i += 3) 
   { 
      $template->assign_block_vars('picrow', array()); 

      for ($j = $i; $j < ($i + 3); $j++) 
      { 
         if( $j >= count($picrow) ) 
         { 
            break; 
         } 

         $template->assign_block_vars('picrow.piccol', array( 
            'U_PIC' => append_sid("album_page.$phpEx?pic_id=". $picrow[$j]['pic_id']), 
            'THUMBNAIL' => append_sid("album_thumbnail.$phpEx?pic_id=". $picrow[$j]['pic_id']), 
            'DESC' => $picrow[$j]['pic_desc'], 
            ) 
         ); 

         $pic_poster = '<a href="'. append_sid("profile.$phpEx?mode=viewprofile&". POST_USERS_URL .'='. $picrow[$j]['user_id']) .'">'. $picrow[$j]['username'] .'</a>'; 

         $template->assign_block_vars('picrow.pic_detail', array( 
            'TITLE' => $picrow[$j]['pic_title'], 
            ) 
         ); 
      } 
   } 

$sql = "SELECT count(pic_id) as entries 
      FROM ". ALBUM_TABLE . " 
      WHERE pic_cat_id = '$cat_id'"; 

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

$template->assign_vars(array( 
   'U_MORE_PICS_1' => ($total['entries'] > 4) ? '<a href="'. append_sid("album_cat.$phpEx?cat_id=". $cat_id) .'">'. $lang['more_pics'] .'</a>' : '', 
)); 
 
// PHP CODE END 
$template->assign_block_vars('switch_albumpics_active', array( 
$template->assign_vars(array( 
// TEMPLATE CODE VARS START 
'ALBUMPICS1' => $lang['albumpics1'], 
'ALBUMPICS2' => $lang['albumpics2'] 
// TEMPLATE CODE VARS END 
)) 
)); 
} 
// SWITCH ALBUMPICS END 
##### portal_body.tpl #####

++ Suche / Find:

Code: Alles auswählen

<!-- ##### GOOGLE START ##### --> 
++ Vorher anfügen / Add before:

Code: Alles auswählen

<!-- ##### ALBUMPICS START ##### --> 
<!-- BEGIN switch_albumpics_active --> 
<table width="100%" border="0" cellpadding="1" cellspacing="1" style="border-collapse: collapse" class="forumline"> 
<tr> 
<td class="catHead" colspan="2" height="25"><span class="cattitle">
{ALBUMPICS1}:
</span></td> 
</tr> 
<tr> 
<td colspan="2" height="1" class="row3"><img src="images/spacer.gif" width="1" height="1" alt="."></td> 
</tr> 
<tr> 
<td align="center" nowrap="nowrap" class="row1"><span class="gensmall"> 
<!-- CODE --> 
        <!-- BEGIN no_pics --> 
        <tr> 
         <td class="row1" align="center" height="50"><span class="gen">{L_NO_PICS}</span></td> 
        </tr> 
        <!-- END no_pics --> 
        <!-- BEGIN picrow --> 
        <tr> 
        <!-- BEGIN piccol --> 
         <td align="center" width="{S_COL_WIDTH}" class="row1"><span class="genmed"><a href="{picrow.piccol.U_PIC}" {TARGET_BLANK}><img src="{picrow.piccol.THUMBNAIL}" border="0" alt="{picrow.piccol.DESC}" title="{picrow.piccol.DESC}" vspace="10" /></a><br />{picrow.piccol.APPROVAL}</span></td> 
        <!-- END piccol --> 
        </tr> 
        <tr> 
        <!-- BEGIN pic_detail --> 
         <td class="row2"><span class="gensmall"> 
         {picrow.pic_detail.TITLE}<br /> 
         </td> 
        <!-- END pic_detail --> 
        </tr> 
        <!-- END picrow --> 
         </td> 
        </tr> 
<!-- CODE --> 
</span></td> 
</tr> 
</table> 
<!-- END switch_albumpics_active --> 
<!-- ##### ALBUMPICS END ##### --> 
##### lang_german/lang_introportal.php #####

++ Suche / Find:

Code: Alles auswählen

$lang['UserNote'] = 'Hinweis'; 
++ Danach anfügen / Add after:

Code: Alles auswählen

$lang['albumpics1'] = 'Bilder aus dem Album'; 
$lang['albumpics2'] = 'Bilder aus dem Album'; 
++ Suche / Find:

Code: Alles auswählen

$google_active_yes = ($new['google_active']) ? 'checked="checked"' : ''; 
$google_active_no = (!$new['google_active']) ? 'checked="checked"' : ''; 
++ Vorher anfügen / Add before:

Code: Alles auswählen

$albumpics_active_yes = ($new['albumpics_active']) ? 'checked="checked"' : ''; 
$albumpics_active_no = (!$new['albumpics_active']) ? 'checked="checked"' : ''; 
++ Suche / Find:

Code: Alles auswählen

'IntroPortaltext26' => $lang['IntroPortaltext26'], 
++ Danach anfügen / Add after:

Code: Alles auswählen

'ALBUMPICS1' => $lang['albumpics1'], 
++ Suche / Find:

Code: Alles auswählen

"google_active_ENABLE" => $google_active_yes, 
"google_active_DISABLE" => $google_active_no, 
++ Vorher anfügen / Add before:

Code: Alles auswählen

"albumpics_active_ENABLE" => $albumpics_active_yes, 
"albumpics_active_DISABLE" => $albumpics_active_no, 
##### admin/introportalmod_body.tpl #####

++ Suche / Find:

Code: Alles auswählen

<tr> 
<td class="row1">{IntroPortaltext25}:
<span class="gensmall">{IntroPortalAdmin22}</span></td></td> 
<td class="row2"><input type="radio" name="google_active" value="1" {google_active_ENABLE} /> {L_ENABLED}&nbsp;&nbsp;<input type="radio" name="google_active" value="0" {google_active_DISABLE} /> {L_DISABLED}</td> 
</tr> 
++ Vorher anfügen / Add before:

Code: Alles auswählen

<tr> 
<td class="row1">{ALBUMPICS1}:
<span class="gensmall">{IntroPortalAdmin22}</span></td></td> 
<td class="row2"><input type="radio" name="albumpics_active" value="1" {albumpics_active_ENABLE} /> {L_ENABLED}&nbsp;&nbsp;<input type="radio" name="albumpics_active" value="0" {albumpics_active_DISABLE} /> {L_DISABLED}</td> 
</tr> 
Denke, das war´s...

Andreas

Verfasst: 11.02.2004 07:24
von Bandito
Hallo Andreas

... erst Mal vielen herzlichen Dank für deine Mühe und Hilfe !!! :grin:
Es hat auch alles wunderbar gepasst. Wenn ich jedoch im ACP die entsprechende 'Bilder aus Album'-Option auf aktivieren will und sie per Absenden aktualisiere, ist die besagte Option wieder auf Deaktiviert gesetzt(?). Ich hatte das schon bei deinem anderen Vorschlag mit dem ADDONBOX1.

Ich habe auch alle eingefügten Codes alle nochmals gecheckt und sie stimmen mit deinen Angaben überein. Hast du vielleicht ne Idee warum sich das nicht aktivieren lässt?


Danke für deine Mithilfe !

MfG
Bandito