Jetzt kostenlos Anmelden!

Sharlyscript Weiblich

lernt alles kennen

Beiträge: 92

Geschlecht: Weiblich

PHPKIT Version: 1.6.5

1

Freitag, 16. Juli 2010, 16:30

Eigene Navox zeigt inhalt woanders an

Hallo ihr lieben,

ich habe mir eine Navbox erstellt. Die zeigt durch Zufall die Bilder aus meiner Gallerie an. Das klappt soweit auch, aber das wird nicht in der Navbox sondern ganz oben links auf der Seite angezeigt:

PHP-Quelltext

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<?php
# PHPKIT Web Content Management System
# --------------------------------------------
# Copyright (c) 2002-2007 Gersöne & Schott GbR
#
# This file / the PHPKIT-software is no freeware!
# For further informations please vistit our website
# or contact us via email:
#
# Diese Datei / die PHPKIT-Software ist keine Freeware!
# Für weitere Information besuchen Sie bitte unsere 
# Webseite oder kontaktieren uns per E-Mail:
#
# Website : http://www.phpkit.de
# Mail    : info@phpkit.de
#
# YOU ARE NOT AUTHORISED TO CREATE ILLEGAL COPIES OF THIS
# FILE AND/OR TO REMOVE THIS INFORMATIONS
#
# SIE SIND NICHT BERECHTIGT, UNRECHTMÄSSIGE KOPIEN DIESER
# DATEI ZU ERSTELLEN UND/ODER DIESE INFORMATIONEN ZU ENTFERNEN


if(!defined('pkFRONTEND') || pkFRONTEND!='public')
    die('Direct access to this location is not permitted.');

$boxlinks=array();
define('ROOT_PATH''wp-gallerie/');

include(ROOT_PATH.'config.php');
include(ROOT_PATH.'includes/db_mysql.php');
include(ROOT_PATH.'includes/constants.php');

$site_db = new Db($db_host$db_user$db_password$db_name);
function is_remote($file_name) {
  return (preg_match('#^https?\\:\\/\\/[a-z0-9\-]+\.([a-z0-9\-]+\.)?[a-z]+#i'$file_name)) ? 0;
}

$sql "SELECT COUNT(*) as total_images
        FROM ".IMAGES_TABLE." a, ".CATEGORIES_TABLE." b 
        WHERE a.image_active=1 
        AND a.cat_id = b.cat_id 
        AND b.auth_viewcat=".AUTH_ALL." 
        AND b.auth_viewimage=".AUTH_ALL."
        ";
$row $site_db->query_firstrow($sql);
$total_images $row['total_images'];

mt_srand((double)microtime() * 1000000);
$number = ($total_images 1) ? mt_rand(0$total_images 1) : 0;

$sql "SELECT a.image_id, a.cat_id, a.image_name, a.image_active, a.image_thumb_file, a.image_comments 
        FROM ".IMAGES_TABLE." a, ".CATEGORIES_TABLE." b 
        WHERE a.image_active=1 
        AND a.cat_id = b.cat_id 
        AND b.auth_viewcat=".AUTH_ALL." 
        AND b.auth_viewimage=".AUTH_ALL." 
        LIMIT $number, 1";
$row $site_db->query_firstrow($sql);
$image_id $row['image_id'];
$cat_id $row['cat_id'];
$image_name $row['image_name'];
$image_comments $row['image_comments'];
$thumb_src = (is_remote($row['image_thumb_file'])) ? $row['image_thumb_file'] : ROOT_PATH.THUMB_DIR."/".$cat_id."/".$row['image_thumb_file'];

echo "<a href=\"".ROOT_PATH."details.php?image_id=$image_id\"><img src=\"".$thumb_src."\" border=\"0\" alt=\"$image_name\"></a><br>\n";
echo "<b>$image_name</b><br>\n";
echo "Comments: $image_comments<br>\n";

return $boxlinks;
?>
  • Zum Seitenanfang
  • Zum Seitenende

Proggi Männlich

schaut regelmäßig rein

Beiträge: 263

Geschlecht: Männlich

Wohnort: Berlin

PHPKIT Version: 1.6.5

2

Freitag, 16. Juli 2010, 16:55

Hi Sharly ;)

Das liegt daran, weil die Ausgabe per echo erfolgt.

PHP-Quelltext

1
2
3
echo "<a href=\"".ROOT_PATH."details.php?image_id=$image_id\"><img src=\"".$thumb_src."\" border=\"0\" alt=\"$image_name\"></a><br>\n";
echo "<b>$image_name</b><br>\n";
echo "Comments: $image_comments<br>\n";


Schreibe es stattdessen mal so:

PHP-Quelltext

1
2
3
$boxlinks[0] = "<a href=\"".ROOT_PATH."details.php?image_id=$image_id\"><img src=\"".$thumb_src."\" border=\"0\" alt=\"$image_name\" /></a><br />\n";
$boxlinks[0] .=  "<b>$image_name</b><br />\n";
$boxlinks[0] .=  "Comments: $image_comments<br />\n";


Nicht getestet, sollte aber gehen.


Netten Gruß Andy --- Proggi
Es gibt viel zu tun - packen wir es an.....


  • Zum Seitenanfang
  • Zum Seitenende

Sharlyscript Weiblich

lernt alles kennen

Beiträge: 92

Geschlecht: Weiblich

PHPKIT Version: 1.6.5

3

Freitag, 16. Juli 2010, 21:25

Achso, dass ist im Kit ja anders :D
Vielen Dank es funktioniert!
  • Zum Seitenanfang
  • Zum Seitenende

Dirk Kántor Männlich

aká Dooki

Beiträge: 2 073

Geschlecht: Männlich

PHPKIT Version: keine

4

Samstag, 17. Juli 2010, 12:03

hättest dir aber selber auch mal die frage stellen können:
Warum erstell ich oben das Array $boxlinks und gebe es unten zurück return $boxlinks, wenn ich es im script nirgends einsetze? :D
:thumbsup:    :thumbsup:       *tc*       :thumbsup:    :thumbsup:
8o           Achtung: Dirk Kántor ist unterwegs!           8o
Er verteilt gerne Verwarnungen ohne vorher darüber diskutiert zu haben.
  • Zum Seitenanfang
  • Zum Seitenende