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.
"inicio": {
"title": "Inicio",
"keywords": "Enter, page, keywords, for, search, engines",
"description": "A page description is also good for search engines.",
"content": "<h1>........",
"subpages": {}
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?
I find it a bit odd that one file, the database.js, holds all the pages. Since pages can be small or huge in terms of content, the database.js file can grow so large it will render a slow page load.
Right, but I would say that a flat-file cms is technically not meant to host a very large website with tons of content. If that's your case, you should probably move on to a less minimal cms, a Wordpress or something.
I'm a rank beginner when it comes to the mechanics of flat file js/JSON databases but, from what I've read, I tend to agree with both the two responses above. However, I'm still curious to have an answer to my PHP centred questions:
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?
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?
There is nothing automatic for duplicate content in the db, you would need to delete any duplicate content manually.
The difference between calling <?= $Wcms->footer() ?> and <?= $Wcms->block('footer') ?> lies in the functionality and purpose of these methods.
This would output the raw content of the footer block without any additional logic or modifications.
The footer() method is used because it provides more than just the content of the footer block. It includes additional logic for user state and customization that a generic block() method wouldn’t handle.
Unfortunately, not your fault, it didn't make much sense to me. I'll need to go away and read up on "methods" and, no doubt, learn of various others terms along the way. I remember first encountering "method" in a computing magazines 25 years ago.
It was the kind of thing you didn't come across in Z80 assembly language. When I finally graduated to a 16bit computer running DOS4 I never got beyond Batch programming and, apart from HTML and CSS, haven't found time to learn anything resembling programming since.
Last edited by NorfolkGreg on Tue Aug 20, 2024 4:58 pm, edited 1 time in total.
I know, it’s time consuming to learn coding. But remember that ChatGPT, mistral AI or Claude AI can be good allies when it comes to putting snippets of code together to make a working php script ^^
That’s honestly what I’ve been doing and it saves tons of time (and helps me not pull my hair so much). Obviously having some solid basics is kind of required, because AI ain’t that smart and it can’t test the code it provides, so making it work is on you