-
-
Save unruthless/410159 to your computer and use it in GitHub Desktop.
EE template: blog/detail
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{!-- Segment_2 isn't blank, so show a blog post's details --} | |
{if segment_2 != ""} | |
{exp:channel:entries channel="blog" url_title="{segment_2}"} | |
{!-- If no results, | |
then segment_2 isn't a URL title for any existing blog post (typo? broken link?), | |
so redirect to the landing page --} | |
{if no_results} | |
{redirect="blog/index"} | |
{/if} | |
{!-- Otherwise display the blog post, with whatever markup you want --} | |
<div class="post"> | |
<h2 class="postTitle"><a href="{path='blog/detail'}">{title}</a></h2> | |
<p>Posted {entry_date format='%m/%d'} by {screen_name}</p> | |
{summary} | |
{post_body} | |
</div> <!-- end post --> | |
{/exp:channel:entries} | |
{!-- Comment form should usually be outside exp:channel:entries, as it's a call to a separate module --} | |
{exp:comment:form channel="blog" preview="channel/preview"} | |
{if logged_out} | |
<label for="name">Name:</label> <input type="text" name="name" value="{name}" size="50" /><br /> | |
<label for="email">Email:</label> <input type="text" name="email" value="{email}" size="50" /><br /> | |
<label for="location">Location:</label> <input type="text" name="location" value="{location}" size="50" /><br /> | |
<label for="url">URL:</label> <input type="text" name="url" value="{url}" size="50" /><br /> | |
{/if} | |
<label for="comment">Comment:</label><br /> | |
<textarea name="comment" cols="70" rows="10">{comment}</textarea> | |
<label><input type="checkbox" name="save_info" value="yes" {save_info} /> Remember my personal information</label><br /> | |
<label><input type="checkbox" name="notify_me" value="yes" {notify_me} /> Notify me of follow-up comments?</label><br /> | |
{if captcha} | |
<label for="captcha">Please enter the word you see in the image below:</label><br /> | |
<p>{captcha}<br /> | |
<input type="text" name="captcha" value="{captcha_word}" maxlength="20" /></p> | |
{/if} | |
<input type="submit" name="submit" value="Submit" /> | |
<input type="submit" name="preview" value="Preview" /> | |
{/exp:comment:form} | |
<h3>Comments</h3> | |
{exp:comment:entries sort="asc" limit="20"} | |
<div class="comment"> | |
{comment} | |
<p>By {name} on {comment_date format="%Y %m %d"}</p> | |
</div><!-- end comment --> | |
{/exp:comment:entries} | |
{!-- Segment_2 is blank, so get us out of here - redirect to the index template --} | |
{if:else} | |
{redirect="blog/index"} | |
{/if} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment