Question

We're using MT to manage publishing for our marketing site (pages), help docs (blog1), and company news (blog2). The goal is for these to feel like part of the same site — same headers / footers etc — and to keep it maintainable by reusing code. We already have the pages / site set up and working; we're working on the blogs now.

Our main template for all our pages has this:

  <div class="main container">
    <mt:If tag="PageBody">
      <$mt:PageBody$>
    </mt:If>
  </div><!-- main container -->

Is there a way to basically switch the IF statement and test for whether it's an entry? MT documentation implies that pages are a subset of entries.

  <mt:If tag="PageBody">
    <$mt:PageBody$>
  <mt:Else tag="Entry">
    // entry-related tags and formatting go here
  </mt:If>

Is this the approach I should take or am I barking up the wrong tree? I've been using MT for years but my mental model of it is still pretty weak...

Était-ce utile?

La solution

The tag you want to use is mt:EntryClass. In fact, I'm pretty sure that mt:EntryBody and mt:PageBody are aliased as are (or we're, last I checked) most/all mt:Entry/mt:Page tags. This is so you can essentially use the same template for both entries and pages if you wanted to. For times when you want to differentiate, the mt:EntryClass tag does the job.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top