• Kontakt
  • O systemie
  • Strona główna
Pomoc
  • Założenia systemu
  • Praca z systemem
  • Opcje
    • Treść
    • Menu
    • Narzędzia
      • Menadżer ilustracji i mediów
      • Menadżer plików
      • Bazy
      • Formularze
      • Banery
      • Galeria zdjęć
      • Kreator banerów
      • Newsletter
      • Opisy parametryczne
      • Sonda
      • Sprzedaż on-line
      • Forum
    • Wygląd
    • Administracja
    • Zatwierdź zmiany
    • Podgląd
  • Szablony
  • Moduły
  • Edytor HTML
  • E-commerce - sprzedaż online
  • Inne zagadnienia
  • Przykłady rozwiązań

Forum

Implementacja forum w szablonie - przykład:

{if $smarty.get.topic}{assign var=title value=$mod.forum.topic.title|strip_tags|truncate}{/if}


        

{******* FORUM START ******}





{if $smarty.get.newTopic || $smarty.get.editPost || $smarty.get.newPost}
<script type="text/javascript" src="/{$set.sub_root_path}js/tiny_mce/tiny_mce.js"></script>
{literal}
<script type="text/javascript">
        tinyMCE.init({
            mode : "specific_textareas",
            editor_selector : "mceEditor",
            theme : "advanced",


    theme_advanced_buttons1 : "bold,italic,underline,separator,strikethrough,justifyleft,justifycenter,justifyright, justifyfull,indent,outdent,quote,bullist,numlist,undo,redo,link,unlink,emotions,uimage",
    theme_advanced_buttons2 : "",
    theme_advanced_buttons3 : "",
    gecko_spellcheck : true,
    theme_advanced_toolbar_location : "top",
    theme_advanced_toolbar_align : "left",


    valid_elements : "a[href|rel|class],img[src|alt|class],ul,li,ol,p[align],strong/b,i,div[align],br,blockquote[class]",

            plugins : "emotions,quote,uimage",
            
            language : "pl",
            content_css : {/literal}"/{$set.sub_root_path}{$set.defaultCss}"{literal}
        });
        
</script>
{/literal}
{/if}

{*** NEW TOPIC ***}

{if $smarty.get.newTopic}

{if $smarty.session.user.login || !$mod.forum.settings.wrilog}


<form method="post">
<fieldset>
<legend>Nowy wątek</legend>
<input type="hidden" name="action" value="newTopic">
<table>
{if $mod.forum.settings.cats|@count > 0}
<tr><td>dział:</td><td><select name="menuid">
{foreach item=catid from=$mod.forum.settings.cats}
<option value="{$catid}">{$category[$catid].name}</option>
{/foreach}
</select></td></tr>
{/if}
<tr><td>tytuł:</td><td><input type="text" name="title" size="60"></td></tr>
<tr><td>treść:</td><td><textarea name="content" class="mceEditor" rows="20" cols="80"></textarea></td></tr>
{if !$smarty.session.user.login}
<tr><td>autor:</td><td><input type="text" name="username"></td></tr>
{/if}
</table>
<label class="sp-kill">dowolny wyraz 6 literowy: <input type="text" name="__sptest" value="" /></label>
<!-- <input type="hidden" name="__iamtrash" value="1" /> -->
<input type="hidden" name="__antbtfnval" />
<input type="submit" name="__submitfield" value="Wyślij">
</fieldset>
</form>
{else}
{$txt.forum_login}
{/if}


{*** NEW POST ***}

{elseif $smarty.get.newPost}

{* {$mod.forum.settings.wrilog} == 2 && {$smarty.get.uid} == {$mod.forum.topic.uid} *}
{if $smarty.session.user.login || !$mod.forum.settings.wrilog || ($mod.forum.settings.wrilog == 2 && $smarty.get.uid==$mod.forum.topic.uid)}

<form method="post">
<fieldset>
<legend>Odpowiedz</legend>
<input type="hidden" name="action" value="newPost">
<input type="hidden" name="parent_post" value="{$smarty.get.newPost}">
<input type="hidden" name="topic_id" value="{$smarty.get.topic}">
<table>
<tr><td>tytuł:</td><td><input type="text" name="title" size="60" value="{if $smarty.get.newPost != 'reply'}Re: {$mod.forum.posts[$smarty.get.newPost].title}{else}{$mod.forum.topic.title}{/if}" ></td></tr>
<tr><td>treść:</td><td><textarea name="content" rows="20" class="mceEditor" cols="80">{if $smarty.get.newPost != 'reply'}<br>{$mod.forum.posts[$smarty.get.newPost].login}:
<blockquote class="forumQuote">{$mod.forum.posts[$smarty.get.newPost].content}</blockquote><p></p><p></p>

{/if}</textarea></td></tr>
{if !$smarty.session.user.login}
<tr><td>autor:</td><td><input type="text" size="60" name="username"></td></tr>
{/if}
</table>
<label class="sp-kill">dowolny wyraz 6 literowy: <input type="text" name="__sptest" value="" /></label>
<!-- <input type="hidden" name="__iamtrash" value="1" /> -->
<input type="hidden" name="__antbtfnval" />
<input type="submit" name="__submitfield" value="Wyślij">
</fieldset>
</form>

{else}
{$txt.forum_login}
{/if}


{*** EDIT POST ***}

{elseif $smarty.get.editPost}


<form method="post">
<fieldset>
<legend>Edytuj post</legend>
<input type="hidden" name="action" value="editPost">
<input type="hidden" name="post_id" value="{$smarty.get.editPost}">
<input type="hidden" name="topic_id" value="{$smarty.get.topic}">
<table>
<tr><td>tytuł:</td><td><input type="text" name="title" size="60" value="{$mod.forum.posts[$smarty.get.editPost].title}" ></td></tr>
<tr><td>treść:</td><td><textarea name="content" rows="20" class="mceEditor" cols="80">{$mod.forum.posts[$smarty.get.editPost].content}</textarea></td></tr>
</table>
<input type="submit" value="Zapisz zmiany">
</fieldset>
</form>


{*** POSTS IN TOPIC ***}

{elseif $smarty.get.topic || $mod.forum.posts|@count > 0}

<h2>Forum - {$mod.forum.topic.title}</h2>
{if $mod.forum.topic.url}<p>Komentowany dodatek: <a href="{$mod.forum.topic.url}">{$mod.forum.topic.title}</a></p>{/if}
<table id="forumPosts" width="100%" cellspacing="0">
<tr>
<th><a href="/{$category.$cat.path}"><img src="/img/forum_back.gif"></a></th>
<th class="l">
{if $smarty.get.phrase}Znaleziono {$mod.forum.allPosts} postów dla frazy <b>"{$smarty.get.phrase}"</b>
{elseif $smarty.get.userPosts}Wszystkie posty użytkownika <b>{$mod.forum.usernamePosts}</b>
{else}
<h3>{$mod.forum.topic.title}</h3><a href="/{$category.$cat.path}/newTopic,1.html"><img src="/img/nowy_temat.gif"></a>   <a href="/{$category.$cat.path}/newPost,reply,topic,{$smarty.get.topic}.html"><img src="/img/odpowiedz.gif"></a>
{/if}
</th></tr>

{foreach item=post key=pid from=$mod.forum.posts}
<tr {if $post.lp%2}class="postWyr"{/if} ><td class="postInfo">
{*
<div class="authButt">
<a href="/{$category.$cat.path}/newPost,{$post.id},topic,{$smarty.get.topic}.html"><img src="/img/profil.gif"></a>
<a href="/{$category.$cat.path}/newPost,{$post.id},topic,{$smarty.get.topic}.html"><img src="/img/pw.gif"></a>
</div>
*}
{$post.pdate}
{if $post.avatar}<a href="/profil/user,{$post.user_id}.html" class="avatar"><img src="/img/avatar/{$post.avatar}"></a>{/if}
<div class="author">
{if $post.user_id}<a href="/profil/user,{$post.user_id}.html">{/if}
{if $post.nick}{$post.nick}{elseif $post.login}{$post.login}{else}{$post.user_name}{/if}
{if $post.user_id}</a>{/if}
</div>

</td>
<td class="postContent"><a name="{$post.id}"></a><h3>{$post.title}</h3><div>{$post.content}</div>
{if !$smarty.get.topic}<a href="/{$category[$post.menu_id].path}/topic,{$post.tid}.html#{$post.id}">&raquo; przejdź do wątku</a>{/if}
{if $smarty.session.user.login && $smarty.session.user.id == $post.user_id}<a href="/{$category[$post.menu_id].path}/editPost,{$post.id},topic,{$post.tid}.html" class="cytuj"><img src="/img/edytuj.gif"></a>
{else}<a href="/{$category[$post.menu_id].path}/newPost,{$post.id},topic,{$post.tid}.html" class="cytuj"><img src="/img/cytuj.gif"></a>{/if}

</td></tr>
{/foreach}

<tr>
<th><a href="/{$category.$cat.path}"><img src="/img/forum_back.gif"></a></th>
<th class="l">{if $smarty.get.topic}<a href="/{$category.$cat.path}/newTopic,1.html"><img src="/img/nowy_temat.gif"></a>  <a href="/{$category.$cat.path}/newPost,reply,topic,{$smarty.get.topic}.html"><img src="/img/odpowiedz.gif"></a>{else} {/if}</th></tr>


</table>


{*** TOPICS ***}

{else}
<h2>{$category[$cat].name}</h2>
<form onsubmit="document.location.href=document.location+'/phrase,'+document.getElementById('fq').value.replace(/[\.,\/]/g,'')+'.html';return false;" action="">
    <div id="forumSearch">
    <label>Szukaj: <input type="text" id="fq" name="query" value="" onclick="this.value=''" /></label> <input type="image" src="/img/search.gif" />
    </div>
</form>


<table id="forumTopics" cellspacing="0">
<tr>
<th><br></th>
<th>Temat</th>
<th>Postów</th>
<th>Autor</th>
<th>Wyświetleń</th>
<th class="r">Ostatni post</th>
</tr>
{foreach item=topic key=tid from=$mod.forum.topics}
<tr>
<td><a href="/{$category[$topic.menu_id].path}/topic,{$tid}.html" class="topic"><img src="/img/watek.gif"></a></td>
<td><a href="/{$category[$topic.menu_id].path}/topic,{$tid}.html" class="topic">{$topic.title}</a></td>
<td class="t">{$topic.posts}</td>
<td class="u">{if $topic.nick}{$topic.nick}{elseif $topic.login}{$topic.login}{else}{$topic.user_name}{/if}</td>
<td class="s">{$topic.shows}</td>
<td class="r small nw">{if $topic.lp_post_id}<a href="/{$category[$topic.menu_id].path}/topic,{$tid}.html#{$topic.lp_post_id}">{$topic.last_post}<br>{$topic.lp_user_name}</a>{else}{$topic.last_post}{/if}</td>
</tr>
{/foreach}
</table>
<div id="newTopic">
<a href="/{$category.$cat.path}/newTopic,1.html">Nowy temat</a>
</div>


{/if}



{* FORUM END *}


Powered by Actualizer CMS