I have created a custom page layout in a SharePoint 2013 Publishing website.
On this page I've added a web part snippet pointing to a list on the same site.
This list contains a numeric column called KBID which holds the unique ID of a publishing page.
In short, I want every page to display my list viewing only the corresponding KBID's.
At the moment, my web part snippet looks like this:
<!--CS: Start Web Part Zone Snippet-->
<!--SPM:<%@Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"%>-->
<div xmlns:ie="ie">
<!--MS:<WebPartPages:WebPartZone runat="server" ID="xaab78734df6f4f649d928272932d54fd" AllowLayoutChange="False" AllowPersonalization="False" FrameType="TitleBarOnly" Orientation="Vertical">-->
<!--MS:<ZoneTemplate>-->
<!--CS: Start Contacts Snippet-->
<!--SPM:<%@Register Tagprefix="ab9da2256" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>-->
<!--MS:<ab9da2256:XsltListViewWebPart runat="server" ViewFlag="" ViewSelectorFetchAsync="False" InplaceSearchEnabled="False" ServerRender="False" ClientRender="False" InitialAsyncDataFetch="False" WebId="00000000-0000-0000-0000-000000000000" IsClientRender="False" GhostedXslLink="main.xsl" ViewGuid="" EnableOriginalValue="False" ViewContentTypeId="" ListName="{9E243D58-72C3-41C4-B21F-7496563B7238}" ListId="9e243d58-72c3-41c4-b21f-7496563b7238" PageSize="-1" UseSQLDataSourcePaging="True" DataSourceID="" ShowWithSampleData="False" AsyncRefresh="False" ManualRefresh="False" AutoRefresh="False" AutoRefreshInterval="60" Title="Contacts" FrameType="Standard" SuppressWebPartChrome="False" Description="" IsIncluded="True" ZoneID="" PartOrder="0" FrameState="Normal" AllowRemove="True" AllowZoneChange="True" AllowMinimize="True" AllowConnect="True" AllowEdit="True" AllowHide="True" IsVisible="True" CatalogIconImageUrl="/_layouts/15/images/itgen.png?rev=23" TitleUrl="/sites/publishing/Lists/Contacts" DetailLink="/sites/publishing/Lists/Contacts" HelpLink="" HelpMode="Modeless" Dir="Default" PartImageSmall="" MissingAssembly="Cannot import this Web Part." PartImageLarge="/_layouts/15/images/itgen.png?rev=23" IsIncludedFilter="" ExportControlledProperties="True" ConnectionID="00000000-0000-0000-0000-000000000000" ID="g_14cf4b1c_b9cd_4382_9c93_8f7368fda8c4" ChromeType="TitleAndBorder" ExportMode="All" __MarkupType="vsattributemarkup" __WebPartId="{14cf4b1c-b9cd-4382-9c93-8f7368fda8c4}" __AllowXSLTEditing="true" WebPart="true" Height="" Width="">-->
<!--PS: Start of READ-ONLY PREVIEW (do not modify)--><div class="ms-webpart-chrome ms-webpart-chrome-fullWidth "><div WebPartID="00000000-0000-0000-0000-000000000000" HasPers="true" id="WebPartg_14cf4b1c_b9cd_4382_9c93_8f7368fda8c4" width="100%" class="noindex " OnlyForMePart="true" allowDelete="false" style=""><div id="WebPartContent">The DataFormWebPart does not provide a design-time preview.</div><div class="ms-clear"></div></div></div><!--PE: End of READ-ONLY PREVIEW-->
<!--MS:<ParameterBindings>-->
<!--MS:<ParameterBinding Name="dvt_sortdir" Location="Postback;Connection">--><!--ME:</ParameterBinding>-->
<!--MS:<ParameterBinding Name="dvt_sortfield" Location="Postback;Connection">--><!--ME:</ParameterBinding>-->
<!--MS:<ParameterBinding Name="dvt_startposition" Location="Postback" DefaultValue="">--><!--ME:</ParameterBinding>-->
<!--MS:<ParameterBinding Name="dvt_firstrow" Location="Postback;Connection">--><!--ME:</ParameterBinding>-->
<!--MS:<ParameterBinding Name="OpenMenuKeyAccessible" Location="Resource(wss,OpenMenuKeyAccessible)">--><!--ME:</ParameterBinding>-->
<!--MS:<ParameterBinding Name="open_menu" Location="Resource(wss,open_menu)">--><!--ME:</ParameterBinding>-->
<!--MS:<ParameterBinding Name="select_deselect_all" Location="Resource(wss,select_deselect_all)">--><!--ME:</ParameterBinding>-->
<!--MS:<ParameterBinding Name="idPresEnabled" Location="Resource(wss,idPresEnabled)">--><!--ME:</ParameterBinding>-->
<!--MS:<ParameterBinding Name="NoAnnouncements" Location="Resource(wss,noXinviewofY_LIST)">--><!--ME:</ParameterBinding>-->
<!--MS:<ParameterBinding Name="NoAnnouncementsHowTo" Location="Resource(wss,noXinviewofY_DEFAULT)">--><!--ME:</ParameterBinding>-->
<!--ME:</ParameterBindings>-->
<!--MS:<DataFields>--><!--ME:</DataFields>-->
<!--MS:<XmlDefinition>-->
<!--MS:<View Name="{C9F57178-3F34-4293-B8DD-12AC5210D6DB}" MobileView="TRUE" Type="HTML" Hidden="TRUE" DisplayName="" Url="/sites/publishing/SitePages/sitepage1.aspx" Level="1" BaseViewID="1" ContentTypeID="0x" ImageUrl="/_layouts/15/images/generic.png?rev=23">-->
<!--MS:<Query>-->
<!--MS:<OrderBy>-->
<!--MS:<FieldRef Name="LinkTitle">--><!--ME:</FieldRef>-->
<!--ME:</OrderBy>-->
<!--MS:<Where>-->
<!--MS:<Eq>-->
<!--MS:<FieldRef Name="KBID">--><!--ME:</FieldRef>-->
<!--MS:<Value Type="Number">--><!--SPM:<SharePoint:FieldValue FieldName="ID" runat="server" id="idb" ControlMode="display" />--><!--ME:</Value>-->
<!--ME:</Eq>-->
<!--ME:</Where>-->
<!--ME:</Query>-->
<!--MS:<ViewFields>-->
<!--MS:<FieldRef Name="LinkTitle">--><!--ME:</FieldRef>-->
<!--MS:<FieldRef Name="Job_x0020_Title">--><!--ME:</FieldRef>-->
<!--MS:<FieldRef Name="Phone">--><!--ME:</FieldRef>-->
<!--MS:<FieldRef Name="GSM">--><!--ME:</FieldRef>-->
<!--MS:<FieldRef Name="Fax">--><!--ME:</FieldRef>-->
<!--MS:<FieldRef Name="E_x002d_mail">--><!--ME:</FieldRef>-->
<!--MS:<FieldRef Name="Website">--><!--ME:</FieldRef>-->
<!--MS:<FieldRef Name="Remarks">--><!--ME:</FieldRef>-->
<!--ME:</ViewFields>-->
<!--MS:<RowLimit Paged="TRUE">--><!--SPM:10--><!--ME:</RowLimit>-->
<!--MS:<Aggregations Value="Off">--><!--ME:</Aggregations>-->
<!--MS:<JSLink>--><!--SPM:clienttemplates.js--><!--ME:</JSLink>-->
<!--MS:<XslLink Default="TRUE">--><!--SPM:main.xsl--><!--ME:</XslLink>-->
<!--MS:<Toolbar Type="Standard">--><!--ME:</Toolbar>-->
<!--ME:</View>-->
<!--ME:</XmlDefinition>-->
<!--ME:</ab9da2256:XsltListViewWebPart>-->
<!--CE: End Contacts Snippet-->
<!--ME:</ZoneTemplate>-->
<!--ME:</WebPartPages:WebPartZone>-->
</div>
<!--CE: End Web Part Zone Snippet-->
and I'm pretty sure that I'm doing something wrong here:
<!--MS:<Value Type="Number">--><!--SPM:<SharePoint:FieldValue FieldName="ID" runat="server" id="idb" ControlMode="display" />--><!--ME:</Value>-->
I've tried using this variable (pointing to the ID displayed on the page) but that won't work either:
<!--SPM:[PageFieldValue:ID]-->
Edit 25/08: I found out that everything I've been filling in so far doesn't return any value, resulting in only returning the list items with KBID 0 (or null/void).
The problem seems that I can't pass a pagefield to a webpart on the same page. I want to pass the Field ID of the Pagelibrary to the listwebpart. Can this be done somehow (perhaps with a global variable?). Can someone show me the syntax to do this?
Please ask more information if something isn't clear.