Page 1 of 1
Dynamically adding new content blocks
Posted: Tue Aug 18, 2009 6:08 pm
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.
Re: Dynamically adding new content blocks
Posted: Tue Aug 18, 2009 7:50 pm
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
Re: Dynamically adding new content blocks
Posted: Tue Aug 18, 2009 9:44 pm
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...
Re: Dynamically adding new content blocks
Posted: Mon Aug 31, 2009 7:27 pm
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}
Re: Dynamically adding new content blocks
Posted: Tue Sep 01, 2009 5:57 pm
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.
Re: Dynamically adding new content blocks
Posted: Tue Sep 01, 2009 11:25 pm
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.
Re: Dynamically adding new content blocks
Posted: Tue Sep 01, 2009 11:30 pm
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.
Re: Dynamically adding new content blocks
Posted: Thu Sep 03, 2009 5:14 am
by pupppet
CGSimpleSmarty's get_children function looks just about perfect, except it only seems to output the word "Array". (in v.1.63)