Witam.
Chciałbym przerobić plik theme.php tak aby wyświetlane były losowe obrazki.
Kod pliku theme.php:
<?php
if (!defined("IN_FUSION")) { header("Location: ../../index.php"); exit; }
require_once INCLUDES."theme_functions_include.php";
// theme settings
$body_text = "#000000";
$body_bg = "#ffffff";
$theme_width = "90%";
$theme_width_l = "177";
$theme_width_r = "177";
function render_header($header_content) {
global $theme_width,$settings;
echo"<table align='center' width='$theme_width' cellspacing='0' cellpadding='0'>
<tr>
<td>
<table width='100%' cellspacing='0' cellpadding='0'>
<tr>
<td class='full-header'>
<table width='100%' cellspacing='0' cellpadding='0'>
<tr>
<td class='logo-top-left'></td>
<td class='logo-top-main'><center><img src='".THEME."images/logo-top-main-center.gif' border='0'></center></td>
<td class='logo-top-right'></td>
</tr>
<tr>
<td class='logo-left-main'><img src='".THEME."images/logo-left-main-center.gif' border='0'></td>
<td class='logo-main'>
</td>
<td class='logo-right-main'><img src='".THEME."images/logo-right-main-center.gif' border='0'></td>
</tr>
<tr>
<td class='logo-bottom-left'></td>
<td class='logo-bottom-main'><center><img src='".THEME."images/logo-bottom-main-center.gif' border='0'></center></td>
<td class='logo-bottom-right'></td>
</tr>
</table>
</td>
</tr>
</table>\n";
tablebreak();
echo "<table width='100%' cellspacing='0' cellpadding='0'>\n<tr>
<td class='menupoziome-l'></td><td class='menupoziome-m'>".showsublinks("·")."</td>
<td align='right' class='menupoziome-m'>".showsubdate()."</td><td class='menupoziome-r' align='right'></td>
</tr>
</table>\n";
tablebreak();
echo "<table width='100%' cellspacing='0' cellpadding='0'>\n<tr>\n";
}
function render_footer($license=false) {
global $theme_width,$settings,$locale;
echo "</tr>\n</table>\n";
echo "<table width='100%' cellspacing='0' cellpadding='0'>
<tr>
<td class='logo-top-left'></td>
<td class='logo-top-main'><center><img src='".THEME."images/logo-top-main-center.gif' border='0'></center></td>
<td class='logo-top-right'></td>
</tr>
<tr>
<td class='logo-left-main'></td>
<td class='logo-main'><center><br>".stripslashes($settings['footer'])."<br>
".showcounter()."<br><br>";
if ($license == false) {
echo showcopyright()."<br> \n";
}
echo "</center></td>
<td class='logo-right-main'></td>
</tr>
<tr>
<td class='logo-bottom-left'></td>
<td class='logo-bottom-main'><center><img src='".THEME."images/logo-bottom-main-center.gif' border='0'></center></td>
<td class='logo-bottom-right'></td>
</tr>
</table>\n";
}
function render_news($subject, $news, $info) {
global $locale;
echo "<table width='100%' cellpadding='0' cellspacing='0'>
<tr>
<td>
<table width='100%' cellpadding='0' cellspacing='0'>
<tr>
<td class='news-top-left'></td>
<td class='news-top-main''> </td>
<td class='news-top-right'></td>
</tr>
</table>
<table width='100%' cellpadding='0' cellspacing='0'>
<tr>
<td class='table-text-left'></td>
<td class='table-text-main'>
<table width='100%' cellpadding='0' cellspacing='0'>
<tr>
<td width='100%' class='news-title'>$subject</td>
</tr>
<tr>
<td width='100%'>
<table width='100%' cellpadding='0' cellspacing='0'>
<tr>
<td class='news-border-tl'></td>
<td class='news-border-t'></td>
<td class='news-border-tr'></td>
</tr>
<tr>
<td class='news-border-l'></td>
<td class='news-main'>
$news
</td>
<td class='news-border-r'></td>
</tr>
<tr>
<td class='news-border-bl'></td>
<td class='news-border-b'></td>
<td class='news-border-br'></td>
</tr>
</table>
</td>
</tr>
<tr>
<td width='100%' style='padding-top: 5px;'>\n";
echo openform("N",$info['news_id']);
echo "Dodał: ";
echo newsposter($info," ").newsopts($info,"·").closeform("N",$info['news_id']);
echo "
</td>
</tr>
</table>
</td>
<td class='table-text-right'></td>
</tr>
</table>
<table width='100%' cellpadding='0' cellspacing='0'>
<tr>
<td class='table-end-left'></td>
<td class='table-end-main'> </td>
<td class='table-end-right'></td>
</tr>
</table>
</td>
</tr>
</table>\n";
tablebreak();
}
function render_article($subject, $article, $info) {
global $locale;
echo "<table width='100%' cellpadding='0' cellspacing='0'>
<tr>
<td>
<table width='100%' cellpadding='0' cellspacing='0'>
<tr>
<td class='table-title-left'></td>
<td class='table-title-main''>$subject</td>
<td class='table-title-right'></td>
</tr>
</table>
<table width='100%' cellpadding='0' cellspacing='0'>
<tr>
<td class='table-text-left'></td>
<td class='table-text-main'>
".($info['article_breaks'] == "y" ? nl2br($article) : $article)."<br><hr>\n";
echo openform("A",$info['article_id']).articleposter($info,"·").articleopts($info,"·").closeform("A",$info['article_id']);
closetable();
}
function opentable($title) {
echo "<table width='100%' cellpadding='0' cellspacing='0'>
<tr>
<td>
<table width='100%' cellpadding='0' cellspacing='0'>
<tr>
<td class='table-title-left'></td>
<td class='table-title-main''>$title</td>
<td class='table-title-right'></td>
</tr>
</table>
<table width='100%' cellpadding='0' cellspacing='0'>
<tr>
<td class='table-text-left'></td>
<td class='table-text-main'>\n";
}
function closetable() {
echo "</td>
<td class='table-text-right'></td>
</tr>
</table>
<table width='100%' cellpadding='0' cellspacing='0'>
<tr>
<td class='table-end-left'></td>
<td class='table-end-main'> </td>
<td class='table-end-right'></td>
</tr>
</table>
</td>
</tr>
</table>\n";
tablebreak();
}
function openside($title) {
echo "<table width='100%' cellpadding='0' cellspacing='0' class='border'>
<tr>
<td>
<table width='100%' cellpadding='0' cellspacing='0'>
<tr>
<td class='scroll-left'></td>
<td class='scroll-main'><center>$title</center></td>
<td class='scroll-right'></td>
</tr>
<tr>
<td class='blockborder-left'></td>
<td class='side-body'>\n";
}
function closeside() {
echo "</td>
<td class='blockborder-right'></td>
</tr>
<tr>
<td class='blockborder-leftb'></td>
<td class='blockborder-bottom'></td>
<td class='blockborder-rightb'></td>
</tr>
</table>
</td>
</tr>
</table>\n";
tablebreak();
}
function opensidex($title,$open="on") {
$boxname = str_replace(" ", "", $title);
echo "<table width='100%' cellpadding='0' cellspacing='0' class='border'>
<tr>
<td>
<table width='100%' cellpadding='0' cellspacing='0'>
<tr>
<td class='scroll-left'></td>
<td><table width='100%' cellpadding='0' cellspacing='0'><tr>
<td class='scroll-main'><center> $title</center></td>
<td class='scroll-mainx' width='10'>".panelbutton($state,$boxname)."</td>
</tr>
</table>
</td>
<td class='scroll-right'></td>
</tr>
<tr>
<td class='blockborder-left'></td>
<td class='side-body'>
<div id='box_$boxname'".($state=="off"?" style='display:none'":"").">\n";
}
function closesidex() {
echo "</div>
</td>
<td class='blockborder-right'></td>
</tr>
<tr>
<td class='blockborder-leftb'></td>
<td class='blockborder-bottom'></td>
<td class='blockborder-rightb'></td>
</tr>
</table>
</td>
</tr>
</table>\n";
tablebreak();
}
function tablebreak() {
echo "<table width='100%' cellspacing='0' cellpadding='0'>
<tr><td height='8'></td></tr>
</table>\n";
}
?>
Skrypt na losowy obrazek :
<script type="text/javascript">
// <![CDATA[
Array.prototype.random = function(limit)
{
if (typeof limit == 'undefined' || limit < 0) limit = 1;
else if (!limit) limit = this.length;
for (var i = 0, source = this, target = new Array(), n = source.length; i < limit && n > 0; i++)
{
do { var index = Math.random(); } while (index == 1);
index = Math.floor(index * n);
target.push(source[index]);
source[index] = source[--n];
}
return target;
}
document.write(new Array(
// Tu wpisz kolejne elementy:
'<img src="http://www.zspradlow.pl/images/logo/1.jpg">',
'<img src="http://www.zspradlow.pl/images/logo/2.jpg">'
).random().join(''));
// ]]>
</script>
W ktorym miejscu umiescic ten kod zeby ten skrypt dzialal?
Trzecia godzine sie mecze i nie moge tego zrobic....
PW od moderatora:
- Przeniesienie tematu - Pieka 30.03 - 20:17
Edytowane przez misiek19 dnia 30.03.2010 21:14:01
|