Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Bruno Alexandre 29 posts 38 karma points
    May 26, 2011 @ 15:53
    Bruno Alexandre
    0

    How do I get the URL name to place as a class in a master page?

    I would like to have the page url as a class name, is this possible?

    my Master page has something like

     

    <div class="intro">
      <div class="intro-holder">
        <div class="spotimage"><img src="images/spot_lej1nav_1.gif" alt=""></div>
          <umbraco:Macro Alias="HomeStandardSpots" runat="server"></umbraco:Macro>
        </div>
      </div>
    </div>

    and imagine that the current URL is:

    domain.dk/forretningsomraader/it-infrastruktur

    I would like to have in the HTML code this:

    <div class="intro it-infrastruktur">

    what snippet/macro should I use?

     

  • Fengelz 106 posts 221 karma points
    Jun 07, 2011 @ 10:30
    Fengelz
    1

    Does it have to be the 100% specific url?

    Otherwise you can do something like this to get a unique class per page, which will in mos cases be the same as the url: 

    <div class="intro">
        <div class="intro-holder <%=umbraco.presentation.nodeFactory.Node.GetCurrent().Name.ToLower().Replace(" ", "-") %>">
          <div class="spotimage"><img src="images/spot_lej1nav_1.gif" alt=""></div>
            <umbraco:Macro Alias="HomeStandardSpots" runat="server"></umbraco:Macro>
          </div>
        </div>
      </div>

     

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies