Content Block "Default" Text

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
intomalakas
New Member
New Member
Posts: 3
Joined: Thu Jul 12, 2012 12:21 pm

Content Block "Default" Text

Post by intomalakas »

Hello community,

I know there is a "default" keyword for content blocks, which allows you to enter the default text... this is exactly what I'm after, but it won't let me add...

{content block="whatever" default='<div class="hi">Hello</div>'}

It doesn't matter that I've changed the double quotes to single... I can't insert double quote content in there...
Is there an effective way to have default HTML content?

Thanks!
User avatar
DIGI3
Dev Team Member
Dev Team Member
Posts: 1803
Joined: Wed Feb 25, 2009 4:25 am

Re: Content Block "Default" Text

Post by DIGI3 »

Doesn't seem like that method will work. You'd be better off testing to see if the block is emtpy, and if so, outputting the div:

{content block=whatever assign=foo}{if $foo == ''}<div class="hi">Hello</div>{/if}
User avatar
Rolf
Power Poster
Power Poster
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Contact:

Re: Content Block "Default" Text

Post by Rolf »

Hello intomalakas

Try something like this:

Code: Select all

{capture assign=foo}<div class="hi">Hello</div>{/capture]
{content block="whatever" default=$foo}
Grtz. Rolf
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
intomalakas
New Member
New Member
Posts: 3
Joined: Thu Jul 12, 2012 12:21 pm

Re: Content Block "Default" Text

Post by intomalakas »

Thanks to the both of you for your prompt replies.
Both solutions are, indeed correct in the context they are for.

I should clarify my requirements a little more, sorry I failed to mention that I would like this default content to first appear in the content editor box in the admin section.

That is, when I create a new page, I would like the content blocks to be pre-populated with content that I pass in through the "default" parameter.

I tried the above, but it did not work.

Is this at all possible?
User avatar
Rolf
Power Poster
Power Poster
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Contact:

Re: Content Block "Default" Text

Post by Rolf »

Yeah, I understand what you mean. I hoped with my suggestion it should work.
But I talked to Calguy just now and it does't work this way, I'm afraid. We have to clarify this in the helptext...

{content block="name" default=$foo} is NOT valid.
{content block="name" default="<p>Default text</p>"} is the only correct methode, but has its limitations...
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
intomalakas
New Member
New Member
Posts: 3
Joined: Thu Jul 12, 2012 12:21 pm

Re: Content Block "Default" Text

Post by intomalakas »

Yeah, looks like it can't be done... shame though.

I'll take a stab at making a module or some sort of alteration to make this work for myself. If I succeed, I'll let you know.
Post Reply

Return to “CMSMS Core”