witam
zrobilem tego moda dla ciebie tu jest przyklad (zjaedz na dol strony bedzie tam obrazek drukarki po kliknieciu pokaze sie zawartosc dodatkowej strony przygotowana do druku)
Pamietaj jest to mod do wejsji 6.xxx
whcodzimy w plik print.php usuwamy cala zawartosc i wklejamy to:
<?php
require_once "maincore.php";
include LOCALE.LOCALESET."print.php";
if (!isset($item_id) || !isNum($item_id)) fallback(index.php);
echo "<html>
<head>
<title>".$settings['sitename']."</title>
<style type=\"text/css\">
body { font-family:Verdana,Tahoma,Arial,Sans-Serif;font-size:14px; }
hr { height:1px;color:#ccc; }
.small { font-family:Verdana,Tahoma,Arial,Sans-Serif;font-size:12px; }
.small2 { font-family:Verdana,Tahoma,Arial,Sans-Serif;font-size:12px;color:#666; }
</style>
</head>
<body>\n";
if ($type == "A") {
$res = dbquery(
"SELECT ta.*, user_id, user_name FROM ".$db_prefix."articles ta
LEFT JOIN ".$db_prefix."users tu ON ta.article_name=tu.user_id
WHERE article_id='$item_id'"
);
if (dbrows($res) != 0) {
$data = dbarray($res);
$article = str_replace("<--PAGEBREAK-->", "", stripslashes($data['article_article']));
if ($data['article_breaks'] == "y") $article = nl2br($article);
echo "<b>".$data['article_subject']."</b><br>
<span class='small'>".$locale['400'].$data['user_name'].$locale['401'].ucfirst(showdate("longdate", $data['article_datestamp']))."</span>
<hr>
$article\n";
}
} elseif ($type == "D") {
$res = dbquery("SELECT * FROM ".$db_prefix."custom_pages WHERE page_id='$item_id'");
if (dbrows($res) != 0) {
$data = dbarray($res);
}
echo "<b>".$data['page_title']."</b><br>
<hr width='600' align='left'>
<table border='0' width='600'>
<td style='text-align:justify;'><span style='font-size:12px;'>".$data['page_content']."</span></td>
</table>\n";
} elseif ($type == "N") {
$res = dbquery(
"SELECT tn.*, user_id, user_name FROM ".$db_prefix."news tn
LEFT JOIN ".$db_prefix."users tu ON tn.news_name=tu.user_id
WHERE news_id='$item_id'"
);
if (dbrows($res) != 0) {
$data = dbarray($res);
$news = stripslashes($data['news_news']);
if ($data['news_breaks'] == "y") $news = nl2br($news);
if ($data['news_extended']) {
$news_extended = stripslashes($data['news_extended']);
if ($data['news_breaks'] == "y") $news_extended = nl2br($news_extended);
}
echo "<b>".$data['news_subject']."</b><br>
<span class='small'>".$locale['400'].$data['user_name'].$locale['401'].ucfirst(showdate("longdate", $data['news_datestamp']))."</span>
<hr>
$news\n";
if (isset($news_extended)) echo "<hr>\n<b>".$locale['402']."</b>\n<hr>\n$news_extended\n";
}
}
echo "</body>
</html>\n";
?>
zapisujemy to i zabieramy sie za edycje pliku viewpage.php tu tez uzuwamy cala zawartosc liku i wklejamy ten kod
<?php
require_once "maincore.php";
require_once "subheader.php";
require_once "side_left.php";
require_once INCLUDES."comments_include.php";
require_once INCLUDES."ratings_include.php";
include LOCALE.LOCALESET."custom_pages.php";
if (isset($page_id) && !isNum($page_id)) fallback("index.php");
$result = dbquery("SELECT * FROM ".$db_prefix."custom_pages WHERE page_id='$page_id'");
if (dbrows($result) != 0) {
$data = dbarray($result);
opentable($data['page_title']);
if (checkgroup($data['page_access'])) {
eval("?>".stripslashes($data['page_content'])."<?php ");
} else {
echo "\n".$locale['400']."\n\n";
}
} else {
opentable($locale['401']);
echo "<br>\n".$locale['402']."\n<br><br>\n";
}
echo "<br><br><br><table border='0' width='100%'><td align='right'><a href='print.php?type=D&item_id=".$data['page_id']."'><img src='".THEME."images/printer.gif' alt='".$locale['045']."' style='border:0px;vertical-align:middle;'>
</a></td></table>";
closetable();
if (dbrows($result) != 0) {
if ($data['page_allow_comments']) showcomments("C","custom_pages","page_id",$page_id,FUSION_SELF."?page_id=$page_id");
if ($data['page_allow_ratings']) showratings("C",$page_id,FUSION_SELF."?page_id=$page_id");
}
require_once "side_right.php";
require_once "footer.php";
?>
no i to by bylo na tyle
Pozdrawiam!!!
Ps przy zmianie pliku print.php funkcje drukowania dla newsow i artow dzialaja poprawnie
Edytowane przez slawekneo dnia 02.04.2006 09:27:49
|