[SOLVED] How to add content blocks?
[SOLVED] How to add content blocks?
Hello there, so I am new to WonderCMS, and am curious.. how do I add editable content blocks to pre-existing content?
Re: How to add content blocks?
Hello ty, welcome to our WonderCMS community!
Could you explain in more detail what you mean? An example of what you need would be perfect
Could you explain in more detail what you mean? An example of what you need would be perfect
Re: How to add content blocks?
By content blocks I'm reffering to making editable parts / sections of a static html website. Do I use a specific <div> to do this? And can only text be modified, or can images be as well?
Re: How to add content blocks?
Would something like this help?
https://github.com/robiso/wondercms/wik ... ble-blocks
It could be also used for loading existing editable areas, but they have to be already in the database.js file - preexisting for this to work.
Let us know if you need any help putting this together and please post any code examples so we can help you easier.
https://github.com/robiso/wondercms/wik ... ble-blocks
It could be also used for loading existing editable areas, but they have to be already in the database.js file - preexisting for this to work.
Let us know if you need any help putting this together and please post any code examples so we can help you easier.
Re: How to add content blocks?
Is there a way to make images editable? Like being able to move them around, replace, etc.wiz wrote: ↑Tue Feb 02, 2021 5:57 am Would something like this help?
https://github.com/robiso/wondercms/wik ... ble-blocks
It could be also used for loading existing editable areas, but they have to be already in the database.js file - preexisting for this to work.
Let us know if you need any help putting this together and please post any code examples so we can help you easier.
Re: How to add content blocks?
There is a possibility of aligning images left, right and center. It also supports drag and drop for images, however the images cannot be free moved around yet (as in exact position), unless you're using CSS.
Hope this answers your questions, let me know if it doesn't.
Hope this answers your questions, let me know if it doesn't.
Re: How to add content blocks?
Hi,
I have a question to place the addition content variables like "addition_content_1" in my template file.
I can find the "addition_content_1" in my "database.js" file. But how can I place this variable now in my html template.
I try this, but doesn't work:
Do you have a tipp for me?
Thanks in advance
and thanks to the WonderCMS team for your great work so far.
---
I have a question to place the addition content variables like "addition_content_1" in my template file.
I can find the "addition_content_1" in my "database.js" file. But how can I place this variable now in my html template.
I try this, but doesn't work:
Code: Select all
<?= $Wcms->block('addition_content_1')?>
Thanks in advance
and thanks to the WonderCMS team for your great work so far.
---
ty505 wrote: ↑Sun Feb 07, 2021 12:24 amIs there a way to make images editable? Like being able to move them around, replace, etc.wiz wrote: ↑Tue Feb 02, 2021 5:57 am Would something like this help?
https://github.com/robiso/wondercms/wik ... ble-blocks
It could be also used for loading existing editable areas, but they have to be already in the database.js file - preexisting for this to work.
Let us know if you need any help putting this together and please post any code examples so we can help you easier.
Re: How to add content blocks?
Hi mrgu, welcome to WonderCMS.
What happens when if you try to use:
OR
Glad you're loving WonderCMS. Is there anything you feel is missing or you have had bad experience with?
What happens when if you try to use:
Code: Select all
<?php
$Wcms->get('blocks','addition_content_1','content')
?>
Code: Select all
<?php
function addition_content_1() {
global $Wcms;
// Check if the addition_content_1 area is already exists, if not, create it
if (empty($Wcms->get('blocks','addition_content_1'))) {
$Wcms->set('blocks','addition_content_1', 'content', 'Your content here.');
}
// Fetch the value of the addition_content_1 from database
$value = $Wcms->get('blocks','addition_content_1','content');
// If value is empty, let's put something in it by default
if (empty($value)) {
$value = 'Empty content';
}
if ($Wcms->loggedIn) {
// If logged in, return block in editable mode
return $Wcms->block('addition_content_1');
}
// If not logged in, return block in non-editable mode
return $value;
}
?>
Glad you're loving WonderCMS. Is there anything you feel is missing or you have had bad experience with?