222
edits
Carlo Enke (talk | contribs) |
Carlo Enke (talk | contribs) |
||
Line 17: | Line 17: | ||
Im Hintergrund der Seite werden alle Daten in einer '''''SQL-Datenbank''''' gespeichert und abgerufen. | Im Hintergrund der Seite werden alle Daten in einer '''''SQL-Datenbank''''' gespeichert und abgerufen. | ||
== Inhalte == | |||
Auf der Startseite ist das zentrale Element das Newssystem. Hier wird ähnlich der der Pinnwand bei Facebook angezeigt, wenn neue Alben, Blogeinträge und News hinzugefügt wurden. Diese werden über den Aufruf | |||
<pre> | |||
<?php | |||
$sql = " | |||
( | |||
SELECT | |||
news.news_id AS id, | |||
news.news_title AS title, | |||
LEFT(news.news_body, 100) AS body, | |||
news.time AS time, | |||
'news' AS `type` | |||
FROM | |||
news | |||
) | |||
UNION ALL | |||
( | |||
SELECT | |||
posts.post_id AS id, | |||
posts.post_title AS title, | |||
LEFT(posts.post_body, 300) AS body, | |||
posts.time AS time, | |||
'posts' AS `type` | |||
FROM | |||
posts | |||
) | |||
UNION ALL | |||
( | |||
SELECT | |||
albums.album_id AS id, | |||
albums.album_title AS title, | |||
LEFT(albums.album_body, 200) AS body, | |||
albums.time AS time, | |||
'albums' AS `type` | |||
FROM | |||
albums | |||
) | |||
ORDER BY | |||
time desc | |||
"; | |||
$qry = mysql_query($sql); | |||
while( $row = mysql_fetch_object($qry) ) | |||
{ | |||
if($row->type == "posts"){ | |||
echo "<div class='index_post'><div class='ip_img'><img src='admin/core/post_image/default.jpg' width='100px'></div><div class='post'><a href='blog_read.php?pid=" . $row->id . "'><h1>" . utf8_encode($row->title) . "</h1></a>" . utf8_encode($row->body) . "<hr/><font size='1' color='#aaa'>Blogeintrag vom " . date("d.m.Y", $row->time) . "</font></div></div>"; | |||
}else if($row->type == "news"){ | |||
echo "<div class='news'><h1>" . utf8_encode($row->title) . "</h1>" . utf8_encode($row->body) . "<hr/><font size='1' color='#aaa'>" . date("d.m.Y", $row->time) . "</font></div>"; | |||
}else if($row->type == "albums"){ | |||
echo "<div class='news'><a href='view_album.php?album_id=" . $row->id . "'><h1>" . utf8_encode($row->title) . "</h1></a>" . utf8_encode($row->body) . "<br/><br/><div class='index_album'></div><div class='index_album'></div><div class='index_album'></div><div class='index_album'></div><div class='index_album'></div><div class='index_album'></div><br/><br/><br/><br/><br/><hr/><font size='1' color='#aaa'>erstellt am " . date("d.m.Y", $row->time) . "</font></div>"; | |||
} | |||
} | |||
?> | |||
</pre> | |||
aufgerufen und nach Datum des Eintrages sortiert. |
edits