16 - Implementing the Weblog, Global Variables, and Passing Variables in Variables

There are a number of ways to implement a weblog with ExpressionEngine.  Let me explain at a high level the approach I’m taking here and you can decide if it meets your needs or not. 

 
Download the EE Code for 16 - Implementing the Weblog, Global Variables, and Passing Variables in Variables

Weblog Implementation Overview
Most weblogs will require a number of templates. However, depending on your requirements and expectations of traffic to a weblog, you can make some choices that will save you some time and trouble on the front end.

Weblogs being, well, weblogs, they usually have the following needs:

  • An index template that comes up by default, and shows the last x number of posts with the newest at the top.  If there are longer posts, often this template only shows part of the post and has a “read more” link of some sort, which leads to the…
  • Single-view template that shows an entire post
  • Comments template where users can respond
  • Permalink template which places this post at a specific URL that won’t change as new content gets added to the weblog
  • Category Index - if the weblog posts are categorized, this view shows the latest posts assigned to the desired category
  • Archive - most often this is broken down by month
  • RSS or Atom feed

That’s quite a list, no?

However - especially for weblogs like we’re building that are part of a business site (rather than really being the entire site), we can repurpose one template to serve multiple needs.  In this tutorial we’ll accomplish the weblog implementation with three main templates and a few new embedded templates.  The three main templates will be:

  • Weblog Index.  This will serve as the default index view, the category view and the archive view
  • Weblog Comments.  This will serve as the single-view, comments, and permalink template
  • RSS feed

If you expect your blog to be quite busy, or if it will have deep archives, or if you will want a different category view, you might consider dedicated templates for those purposes.  I prefer to start simple; so, for most clients just getting into blogs, I’ll start with this approach and modify it later based on actual need.

Onto the build!

Create Data Structures
To begin, you’ll first need to get the EE data structures in place.  You’ll need:

  • A new weblog.  In my case, and in all the sample templates I’ll be providing, this is called “weblog”.  Make sure commenting is enabled – the setting is found under Admin > Weblog Administration > Weblog Management > Edit Weblog Comment Posting Preferences > Allow Comments in This Weblog?
  • A Field Group.  I’m using the Default Field Group that installs with EE so will have fields of Summary, Body, and Extended Text.
  • A Category Group.  I created a weblog-specific Category Group called “weblog” with categories of Company News, Industry News, and Ramblings.  I entered short descriptions for each.
  • Remember to assign the new Category Group and Field Group to the new weblog.

Do Some Data Entry
Go ahead and make some entries in your new weblog, at least one per category.  Make sure to use all the fields so you’ll know if your templates function correctly.

Oh , and also post a new section heading type thing into your Miscellaneous Content Weblog.  Make sure it has a URL Title of “weblog.”

New Template Group
Create a new Template Group for the weblog-related templates.  In a fit of sheer creativity I’ve named mine “weblog”.

Weblog Main Templates - Index
Here is the code for the weblog/index template.  It has some higher-level EE coding in it, so will look a bit strange.
(Note – in order to have less word-wrapping I’ve removed some of the formatting of the code in these samples.  The text versions in the attached files will retain their formatting and might be easier to read).

{assign_variable:my_weblog="weblog"}
{assign_variable
:my_template_group="weblog"}
{assign_variable
:my_embedded_template_group="embeds"}
{assign_variable
:my_index_template=""}
{assign_variable
:my_comments_template="comments"}
{embed
="{my_embedded_template_group}/html_header" my_page_title="Weblog"}
<body>
<
div id="content">
{embed="{my_embedded_template_group}/logo_title"}
{embed
="{my_embedded_template_group}/main_nav" my_location="weblog"}
{embed
="{my_embedded_template_group}/search_section_intros" the_url_title="weblog"}

<div id="maincontent">
<
div id="right_side">

{embed="{my_embedded_template_group}/weblog_categories" the_index_template="{my_index_template}" the_template_group="{my_template_group}" the_weblog="{my_weblog}"}

{embed
="{my_embedded_template_group}/monthly_archives" the_index_template="{my_index_template}" the_template_group="{my_template_group}" the_weblog="{my_weblog}"}
{embed
="{my_embedded_template_group}/syndicate_block" the_template_group="{my_template_group}"}
</div><!-- close right_side -->
<
div id="left_side">
{exp:weblog:category_heading weblog="{my_weblog}"}
<h3>Category:&nbsp;{category_name}</h3>
{if category_description}
<p>{category_description}</p>
{/if}
<div class="horizontal_rule"></div>
{/exp:weblog:category_heading}
{exp
:weblog:entries weblog="{my_weblog}" orderby="date" sort="desc" limit="15" disable="trackbacks"}
<div class="entry">
<
h3><a href="{homepage}/{my_template_group}/{my_comments_template}/{url_title}">{title}</a></h3>
{summary}
{body}
{if extended}
<p><a href="{homepage}/{my_template_group}/{my_comments_template}/{url_title}">Read More...</a></p>{/if}
<div class="posted">
Posted by {author} on {entry_date format='%m/%d'} at {entry_date format='%h:%i %A'} in
{categories}
<a href="{path={my_template_group}/{my_index_template}}">{category_name}</a> &#8226;
{/categories}

{if allow_comments}
({comment_total}) <a href="{homepage}/{my_template_group}/{my_comments_template}/{url_title}#comments">Comments</a> &#8226;
{/if}
<a href="{homepage}/{my_template_group}/{my_comments_template}/{url_title}">Permalink</a>
</
div>
{paginate}
<div class="paginate">
<
span class="pagecount">Page {current_page} of {total_pages} pages</span>  {pagination_links}
</div>
{/paginate}
</div>
{/exp:weblog:entries}

</div><!-- close left side div -->
</
div><!-- close main content div -->
{embed="{my_embedded_template_group}/footer"}
</div>    <!-- close content div -->
</
body>
</
html

What’s up with all that assign_variable stuff?

Hang on – let’s get through all the new templates, then we’ll dig into it.  Don’t check out on me – this is pretty cool stuff.

Weblog Main Templates – Comments
Here’s the code for the new weblog/comments template:

{assign_variable:my_weblog="weblog"}
{assign_variable
:my_template_group="weblog"}
{assign_variable
:my_embedded_template_group="embeds"}
{assign_variable
:my_index_template="index"}
{assign_variable
:my_comments_template="comments"}

{embed
="{my_embedded_template_group}/html_header" my_page_title="Weblog | {exp:weblog:entries weblog="{my_weblog}" orderby="date" sort="desc" limit="1" disable="member_data|trackbacks|pagination|categories|custom_fields"}{title}{/exp:weblog:entries}"}

<body>
<
div id="content">
{embed="{my_embedded_template_group}/logo_title"}
{embed
="{my_embedded_template_group}/main_nav" my_location="weblog"}
{embed
="{my_embedded_template_group}/search_section_intros" the_url_title="weblog"}

<div id="maincontent">
<
div id="right_side">

{embed="{my_embedded_template_group}/weblog_categories" the_index_template="{my_index_template}" the_template_group="{my_template_group}" the_weblog="{my_weblog}"}
{embed
="{my_embedded_template_group}/monthly_archives" the_index_template="{my_index_template}" the_template_group="{my_template_group}" the_weblog="{my_weblog}"}
{embed
="{my_embedded_template_group}/syndicate_block" the_template_group="{my_template_group}"}

</div><!-- close right_side -->

<
div id="left_side">
{exp:weblog:entries weblog="{my_weblog}" orderby="date" sort="desc" limit="1" disable="member_data|trackbacks"}
<div class="entry">
<
h3>{title}</h3>
{summary}
{body}
{extended}
<div class="posted">
Posted by {author} on {entry_date format='%m/%d'} at {entry_date format='%h:%i %A'} in
{categories}
<a href="{path={my_template_group}/{my_index_template}}">{category_name}</a> &#8226;
{/categories}

{if allow_comments}
({comment_total}Comments
{
/if}

</div>
</
div>
{/exp:weblog:entries}

{embed
="{my_embedded_template_group}/weblog_entry_comments" the_weblog="{my_weblog}"}

</div><!-- close left side div -->

</
div><!-- close main content div -->
{embed="{my_embedded_template_group}/footer"}
</div>    <!-- close content div -->
</
body>
</
html

Weblog Main Templates – RSS
Make sure when you create the new template for the RSS feed, you choose RSS Page in the Template Type drop-down.  If you forget while creating the template, just click the Preferences link for the Template Group you put it in, and change it there.

Here’s the code:

Template Name: weblog/rss_2

{assign_variable:master_weblog_name="weblog"}
{exp
:rss:feed weblog="{master_weblog_name}"}
<?xml version
="1.0" encoding="{encoding}"?>
<rss version="2.0"
    
xmlns:dc=http://purl.org/dc/elements/1.1/
    
xmlns:sy=http://purl.org/rss/1.0/modules/syndication/
    
xmlns:admin=http://webns.net/mvcb/
    
xmlns:rdf=http://www.w3.org/1999/02/22-rdf-syntax-ns#
    
xmlns:content="http://purl.org/rss/1.0/modules/content/">

  <
channel>
    <
title>{exp:xml_encode}{weblog_name}{/exp:xml_encode}</title>
    <
link>{weblog_url}</link>
    <
description>{weblog_description}</description>
    <
dc:language>{weblog_language}</dc:language>
    <
dc:creator>{email}</dc:creator>
    <
dc:rights>Copyright {gmt_date format="%Y"}</dc:rights>
    <
dc:date>{gmt_date format="%Y-%m-%dT%H:%i:%s%Q"}</dc:date>
    <
admin:generatorAgent rdf:resource="http://www.pmachine.com/" />

{exp:weblog:entries weblog="{master_weblog_name}" limit="10" rdf="off" dynamic_start="on" disable="member_data|trackbacks"}
    
<item>
      <
title>{exp:xml_encode}{title}{/exp:xml_encode}</title>
      <
link>{title_permalink=weblog/comments}</link>
      <
guid>{title_permalink=weblog/comments}#When:{gmt_entry_date format="%H:%i:%sZ"}</guid>
      
<description><![CDATA[{summary}{body}{extended}]]></description>
      <
dc:subject>{exp:xml_encode}{categories backspace="1"}{category_name}{/categories}{/exp:xml_encode}</dc:subject>
      <
dc:date>{gmt_entry_date format="%Y-%m-%dT%H:%i:%s%Q"}</dc:date>
    </
item>
{/exp:weblog:entries}
    
</channel>
</
rss>
{/exp:rss:feed} 

Load the New Embedded Templates
The weblog/index and weblog/comments templates share some right-column elements, so I’ve pulled these out and saved them as embedded templates. Save all of these in the same Template Group as your existing embedded templates.

Weblog Embedded Template – Weblog Categories
Here’s the code for a new embedded template that will display our weblog categories.  Save this template with a name of weblog_categories.
Template Name: embeds/weblog_categories

<h3>Weblog Categories</h3>
<
div class="lcontent">
    <
ul>
         
{!-- Conditional on the list item applies an active class to the currently viewed category. --}
        {exp
:weblog:categories weblog="{embed:the_weblog}" style="linear"}
            
<li {if segment_3==category_url_title}class="active_cat"{/if}>
                <
a href="{homepage}/{embed:the_template_group}/category/{category_url_title}/">{category_name}</a>
            </
li>
        
{/exp:weblog:categories}

         {
!-- This conditional will only show when a category has been selected, and allows a user to return to the default of showing all posts on the weblog --}
        {if segment_2
=="category"}    
            
<li><a href="{homepage}/{embed:the_template_group}/">All News Items</a></li>
        
{/if}
    
</ul>
</
div

Weblog Embedded Template – Weblog Monthly Archives
Here’s the code for a new embedded template that will display monthly archive links for our weblog.  Save this with a template name of monthly_archives.

<h3>Monthly Archives</h3>
<
div class="lcontent">
    <
ul>
        
{exp:weblog:month_links weblog="{embed:the_weblog}"}
                
<li><a href="{path="{embed:the_template_group}"}">{month}{year}</a></li>
        
{/exp:weblog:month_links}
    
</ul>
</
div

Weblog Embedded Template – Syndicate Block
Now that we’ll have an RSS feed, we need the site to provide a link to it.  This embedded template will create another sidebar entry for that purpose.  Save it into your embeds Template Group with a name of syndicate_block:

<h3>Syndicate Weblog</h3>
<
div class="lcontent">
    <
ul>
        <
li><a href="{homepage}/{embed:the_template_group}/rss_2/">RSS 2.0</a></li>
    </
ul>
</
div

Weblog Embedded Template – Entry Comments
This template displays existing comments on a weblog entry, and shows the form for users to enter new comments.  More on why I choose to embed this later.  For now, save this into your embeds Template Group with a name of weblog_entry_comments.

Template Name: embeds/weblog_entry_comments

<a name="comments"></a>
<
h3>Comments</h3>
<
div class="comment_entries">
    
{exp:comment:entries weblog="{embed:the_weblog}"}
        
<div class="posted">
            <
strong>#{count}.&nbsp;</strong>Posted by  {url_or_email_as_author} on {comment_date format="%F %d, %Y"}
        
</div>
        <
div class="comment_body">
            
{comment}
        
</div>
    
{/exp:comment:entries}

</div><!-- close comment entries -->
<
div class="comment_form">
    
{exp:comment:form}
        {if logged_out}
            
<p>
                
Name:<br/>
                <
input type="text" class="comment_textbox" name="name" value="{name}" />
            </
p>
            <
p>
                
Email:<br/>
                <
input type="text" class="comment_textbox" name="email" value="{email}" />
            </
p>
            <
p>
                
URL:<br/>
                <
input type="text" class="comment_textbox" name="url" value="{url}" />
            </
p>
        
{/if}
        
<p>
            
Comments:<br/>
            <
textarea name="comment" cols="60" rows="12">{comment}</textarea>
        </
p>
        
{if logged_out}
            
<p><input type="checkbox" class="check" name="save_info" value="yes" {save_info} /> Remember my personal information</p>
        
{/if}
        
<p><input type="checkbox" class="check" name="notify_me" value="yes" {notify_me} /> Notify me of follow-up comments?</p>
        
{if captcha}
            
<p>
                
Enter this word:<br/>
                
{captcha}
            
</p>
            <
br/>
            <
p>
                
Here:<br/>
                <
input type="text" name="captcha" value="" size="20" maxlength="20" style="width:140px;" />
            </
p>
        
{/if}
        
<p><input type="submit" class="submit_button" name="submit" value="Submit" /></p>
    
{/exp:comment:form}
</div

Update Main Navigation
Now that you have a new section of the site implemented, remember to update the embeds/main_nav template.  Mine now looks like this:

<div id="menu">
    <
div class="submit">
        <
ul>
            <
li><a{if '{embed:my_location}'=="home"class="selected"{/if} href="{homepage}" ><span>Home</span></a></li>
            <
li><a{if '{embed:my_location}'=="about"class="selected"{/if} 
href
="/index.php/site/about/"><span>About</span></a></li>
            <
li><a{if '{embed:my_location}'=="products"class="selected"{/if} href="/index.php/products/"><span>Products</span></a></li>
            <
li><a{if '{embed:my_location}'=="services"class="selected"{/if} href="/index.php/services/"><span>Services</span></a></li>
            <
li><a{if '{embed:my_location}'=="weblog"class="selected"{/if} href="/index.php/weblog/"><span>Weblog</span></a></li>
            <
li><a href="#"><span>Contact</span></a></li>
        </
ul>
    </
div>
</
div

Specifying Names with Global Variables
OK, with those new templates loaded you may need to make name or pathing changes required for using them in your environment.

But don’t do that yet.  I’ve made this easier, and want to explain how.  First open the weblog/index template.  See where it has the following code:

{assign_variable:my_weblog="weblog"}
{assign_variable
:my_template_group="weblog"}
{assign_variable
:my_embedded_template_group="embeds"}
{assign_variable
:my_index_template=""}
{assign_variable
:my_comments_template="comments"

What’s that all about?

These are Dynamically Assigned Global Variables.  Review the EE documentation for them.

Don’t let the “Global” world fool you, though.  Like the docs state: “Variables created this way are available for use anywhere within that template.”

Essentially you can think of these as “text-replacement” variables.  As EE parses the template, it will store the text you specify in the “assign_variable” statement, and then anywhere it runs into that variable name in the rest of the code template, EE will swap out the variable name for the text.  For example, we’ve specified “embeds” as the value for “my_embedded_template_group”.  Later in the template, when EE finds:

{embed="{my_embedded_template_group}/logo_title"

EE will substitute the text we specified and see that line of code as:

{embed="embeds/logo_title"

Got it?

Cool.

Why did I use them?  Two reasons:

  • First, to make it easier for you to move these templates into your environment.  Rather than having to edit several lines of code, now you can just make the change in one spot and the rest of the template will use that updated variable value.
  • To get you thinking about more advanced coding methods like this.  Depending on your specific EE project, using things like Global Variables can make it easier to get your work done by centralizing templates that do the same thing but for different areas of your site.

So, take a moment now and edit the values of those variables in both the weblog/index and weblog/comments templates, where appropriate. Once saved, the templates should load and function properly.

Building Links Using a Combination of Variables
With the Global Variables in place, now it’s possible to build links using a combination of true Global Variables, template Global Variables, and content from a weblog entry.  Consider this link:

<a href="{homepage}/{my_template_group}/{my_comments_template}/{url_title}">Read More...</a

Passing Global Variables to Embedded Templates
OK, take a deep breath.  This will be the most complex part of this chapter, and possibly this entire tutorial series. Go do some carbo-loading if need be.  Ready?  OK.

Here’s the situation.  The weblog/index and weblog/comments templates know some things that the embedded templates also need to know.  The embedded templates are building the navigation to the category and archive views of our weblog, which will use the weblog/index template for presentation.  The weblog templates know the name of the weblog needed, the name of the weblog/index template and what Template Group it’s in, because we’ve specified those items as Global Variables.  But we have embedded templates that will also need that information.

What to do?  Well, we could just copy our “assign_variable” code from the weblog templates to the embedded templates.  But that’s not very elegant, and increases the number of places to make edits if those values change.

The other alternative is to combine Global Variables with Embedded Variables.  This way, the variable is specified in the weblogs templates, and then passed into the embedded template for use there.

Now just stop and think about this for a minute.

What we’ll end up with is an embedded template that builds, for example, links to weblog categories.  But the weblog name of where the categories come from, along with the location of the templates it needs to link to, are variables.

What’s this mean?

You will now have a little “category-link-builder” that you could re-use across different parts of a site, even when the weblog is different or the template it’s linking to is different.

I’ve used this approach on Boyink.com where I have four main weblogs (the business blog, Jeep, Bantam, and Photos).  On each of them I wanted category navigation for the bottom of the page. With this approach I have one embedded template that builds that category navigation, and I just send it the necessary weblog name and template names it needs to link to.

Then, for example, when I wanted to pull category descriptions in addition to the category name, all I had to do was edit that one embedded template’s code, and voila - all four weblogs instantly see the update.

So how to do this?  The trick to remember is that in order to pass a Global Variable to an embedded template you have to change its name on the way.  For example, in our weblog/index template we have:

{assign_variable:my_weblog="weblog"

While passing it to the embedded template (category navigation builder), the variable gets its name changed to “the_weblog”:

{embed="{my_embedded_template_group}/weblog_categories" the_index_template="{my_index_template}" the_template_group="{my_template_group}" the_weblog="{my_weblog}"

Then in the embedded template, the new name is used:

{exp:weblog:categories weblog="{embed:the_weblog}" style="linear"

Also note that formatting with quotes, etc., is very picky and particular while doing this.

OK- breathe easy. The hardest part is over.

Again, to summarize, with these templates you should be able to load them up, edit the Global Variables to reflect what you’ve named both the templates and your Template Groups (make sure to edit both the weblog/index and weblog/comments templates) and, once saved, the weblog should function.

The Comments Form
Let’s take a look at the comments form now.  You might be wondering why, since I have only one weblog single view/permalink/comments template, why I choose to embed the part of the page that actually displays the comments (the embedded template called “weblog_entry_comments”).

Mainly because it makes the weblog/comments template a bit shorter and cleaner, and it sets you up well for use with multiple weblogs.  Ever since building Boyink.com in this fashion - where I wanted to have a centralized comments form for use by four different weblogs - I’ve been doing it this way.  Comments are a bit of a pain to layout and style, so only doing it once for multiple weblogs is a nice way to go.

Lesse…what else is there with this chapter.  Oh yea…

Highlighted Category Navigation
Just for fun I used URL Segments along with conditionals to apply an active class to the currently viewed category.
Let’s look at the weblog/categories template again:

<h3>Weblog Categories</h3>
<
div class="lcontent">
    <
ul>
         
{!-- Conditional on the list item applies an active class to the currently viewed category. --}
        {exp
:weblog:categories weblog="{embed:the_weblog}" style="linear"}
            
<li {if segment_3==category_url_title}class="active_cat"{/if}>
                <
a href="{homepage}/{embed:the_template_group}/{embed:the_index_template}/category/{category_url_title}/">{category_name}</a>
            </
li>
        
{/exp:weblog:categories}
        
         {
!-- This conditional will only show when a category has been selected, and allows a user to return to the default of showing all posts on the weblog --}
        {if segment_2
=="category"}    
            
<li><a href="{homepage}/{embed:the_template_group}/{embed:the_index_template}/">All News Items</a></li>
        
{/if}
    
</ul>
</
div

All this does is compare the third URL segment (which displays the category URL Title for the currently viewed category) to the category_url_title of each category returned by the exp:weblog:categories tag.  When the condition is true, the class of “active_cat” is applied to that category name.

Note that if your URL structure is different (or if EE is installed, a directory down from the root) you may need to change what segment the code looks at.

Also, I’ve used another conditional to display an All News Items link under the category list.  This will only display if a category has been chosen.  Not a big deal - it just flags the user that they are looking at a category view and provides a link that’s a bit more clear than remembering to click the Weblog main navigation item.

Monthly Archives
Aside from our trickery with the variables, the archive links are built using a straightforward implementation of the exp:weblog:month_links tag.

RSS Template
The RSS template is also a straightforward copy/tweak of the template that EE installs with.  I did make the changes required for it to display HTML.

Zzzzzzzz
Still with me?  This was a big chapter, but one with some valuable concepts for developing websites in EE.
The Results
At the end of this chapter you should have a working Weblog section on your site, with the ability to leave comments, view categorized pages, archives, and have a working RSS feed.  Here’s my working example.

 

Category Navigation

<< Previous Entry   

Next Entry >>

 

Previous Comments

Picture of Nate Hamilton

by Nate Hamilton

Date: Wednesday, December 17th, 2008
Comment: #1

Hey Mike -

I figured out how to use javascript to change pages. My problem know is trying to figure out how to send the {url_title} to another part of the page. If you look at “www.lcbcchurch.com/splash2/”, I am trying to send the url_title of the audio cast play link to the player so that it knows which code to look at. I can’t change url’s because I am using javascript to hide and show the pages. Do you have any ideas how to send the url_title to another portion of the current page? Let me know, thanks!

Mike Boyink

by Mike Boyink (Author)

Date: Wednesday, December 17th, 2008
Comment: #2

Sorry…you’re off in a direction that I don’t know much about.  Possibly you could use an embed for the code in that other part of the page, then send it the url title as an embed variable.  Past that, you got me.

Picture of Matthew

by (JavaScript must be enabled to view this email address)

Date: Friday, January 2nd, 2009
Comment: #3

Hey Mike, quick question. Was leaving the my_index_template variable empty on the weblog index page intentional? On that same page you are passing an empty variable through to the weblog_categories and monthly_archives embed templates, which is not really nessessary. If I’m correct and not reading it wrong, I think you wanted to put “index” for that value like you did on the comments page. Let me know what you think when you get a chance. We all know you’re a busy man. Thanks for everything. ~M

Mike Boyink

by Mike Boyink (Author)

Date: Friday, January 2nd, 2009
Comment: #4

Yep - it was intentional.  I think it’d work either way, but I choose to leave it off.  EE will assume the index template if you specify just the template group.

I did this (IIRC) so I had the same variables at the top of both the weblog/index and weblog/comments templates in this case.

In practice I actually find that I don’t use template variables in this manner much.  They make the code a bit harder to read, and the copy/paste/repurpose process is easily handled with a good text editor and find/replace.

Picture of Andy Marshall

by Andy Marshall

Date: Tuesday, January 6th, 2009
Comment: #5

when trying to view the RSS pages i’m getting an error message:-

XML Parsing Error: not well-formed
Location: http://dev.moogaloo.com/tutorial/index.php/weblog/rss_2/
Line Number 3, Column 14:  xmlns:dc=http://purl.org/dc/elements/1.1/
——————-^

awesome tutorials btw!

Mike Boyink

by Mike Boyink (Author)

Date: Tuesday, January 6th, 2009
Comment: #6

Hi Andy -

It’s tough to tell what’s going on from the output - try the RSS validator: http://validator.w3.org/feed/ .  Maybe it will provide more clues.

Picture of Andy Marshall

by Andy Marshall

Date: Wednesday, January 7th, 2009
Comment: #7

Hi Mike.
Thanks for the reply - the w3c validator gives the same response, stating “This feed does not validate” pointing to the same line. If I take that line out it then throws the same error for the next one.
Its happened on to rss2 feeds I’ve made now - the one in your tutorial, and the one in my own site… very mysterious.
Might try an atom feed now…
Thanks for the help tho!
Andy

Picture of Andy Marshall

by Andy Marshall

Date: Wednesday, January 7th, 2009
Comment: #8

Atom works fine!
Thanks again.

Picture of Andy Marshall

by Andy Marshall

Date: Wednesday, April 8th, 2009
Comment: #9

I’ve come out of a web design agency that made its own CMS and plugged it into every site and since going freelance have had to find my own CMS solution - I initially thought that too, and then asked a friend who also got made redundant at the same time and he pointed out that they charged 4 times the cost of an EE license for a CMS and EE does more!

Picture of billseymour

by (JavaScript must be enabled to view this email address)

Date: Saturday, May 2nd, 2009
Comment: #10

Excellent tutorial. One suggestion: there is a lot going on here, a lot of coding/copying (for some) before knowing how tangled up things might have gotten. So I would suggest breaking tutorial 16 into two or more parts, where each part could have an interim ‘up to here’  stopping point to check one’s progress. Appreciate the good work.—Bill

Picture of Derek

by (JavaScript must be enabled to view this email address)

Date: Wednesday, June 24th, 2009
Comment: #11

Great tutorial.

I’m using this part of the tutorial to list a number of case studies on one page. On the index page, I’m able to list all title links in the main section as well as in a side bar. Unfortunately, when I click on a case study link to view the information (like the comments page), the links in the side bar only show the title/link of the current case study. Is there a way to have all links shown in the side bar on the comments page like on the index page?

I hope I was clear enough…I apologize in advance for any confusion.  :-)

Mike Boyink

by Mike Boyink (Author)

Date: Wednesday, June 24th, 2009
Comment: #12

Hey Derek -

This is a T-shirt moment…every EE developer is struck with this one at some point…;)

Add “dynamic=“off” to the weblog:entries tag in your sidebar.

Picture of Derek

by (JavaScript must be enabled to view this email address)

Date: Wednesday, June 24th, 2009
Comment: #13

Thanks! That worked perfectly.

Picture of Efraín Bárcena

by (JavaScript must be enabled to view this email address)

Date: Saturday, July 4th, 2009
Comment: #14

Hi Mike,

I want to incorporate an article image on the the full article view. I created a custom field called article_image and my article content filed formatting is set to xhtml to automatically keep everything looking nice when the post has multiple paragraphs.

The problem is that I don’t know how to put the img scr tag inside the first set of <.p></p.> generated by the article content field.


{exp:weblog:entries weblog=”{my_weblog}”}
<h3>{title}</h3>
<.p><img scr=”{article_image}” class=“left” >{body}
{/exp:weblog:entries}

this generates this:

<h3>Title</h3>
<.p><img scr=”{article_image}” class=“left” > <.p>Paragraph One</p.> <.p>Paragraph Two</p.>

How can I get rid of the the first <.p> that {body} tag is generating??? I know there a backspace=”” but that will only apply to the last </p.>.

Can the html strip plugin do the trick or is there a better approach to accomplish this??

Thanks and Happy 4th of July!!

Add Your Comment

Comment on this Post

  

Unless otherwise stated all content is © Michael Boyink of Train-ee.com & Boyink Interactive. Please don't steal - I've got kids to feed...