Page 1 of 1

Content Block "Default" Text

Posted: Thu Jul 12, 2012 12:25 pm
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!

Re: Content Block "Default" Text

Posted: Fri Jul 13, 2012 2:42 pm
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}

Re: Content Block "Default" Text

Posted: Fri Jul 13, 2012 2:51 pm
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

Re: Content Block "Default" Text

Posted: Fri Jul 13, 2012 7:30 pm
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?

Re: Content Block "Default" Text

Posted: Fri Jul 13, 2012 8:03 pm
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...

Re: Content Block "Default" Text

Posted: Sat Jul 14, 2012 5:20 am
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.