I'm probably not using this functionality as it was intended, but I was hoping that someone could explain what I'm doing wrong!
I created a page in what you could describe as a "templates" folder. This contains a page that I've populated with content that I want to update all over the place by only editing it once.
I then used the copy and paste facility to copy and paste that page elsewhere in my website's hierarchy.
I then edited the page, and in the "shortcut / external link" tab, chose "Fetch data from page in EPiServer CMS".
Now I am accessing that content programmatically, but referencing the PageLink of the copied page. Why, when I change the original page, is the content I'm fetching from the copy not updating as well?
I might've got this bit of functionality completely the wrong way around!
Cheers for any help,
I think the shourtcut/external link only affects how the page is displayed. So if you look at the PageData object in codebehind you will still get the real values of this page.
If you think about it, this makes sense. What if you would like to change the link the page fetches it's data from, then you would have to operate on real values of the page (the PageData object of the actual page, not the linked page).
If you want to get the values displayed, look at the the PageShortcutType and PageShortcutLink properties of the page. If the PageShortCutType property value is PageShortcutType.FetchData, then get the data from the page named in PageShortcutLink instead.
When you use the Fetch data from there is different ways of geting content.
If you use CurrentPage.Property["propertyName"] you will get the template (fetch data from) of the propertyName is empty on current page.
if ypou use CurrentPage.Property.Get("propertyName") you wll always the the property from the current page.
Ah, I was unaware of that. If you have a writable PageData object, however, both CurrentPage.Property["propertyName"] and CurrentPage.Property.Get("propertyName") will return the "local" page values.
Fantastic, that explains it! Thanks very much chaps.