In the first step, let's create the Authoring and Publishing site collections.
Authoring site collection allows the authors to manage their website content while Publishing site collection reviews the content from the authoring site collection.
Open Authoring site collection.
Create a list named Breaking News, which contains title and description.


Let’s create a control and a template to display the items.
- Control Template
It provides the overall structure (layout) of HTML elements along with start and end tags. - Item Template
It renders the items from the list, and contains text and pictures.
Now, let's create two display templates to display a jQuery News Ticker control and a jQuery News Ticker item.
Code – News Control Template
Upload the script and CSS into style library.

Add the scripts and CSS into Control template.
- <script>
- $includeScript(this.url, "~sitecollection/Style%20Library/news%20ticker/jquery.min.js");
- $includeScript(this.url, "~sitecollection/Style%20Library/news%20ticker/ticker.js");
- $includeCSS(this.url, "~sitecollection/Style%20Library/news%20ticker/ticker.css");
- </script>
Now, let's define HTML layout to Control Template.
- <div class="ticker-container">
- <div class="ticker-caption">
- <p>Breaking News</p>
- </div>
- <ul>
- _#= ctx.RenderItems(ctx) =#_
- </ul>
- </div>
The full code looks, as shown below.
- <html xmlns:mso="urn:schemas-microsoft-com:office:office" xmlns:msdt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882">
- <head>
- <title>News Control</title>
- <!--[if gte mso 9]><xml>
- <mso:CustomDocumentProperties>
- <mso:TemplateHidden msdt:dt="string">0</mso:TemplateHidden>
- <mso:MasterPageDescription msdt:dt="string">Display a News Control</mso:MasterPageDescription>
- <mso:ContentTypeId msdt:dt="string">0x0101002039C03B61C64EC4A04F5361F385106601</mso:ContentTypeId>
- <mso:TargetControlType msdt:dt="string">;#SearchResults;#Content Web Parts;#</mso:TargetControlType>
- <mso:HtmlDesignAssociated msdt:dt="string">1</mso:HtmlDesignAssociated>
- <mso:HtmlDesignConversionSucceeded msdt:dt="string">True</mso:HtmlDesignConversionSucceeded>
- <mso:CrawlerXSLFile msdt:dt="string"></mso:CrawlerXSLFile>
- <mso:HtmlDesignPreviewUrl msdt:dt="string"></mso:HtmlDesignPreviewUrl>
- <mso:HtmlDesignStatusAndPreview msdt:dt="string">http://technologygeeks/sites/publishing/_catalogs/masterpage/Display Templates/Content Web Parts/banner/bannercontrol.html, Conversion successful.</mso:HtmlDesignStatusAndPreview>
- </mso:CustomDocumentProperties>
- </xml><![endif]-->
- </head>
- <body>
- <script>
- $includeScript(this.url, "~sitecollection/Style%20Library/news%20ticker/jquery.min.js");
- $includeScript(this.url, "~sitecollection/Style%20Library/news%20ticker/ticker.js");
- $includeCSS(this.url, "~sitecollection/Style%20Library/news%20ticker/ticker.css");
- </script>
- <div>
- <!--#_if (!$isNull(ctx.ClientControl) && !$isNull(ctx.ClientControl.shouldRenderControl) && !ctx.ClientControl.shouldRenderControl()){return "";}
- ctx.ListDataJSONGroupsKey = "ResultTables";
- ctx["CurrentItems"] = ctx.ListData.ResultTables[0].ResultRows;
- var siteURL = SP.PageContextInfo.get_siteAbsoluteUrl();
- AddPostRenderCallback(ctx, function() {
- $.getScript(siteURL + "");
- });
- _#-->
- <div class="ticker-container">
- <div class="ticker-caption">
- <p>Breaking News</p>
- </div>
- <ul>
- _#= ctx.RenderItems(ctx) =#_
- </ul>
- </div>
- </div>
- </body>
- </html>












Nicholas GrochalPosted May 3, 2018, 10:38 AM
Hey, I seem to be lost on step: "Add the scripts and CSS into Control template. " Sorry I could use more help....