{!-- Explanations and learning materials can be found in news/index and the other news template groups.  In-line comments here are only for features not introduced in news/index.
	 NOTE:  This is an ExpressionEngine Comment and it will not appear in the rendered source.
			https://ellislab.com/expressionengine/user-guide/templates/commenting.html
--}
{html_head}
<!-- Below we use a channel entries tag to deliver a dynamic title element. -->
	<title>{site_name}: Comments  on
		{exp:channel:entries channel="news|about" limit="1" disable="categories|member_data|category_fields|pagination"}{title}{/exp:channel:entries}</title>
{global_stylesheets}
{rss}
{favicon}
{html_head_end}
	<body>
{nav_access}
	{branding_begin}
			{embed="global_embeds/_top_nav" loc="home"}
			{global_top_search}
			{global_top_member}
	{branding_end}
	{wrapper_begin}
{embed="global_embeds/_page_header" header="News"}
	<div id="feature">
			{global_featured_welcome}
			{global_featured_band}
	    </div> <!-- ending #feature -->

        	<div class="feature_end"></div>

	<div id="content_pri"> <!-- This is where all primary content, left column gets entered -->
		<!--  This is the channel entries tag.  Documentation for this parameter can be found at https://ellislab.com/expressionengine/user-guide/modules/channel/channel_entries.html
				 Parameters are the items inside the opening exp:channel:entries tag that allow limiting, filtering, and sorting. They go in the format item="limiter".  ie: channel="news". Below are links to the parameters used in this particular instance of the channel entries tag.  These are documented here:

				https://ellislab.com/expressionengine/user-guide/channels/weblog/parameters.html

		channel= which channel to output, multiple channels may be piped in (channel_1|channel_2)
		limit= limits the number of entries output in this instance of the tag
		disable= turns off parsing of un-needed data
		require_entry= forces ExpressionEngine to compare Segment 3 to existing URL titles.  If there is no match, then nothing is output.  Use this in combination with if no_results to force a redirect to 404. -->

		{exp:channel:entries channel="news|about" limit="3" disable="categories|member_data|category_fields|pagination" require_entry="yes" status="open|featured"}

		<!-- if no_results is a conditional variable, it can not be combined with advanced conditionals.  https://ellislab.com/expressionengine/user-guide/modules/channel/conditional_variables.html#cond_if_no_results

		This is used here in combination with the require_entry parameter to ensure correct delivery of information or redirect to a 404 -->

		{if no_results}{redirect="404"}{/if}
		<!-- count is a single variable: https://ellislab.com/expressionengine/user-guide/modules/weblog/variables.html#var_count

		In this case we've combined the count single variable with a Conditional Global Variable:

		https://ellislab.com/expressionengine/user-guide/templates/globals/conditionals.html

		to create code that shows up only once, at the top of the list of outputted channel entries and only if there is 1 or more entries -->

		{if count == "1"}
		<h3 class="recentnews">Recent News</h3>
		<ul id="news_listing">

			<!-- Here we close the conditional after all of the conditional data is processed. -->

		{/if}
			<li>
					<!-- comment_url_title_auto_path is a channel entries variable:

					https://ellislab.com/expressionengine/user-guide/modules/channel/variables.html#var_comment_url_title_auto_path

					This allows you to outpt a per-channel link to a single-entry page.  This can be used even if you are not using comments as a way to get a per-channel "permalink" page without writing your own conditional. -->

				<h4><a href="{comment_url_title_auto_path}">{title}</a>  //  <!-- entry_date is a variable, and date formatting variables can be found at https://ellislab.com/expressionengine/user-guide/templates/date_variable_formatting.html -->{entry_date format="%F %d %Y"}</h4>

				<!-- the following two lines are custom channel fields. https://ellislab.com/expressionengine/user-guide/cp/admin/channel_administration/custom_channel_fields.html -->

				{if news_image}
					<img src="{news_image}" alt="{title}" />
				{/if}

				<!-- Here we come a custom field variable with a global conditional to output the HTML only if he custom field is _not_ blank -->

				{if about_image != ""}<img src="{about_image}" alt="{title}"  />{/if}
				{news_body}
				{about_body}
				{news_extended}

				<!-- Here we compare the channel short-name to a predefined word to output some information only if the entry occurs in a particular channel -->
				{if channel_short_name == "news"}<p><a href="{comment_url_title_auto_path}#news_comments">{comment_total} comments</a> <!-- edit_this is a Snippet: https://ellislab.com/expressionengine/user-guide/templates/globals/snippets.html --> {global_edit_this} </p> {/if}
			</li>
		<!-- Comparing two channel entries variables to output data only at the end of the list of outputted channel entries -->
		{if count == total_results}</ul>{/if}
		<!-- Closing the Channel Entries tag -->
		{/exp:channel:entries}

			<div id="news_comments">
			<!-- Comment Entries Tag outputs comments: https://ellislab.com/expressionengine/user-guide/ https://ellislab.com/expressionengine/user-guide/
			Parameters found here: https://ellislab.com/expressionengine/user-guide/modules/comment/entries.html#parameters
			sort= defines in what order to sort the comments
			limit= how many comments to output
			channel= what channels to show comments from
			-->
			{exp:comment:entries sort="asc" limit="20" channel="news"}
			{if count == "1"}
			<h3>Comments</h3>
			<ol>{/if}
				<li>
					<h5 class="commentdata">
						<!-- Comment Entries variable: https://ellislab.com/expressionengine/user-guide/modules/comment/entries.html#url_as_author
						url_as_author outputs the URL if entered/in the member profile (if registered) or just the name if no URL-->
						{url_as_author}
						<!-- Comment date:
						 https://ellislab.com/expressionengine/user-guide/modules/comment/entries.html#var_comment_date

						Formatted with Date Variable Formatting:

	https://ellislab.com/expressionengine/user-guide//templates/date_variable_formatting.html -->

						<span>{comment_date format="%h:%i%a"}, {comment_date format=" %m/%d/%Y"}</span>
						<!-- Checks if the member has chosen an avatar and displays it if so

	https://ellislab.com/expressionengine/user-guide/modules/comment/entries.html#conditionals
						-->
						{if avatar}
							<img src="{avatar_url}" width="{avatar_image_width}" height="{avatar_image_height}" alt="{author}'s avatar" />
						{/if}
					</h5>
					{comment}

                    <div style="clear: both;"></div>
				</li>
			{if count == total_results}</ol>{/if}
			{/exp:comment:entries}

			<!-- Comment Submission Form:

			https://ellislab.com/expressionengine/user-guide/ modules/comment/entries.html#submission_form

			channel= parameter says which channel to submit this comment too.  This is very important to include if you use multiple channels that may have the same URL title.  It will stop the comment from being attached to the wrong entry.  channel= should always be included.

			-->

			{exp:comment:form channel="news" preview="news/comment_preview"}
			<h3 class="leavecomment">Leave a comment</h3>
			<fieldset id="comment_fields">
			<!-- Show inputs only if the member is logged out.  If logged in, this information is pulled from the member's account details -->
			{if logged_out}
				<label for="name">
					<span>Name:</span>
					<input type="text" id="name" name="name" value="{name}" size="50" />
				</label>
				<label for="email">
					<span>Email:</span>
					<input type="text" id="email" name="email" value="{email}" size="50" />
				</label>
				<label for="location">
					<span>Location:</span>
					 <input type="text" id="location" name="location" value="{location}" size="50" />
				</label>
				<label for="url">
					<span>URL:</span>
					<input type="text" id="url" name="url" value="{url}" size="50" />
				</label>
			{/if}
				<!-- comment_guidelines is a User Defined Global Variable: https://ellislab.com/expressionengine/user-guide/templates/globals/user_defined.html -->
				{comment_guidelines}
				<label for="comment" class="comment">
					<span>Comment:</span>
					<textarea id="comment" name="comment" rows="10" cols="70">{comment}</textarea>
				</label>
			</fieldset>

				<fieldset id="comment_action">
				{if logged_out}
				<label for="save_info">Remember my personal info? <input type="checkbox" name="save_info" value="yes" {save_info} /> </label>
				{/if}
				<label for="notify_me">Notify me of follow-up comments? <input type="checkbox" id="notify_me" name="notify_me" value="yes" {notify_me} /></label>

				<!-- Insert CAPTCHA.  Will show for those that are not exempt from needing the CAPTCHA as set in the member group preferences

				-->
				{if captcha}
				<div id="captcha_box">
					<span>{captcha}</span>
				</div>
					<label for="captcha">Please enter the word you see in the image above:
<input type="text" id="captcha" name="captcha" value="{captcha_word}" maxlength="20" />
					</label>
				{/if}
				<input type="submit" name="preview" value="Preview Comment" />
				<input type="submit" name="submit" value="Submit" id="submit_comment" />
			</fieldset>
			{/exp:comment:form}

	</div> <!-- ending #news_comments -->
	</div> <!-- ending #content_pri -->

	<div id="content_sec" class="right green40">
		<h3 class="oldernews">Browse Older News</h3>
		<div id="news_archives">
			<!-- The period before the template in this embed indicates a "hidden template".  Hidden templates can not be viewed directly but can only be viewed when embedded in another template: https://ellislab.com/expressionengine/user-guide/templates/hidden_templates.html -->
			<div id="categories_box">
			{news_categories}
			</div>
			<div id="month_box">
			{news_month_archives}
			</div>
		</div> <!-- ending #news_archives -->

		{news_calendar}

		{news_popular}

	{rss_links}

	</div>	<!-- ending #content_sec -->

{global_footer}
{wrapper_close}
{js}
{html_close}
