Different Subside

CarstenDenmark
Posts: 8
Joined: Sat Nov 06, 2021 2:53 pm

Different Subside

Post by CarstenDenmark »

Hi guys,
Newbie here from Denmark.

I just came accross WonderCMS and thought I would give it a run.

I am used to other CMS, such as:
- Wordpress
- Concrete5
- Mambo
- Joomla
- Typo3

I am trying to make something for my own website and wanted to it a go with WonderCMS.

However, when researching i come accross an issue.

I would like <? = $Wcms->block('subside') ?> to not contain the same content on every page.
I enclosed an image showing the image in an <aside> but this should be different on every page, so my question is, is it possible to have a editable container on each page that could hold different content, for instance different images?
Attachments
newsite.jpg
newsite.jpg (370.73 KiB) Viewed 7793 times
User avatar
wiz
Posts: 749
Joined: Sat Oct 30, 2010 12:23 am

Re: Different Subside

Post by wiz »

Hey CarstenDenmark, warm greetings to Denmark!

You have a few options, the most simple one is:
- Remove subside block from your theme.
- Install additional contents plugin, which should enable you unlimited editable contents on each page.

Let me know if this helps.
CarstenDenmark
Posts: 8
Joined: Sat Nov 06, 2021 2:53 pm

Re: Different Subside

Post by CarstenDenmark »

Hi @wiz

The problem is that I have to have the area on the right (showing the picture) which on each page should be numerous images displayed on transition.
So I have to have an area on my right which should contain images, so deleting the "subside" is a bad idea i guess.

If I install "additional contents plugin" this on only works alongside <?= $Wcms->page('content') ?>.

Is this not correct?

So according to my research, i can not do this:

<main>
<?= $Wcms->page('content') ?>
</main>

<aside>
images via "additional contents plugin"
</aside>

Or am i missing something?

/Carsten - Denmark
CarstenDenmark
Posts: 8
Joined: Sat Nov 06, 2021 2:53 pm

Re: Different Subside

Post by CarstenDenmark »

It would be very nice if the "subside" could be detached from showing the same content on each page.
An "on/off" switch when adding pages would be nice, so you could decide if you want it to show the same images/content, or if you want it to be unique on each page
User avatar
wiz
Posts: 749
Joined: Sat Oct 30, 2010 12:23 am

Re: Different Subside

Post by wiz »

You are correct, you would need to modify/fork the additional contents plugin to be added somewhere else.

The subside is meant to be a static editable area visible on all pages.

Would creating custom additional areas for each of your subpages help out?
Documentation: https://github.com/robiso/wondercms/wik ... ble-blocks
CarstenDenmark
Posts: 8
Joined: Sat Nov 06, 2021 2:53 pm

Re: Different Subside

Post by CarstenDenmark »

Hi Wiz,
I tried this already, without any success.

The reason again being that these areas will be shown on all pages.

And I have not yet been able to differ these by adding for instance an ID to a div. The div gets and ID when logged in, but as soon I log out the div and ID vanishes, leaving only the "content".
User avatar
wiz
Posts: 749
Joined: Sat Oct 30, 2010 12:23 am

Re: Different Subside

Post by wiz »

You could use a condition to show or hide your additional editable area in the following way (same as it used on the official wondercms.com).

This is a simple change required in your theme PHP.

Code: Select all

<!-- Custom editable block, different for each page -->
<?php
    if ($Wcms->currentPage == 'home') {
    } else {
        echo $Wcms->block('newEditableArea');
    }
?>
Please understand we have don't include all feature requests in WonderCMS to retain it's simple and small nature, however everything should be possible with a bit of modification.
CarstenDenmark
Posts: 8
Joined: Sat Nov 06, 2021 2:53 pm

Re: Different Subside

Post by CarstenDenmark »

Hi Wiz,
So how would you do what you describe using PHP?

I would like to use "subside" but have tried with javascript without much luck.

I have, let´s say 6 pages:
Page 1
Page 2
Page 3 and so on

Page 1 = Home
Page 2 = About

So in order to make this PHP work, how could i do this?


On "Home"
<!-- Custom editable block, same on each page -->
<?php
if ($Wcms->currentPage == 'home') {
} else {
echo $Wcms->block('newEditableArea');
}
?>

On "About"
<!-- Custom editable block, same on each page -->
<?php
if ($Wcms->currentPage == 'about) {
} else {
echo $Wcms->block('newEditableArea');
}
?>
or what do you recommend?

And when i am on "Home" i want to see the specific content of "newEditableArea", and when i am on "about" i want to see specific content here.

How to?

/Carsten - Denmark
CarstenDenmark
Posts: 8
Joined: Sat Nov 06, 2021 2:53 pm

Re: Different Subside

Post by CarstenDenmark »

This is my attempt of using javascript, and it works but not the way I would like it to.

** In <head> **
<script type="text/javascript">
function callOnPageLoad()
{
var url = window.location.href;
if(url == "http://localhost/wonder/home")
{
document.getElementById('one').style.display = 'none';
}
else if(url == "http://localhost/wonder/about")
{
document.getElementById('two').style.display = 'none';
}
else if(url == "http://localhost/wonder/photo")
{
document.getElementById('three').style.display = 'none';
}
}
</script>

** My <body> **
<body onload="callOnPageLoad()">


** Input in my newEditableArea **

<h2 id="one"> number 1 </h2>
<h2 id="two"> number 2 </h2>
<h2 id="three"> number 3 </h2>


So i am a bit frustrated to say the least, because even if this is working, it would give me a lot of work when putting all of this in "subside", where i want to either show or hide on account of my URL.
jens53121
Posts: 1
Joined: Fri Nov 12, 2021 11:32 am

Re: Different Subside

Post by jens53121 »

my way in 4 steps:
1. i create in data/database.js 10 new blocks (subside-01 to subside-10):

"subside-01": {
"content": "<h2>Subside 01<\/h2>Please fill the content here<br>Lorem ipsum... "
},

2, this 10 blocks i put in theme.php

<aside>
<div id="s00"><?=$Wcms->block('subside')?> </div>

<div id="s01"> <?=$Wcms->block('subside-01')?> </div>
<div id="s02"> <?=$Wcms->block('subside-02')?> </div>
<div id="s03"> <?=$Wcms->block('subside-03')?> </div>
<div id="s04"> <?=$Wcms->block('subside-04')?> </div>
<div id="s05"> <?=$Wcms->block('subside-05')?> </div>
<div id="s06"> <?=$Wcms->block('subside-06')?> </div>
<div id="s07"> <?=$Wcms->block('subside-07')?> </div>
<div id="s08"> <?=$Wcms->block('subside-08')?> </div>
<div id="s09"> <?=$Wcms->block('subside-09')?> </div>
<div id="s10"> <?=$Wcms->block('subside-10')?> </div>
</aside>

3. i style this blocks in style.css

#s01, #s02, #s03, #s04, #s05, #s06, #s07, #s08, #s09, #s10 {
width: 100%;
display:none;
}

4. in the website content (home, about etc ) code view of summernote;

<style> #s00 {display: none;}, #s01 {display: block;} </style>

and every site has s different editable Subside block.

Have fun
Post Reply