Week 5

This week we continue implementing our simple CMS system starting with managing articles which appear in our public site and then moving into more database work.

Some background reading

First we have some background reading on topics past, present and future. None of these are designed to be a comprehensive in depth report on all of these issues but they should be a good start to understand some of the basic and underlying concepts of the topics at hand.

Adding WYSIWYG to manageArticles.bxm

WYSIWYG (pronounced Wiz-E-Wig) stands for What You See Is What You Get. It is a tool that a non-programmer can use to edit text, format it like you can in a word processer and the HTML is written behind the scenes automatically.

There are many WYSIWYG libraries which exist but due to licensing changes for many of them we are going to use one called HugeRTE which is a fork from a popular library called tinyMCE. It is open source and free to use.

We are going to add it to our manageArticles.bxm file for the body/description field.

1
Add the script to the manageArticles.bxm page

The library for hugeRTE is served from a Content Delivery Network ( CDN ) called jsdelivr.com located here.

</div>
</bx:output>
<script src="https://cdn.jsdelivr.net/npm/hugerte@1.0.15/hugerte.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/hugerte@1.0.15/skins/ui/oxide/skin.min.css">
<script type="text/javascript">
    hugerte.init({
    selector: 'textarea',  // change this value according to your HTML
    plugins: 'a_hugerte_plugin',
    a_plugin_option: true,
    a_configuration_option: 400
});
</script>
2
Make a small change to our textarea
                </div>
                <div class="form-floating">
                <div>
                    <label for="floatingTextarea">Description / Body</label>
                    <textarea class="form-control" placeholder="Leave a comment here" id="floatingTextarea" name="description">#articleData.description#</textarea>
                    <label for="floatingTextarea">Description / Body</label>
                </div>
                <div class="form-check">

3
Try loading the page and saving either a new article or an edit.

Did it work?

Showing our articles on the front page
creating the forms for our other tables

::: So far we've created our articles page. This included a management page to create and edit articles and a display them on a public page. This system is roughly the entire process of app and webpage development - develop a model (data base or table), create a UI and connect the two. Our articles only had 3 fields. The books in our bookstore have many more but the principles remain the same.

This week we are going to dive in to modelling by creating the data tables which will house our book data.