Page 1 of 1

Site Admin > Page Defaults > Content :: Define Template-specific Default Content

Posted: Mon Jun 09, 2008 6:36 pm
by ewebarchitecture
Hi. I'm running CMS Made Simple 1.2.5. I'm using PHP 5.0.4, and MySQL 4.1.20, and this is all working with Apache/2.0.54 running on Linux 2.6.11. I have created three user-defined templates which invoke the FCKeditorX editor. My FCKeditorX editor is version 1.1.0.

The user-defined templates are made up of several content blocks I have defined in Content > Global Content Blocks, and the structure for the site is outlined below:

Section Header 1 (uses Template 1)

Page 1-a
Page 1-b
Page 1-c

Section Header 2 (uses Template 2)

Page 2-a
Page 2-b
Page 2-c

Section Header 3 (uses Template 3)

Page 3-a
Page 3-b
Page 3-c

I see under Site Admin > Page Defaults there is an option to set Content, but I would like to specify default content that may be adapted for each section/template (as opposed to the whole site).

In other words, pages 1-a, 1-b and 1-c in Section 1 (Template 1) would all have the same default content to be changed as needed. Section 2 (Template 2) pages, 2-a, 2-b and 2-c, would also all have the same default content, but this default content will be different from the default content for Section 1 pages. Similarly for Section 3 (Template 3).

The gist of what I would like to do is insert logic in each template which runs thusly:

{ content defaultvalue = template_content_block }

where template_content_block is a content block I've defined in Content > Global Content Blocks (or I could just as easily cram into a PHP include file), and there will be three of these -- one for each template.

I've searched the forum and online documentation (I'd be really surprised if someone else hasn't already asked about this), but I'll be darned if I can find the procedure and/or syntax outlined for how to do this.

I'm a Web programmer by trade and am familiar with proprietary code usage in general, but I'm new to CMSMS. I sure hope someone can help point me in the right direction.

Thanks,
Mattie

Re: Site Admin > Page Defaults > Content :: Define Template-specific Default Con

Posted: Mon Jun 09, 2008 7:55 pm
by calguy1000
to specify default content for anything but the default content block you can use something like this (in the template).  (not I haven't tested yet, but it should be close).

Code: Select all

{content block='stuff' assign='stuff'}
{if empty($stuff)}
  put default content here, or use a gcb or something
{else}
  {$stuff}
{/if}
for the default content block you can try something like:
a) go to the global settings and specify the default content as  'notset'
b) use code like this in your template

Code: Select all

{content assign='dfltcontent'}
{if $dfltcontent != 'notset'}
  put content here, or use a gcb or something
{else}
  {$dfltcontent}
{/if}

Re: Site Admin > Page Defaults > Content :: Define Template-specific Default Content

Posted: Tue Jun 10, 2008 8:04 am
by epo
I have had an identical query I raised in a different part of the forum (sorry!). The mechanism here is a display trick which will provide default text to show on the web page if a given content block is empty.

I have been looking for something similar at the template level. What I want is boilerplate text to provide e.g. placeholders to insert headings and text, these can be filled in on the page when the template is used to create a new page. Site admin > page defaults provides (I assume) just this for the content block, what I need is a page default for each content block defined in a template.

Does this make sense?

Ed

Re: Site Admin > Page Defaults > Content :: Define Template-specific Default Con

Posted: Tue Jun 10, 2008 2:44 pm
by ewebarchitecture
Thanks for the pointer, CalGuy. Your suggestion is similar to the "Passing page content as a parameter" (http://wiki.cmsmadesimple.org/index.php ... fined_Tags). I had trouble with the syntax in this documentation, but hopefully your input will clear things up.

Stay tuned, and I'll let you know how it goes, Ed,
Mattie

Re: Site Admin > Page Defaults > Content :: Define Template-specific Default Con

Posted: Tue Jun 10, 2008 2:51 pm
by calguy1000
This functionality doesn't exist (yet) but will be in 2.0
I have been looking for something similar at the template level. What I want is boilerplate text to provide e.g. placeholders to insert headings and text, these can be filled in on the page when the template is used to create a new page. Site admin > page defaults provides (I assume) just this for the content block, what I need is a page default for each content block defined in a template.

Re: Site Admin > Page Defaults > Content :: Define Template-specific Default Con

Posted: Fri Aug 29, 2008 1:48 am
by Dr.CSS
Thank You calguy1000 this works great! :)