Trikovi za poboljsanje vaseg foruma

Started by Dzonny, May 31, 2009, 08:54:29 AM

Previous topic - Next topic

Bob Marley

Pa to je to covece... " // Show information about the poster of this message." lol

Madzgo

da ali uporedi moj kod i tvoj kod...
kad stavim tvoj kod iskoci mi eror

LOL!!!

Bob Marley

Pa covece... Nemoj biti bukvalista :D Poenta je bila i dalje je krajnje jednostavna zamenis left sa center :D omg :D

Madzgo

pa krajnje jednostavno nije uopste nidje bilo align="left" tako da se nije moglo zamijenit... aj da si rekao dodaj pa ajde.. nego sam nervozan, zamalo nagrdih forum, uh.. :)

Masterd

#124
Quote from: Dzonny on July 07, 2009, 11:44:16 AM
Unapred ispisan text u postu.

Je li to radi na SMF- u 2.0 RC3?

Masterd

Postavio sam pitanje u originalnoj Antechinusovoj temi, ali mi nitko ne odgovara, pa ću okušati sreću ovdje. Imam problem sa zaobljenim citatima. Također me zanima kako maknuti ovaj slide bar s desne strane.


Masterd

                           
Dodavanje novih post ikona

SMF 1.1.x

Sources/Post.php

Pronađite:

$context['icons']

Trebali biste vidjeti ovo:

   $context['icons'] = array(
      array('value' => 'xx', 'name' => $txt[281]),
      array('value' => 'thumbup', 'name' => $txt[282]),
      array('value' => 'thumbdown', 'name' => $txt[283]),
      array('value' => 'exclamation', 'name' => $txt[284]),
      array('value' => 'question', 'name' => $txt[285]),
      array('value' => 'lamp', 'name' => $txt[286]),
      array('value' => 'smiley', 'name' => $txt[287]),
      array('value' => 'angry', 'name' => $txt[288]),
      array('value' => 'cheesy', 'name' => $txt[289]),
      array('value' => 'grin', 'name' => $txt[293]),
      array('value' => 'sad', 'name' => $txt[291]),
      array('value' => 'wink', 'name' => $txt[292])
   );


Novi kod bi trebao izgledati ovako:

   $context['icons'] = array(
      array('value' => 'xx', 'name' => $txt[281]),
      array('value' => 'thumbup', 'name' => $txt[282]),
      array('value' => 'thumbdown', 'name' => $txt[283]),
      array('value' => 'exclamation', 'name' => $txt[284]),
      array('value' => 'question', 'name' => $txt[285]),
      array('value' => 'lamp', 'name' => $txt[286]),
      array('value' => 'smiley', 'name' => $txt[287]),
      array('value' => 'angry', 'name' => $txt[288]),
      array('value' => 'cheesy', 'name' => $txt[289]),
      array('value' => 'grin', 'name' => $txt[293]),
      array('value' => 'sad', 'name' => $txt[291]),
      array('value' => 'wink', 'name' => $txt[292]),
      array('value' => 'novaikona', 'name' => 'Nova ikona),
      array('value' => 'novaikona1', 'name' => $txt['novaikona1'])
   );


Sada samo uploadajte gif sliku u Themes/vaša tema/images/post


rocknroller

#127
Aktivne teme Smf 2.0 RC 2 + oglasi



Radi se o proširenoj obogaćenoj ssi funkciji recentTopics sa mogućim dodavanjem google okomitih oglasa.  Dodana na stranicu Portala.

U rootu foruma datoteka SSI.php pronađite ?> i dodajte iznad
// Recent topic list:   Proširena verzija By rocknroller
function ssi_recentTopicsrocknroller($num_recent = 100, $exclude_boards = null, $include_boards = null, $output_method = 'echo')
{
global $context, $settings, $scripturl, $txt, $db_prefix, $user_info;
global $modSettings, $smcFunc;

if ($exclude_boards === null && !empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0)
$exclude_boards = array($modSettings['recycle_board']);
else
$exclude_boards = empty($exclude_boards) ? array() : (is_array($exclude_boards) ? $exclude_boards : array($exclude_boards));

// Only some boards?.
if (is_array($include_boards) || (int) $include_boards === $include_boards)
{
$include_boards = is_array($include_boards) ? $include_boards : array($include_boards);
}
elseif ($include_boards != null)
{
$output_method = $include_boards;
$include_boards = array();
}

$stable_icons = array('xx', 'thumbup', 'thumbdown', 'exclamation', 'question', 'lamp', 'smiley', 'angry', 'cheesy', 'grin', 'sad', 'wink', 'moved', 'recycled', 'wireless');
$icon_sources = array();
foreach ($stable_icons as $icon)
$icon_sources[$icon] = 'images_url';

// Find all the posts in distinct topics.  Newer ones will have higher IDs.
$request = $smcFunc['db_query']('substring', '
SELECT
m.poster_time, ms.subject, m.id_topic, m.id_member, m.id_msg, b.id_board, b.name AS board_name, t.num_replies, t.num_views,
IFNULL(mem.real_name, m.poster_name) AS poster_name, ' . ($user_info['is_guest'] ? '1 AS is_read, 0 AS new_from' : '
IFNULL(lt.id_msg, IFNULL(lmr.id_msg, 0)) >= m.id_msg_modified AS is_read,
IFNULL(lt.id_msg, IFNULL(lmr.id_msg, -1)) + 1 AS new_from') . ', SUBSTRING(m.body, 1, 384) AS body, m.smileys_enabled, m.icon
FROM {db_prefix}topics AS t
INNER JOIN {db_prefix}messages AS m ON (m.id_msg = t.id_last_msg)
INNER JOIN {db_prefix}boards AS b ON (b.id_board = t.id_board)
INNER JOIN {db_prefix}messages AS ms ON (ms.id_msg = t.id_first_msg)
LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = m.id_member)' . (!$user_info['is_guest'] ? '
LEFT JOIN {db_prefix}log_topics AS lt ON (lt.id_topic = t.id_topic AND lt.id_member = {int:current_member})
LEFT JOIN {db_prefix}log_mark_read AS lmr ON (lmr.id_board = b.id_board AND lmr.id_member = {int:current_member})' : '') . '
WHERE t.id_last_msg >= {int:min_message_id}
' . (empty($exclude_boards) ? '' : '
AND b.id_board NOT IN ({array_int:exclude_boards})') . '
' . (empty($include_boards) ? '' : '
AND b.id_board IN ({array_int:include_boards})') . '
AND {query_wanna_see_board}' . ($modSettings['postmod_active'] ? '
AND t.approved = {int:is_approved}
AND m.approved = {int:is_approved}' : '') . '
ORDER BY t.id_last_msg DESC
LIMIT ' . $num_recent,
array(
'current_member' => $user_info['id'],
'include_boards' => empty($include_boards) ? '' : $include_boards,
'exclude_boards' => empty($exclude_boards) ? '' : $exclude_boards,
'min_message_id' => $modSettings['maxMsgID'] - 35 * min($num_recent, 5),
'is_approved' => 1,
)
);
$posts = array();
while ($row = $smcFunc['db_fetch_assoc']($request))
{
$row['body'] = strip_tags(strtr(parse_bbc($row['body'], $row['smileys_enabled'], $row['id_msg']), array('<br />' => '&#10;')));
if ($smcFunc['strlen']($row['body']) > 128)
$row['body'] = $smcFunc['substr']($row['body'], 0, 128) . '...';

// Censor the subject.
censorText($row['subject']);
censorText($row['body']);

if (empty($modSettings['messageIconChecks_disable']) && !isset($icon_sources[$row['icon']]))
$icon_sources[$row['icon']] = file_exists($settings['theme_dir'] . '/images/post/' . $row['icon'] . '.gif') ? 'images_url' : 'default_images_url';

// Build the array.
$posts[] = array(
'board' => array(
'id' => $row['id_board'],
'name' => $row['board_name'],
'href' => $scripturl . '?board=' . $row['id_board'] . '.0',
'link' => '<a href="' . $scripturl . '?board=' . $row['id_board'] . '.0">' . $row['board_name'] . '</a>'
),
'topic' => $row['id_topic'],
'poster' => array(
'id' => $row['id_member'],
'name' => $row['poster_name'],
'href' => empty($row['id_member']) ? '' : $scripturl . '?action=profile;u=' . $row['id_member'],
'link' => empty($row['id_member']) ? $row['poster_name'] : '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['poster_name'] . '</a>'
),
'subject' => $row['subject'],
'replies' => $row['num_replies'],
'views' => $row['num_views'],
'short_subject' => shorten_subject($row['subject'], 25),
'preview' => $row['body'],
'time' => timeformat($row['poster_time']),
'timestamp' => forum_time(true, $row['poster_time']),
'href' => $scripturl . '?topic=' . $row['id_topic'] . '.msg' . $row['id_msg'] . ';topicseen#new',
'link' => '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.msg' . $row['id_msg'] . '#new" rel="nofollow">' . $row['subject'] . '</a>',
// Retained for compatibility - is technically incorrect!
'new' => !empty($row['is_read']),
'is_new' => empty($row['is_read']),
'new_from' => $row['new_from'],
'icon' => '<img src="' . $settings[$icon_sources[$row['icon']]] . '/post/' . $row['icon'] . '.gif" align="middle" alt="' . $row['icon'] . '" border="0" />',
);
}
$smcFunc['db_free_result']($request);

// Just return it.
if ($output_method != 'echo' || empty($posts))
return $posts;

echo '
<div ><h3 class="catbg" align="center"><strong>Aktivne teme:</strong></h3></div>
<hr />
<div class="adds"></div><table border="0" class="ssi_table">';
foreach ($posts as $post)
echo '

<tr>
<td class="aktivneteme" align="left" valign="top" nowrap="nowrap">
[', $post['board']['link'], ']
</td>
<td class="aktivneteme">
', !$post['is_new'] ? '' : '<a href="' . $scripturl . '?topic=' . $post['topic'] . '.msg' . $post['new_from'] . ';topicseen#new" rel="nofollow"><img src="' . $settings['lang_images_url'] . '/new.gif" alt="' . $txt['new'] . '" border="0" /></a>', '
</td>
<td class="aktivneteme" valign="top">

<a href="', $post['href'], '">', $post['subject'], '</a>

</td>
<td class="aktivneteme">
[&nbsp;', $txt['by'], ' ', $post['poster']['link'], '&nbsp;]&nbsp;
</td>

<td class="aktivneteme" align="left" nowrap="nowrap">
', $post['time'], '
</td>
</tr>';
echo '
</table>

';
}



U CSS datoteku predloška ...tema/css/index.css
na dno dodajte:

/*Aktivne teme*/
.aktivneteme
{
margin: 0px;
padding: 2px;
border-top-width: 0px;
border-right-width: 0px;
border-bottom-width: 1px;
border-left-width: 0px;
border-top-style: none;
border-right-style: none;
border-bottom-style: solid;
border-left-style: none;
border-top-color: #ccc;
border-right-color: #ccc;
border-bottom-color: #ccc;
border-left-color: #ccc;
color: black;
}

.ssi_table
{
margin: 0px;
padding: 0px;
border-top-width: 0px;
border-right-width: 0px;
border-bottom-width: 0px;
border-left-width: 0px;
}
.adds
{
margin: 0px;
padding: 0px;
float: right;
}
/*Aktivne teme kraj*/


Za dodavanje oglasa  pronađite gore u kodu
<div class="adds"></div>
i dodajte kod oglasa između div tagova ovako:
<div class="adds">OVDIJE DODAJTE KOD OGLASA</div>


Napravite stranicu na portalu, označite ju za PHP i unutra dodajte
<?php ssi_recentTopicsrocknroller(); ?>
link od stranice postavite gdje vam odgovara na forumu.

Masterd

#128
                                     
Prateći/leteći quick reply box

Samo za SMF 2.0 RC4 i novije verzije!

Prvo dodajte ovo u index.css:

#quickreplybox {
bottom:10px;
left:-10px;
display:block;
max-width:900px;
position:fixed;
width:350px;
z-index:1000;
}


Display.template.php:

Pronađite:

   if ($context['can_reply'] && !empty($options['display_quick_reply']))
   {


Dodajte poslije:

      echo '
<script type="text/javascript" src="', $settings['theme_url'], '/scripts/jquery-1.4.2.min.js" ></script>
<script type="text/javascript">
  $(document).ready(function() {

     //have the quick reply box expand on focus
   $("#quickreplybox textarea").focus(function() {
      $("#quickreplybox").animate({
      width: "900px"
     }, 500);
   });

   // be sure to know when the mouse is over the quick reply box (we will need it soon)
   var mouse_is_inside = false;
    $("#quickreplybox").hover(function(){
        mouse_is_inside=true;
    }, function(){
        mouse_is_inside=false;
    });

   // if the mouse is clicked somewhere OUTSIDE the reply box, fold it back
    $(document).mouseup(function(){
      if(! mouse_is_inside) {
      $("#quickreplybox").animate({
         width: "350px"
         }, 500);
         };
    });
   
  });
</script>';


Zatim napravite file jquery-1.4.2.min.js ovog sadržaja i spremite ga u scripts direktorij Vaše teme.

Upozorenje: Ako kliknete na površinu izvan quick reply boxa, on će se zatvoriti, ali to neće biti moguće ako koristite ovaj mod.


Madzgo

Quote from: Dzonny on May 31, 2009, 09:51:20 AM
Kako dodati favicon ikonicu?



Index,template.php
<title>', $context['page_title'], '</title>';
Zamenite sa:
<title>', $context['page_title'], '</title>';

echo '<link rel="shortcut icon" type="image/x-icon" href="favicon.ico" />';
echo '<link rel="icon" href="/favicon.ico" type="image/x-icon" />';


Napravite ikonicu favicon.ico. Ikonica mora biti formata 16 x 16 i upoadujte se u root vaseg sajta / foruma.


Drugi nacin
Favicon Mod
Add favicon support


A u koji fajl se nalazi ovo u RC4?

Dzonny


Masterd

Server bi inače trebao sam prepoznati favicon.ico file bez ikakvih modifikacija.

scrolllock

U vezi img taga meni i dalje trazi da link od slike stavljam u img tag iako sam zamenio sve kako si objasnio, u cemu je problem?

Dzonny

Koja je verzija foruma?
Priloži Subs.php da pogledam.

scrolllock

Verzija 1.1.12

evo dela gde sam zamenio i par linija pre i posle

// Close any remaining tags.
while ($tag = array_pop($open_tags))
$message .= $tag['after'];

if (substr($message, 0, 1) == ' ')
$message = '&nbsp;' . substr($message, 1);

if (strpos($message, '<a href') !== false )
{
    //show up images without inserting them between [img] tags ;)
$message = preg_replace('~<a href="(.*?)(\.(?i)(jpg|jpeg|gif|png|bmp))"(.*?)>(.*?)(\.(?i)(jpg|jpeg|gif|png|bmp))</a>~i', '<img src="$1$2" alt="" />', $message);
}

if (strpos($message, '<a href') !== false )
{
    //show up images without inserting them between [img] tags ;)
$message = preg_replace('~<a href="(.*?)(\.(?i)(jpg|jpeg|gif|png|bmp))"(.*?)>(.*?)(\.(?i)(jpg|jpeg|gif|png|bmp))</a>~i', '<img src="$1$2" alt="" />', $message);
}

Dzonny

Možeš li mi reći koji si link ostavio, a da se nije prikazala slika? Da li imaš nešto u error logu?

scrolllock

U error logu nemam nista a ako mislis na link od slike postavljao sam razlicite i sa razlicitih hostinga ali ne prikazuje.

Dzonny

Aha, nadam se da si pokušao sa različitim ekstenzijama, pošto nisu sve dozvoljene.
Daj mi samo malo vremena da testiram, možda je nešto promenjeno u novoj verziji smfa, pa ne radi.

Masterd

#139
                             
AUTOMATSKI KODIRAJ LINKOVE

Ovo je sada dostupno kao mod.

http://custom.simplemachines.org/mods/index.php?mod=2881





           http://www.simplemachines.org/community/index.php?topic=415898.0

Ova modifikacija koda će sve linkove na Vašem forumu automatski pretvoriti u kod.

SMF 1.1.x

Za SMF 1.1.x koristite ovaj mod:

http://custom.simplemachines.org/mods/index.php?mod=1724

SMF 2.0

Sources/Subs.php 

Pronađite:

array(
'tag' => 'url',
'type' => 'unparsed_content',
'content' => '<a href="$1" class="bbc_link new_win" target="_blank">$1</a>',
'validate' => create_function('&$tag, &$data, $disabled', '
$data = strtr($data, array(\'<br />\' => \'\'));
if (strpos($data, \'http://\') !== 0 && strpos($data, \'https://\') !== 0)
$data = \'http://\' . $data;
'),
),
array(
'tag' => 'url',
'type' => 'unparsed_equals',
'before' => '<a href="$1" class="bbc_link new_win" target="_blank">',
'after' => '</a>',
'validate' => create_function('&$tag, &$data, $disabled', '
if (strpos($data, \'http://\') !== 0 && strpos($data, \'https://\') !== 0)
$data = \'http://\' . $data;
'),
'disallow_children' => array('email', 'ftp', 'url', 'iurl'),
'disabled_after' => ' ($1)',
),


Zamijenite s:

array(
'tag' => 'url',
'type' => 'unparsed_content',
'content' => '<div class="codeheader">' . $txt['code'] . ' <a href="javascript:void(0);" onclick="return smfSelectText(this);" class="codeoperation">' . $txt['code_select'] . '</a></div><code href="$1" class="bbc_code">$1</code>',
'validate' => create_function('&$tag, &$data, $disabled', '
$data = strtr($data, array(\'<br />\' => \'\'));
if (strpos($data, \'http://\') !== 0 && strpos($data, \'https://\') !== 0)
$data = \'http://\' . $data;
'),
),
array(
'tag' => 'url',
'type' => 'unparsed_equals',
'before' => '<div class="codeheader">' . $txt['code'] . ' <a href="#" onclick="return smfSelectText(this);" class="codeoperation">' . $txt['code_select'] . '</a></div><code href="$1" class="bbc_code">',
'after' => '</code>',
'validate' => create_function('&$tag, &$data, $disabled', '
if (strpos($data, \'http://\') !== 0 && strpos($data, \'https://\') !== 0)
$data = \'http://\' . $data;
'),
'disallow_children' => array('email', 'ftp', 'url', 'iurl'),
'disabled_after' => ' ($1)',
),


Slika je u privitku. (Hvala, Dzonny!  :D)

Advertisement: