<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>HTML Headers</title><link>https://community.telligent.com/community/11/w/developer-training/65060/html-headers</link><description /><dc:language>en-US</dc:language><generator>14.0.0.586 14</generator><item><title>HTML Headers</title><link>https://community.telligent.com/community/11/w/developer-training/65060/html-headers</link><pubDate>Wed, 05 Aug 2020 15:13:08 GMT</pubDate><guid isPermaLink="false">30adcf47-24f4-4e03-bf89-f5bb8e7502b5</guid><dc:creator>Former Member</dc:creator><comments>https://community.telligent.com/community/11/w/developer-training/65060/html-headers#comments</comments><description>Current Revision posted to Developer Training by Former Member on 08/05/2020 15:13:08&lt;br /&gt;
&lt;p&gt;HtmlHeaderExtensions allow a plugin to insert additional headers into response. &amp;nbsp;It does not allow overwriting or editing the existing tags in HTML&amp;nbsp;header.&lt;/p&gt;
&lt;h2&gt;&lt;a id="Creating_an_HtmlHeaderExtension" name="Creating_an_HtmlHeaderExtension"&gt;&lt;/a&gt;Creating an HtmlHeaderExtension&lt;/h2&gt;
&lt;p&gt;To create an HtmlHeaderExtension, implement the [[api-documentation:IHtmlHeaderExtension Plugin Type|IHtmlHeaderExtension]] interface (which requires a reference to Telligent.Evolution.Components.dll). The IHtmlHeaderExtension&amp;nbsp;interface extends &lt;a class="ExistingPageLink" title="Click to view the page titled: Plugins" href="/training/w/developer90/52443.plugins"&gt;IPlugin&lt;/a&gt;&amp;nbsp;to add support extending the HTML&amp;nbsp;header.&lt;/p&gt;
&lt;p&gt;The GetHeader method is used to output the header HTML. &amp;nbsp;It takes a RenderTarget parameter with values of Page and Modal, specifying if the response is for a standard page or a modal page. &amp;nbsp;In our example we want to alter the site banner by adding a border to it, so the GetHeader method will return a style tag to implement this change.&lt;/p&gt;
&lt;h2&gt;&lt;pre class="ui-code" data-mode="csharp"&gt;public string GetHeader(RenderTarget target)
{
    return &amp;quot;&amp;lt;style&amp;gt;.banner.site { border: 3px solid red !important; }&amp;lt;/style&amp;gt;&amp;quot;;
}&lt;/pre&gt;&lt;/h2&gt;
&lt;p&gt;Next we need to identify if the header is cacheable and if the cache should be per user or the same for all users. &amp;nbsp;In our example, the output is always the same so we can cache it and the same cache can be used for all users. &amp;nbsp;The&amp;nbsp;IsCacheable and&amp;nbsp;VaryCacheByUser will be implemented as follows:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="csharp"&gt;public bool IsCacheable
{
    get { return true; }
}

public bool VaryCacheByUser
{
    get { return false; }
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Here is the completed source&amp;nbsp;code for our sample Header Extension:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://community.telligent.com/cfs-file/__key/communityserver-wikis-components-files/00-00-00-12-83/SampleHeaderExtension_2E00_cs"&gt;community.telligent.com/.../SampleHeaderExtension_2E00_cs&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Once this sample is deployed to Verint Community, you should see a border around the site banner:&lt;/p&gt;
&lt;p&gt;&lt;a href="/cfs-file/__key/communityserver-wikis-components-files/00-00-00-12-83/2376.png"&gt;&lt;img alt=" " src="/resized-image/__size/800x240/__key/communityserver-wikis-components-files/00-00-00-12-83/2376.png" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: IHtmlHeaderExtension&lt;/div&gt;
</description></item><item><title>HTML Headers</title><link>https://community.telligent.com/community/11/w/developer-training/65060/html-headers/revision/1</link><pubDate>Thu, 13 Jun 2019 19:23:55 GMT</pubDate><guid isPermaLink="false">30adcf47-24f4-4e03-bf89-f5bb8e7502b5</guid><dc:creator>Ben Tiedt</dc:creator><comments>https://community.telligent.com/community/11/w/developer-training/65060/html-headers#comments</comments><description>Revision 1 posted to Developer Training by Ben Tiedt on 06/13/2019 19:23:55&lt;br /&gt;
&lt;p&gt;HtmlHeaderExtensions allow a plugin to insert additional headers into response. &amp;nbsp;It does not allow overwriting or editing the existing tags in HTML&amp;nbsp;header.&lt;/p&gt;
&lt;h2&gt;&lt;a id="Creating_an_HtmlHeaderExtension" name="Creating_an_HtmlHeaderExtension"&gt;&lt;/a&gt;Creating an HtmlHeaderExtension&lt;/h2&gt;
&lt;p&gt;To create an HtmlHeaderExtension, implement the [[api-documentation:IHtmlHeaderExtension Plugin Type|IHtmlHeaderExtension]] interface (which requires a reference to Telligent.Evolution.Components.dll). The IHtmlHeaderExtension&amp;nbsp;interface extends &lt;a class="ExistingPageLink" title="Click to view the page titled: Plugins" href="/training/w/developer90/52443.plugins"&gt;IPlugin&lt;/a&gt;&amp;nbsp;to add support extending the HTML&amp;nbsp;header.&lt;/p&gt;
&lt;p&gt;The GetHeader method is used to output the header HTML. &amp;nbsp;It takes a RenderTarget parameter with values of Page and Modal, specifying if the response is for a standard page or a modal page. &amp;nbsp;In our example we want to alter the site banner by adding a border to it, so the GetHeader method will return a style tag to implement this change.&lt;/p&gt;
&lt;h2&gt;&lt;pre class="ui-code" data-mode="csharp"&gt;public string GetHeader(RenderTarget target)
{
    return &amp;quot;&amp;lt;style&amp;gt;.banner.site { border: 3px solid red !important; }&amp;lt;/style&amp;gt;&amp;quot;;
}&lt;/pre&gt;&lt;/h2&gt;
&lt;p&gt;Next we need to identify if the header is cacheable and if the cache should be per user or the same for all users. &amp;nbsp;In our example, the output is always the same so we can cache it and the same cache can be used for all users. &amp;nbsp;The&amp;nbsp;IsCacheable and&amp;nbsp;VaryCacheByUser will be implemented as follows:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="csharp"&gt;public bool IsCacheable
{
    get { return true; }
}

public bool VaryCacheByUser
{
    get { return false; }
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Here is the completed source&amp;nbsp;code for our sample Header Extension:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://community.telligent.com/cfs-file/__key/communityserver-wikis-components-files/00-00-00-12-83/SampleHeaderExtension_2E00_cs"&gt;community.telligent.com/.../SampleHeaderExtension_2E00_cs&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Once this sample is deployed to Telligent Community, you should see a border around the site banner:&lt;/p&gt;
&lt;p&gt;&lt;a href="/cfs-file/__key/communityserver-wikis-components-files/00-00-00-12-83/2376.png"&gt;&lt;img src="/resized-image/__size/800x240/__key/communityserver-wikis-components-files/00-00-00-12-83/2376.png" alt=" " /&gt;&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: IHtmlHeaderExtension&lt;/div&gt;
</description></item></channel></rss>