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 Info From URL

June 27, 2007 6:26am

Subscribe [2]
  • #1 / Jun 27, 2007 6:26am

    Phil Norton

    41 posts

    Hi there

    I’m playing with the new Pages module, and was wondering how to get info from the URL. Say, for example, that my URL is like this:

    http://www.mysite.com/about/

    I’d obviously be in the “About” section of the site. In the nav, I want to be able to highlight this fact, kinda like:

    {if section == "About"}{/if}About{if section == "About"}{/if}

    Is there an “Expression Engine Way” of doing this? I know how to do it in PHP, but I’m keen to learn as much EE syntax as possible.

    Thanks in advance,
    Phil

  • #2 / Jun 27, 2007 7:20am

    Mark Bowen

    12637 posts

    Hi Phil,

    I think you will want to take a look at URL segment variables.

    These should enable you to do what you need. There are also quite a few posts in the forums about highlighting navigation items depending on which page you are on. Specifically you would use a :

    <body id="about">

    on the page which could be written dynamically (I think! - As long as the parse order allows it) and then your nav items can take their role from that.

    Hope that helps.

    Regards,

    Mark

  • #3 / Jun 27, 2007 7:41am

    Phil Norton

    41 posts

    Hi Mark, that’s exactly what I was looking for!!

    Ta
    Phil

  • #4 / Jun 27, 2007 9:11am

    Mark Bowen

    12637 posts

    Hi Phil,

    No problems at all. Hope it all goes well for you!

    Mark

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

ExpressionEngine News!

#eecms, #events, #releases