Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Read More - News Manager
#1
Hello!

I want to add a read more button to news manager.

I can create function to edit and save short and full text but i cant make the more button (link) to show the full article

Code:
function show_articles($n) {
  $articles = get_articles();
  if (isset($n) && $n > 0) {
    $index = (isset($_GET['page'])) ? $_GET['page'] : 0;
    $pages = array_chunk($articles, $n);
    $articles = $pages[$index];
  }
  foreach ($articles as $article) {
    $id = basename($article, ".xml");
    show_single($id);
    
?>
   <a href="WHAT TO PUT HERE?">more</a>
    <?php
    
  }
  if (isset($n))
    show_navigation($index, sizeof($pages));
}

I dont know what to put as link because getsimple uses index.php?id=pageid and i cant send variables like index.php?id=news&postid=$id
how do i do that? so a function can show the full article
Code:
$id= $_GET["postid"]

function show_full($id) {
  $file = GSDATANEWSPATH . $id . '.xml';
  $data = getXML($file);
  if (!empty($data)) {
    $date = $data->date;
    $title = stripslashes(htmlspecialchars_decode($data->title, ENT_QUOTES));
    $short = stripslashes(htmlspecialchars_decode($data->short, ENT_QUOTES));
    $content = stripslashes(htmlspecialchars_decode($data->content, ENT_QUOTES));

    
    ?>
    <div class="article">
      <h3 class="article_title"><?php echo $title; ?></h3>
      <p class="article_date">Posted on: <?php echo $date; ?></p>
      <div class="article_content"><?php echo $short; ?></div>
    <div class="article_content"><?php echo $content; ?></div>
    </div>
    <?php
  } else {
    echo '<p>The requested article does not exist.</p>';
  }
}
Reply


Messages In This Thread
Read More - News Manager - by rigor789 - 2011-02-14, 02:44:19
RE: Read More - News Manager - by edita26 - 2013-04-06, 02:56:38
Read More - News Manager - by dom - 2011-03-02, 08:53:13



Users browsing this thread: 1 Guest(s)