ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Advice on performance and html inside entry_date_format

September 10, 2010 2:16pm

Subscribe [2]
  • #1 / Sep 10, 2010 2:16pm

    Jonathan Schofield

    175 posts

    Wondering if you can give me some advice on the following…

    I want to produce HTML output like this:

    <span class="start">
      <span class="label">from</span> 
      <abbr title="2010-09-10T17:58}">
        <span class="weekday">FRI</span> 
        <span class="day">10</span> 
        <span class="month">Sep</span>
      </abbr>
    </span>

    So I had some template code like this:

    <span class="start">
      <span class="label">from</span> 
      <abbr title="{entry_date format=">
        {entry_date format="<span class='weekday'>%D</span> 
        <span class='day'>%d</span> 
        <span class='month'>%M</span>"}
      </abbr>
    </span>

    I thought the single quotes around the class names might get processed as text but it seems not.

    It does work if I don’t quote the attributes at all (eg: <span class=day>) but that offends my markup sensibilities!

    So I guess I have to make multiple entry_date_format calls with:

    <span class="start">
      <span class="label">from</span> 
      <abbr title="{entry_date format=">
        <span class="weekday">{entry_date format="%D"}</span> 
        <span class="day">{entry_date format="%d"}</span> 
        <span class="month">{entry_date format="%M"}</span>
      </abbr>
    </span>

    Any thoughts as to the performance hit of doing this or whether I’ve missed a way of outputting the readable text wrapped in spans with just a single entry_date_format variable?

  • #2 / Sep 10, 2010 5:51pm

    Sue Crocker

    26054 posts

    I don’t see another method of doing this, but only you can see what kind of performance hit you’re going to have. It depends on the rest of the page, etc.

    Does that help?

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

ExpressionEngine News!

#eecms, #events, #releases