|
Home > Archive > Microsoft Content Management Server > November 2004 > placeholder question
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
placeholder question
|
|
| Will_Welch 2004-11-23, 5:57 pm |
| Hello, I'm fairly new to MCMS, though I've built CMS systems from scratch
with C# in the past, I'm trying to get used to the MCMS way of doing things.
I'm wondering what the best practice for handling the following situation
would be. Let's say I have a templated page and on this page I want the
author to be able to link an undetermined number of attachments. When they
add one attachment a new placeholder should appear and allow them to add yet
another, indefinitely. Keep in mind that I'm not interested in a work around
for this specific example but rather a method for handling this type of
situation where the undetermined number of attachments could be anything the
author is adding to a page. Any knowledge on this would be greatly helpful,
TIA.
Will
| |
| Liam Leane 2004-11-24, 7:52 am |
| Hi Will,
Seems to me you have two options here.
First off (and how i would choose to do it) you could create a custom
placeholder control which knows about the difference between different
attachments (say using an XML placeholder definition which maintains a
list of attachments in the placeholder content). In author mode you
show n number of edit boxes to let authors edit existing attachments
or add their own. In published mode you simply write out links to the
attachments in your prefered style. Have a look at
http://msdn.microsoft.com/library/d...rctrls_szbo.asp
it covers creating custom placeholders. With this method it is likely
you would have to do something to get the CMS resource browser to load
on to this correctly (and you could probably pull off the majority of
the code client side to prevent postback issues)
Seccondly you could dynamicly modify the template's placeholder
definition collection. Would work something like this:
- User hits "add" button to add additional attachment (you may want to
consider commiting the changes to the rest of the placeholers at this
point)
- Button event handler fires and uses CmsApplicationContext to
authenticate as a user with access to modify a template
- In CmsApplicationContext you grab the same posting you have in
CmsHttpContext
- in CmsApplicationContext you call the
Posting.Template.CreatePlaceholderDefinition() method passing it an
attachment type
- Likely have to do a redirect back to the same page you are currently
on to keep viewstate happy at this point
Hope that helps
Liam
"Will_Welch" <Will_Welch@discussions.microsoft.com> wrote in message news:<A9F6A2D8-3A91-416A-955C-72DA2CAFA511@microsoft.com>...
> Hello, I'm fairly new to MCMS, though I've built CMS systems from scratch
> with C# in the past, I'm trying to get used to the MCMS way of doing things.
> I'm wondering what the best practice for handling the following situation
> would be. Let's say I have a templated page and on this page I want the
> author to be able to link an undetermined number of attachments. When they
> add one attachment a new placeholder should appear and allow them to add yet
> another, indefinitely. Keep in mind that I'm not interested in a work around
> for this specific example but rather a method for handling this type of
> situation where the undetermined number of attachments could be anything the
> author is adding to a page. Any knowledge on this would be greatly helpful,
> TIA.
>
> Will
| |
| Stefan [MSFT] 2004-11-24, 7:52 am |
| Hi Will,
there are different way to achieve this.
The most elegant would be to have a custom placeholder control that handles
this.
This would allow to achieve this with one single placeholder objects.
A good start for this is mentioned here:
http://blogs.msdn.com/stefan_gossne...2/07/41861.aspx
An alternative would be to implement it as outlined here:
http://www.gotdotnet.com/Community/...d5-0a610ebda849
Cheers,
Stefan.
--
This posting is provided "AS IS" with no warranties, and confers no rights.
MCMS FAQ:
http://download.microsoft.com/downl...6a/MCMS+2002+-+(complete)+FAQ.htm
MCMS Blog: http://blogs.msdn.com/stefan_gossner/category/4983.aspx
MCMS Sample Code:
http://www.gotdotnet.com/community/...t+S
erver
MCMS Whitepapers and other docs:
http://blogs.msdn.com/stefan_gossne...2/07/41859.aspx
--------------------------------
"Will_Welch" <Will_Welch@discussions.microsoft.com> wrote in message
news:A9F6A2D8-3A91-416A-955C-72DA2CAFA511@microsoft.com...
> Hello, I'm fairly new to MCMS, though I've built CMS systems from scratch
> with C# in the past, I'm trying to get used to the MCMS way of doing
things.
> I'm wondering what the best practice for handling the following situation
> would be. Let's say I have a templated page and on this page I want the
> author to be able to link an undetermined number of attachments. When they
> add one attachment a new placeholder should appear and allow them to add
yet
> another, indefinitely. Keep in mind that I'm not interested in a work
around
> for this specific example but rather a method for handling this type of
> situation where the undetermined number of attachments could be anything
the
> author is adding to a page. Any knowledge on this would be greatly
helpful,
> TIA.
>
> Will
>
|
|
|
|
|