Editing database.js

Ask for help or provide support to other members.
Post Reply
Posts: 1
Joined: Tue Jan 02, 2024 12:21 pm

Editing database.js

Post by joseluis »


I am new to WonderCMS and I like the structure and simplicity of this CMS.

I would like to know if it is possible to directly edit the database.js file to add new pages.

I am creating a website with many pages that will have the same content structure and I think it would be faster to duplicate the pages in the "database.js" file and then combine them with the WonderCMS editor.

Can I copy and paste the following code?

Code: Select all

        "inicio": {
            "title": "Inicio",
            "keywords": "Enter, page, keywords, for, search, engines",
            "description": "A page description is also good for search engines.",
            "content": "<h1>........",
            "subpages": {}      
User avatar
Posts: 34
Joined: Sat May 23, 2020 9:02 pm

Re: Editing database.js

Post by nox »

Hi joseluis,
sure, here is a database.js example:
https://github.com/WonderCMS/wondercms/ ... atabase.js

You can add new pages or delete existing, set page order, visibility (menu items) and so on.
Create a backup just in case before editing database.
Posts: 90
Joined: Wed Sep 01, 2021 7:50 am

Re: Editing database.js

Post by NorfolkGreg »

I looked at my database recently. I've deleted the call to the "subside" block from my theme.php but the "subside" block remains in the database.
There's also a "footer" block and a "header" block. I assume the latter was created when I tried to implement a functions.php.

A few questions follow...

I know that the guidance says I need to call the "header" block in the same way as the "subside" block , i.e.
<?= $Wcms->block('header') ?>

But how come, although it's in the "blocks" section of the database, that the footer is called with:
<?= $Wcms->footer() ?>
and not
<?= $Wcms->block('footer') ?>

And related to all this, is there any periodic automated deletion of redundant content of the database?
If I delete the "subside" block from the database, will WonderCMS issue error messages if I switch to a theme that calls the "subside" block, or does it just ignore something that's not there?
Post Reply