<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Hiding Empty Publishing Fields in a Page Layout</title>
	<atom:link href="http://corypeters.net/2008/06/hiding-empty-publishing-fields-in-a-page-layout/feed/" rel="self" type="application/rss+xml" />
	<link>http://corypeters.net/2008/06/hiding-empty-publishing-fields-in-a-page-layout/</link>
	<description>Adventures with SharePoint</description>
	<lastBuildDate>Fri, 27 Jan 2012 02:06:01 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Ryan M</title>
		<link>http://corypeters.net/2008/06/hiding-empty-publishing-fields-in-a-page-layout/comment-page-1/#comment-70</link>
		<dc:creator>Ryan M</dc:creator>
		<pubDate>Wed, 30 Sep 2009 17:38:58 +0000</pubDate>
		<guid isPermaLink="false">http://cbpeters.wordpress.com/2008/06/11/hiding-empty-publishing-fields-in-a-page-layout/#comment-70</guid>
		<description>This line was omitted:
 Import Namespace=&quot;Microsoft.SharePoint&quot;</description>
		<content:encoded><![CDATA[<p>This line was omitted:<br />
 Import Namespace=&#8221;Microsoft.SharePoint&#8221;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ryan M</title>
		<link>http://corypeters.net/2008/06/hiding-empty-publishing-fields-in-a-page-layout/comment-page-1/#comment-69</link>
		<dc:creator>Ryan M</dc:creator>
		<pubDate>Wed, 30 Sep 2009 17:38:21 +0000</pubDate>
		<guid isPermaLink="false">http://cbpeters.wordpress.com/2008/06/11/hiding-empty-publishing-fields-in-a-page-layout/#comment-69</guid>
		<description>I put this directive on the page:


I also have the same question about the item variable.</description>
		<content:encoded><![CDATA[<p>I put this directive on the page:</p>
<p>I also have the same question about the item variable.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: George</title>
		<link>http://corypeters.net/2008/06/hiding-empty-publishing-fields-in-a-page-layout/comment-page-1/#comment-25</link>
		<dc:creator>George</dc:creator>
		<pubDate>Wed, 18 Mar 2009 17:05:28 +0000</pubDate>
		<guid isPermaLink="false">http://cbpeters.wordpress.com/2008/06/11/hiding-empty-publishing-fields-in-a-page-layout/#comment-25</guid>
		<description>where is the variable &quot;item&quot; initialized becuase I get error CS0103</description>
		<content:encoded><![CDATA[<p>where is the variable &#8220;item&#8221; initialized becuase I get error CS0103</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: George</title>
		<link>http://corypeters.net/2008/06/hiding-empty-publishing-fields-in-a-page-layout/comment-page-1/#comment-24</link>
		<dc:creator>George</dc:creator>
		<pubDate>Fri, 13 Mar 2009 12:43:38 +0000</pubDate>
		<guid isPermaLink="false">http://cbpeters.wordpress.com/2008/06/11/hiding-empty-publishing-fields-in-a-page-layout/#comment-24</guid>
		<description>Hi Cory,
Using the code you have provided I get this error:CS0246: The type or namespace name &#039;SPListItem&#039; could not be found (are you missing a using directive or an assembly reference?)

What do I do about this?</description>
		<content:encoded><![CDATA[<p>Hi Cory,<br />
Using the code you have provided I get this error:CS0246: The type or namespace name &#8216;SPListItem&#8217; could not be found (are you missing a using directive or an assembly reference?)</p>
<p>What do I do about this?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Cory</title>
		<link>http://corypeters.net/2008/06/hiding-empty-publishing-fields-in-a-page-layout/comment-page-1/#comment-23</link>
		<dc:creator>Cory</dc:creator>
		<pubDate>Thu, 12 Mar 2009 20:06:11 +0000</pubDate>
		<guid isPermaLink="false">http://cbpeters.wordpress.com/2008/06/11/hiding-empty-publishing-fields-in-a-page-layout/#comment-23</guid>
		<description>Hey George, 

Here is one option...

&lt;%
if (FieldHasValue(item, &quot;PublishingContent&quot;))
Response.Write(&quot;&lt;h3&gt;&quot;);
%&gt;
&lt;publishingwebcontrols:richhtmlfield id=&quot;PublishingContent1&quot; fieldname=&quot;PublishingContent&quot; runat=&quot;server&quot;&gt;&lt;/publishingwebcontrols:richhtmlfield&gt;
&lt;%
if (FieldHasValue(item, &quot;PublishingContent&quot;))
Response.Write(&quot;&lt;/h3&gt;&quot;);
%&gt;

This way the &lt;h3&gt; tag is only rendered around the content if the field does have a value.</description>
		<content:encoded><![CDATA[<p>Hey George, </p>
<p>Here is one option&#8230;</p>
<p>< %<br />
if (FieldHasValue(item, "PublishingContent"))<br />
Response.Write("&lt;h3>&#8220;);<br />
%><br />
&lt;publishingwebcontrols:richhtmlfield id=&#8221;PublishingContent1&#8243; fieldname=&#8221;PublishingContent&#8221; runat=&#8221;server&#8221;>&lt;/publishingwebcontrols:richhtmlfield><br />
< %<br />
if (FieldHasValue(item, "PublishingContent"))<br />
Response.Write("&lt;/h3>&#8220;);<br />
%></p>
<p>This way the &lt;h3> tag is only rendered around the content if the field does have a value.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: George</title>
		<link>http://corypeters.net/2008/06/hiding-empty-publishing-fields-in-a-page-layout/comment-page-1/#comment-22</link>
		<dc:creator>George</dc:creator>
		<pubDate>Thu, 12 Mar 2009 19:07:48 +0000</pubDate>
		<guid isPermaLink="false">http://cbpeters.wordpress.com/2008/06/11/hiding-empty-publishing-fields-in-a-page-layout/#comment-22</guid>
		<description>Hi Cory,

I tried to follow what you have presented here and I am a little confused...I&#039;m new to sharepoint but I&#039;m an experienced web developer (well on the front end of things) I know CSS and XHTML and javascript. 

How is the H3 tag getting populated if the publish control is not in it?

Well anyway I have the following code in my page layout:




 
I do not want the H2 tag to be present if it is empty...As you know it will cause spacing issues. How do I do that using your code?

I also have the following code on my page and I do not want the whole DL tag outputting if there is no content in both the DT and DD tags. How do I use your code for that? 


						
																										
							
						


Thank you ahead of time :)</description>
		<content:encoded><![CDATA[<p>Hi Cory,</p>
<p>I tried to follow what you have presented here and I am a little confused&#8230;I&#8217;m new to sharepoint but I&#8217;m an experienced web developer (well on the front end of things) I know CSS and XHTML and javascript. </p>
<p>How is the H3 tag getting populated if the publish control is not in it?</p>
<p>Well anyway I have the following code in my page layout:</p>
<p>I do not want the H2 tag to be present if it is empty&#8230;As you know it will cause spacing issues. How do I do that using your code?</p>
<p>I also have the following code on my page and I do not want the whole DL tag outputting if there is no content in both the DT and DD tags. How do I use your code for that? </p>
<p>Thank you ahead of time <img src='http://corypeters.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Cory</title>
		<link>http://corypeters.net/2008/06/hiding-empty-publishing-fields-in-a-page-layout/comment-page-1/#comment-10</link>
		<dc:creator>Cory</dc:creator>
		<pubDate>Tue, 04 Nov 2008 11:10:26 +0000</pubDate>
		<guid isPermaLink="false">http://cbpeters.wordpress.com/2008/06/11/hiding-empty-publishing-fields-in-a-page-layout/#comment-10</guid>
		<description>Hey Andy,

Sorry about that, looks like some additional formatting was adding when I did my migration to my new blog, very strange. I&#039;ll get this updated asap.

This Regex is designed to remove empty HTML tags so that a control that only holds &lt;div&gt;&lt;/div&gt; or &lt;br/&gt; will be validated as empty... but as you pointed out it&#039;s broken, I&#039;m not sure what happened with the migration as the regex above doesn&#039;t even look remotely like what was originally there. Hope to have your fix shortly.</description>
		<content:encoded><![CDATA[<p>Hey Andy,</p>
<p>Sorry about that, looks like some additional formatting was adding when I did my migration to my new blog, very strange. I&#8217;ll get this updated asap.</p>
<p>This Regex is designed to remove empty HTML tags so that a control that only holds
<div></div>
<p> or <br /> will be validated as empty&#8230; but as you pointed out it&#8217;s broken, I&#8217;m not sure what happened with the migration as the regex above doesn&#8217;t even look remotely like what was originally there. Hope to have your fix shortly.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andy</title>
		<link>http://corypeters.net/2008/06/hiding-empty-publishing-fields-in-a-page-layout/comment-page-1/#comment-9</link>
		<dc:creator>Andy</dc:creator>
		<pubDate>Mon, 03 Nov 2008 20:05:24 +0000</pubDate>
		<guid isPermaLink="false">http://cbpeters.wordpress.com/2008/06/11/hiding-empty-publishing-fields-in-a-page-layout/#comment-9</guid>
		<description>Hi Cory,

What is the regular expression supposed to do?  I get the following error.

Server Error in &#039;/&#039; Application.
parsing &quot;\s]+))?)+\s*&#124;\s*)/?&gt;&quot; - Too many )&#039;s. 

Andy</description>
		<content:encoded><![CDATA[<p>Hi Cory,</p>
<p>What is the regular expression supposed to do?  I get the following error.</p>
<p>Server Error in &#8216;/&#8217; Application.<br />
parsing &#8220;\s]+))?)+\s*|\s*)/?&gt;&#8221; &#8211; Too many )&#8217;s. </p>
<p>Andy</p>
]]></content:encoded>
	</item>
</channel>
</rss>

