[Solved] Content Tag (Second Block) Not Working

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
baldguy
Forum Members
Forum Members
Posts: 34
Joined: Mon Jan 28, 2008 4:04 am

[Solved] Content Tag (Second Block) Not Working

Post by baldguy »

CMSMS 1.11

This is my first installation of 1.11, and I'm adapting a template/structure that I've been using for years. I'm having a problem getting the second block of content to display. Here's what I have:

Code: Select all

		<div class="content cf">
			{content assign="maincontent"}
			{content block="sidebar" label="Sidebar" assign=sidebar}
			<div class="main">
				{$maincontent}
			</div>

			<div class="sidebar">
				{$sidebar}
			</div>
		
		</div>
The first instance of content ($maincontent) displays just fine. The second one ($sidebar) does not display at all. The div's are there, but there is no content.

In the backend, the page shows the second editor block just fine, and the information that I enter there is saved, it just won't display on the front end.

Is there a change in 1.11 that changes the syntax of this call? I've tried all combinations of quotes - single, double, none - and ended up with what's here based on the help for the tag.

And, I didn't do anything weird with the CSS:

Code: Select all

.content {
padding: 2em 1em;
}

.main {
width: 73%;
float: right;
}
.sidebar {width: 21%;}
Anyone have any ideas?
Thanks!
Last edited by baldguy on Mon Aug 06, 2012 9:56 pm, edited 1 time in total.
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am
Location: Arizona

Re: Content Tag (Second Block) Not Working

Post by Dr.CSS »

Maybe you want to change the block= or the assign so they aren't the same name...
baldguy
Forum Members
Forum Members
Posts: 34
Joined: Mon Jan 28, 2008 4:04 am

Re: Content Tag (Second Block) Not Working

Post by baldguy »

Changed the assign= to this, but it's still not working.

Code: Select all

		<div class="content cf">
			{content assign="maincontent"}
			{content block="sidebar" label="Sidebar" assign=sidebarcontent}
			<div class="main">
				{$maincontent}
			</div>

			<div class="sidebar">
				{$sidebarcontent}
			</div>
		
		</div>
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am
Location: Arizona

Re: Content Tag (Second Block) Not Working

Post by Dr.CSS »

If you are just using the assign block right below the logic why do the logic?...
baldguy
Forum Members
Forum Members
Posts: 34
Joined: Mon Jan 28, 2008 4:04 am

Re: Content Tag (Second Block) Not Working

Post by baldguy »

Mostly because I'm recycling templates. Typically I have them set up so that the user has the option to add information in a sidebar editor. The template is set so if there is nothing entered, it displays the Main Content full width. If there is something entered, it adds the sidebar. It just happens that this template has a fixed sidebar on all pages.

I did also initially set it up with the "optional" sidebar, but I got the same result - no sidebar even if there was text there.

And I also tried just putting the sidebar call where it is displayed, and got the same result (content displays, sidebar does not):

Code: Select all

		<div class="content cf">
			
			<div class="main">
				{content}
			</div>

			<div class="sidebar">
				{content block="sidebar" label="Sidebar"}
			</div>
		
		</div>
But, I do have the logic and code right, do I not? I mean it should be working, based on the code I'm displaying?
baldguy
Forum Members
Forum Members
Posts: 34
Joined: Mon Jan 28, 2008 4:04 am

Re: Content Tag (Second Block) Not Working

Post by baldguy »

I'm reluctant to call it solved, but it seems to be working now.

I left it for a while, then came back, removed the stylesheets, and started to strip out all the template code until I got down to nothing in the head, and only the content tags in the body. It still wasn't displaying, so I went to Page->Options and unchecked the "Cacheable" box. Suddenly not only did that page work, but all of them did. I restored the original template to the page, and it's still working.

Keep in mind that the "Cacheable" box was checked by default, and in Global Settings->Advanced Setup the "Allow Browser to Cache Pages" has been unchecked the whole time. The "Browser Cache Expiry Time" is still set to 60 from the default install. Perhaps I should set it to 0, even though there should be no caching.

Also, I cleared my browser cache frequently during the testing, and ran System Maintenance->Clear Cache, so I don't know why all of a sudden it worked, but I'll take it! (Or at least it gives me a solution to try.)
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am
Location: Arizona

Re: [Solved] Content Tag (Second Block) Not Working

Post by Dr.CSS »

If you are using the very latest CMSMS then you might want to make sure you have the SERVER time zone set in the config.php as it may make you wait a few hours before any changes/pages/etc. show...
baldguy
Forum Members
Forum Members
Posts: 34
Joined: Mon Jan 28, 2008 4:04 am

Re: [Solved] Content Tag (Second Block) Not Working

Post by baldguy »

I do have $config['timezone'] set, but that's a good thing to keep in mind if I run into this in the future.

Thanks for your suggestions!
User avatar
rotezecke
Power Poster
Power Poster
Posts: 411
Joined: Fri Apr 18, 2008 9:34 pm
Location: Nimbin, Australia

Re: [Solved] Content Tag (Second Block) Not Working

Post by rotezecke »

I am having a similar issue but in my case removing an if statement that wrapped the additional content sort of fixed it.

http://forum.cmsmadesimple.org/viewtopi ... =8&t=62316

all other if statements are working.
baldguy
Forum Members
Forum Members
Posts: 34
Joined: Mon Jan 28, 2008 4:04 am

Re: [Solved] Content Tag (Second Block) Not Working

Post by baldguy »

Ooohh..thanks for that tip!

I don't have Smarty caching set like in your other thread, but it appears to me that the problems I was seeing were caching-related.

You know how sometimes you see a default installation of something, and it has boxes/parameters checked, but they aren't really recognized by the system until you click "save" on the page (even if you don't change anything)? I'm wondering if that's what is happening here. CMSMS installs with those boxes checked, but the site doesn't recognize them until they are saved.

I could be totally wrong on that, but I haven't had any issues since I saved the caching configuration.

We'll see what happens on the next installation with 'if' statements, too! ;)
Post Reply

Return to “CMSMS Core”