Dynamically adding new content blocks

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
pupppet
Forum Members
Forum Members
Posts: 13
Joined: Fri Jul 17, 2009 11:02 pm

Dynamically adding new content blocks

Post by pupppet »

Is it possible to create new content blocks from within the edit page interface?  For example let's say I have a portfolio page, each portfolio item has a title, description, and image.  In the template I could have something like this:

Code: Select all

{content block='title' oneline='true'}
{content block='description'}
{content block='Image'}
This of course would only support a single portfolio item, but let's say I would like the ability to add more while editing the page.  I know I can add a number of these in the template for a set limit of portfolio items, or go the custom content dropdown route to create a boilerplate for use within a single editor, but I'm hoping for an option that's more flexible and less prone to user error.  Btw I'm sure there are modules that support something like this in the context of a portfolio, I'm just using a portfolio as an example.  I'm really just looking for the ability to duplicate a set of content blocks while editing a page.
JeremyBASS

Re: Dynamically adding new content blocks

Post by JeremyBASS »

The only way to do what your asking would be to change the template IIRC... that would simulate the effect of dynamically addin those new content blocks... Hope that helps...

Cheers
Jeremy
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: Dynamically adding new content blocks

Post by Dr.CSS »

If you are editing a page there is no way to add {content block="somename"} and you can't do this in the template dynamically like {content block={$page_alias"} as the alias isn't assigned till you submit the new page...
pupppet
Forum Members
Forum Members
Posts: 13
Joined: Fri Jul 17, 2009 11:02 pm

Re: Dynamically adding new content blocks

Post by pupppet »

Ok how about this- I have a portfolio template with the custom fields-

Code: Select all

{content block='title' oneline='true'}
{content block='description'}
{content block='Image'}
I then add a new page for each portfolio item.  Is there any way for the parent page to somehow iterate through the individual childpages, importing their content into the parent page, i.e.

Code: Select all

{Start get content from childpages of ID 12}

  {content block='title' oneline='true'}
  {content block='description'}
  {content block='Image'}

{End}
Pierre M.

Re: Dynamically adding new content blocks

Post by Pierre M. »

Hello,

I don't understand your {Start...End} block. Nevermind.

May be a module or some UDTs could help doing what you are trying but I think (without having reviewed CMSms code) that "Dynamically adding new content blocks" is a Bad Idea(TM) because it doesn't use CMSms how it is guaranteed in the long run.

If you want more structured information (catalogs, products, lists/items...) than editorial content (traditional HTML pages...) I suggest some other solutions than content_blocks be tried : FormBuilder/Browser, Products, directories, reservations... (search modules).

Maintained modules may last longer than audacious hacks.

Pierre M.
pupppet
Forum Members
Forum Members
Posts: 13
Joined: Fri Jul 17, 2009 11:02 pm

Re: Dynamically adding new content blocks

Post by pupppet »

Pierre M. wrote: Maintained modules may last longer than audacious hacks.
This wouldn't be an audacious hack, the ability to iterate through specific blocks of content found in children of X parent would be very useful, and would negate the need for many of the existing modules that only serve a single purpose.

The menuing system already does what I'm suggesting for the most part (as in you can draw from the "Menu Text" fields in children of X parent), I'm simply suggesting the added ability to draw from other content blocks associated with a page.  I'm sure it's already possible, I'm simply not a dev.
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: Dynamically adding new content blocks

Post by calguy1000 »

pupppet wrote: Ok how about this- I have a portfolio template with the custom fields-

Code: Select all

{content block='title' oneline='true'}
{content block='description'}
{content block='Image'}
I then add a new page for each portfolio item.  Is there any way for the parent page to somehow iterate through the individual childpages, importing their content into the parent page, i.e.

Code: Select all

{Start get content from childpages of ID 12}

  {content block='title' oneline='true'}
  {content block='description'}
  {content block='Image'}

{End}
Use the CGSimpleSmarty module.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
pupppet
Forum Members
Forum Members
Posts: 13
Joined: Fri Jul 17, 2009 11:02 pm

Re: Dynamically adding new content blocks

Post by pupppet »

CGSimpleSmarty's get_children function looks just about perfect, except it only seems to output the word "Array". (in v.1.63)
Post Reply

Return to “CMSMS Core”