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.

getting {title} into < title>

September 02, 2012 4:08pm

Subscribe [2]
  • #1 / Sep 02, 2012 4:08pm

    jtnews

    62 posts

    I know this should be a simple question, but it doesn’t seem to be working as simply as it feels like it should. I want to give the HTML page title the same name as the current page’s channel entry title, but because the {title} tag falls outside of the channel declaration, it simply shows up as {title} on the screen. How do I get around this?

  • #2 / Sep 02, 2012 5:00pm

    Nico Meijer

    41 posts

    {exp:channel:entries channel="mychannel" status="not closed" limit="1" disable="categories|member_data|pagination"}
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>{title}</title>
    ....

    Works for me.

    HTH… Nico

  • #3 / Sep 05, 2012 11:24am

    Kevin Smith

    4784 posts

    Hey jtnews,

    Yep, you’ll just need to make sure you wrap the {title} variable in Channel Entries tags like Nico suggested. Does that do it for you?

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

ExpressionEngine News!

#eecms, #events, #releases