Posted on Wtorek, 24th marzec 2009 by admin
Modyfikację Profile z poprzedniego wpisu już wgrałem do gry Santic. Potrzebne było kika poprawek, a oto instrukcja:
1. Kopiujemy wszystkie pliki .js do katalogu js/profile/.
2. Następnie edytujemy plik account.php. Jako że w Santic Engine profile zostały przeniesione do osobnej tabeli, kod odrobinę od tej modyfikacji się różni. Wstawiamy poniższe linie:
{
$ADODB_CACHE_DIR = ‘tmp’;
$db -> cacheFlush("SELECT profile FROM profile WHERE id=?", array($player -> id));
$objprofil = $db -> SelectLimit("SELECT * FROM profile WHERE id=".$player -> id, 1);
if (!isset($objprofil -> fields[‘id’])) $db -> Execute("INSERT INTO `profile` (`id`, `profile`) VALUES(".$player -> id.", ”)");
$profil = $objprofil -> fields[‘profile’];
$objprofil -> Close();
require_once(‘includes/bbcodeprof.php’);
$profil = htmltobbcode($profil);
$smarty -> assign(array("Profileinfo" => PROFILE_INFO,
"Newprofile" => NEW_PROFILE,
"Profile" => $profil,
"Change" => CHANGE));
if (isset($_GET[’step’]) && $_GET[’step’] == "profile")
{
if ($player -> rank == ‘Tester’) error(‘Załóż konto aby mieć peĹ‚ny dostÄ™p do gry!’);
if (empty ($_POST[‘profile’])) error (EMPTY_FIELDS);
require_once(‘includes/bbcodeprof.php’);
$_POST[‘profile’] = bbcodetohtml($_POST[‘profile’]);
if (isset($_POST[‘podglad’]))
{
$strProfil = "PodglÄ…d profilu:".$_POST[‘profile’]."";
$_POST[‘profile’] = htmltobbcode($_POST[‘profile’]);
$smarty -> assign(array("Podglad" => $strProfil, "Profile" => $_POST[‘profile’]));
}
if (isset($_POST[‘zapisz’]))
{
$strProfile = $db -> qstr($_POST[‘profile’], get_magic_quotes_gpc());
$db -> Execute("UPDATE profile SET profile = ".$strProfile." WHERE id = ‘".$player -> id."’");
$_POST[‘profile’] = htmltobbcode($_POST[‘profile’]);
$smarty -> assign (array("Profile" => $_POST[‘profile’],
"Profileview" => bbcodetohtml($_POST[‘profile’]),
"Newprofile2" => NEW_PROFILE2));
}
}
}
w miejsce starej edycji profilu: if (isset($_GET['view']) && $_GET['view'] == “profile”). Zdaję się na wasz spryt :)
3. Wstawiamy nowy kod do pliku templates/account.tpl:
<script src="js/profile/domel.js" type="text/javascript"></script> <script src="js/profile/script.js" type="text/javascript"></script>
<script src="js/profile/color-picker.js" type="text/javascript"></script> <script src="js/profile/bbcode.js"></script></code>
{if $Step == "profile"}
{$Podglad}
{$Message}
{/if}
<form id="generator" action="account.php?view=profile&step=profile" method="post">
<table border="0" cellspacing="0" cellpadding="2" width="400" align="center">
<tbody>
<tr>
<td align="left"><span class="genmed">
<input class="button" style="font-weight: bold; width: 100%;" onclick="bbstyle(2)" onmouseover="helpline(’b')" name="addbbcode2" type="button" value=" B " accesskey="b" />
</span></td>
<td><span class="genmed">
<input class="button" style="font-style: italic; width: 100%;" onclick="bbstyle(4)" onmouseover="helpline(’i')" name="addbbcode4" type="button" value=" i " accesskey="i" />
</span></td>
<td><span class="genmed">
<input class="button" style="text-decoration: underline; width: 100%;" onclick="bbstyle(6)" onmouseover="helpline(’u')" name="addbbcode6" type="button" value=" u " accesskey="u" />
</span></td>
<td><span class="genmed">
<input class="button" style="width: 100%;" onclick="bbstyle(8)" onmouseover="helpline(’q')" name="addbbcode8" type="button" value=" Cytat " accesskey="q" />
</span></td>
<td><span class="genmed">
<input class="button" style="width: 100%;" onclick="bbstyle(16)" onmouseover="helpline(’p')" name="addbbcode16" type="button" value=" Img " accesskey="p" />
</span></td>
<td><span class="genmed">
<input class="button" style="width: 100%;" onclick="bbstyle(0)" onmouseover="helpline(’f')" name="addbbcode0" type="button" value=" Center " accesskey="f" />
</span></td>
<td><span class="genmed">
<input class="button" style="text-decoration: underline; width: 100%;" onclick="bbstyle(18)" onmouseover="helpline(’w')" name="addbbcode18" type="button" value=" Right " accesskey="w" />
</span></td>
</tr>
<tr>
<td colspan="9">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tbody>
<tr>
<td><span class="genmed">Kolor:
<select onmouseover="helpline(’s’)" name="addbbcode20"> <option class="genmed" style="color:black;" value="#FFFFFF">DomyĹ›lny</option> <option class="genmed" style="color:darkred;" value="darkred">Ciemnoczerwony</option> <option class="genmed" style="color:red;" value="red">Czerwony</option> <option class="genmed" style="color:orange;" value="orange">PomaraĹ„czowy</option> <option class="genmed" style="color:brown;" value="brown">BrÄ…zowy</option> <option class="genmed" style="color:yellow;" value="yellow">Żółty</option> <option class="genmed" style="color:green;" value="green">Zielony</option> <option class="genmed" style="color:olive;" value="olive">Oliwkowy</option> <option class="genmed" style="color:cyan;" value="cyan">Błękitny</option> <option class="genmed" style="color:blue;" value="blue">Niebieski</option> <option class="genmed" style="color:darkblue;" value="darkblue">Ciemnoniebieski</option> <option class="genmed" style="color:indigo;" value="indigo">Purpurowy</option> <option class="genmed" style="color:violet;" value="violet">Fioletowy</option> <option class="genmed" style="color:white;" value="white">BiaĹ‚y</option> <option class="genmed" style="color:black;" value="black">Czarny</option> </select>
</span></td>
<td><label id="type" class="sort" for="color1">Kolor własny:</label>
<span>#</span>
<input id="color1" class="color" style="width: 70px; font-size: 12px;" onmouseover="helpline(’x')" name="color1" type="text" value="000000" /></td>
<td align="right"><span class="gensmall"><a class="genmed" onmouseover="helpline(’a')" href="javascript:bbstyle(-1)">Zamknij Tagi</a></span></td>
</tr>
</tbody></table>
</td>
</tr>
<tr>
<td colspan="9"><span class="gensmall">
<input class="helpline" style="width: 400px; font-size: 10px;" maxlength="100" name="helpbox" readonly="readonly" size="45" type="text" value="Rada: Style mogą być stosowane szybko do zaznaczonego tekstu" />
</span></td>
</tr>
<tr>
<td colspan="9"><span class="gen">
<textarea class="post" style="width: 400px;" onclick="storeCaret(this);" onkeyup="storeCaret(this);" cols="30" rows="20" name="profile">{$Profile}</textarea>
<input style="width: 200px; font-size: 12px;" name="podglad" type="submit" value="PodglÄ…d" /><input style="width: 200px; font-size: 12px;" name="zapisz" type="submit" value="{$Change}" />
Przed zapisaniem profilu, możesz zrobić jego podgląd widoczny tylko dla Ciebie i sprawdzić co trzeba ewentualnie jeszcze dodać/poprawić
* - oznacza iĹĽ uĹĽyty tag jest otwarty
</span></td>
</tr>
</tbody></table>
<table border="0">{/if}
Z Khulmar-owego pliku wyrzuciłem zbędne opisy a także zmieniłem szerokości tabel tak aby mieściła się w mojej grze.
4. Wrzucami pliki obrazków z katalogu images do images.
Tags: modyfikacje
Posted in Santic Engine | Comments (16)
kwiecień 11th, 2009 at 14:17
if (isset($_GET[’step’]) && $_GET[’step’] == “profile”)
Co to jest && ? xD
Chyba && miało być :) ?
kwiecień 11th, 2009 at 14:18
Podwójny koment, ale nie wiedziałem, że CI interpretuje html :)
W kodzie jest && zapisane w htmlu - amp amp, a powinno być normalnie - &&
kwiecień 11th, 2009 at 14:34
dzieki, poprawilem ;)
kwiecień 11th, 2009 at 15:40
{/if}
Kolejny błąd - zbędne :)
kwiecień 11th, 2009 at 15:41
Dobija ta interpretacja powiem Ci :D
Miało być, że w pliku .tpl nie potrzebnie jest otwarta nowa tabela - psuje konstrukcje strony ;)
maj 13th, 2009 at 14:03
That was nice. Thank you for sharing this one.
maj 18th, 2009 at 18:11
well.. it’s like I said!
czerwiec 1st, 2009 at 13:40
any news coming ?
czerwiec 13th, 2009 at 21:04
Original post by Dmitri Gromov
czerwiec 15th, 2009 at 17:42
The best information i have found exactly here. Keep going Thank you
czerwiec 16th, 2009 at 15:04
Hi! I like your srticle and I would like very much to read some more information on this issue. Will you post some more?
czerwiec 19th, 2009 at 18:33
any changes coming ?
lipiec 4th, 2009 at 10:13
emm. good one..
lipiec 6th, 2009 at 20:29
I’m glad that after surfing the web for uch a long time I have found out this information. I’m really lucky.
lipiec 6th, 2009 at 21:30
Some of us even don’t realize the importance of this information. What a pity.
lipiec 6th, 2009 at 22:11
I think I will try to recommend this post to my friends and family, cuz it’s really helpful.