2011-02-14, 02:44:19
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
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
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>';
}
}