Blog Example - lokothodida/DM_Matrix GitHub Wiki
This is a brief walk-through on how to set up a simple blog.
Build a table with the following properties
- Name: blog
-
Fields:
- Name: title, Type: textlong
- Name: date, Type: datetimelocal
- Name: tags, Type: tags
- Name: content, Type: wysiwyg
- Max Records: 0
<?php
$blog = $var->query("SELECT * FROM blog ORDER BY date DESC");
$blog = $var->formatQuery($blog, 'blog');
$blog = $var->paginateQuery($blog);
?>
<div class="pagination"><?php echo $entry['links']; ?></div>
<?php foreach ($blog['results'] as $entry) { ?>
<!--title-->
<h2>
<a href="/index.php?id=blog&entry=<?php echo $entry['id']; ?>"><?php echo $entry['title']; ?></a>
</h2>
<!--date-->
<span class="date">
<?php echo $entry['date']; ?>
</span>
<!--content-->
<div class="content">
<?php echo $entry['content']; ?>
</div>
<!--tags-->
<span class="tags">
<?php echo $entry['tags']; ?>
</span>
<?php } ?>
<div class="pagination"><?php echo $entry['links']; ?></div>
<?php
$id = $_GET['entry']; // id corresponds to blog entry; for this example we are just
// assuming that it is in the GET array
$entry = $var->query("SELECT * FROM blog WHERE id = $id");
?>
<!--title-->
<h2><?php echo $entry['title']; ?></h2>
<!--date-->
<span class="date"><?php echo $entry['tags']; ?></span>
<!--content-->
<div class="content"><?php echo $entry['content']; ?></div>
<!--tags-->
<span class="tags"><?php echo $entry['tags']; ?></span>