Addition features Action view on News!

212
.
ryansiprofesor
just as we know, in the previous JohnCMS News just a list / list everything looks full without cutting text. and it is a little annoying if admin wrote a long text message her and tired of pressing down let alone who use mobile phone.
well now ane ya want to share that can be seen easily.

feature:
on the start menu /news/index.php will appear with the list of news and agan cutting text will be read in full by clicking on the NEXT ...


How:
Edit index.php is in the news .
then add the above case the default case
add this code
case 'view':
/*/ Added Action views by: Ryan Si Profesor, http://facebook.com/ryansiprofesor /*/
if(!empty($_GET['id'])) {
$qnews = mysql_fetch_array(mysql_query("SELECT * FROM news WHERE id = '" . $id . "'"));
$text = functions::checkout($qnews['text'], 1, 1);
if ($set_user['smileys'])
             $text = functions::smileys($text, 1);
echo '<div class="phdr">' . $lng_news['article_title'] . ': <b>' . $qnews['name'] . '</b></div>' .
 '<div class="menu"><div class="func">' . $lng['author'] . ': ' . $qnews['avt'] . ' (' . functions::display_date($qnews['time']) . ')</div>' .
 '<div class="ctxt">' . $text . '</div></div>' .
 '<div class="phdr"><a href="index.php">' . $lng_news['to_news'] . '</a></div>';
 }
break;


if you have, now find the code below in the default case.
[Code] while($res = mysql_fetch_array($req)) {[/code]
replace code marked below.
echo $i % 2 ? '<div class="list2">' : '<div class="list1">';
$text = functions::checkout($res['text'], 1, 1);
if ($set_user['smileys'])
$text = functions::smileys($text, 1);
echo '<h3>' . $res['name'] . '</h3>' .
'<span class="gray"><small>' . $lng['author'] . ': ' . $res['avt'] . ' (' . functions::display_date($res['time']) . ')</small></span>' .
'
' . $text . '<div class="sub">';

Remove and replace the red marked code above with the code below

$text = $res['text'];
$txt = strtr($text, array(
'&quot;' => '',
'&amp;' => '',
'&lt;' => '',
'&gt;' => '',
'&#039;' => ''
));
    $txt = mb_substr($text, 0, 150);
$txt = functions::checkout($txt);
$txt = bbcode::notags($txt);
$text_n = mb_strlen($res['text']) > 150 ? $txt . '
<a href="index.php?do=view&amp;id=' . $res['id'] . '">' . $lng['next'] . '...</a>' : $txt;


for the code marked with a green dressing code below
$text_n


After that, open the folder /incfiles/classes/mainpage.php

and find the following code
$text. = '<a Href="news/index.php">' . $lng['next']. '... </a>';


change the code above with the code below:
$text. = '<a Href="news/index.php?do=view&id='. $res['id'].'">'. $lng['next']. '... </a>';


then save and see the results on yoursite.com/news
or on the main page and click next news!!!

need help please call admin
.
Let Mortal Kombat begin
good job, men.
ps the topic was moved to other forum
Всего: 2