Please login or register.

Login with username, password and session length
Advanced search  

News:

You need/want an older version of sNews ? Download an older/unsupported version here.

Author Topic: I want to help, please ... Must add a word "Read more>>>" at my method  (Read 892 times)

adminphp

  • Full Member
  • ***
  • Karma: 4
  • Posts: 150
  • you must be a great snewser .

Good evening, all members Sa went directly to the proposal
I want to add a word - read more>>> -
To each article in this method  http://snewscms.com/forum/index.php?topic=8858.0  



 I know it must be add  that word "read more"  here.in Blue line
---------------------------------------
<?php
function get_featured_articles( $catArray, $txtLimit ) {
if (!is_array($catArray)) return;
$catCount = count($catArray);
$cats = implode(',', $catArray);
$query = 'SELECT
category, title, seftitle as artSEF, text
FROM '.db('prefix').'articles
WHERE position = 1
AND published = 1
AND category IN('. $cats .')
ORDER BY date DESC
LIMIT '. $catCount;
$result = mysql_query($query);
$c = array();
while ($r = mysql_fetch_assoc($result)){
$r['catSEF'] = find_cat_sef($r['category']);
$r['text'] = substr($r['text'], 0, $txtLimit).'...';$c[] = $r;
}
if (empty($c)) $c['error'] = l('no_articles');
return $c;
}

function featured_articles( $catArray, $txtLimit = 200 ) {
$c = get_featured_articles( $catArray, $txtLimit );
if (isset($c['error'])) {
echo '<p>'.$c['error'].'</p>';
} else {
foreach ($c as $k=>$v){
echo '
<div id="'. $v['artSEF'] .'_tab">
<h4><a href="'.db('website').$v['catSEF'].'/'.$v['artSEF'].'/">'.$v['title'].'</a></h4>
<p class="latest-text">'. $v['text'] .'</p>
</div>';
}

// If the user doesn't have Javascript enabled....
echo "
<script type=\"text/javascript\">
document.write('";
echo '<ul class="tabs">';
$count = 1;
foreach ($c as $k=>$v){
echo '<li><a href="#'. $v['artSEF'] .'_tab">'. $count .'</a></li>';
$count++;
}
echo '</ul>';
echo "');</script>";
}
}

?>
------------------------------------------------------------------------------------------
But we must communicate with the database
$query = 'SELECT
category, title, seftitle as artSEF, text
FROM '.db('prefix').'articles . etc
« Last Edit: July 09, 2010, 01:03:24 AM by adminphp »
Logged
“Fifty years of programming language research, and we end up with C++?”

nukpana

  • Hero Member
  • *****
  • Karma: 71
  • Posts: 663

See the comments below
Code: [Select]
<?php

function featured_articles$catArray$txtLimit 200 ) {
$c get_featured_articles$catArray$txtLimit );
if (isset($c['error'])) {
echo '<p>'.$c['error'].'</p>'
} else {
foreach ($c as $k=>$v){
echo '
<div id="'
$v['artSEF'] .'_tab">
<h4><a href="'
.db('website').$v['catSEF'].'/'.$v['artSEF'].'/">'.$v['title'].'</a></h4>



// THE READ MORE LINK CAN GO BEFORE THE CLOSING P HERE OR
<p class="latest-text">'
$v['text'] .'</p>


// ADD THE READ MORE LINK AFTER THE TEXT LIKE SO: 
/ /<p><a href="'
.db('website').$v['catSEF'].'/'.$v['artSEF'].'/">READ MORE</a></p>


</div>'
;
}

   // If the user doesn't have Javascript enabled....
echo "
<script type=\"text/javascript\">
document.write('"
;
echo '<ul class="tabs">';
$count 1;
foreach ($c as $k=>$v){
echo '<li><a href="#'$v['artSEF'] .'_tab">'$count .'</a></li>';
$count++;
}
echo '</ul>';
echo "');</script>";
}
}

?>

Logged

adminphp

  • Full Member
  • ***
  • Karma: 4
  • Posts: 150
  • you must be a great snewser .

Thank you  for your reply .. Successful way
Logged
“Fifty years of programming language research, and we end up with C++?”