Jump to content

CMS (Pages) - Sidebar block separated from articles


Go to solution Solved by Nathan Explosion,

Recommended Posts

All views of a database page have the same blocks, unless the visibility is coded into the block itself. 

For a homepage, it can make sense not to use the article database itself but to create a new page and then put the article feed on there as a block. This gives more freedom regarding the blocks. I do that on one of my sites. This is the homepage with an article listing (as blocks) plus sidebar widgets. The actual article page is here without a sidebar. So it gives the result you ask for (in a way). 

Edited by opentype
Link to comment
Share on other sites

1 hour ago, opentype said:

All views of a database page have the same blocks, unless the visibility is coded into the block itself. 

For a homepage, it can make sense not to use the article database itself but to create a new page and then put the article feed on there as a block. This gives more freedom regarding the blocks. I do that on one of my sites. This is the homepage with an article listing (as blocks) plus sidebar widgets. The actual article page is here without a sidebar. So it gives the result you ask for (in a way). 

That's exactly what I want to do, I just don't understand how to do it hahah

Screenshot_134.png.5d404e0d7b88cc7b5e07d2374e011bdb.png

---

Thus, article without a block on sidebar

Screenshot_135.thumb.png.5d6f6293c9be2d0d46cb108d90e41958.png

Edited by Hisashi
Link to comment
Share on other sites

24 minutes ago, Nathan Explosion said:

What blocks exactly? Custom ones you have made yourself, or the default ones provided by the software?

I don't speak fluent english so sorry if you're confused.

Screenshot_141.thumb.png.7da3accd6c52bd2c5ddbfc73a4ebcf50.png

 

I want to make it not appear within post

Screenshot_142.thumb.png.f1e58ce8ba4eb7ca5eefbf9646b8eb0b.png

 

Staying this way, only appearing on homepage where I putScreenshot_143.thumb.png.c7c8ab91c57b2a57e2c52895022ae321.png

Edited by Hisashi
Link to comment
Share on other sites

  • Solution
32 minutes ago, Hisashi said:

so sorry if you're confused.

I'm not confused - I'm clarifying your request to move from the general ("the blocks") to the specific ("the Recent Status Update block"), and your response confirms that it is the default blocks that you are asking about.

The 'fix' is to use custom blocks instead, as follows (note: I am not providing what you put in to every field, I am providing the specific things that need to be done...the rest is up to you)

  1. ACP
  2. Pages -> Blocks -> Create Block
  3. In the second field ('Plugin') select the block you want to use ('Recent Status Updates')
  4. Give it a name (example: myBlock)
  5. Save this
  6. Pages -> Blocks -> Create Block
  7. This time, choose 'Custom' -> 'Manual HTML'
  8. On the first tab, name your custom block
  9. On the 'Content' tab, insert the code below
  10. On the same tab, DO NOT enable 'Cache this block'
  11. Save the new custom block
  12. Now, on the front-end you put that custom block in place, instead of the 'Recent Status Updates' block
{{if \IPS\Request::i()->controller==='page' AND !isset(\IPS\Request::i()->id)}}
{block="myBlock"}
{{endif}}

Why do it this way? The 'Recent Status Updates' block is cached, so adding the {{if....}} statement in its content will end up with strange caching results.

Result (there may be some finesse needed, but there is your starting point):

 

image.thumb.png.39a268e4a2306a9b6290c4d1ed51f6c3.png

 

image.thumb.png.5787d0943a507143fb6a0b5f3997d4b2.png

 

Link to comment
Share on other sites

39 minutes ago, Nathan Explosion said:

I'm not confused - I'm clarifying your request to move from the general ("the blocks") to the specific ("the Recent Status Update block"), and your response confirms that it is the default blocks that you are asking about.

The 'fix' is to use custom blocks instead, as follows (note: I am not providing what you put in to every field, I am providing the specific things that need to be done...the rest is up to you)

  1. ACP
  2. Pages -> Blocks -> Create Block
  3. In the second field ('Plugin') select the block you want to use ('Recent Status Updates')
  4. Give it a name (example: myBlock)
  5. Save this
  6. Pages -> Blocks -> Create Block
  7. This time, choose 'Custom' -> 'Manual HTML'
  8. On the first tab, name your custom block
  9. On the 'Content' tab, insert the code below
  10. On the same tab, DO NOT enable 'Cache this block'
  11. Save the new custom block
  12. Now, on the front-end you put that custom block in place, instead of the 'Recent Status Updates' block
{{if \IPS\Request::i()->controller==='page' AND !isset(\IPS\Request::i()->id)}}
{block="myBlock"}
{{endif}}

Why do it this way? The 'Recent Status Updates' block is cached, so adding the {{if....}} statement in its content will end up with strange caching results.

Result (there may be some finesse needed, but there is your starting point):

 

image.thumb.png.39a268e4a2306a9b6290c4d1ed51f6c3.png

 

image.thumb.png.5787d0943a507143fb6a0b5f3997d4b2.png

 

 

Amazing, it worked perfectly! Thanks

I only had two problems...

1. When I tried to replicate in "Popular contributors" disappeared the names.

Screenshot_145.png.a9e60a6492712a6734a6388014127ed4.png

2. In version 4.6.0 it worked, but in my 4.5.4.2 there was a space

Screenshot_146.png.062da5a1510ffad4ff5122709f78f67a.png

 

Link to comment
Share on other sites

7 minutes ago, Nathan Explosion said:

You won't have access to this linked content, but it's an issue that is fixed in (as you found) 4.6.0:

 

What a pity 😔

Thank you anyway, helped me a lot! When I finish my adjustments I update the version.

Do you have any solution for Popular contributors?

Link to comment
Share on other sites

36 minutes ago, Hisashi said:

1. When I tried to replicate in "Popular contributors" disappeared the names.

Unfortunately, I think that block has a little JS code that acts against it and the above method isn't compatible.

That specific block could probably be handled via a template edit instead (not fully tested - I'm going to bed):

core -> front -> widgets -> mostContributors

Enclose the template content with the following:

{{if \IPS\Request::i()->controller==='page' AND !isset(\IPS\Request::i()->id)}}
ALL THE EXISTING TEMPLATE
{{endif}}

 

4 minutes ago, Hisashi said:

Do you have any solution for Popular contributors?

Was typing it up as you replied - hope it works as I think it might.

Link to comment
Share on other sites

17 hours ago, Nathan Explosion said:

Unfortunately, I think that block has a little JS code that acts against it and the above method isn't compatible.

That specific block could probably be handled via a template edit instead (not fully tested - I'm going to bed):

core -> front -> widgets -> mostContributors

Enclose the template content with the following:

{{if \IPS\Request::i()->controller==='page' AND !isset(\IPS\Request::i()->id)}}
ALL THE EXISTING TEMPLATE
{{endif}}

 

Didn't work

Link to comment
Share on other sites

As I said - I was tired hehe

17 hours ago, Nathan Explosion said:

(not fully tested - I'm going to bed)

The correct template for that widget is actually core -> front -> widgets -> topContributors

However, the suggested theme edit won't work because this widget is cached too. Unfortunately, I think you're out of luck on this one specifically.

Edited by Nathan Explosion
Link to comment
Share on other sites

2 hours ago, opentype said:

As I said in the beginning: Just create two independent pages like I did. 

I just didn't understand how I do it that way.

  1. I create two pages (being one main)
  2. The main I put the blocks
  3. other the database

That's it?

Link to comment
Share on other sites

I managed to do it in another way with the idea of @opentype
I'll leave it here as a help, in case anyone looks for...
---------

1. Create two pages (Manual HTML), one with a sidebar that you will mark as main page Screenshot_164.png.6e69b21ee8dabcbe4e47c488cee79520.png
The other without sidebar (On this page you will place the database)

Screenshot_163.png.52c3a4dfc9a29359106924db7204ce33.png

2. Create a new block as per a screenshot

Screenshot_167.png.692d9ca9840171a07060143c60e9a122.png

Here you put your database (Don't enable "Cache this block")

Screenshot_169.png.e5035807c96f3cfbf4d6fea9ae4ea3cd.png

 

3. Now go to your main page and place the block with the database you just created.

Screenshot_170.png.47859a93bec41ff066ad3b8d05a2b08c.png

 

Now just add your blocks in sidebar and when you click it won't show.

Thank you @Nathan Explosion for the other way to do this.

Edited by Hisashi
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...