4
votes

I am using the Dynamic Placeholders from Fortis, but need to setup a page template where the Dynamic Placeholders contains renderings. I am setting the page template up, by setting layout detail on the standard values of the page template.

I have been unable to succeed in this, since the dynamic placeholder is postfixed by a GUID which is generated. Is there a way to predict this GUID? According to the documentation, the GUID is generated using the following logic:

Dynamic Placeholders simply use the rendering ID to create a unique placeholder name. If more than one dynamic placeholder with the same name is in a rendering it will also append on an incrementing number

I tried another approach, by using a home brewed dynamic placeholder library, which just prepended the dynamic placeholder with a sequential number, e.g. row1, row2, row3. But this approach makes the content editors unable to move rows in the experience editor, since the content inside the row is tied to a fixed number, which changes when the rows are moved.

1
I haven't worked much with Dynamic Placeholders yet... But for this scenario that you're describing, couldn't you just use normal placeholders?Snapper
If I use a normal placeholder, the content put into, eg. /body/row/, will be displayed in all rows on the page. Dynamic placeholders is used to remedy this, enabling us to use the same rendering, containing a placeholder, multiple times on the same page.AndreasPK
Could you please give more info why you can't set the layout on standard values? We've been using dynamic placeholders extensively on our projects and didn't had any issues with dynamic generation.Jack Spektor
The reason I cannot set the layout on standard values is, that I do not know the GUID which the placeholder will be named by. I should say, that I found a solution to this, by opening the __Standard Values in the experience editor.AndreasPK

1 Answers

2
votes

As this question have been answered on sitecore.stackexchange.com, I want to bring the answer here as well. Big credit to Richard Seal and Thomas D.

Thomas D: You can try to open the standard values item with the Experience Editor and add the renderings you like.

Richard Seal: This is an alternative to the method mentioned by Thomas D.

The Fortis solution uses the UID for the rendering attached to the placeholder key that you enter. You can get this by changing to Raw Values view and copying the xml out of the renderings or final renderings field.

Find the rendering that contains your placeholder. There will be an xml element like this:

<r id="{CA76EB6F-2934-4B8A-BB6A-508A8E44A7C5}" 
   ph="body" 
   uid="{0FD41EBD-43CF-4647-8A0F-F1F1D2E00CCD}" />

There may be other fields too. The 2 that are important are id, which is the item id of your rendering item and uid, this is the unique rendering id that is added to your placeholder key.

The key is built like this: string.Format("{0}_{1}", placeholderName, renderingId);

So if you have a placeholder key called title, the key for the above xml snippet would be: title_{0FD41EBD-43CF-4647-8A0F-F1F1D2E00CCD}