Different Subside

User avatar
wiz
Posts: 803
Joined: Sat Oct 30, 2010 12:23 am

Re: Different Subside

Post by wiz »

Code: Select all

In your theme.php, you can use the following example, meaning this can be solved with PHP only.
- This should show your about area only on the about page.
<?php
if ($Wcms->currentPage == 'about) {
    echo $Wcms->block('newEditableArea');
    } else {
}

if ($Wcms->currentPage == 'anotherPage) {
    echo $Wcms->block('newEditableArea2');
    } else {
}
?>
Be sure to change newEditableArea to the actual name of the editable area you've created prior.
edhaswell
Posts: 1
Joined: Mon Nov 11, 2024 1:50 am

Re: Different Subside

Post by edhaswell »

jens53121 wrote: Fri Nov 12, 2021 3:37 pm 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
This worked great for me; thanks. Although it is worth noting to save others a little trouble that the comma in step four will cause the style to fail.
Post Reply