| Stefan [MSFT] 2004-02-23, 5:35 am |
| Hi Morten,
there are two ways to achieve this:
1) using a user web control or a server control rather than a cms
placeholder object:
the control needs to pick up the Posting Collection in the channel
(channel.Postings) and sort them (e.g. SortByLastChangedDate or
SortByLastModified).
Then pick the first posting in the collection (channel.Postings[0]) and
extract the Url to the image
string Url = ((ImagePlaceholder)(posting.Placeholders["ImagePh"])).Src;
Benefit: only one place has the actual URL - content is deployed
dynamically - always accurate content
A server control that can be used as a starter for your developments is the
following:
http://www.gotdotnet.com/Community/...b9-8b395b722f24
This version uses a hard coded posting reference but you could replace this
with the logic above.
2) using a CMS placeholder object and a CMS workflow event to populate the
postings
Here you would have to copy the URL to the ImagePlaceholder on the front
page from within a workflow event.
This can be done in the CmsPosting_Changing event (e.g.) or in the
CmsPosting_PlaceholderPropertyChanging event (you need to check for the
right placeholder).
You need to get a reference to the front page (e.g.) using the searches
object and update the Src property of the placeholder object.
Cheers,
Stefan.
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"Morten Petterĝe" <morten@imano.nospam (remove the spam, leave the no)>
wrote in message news:eULO72h#DHA.452@TK2MSFTNGP11.phx.gbl...
> Hi
>
> I want to promote the latest posting in certain channels on my front page.
I
> have created a placeholder for an image that I want to retrieve from the
> latest posting in another channel.
>
> Is there a code sample out there that shows me how to do this?
>
>
> Thanks,
>
> Morten
>
>
|