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.

Single entry page issue - need categories!

September 16, 2010 11:22am

Subscribe [2]
  • #1 / Sep 16, 2010 11:22am

    bmdstinky

    4 posts

    Hi All, hope you can help with a small issue I’m having.

    I’ve imported our branch directory into EE using the excellent CSVGrab extension. I want to have single entry pages for each of these branches but I also want to pass the category into either the page or the URL as there are case where the same address is used by two different business areas (businessareas is a custom field and each different business area is a category).

    So for example I’d like my URls to be domain.com/locations/retail/123-High-Street or
    domain.com/locations/travel/123-High-Street if a retail and travel branch use the same address. My single entry page should then check the category (problems here!), then get the correct 123 High Street entry for the business area/category.

    Is there any way I can do this?

    My templates (still in debug and bodged for readability) are below:

    Index:

    <ul>
    {exp:weblog:entries weblog="locations" entry_id="985"}
    
    <li>{title}</li>
    <li><a permalink='mytemplategroup/template'>{street}</a></li> [b]<!-- pass a category or customfield in here? -->[/b]
    <li>{street2}</li>
    <li>{telephone}</li>
    <li>{pc}</li>
    
    {/exp:weblog:entries}
    </ul>

    Store-page

    <html>
    <head>
    <style type="text/css">
    h2, h3 {margin:10px 0 0 0;}
    #mapviewer{height:500px;width:500px;float:left;border:1px solid black;}
    #store-details{float:left;margin-left:20px;}
    #store-details ul{margin:0;padding:0;list-style-type:none;}
    #store-details ul li{margin:2px 0px;}
    </style>
    [removed][removed] 
    </head>
    <body>
    {exp:weblog:entries weblog="locations"}
    <div id="wrapper">
    <div id="mapviewer"></div>
    {gl-clearfix}
    <div id="store-details">
    <h2>Address</h2>
    <p><ul></p>
    
    <p>{if street}<li>{exp:replace find="QUOTE"}{street}{/exp:replace}</li>{/if}<br />
    {if street2}<li>{exp:replace find="QUOTE"}{street2}{/exp:replace}</li>{/if}<br />
    {if street3}<li>{exp:replace find="QUOTE"}{street3}{/exp:replace}</li>{/if}<br />
    {if street4}<li>{exp:replace find="QUOTE"}{street4}{/exp:replace}</li>{/if}<br />
    {if town}<li>{exp:replace find="QUOTE"}{town}{/exp:replace}</li>{/if}<br />
    {if county}<li>{exp:replace find="QUOTE"}{county}{/exp:replace}</li>{/if}<br />
    {if pc}<li>{exp:replace find="QUOTE"}{pc}{/exp:replace}</li>{/if}<br />
    {if telephone}</p><h3>Telephone:</h3>
    <p>{exp:replace find="QUOTE"}{telephone}{/exp:replace}<br />
    {/if}<br />
    </ul></p><h2>Opening Hours</h2>
    <p><ul><br />
    <li>Mon: {exp:replace find="QUOTE"}{openinghours-mon}</li>{/exp:replace}<br />
    <li>Tue: {exp:replace find="QUOTE"}{openinghours-tue}</li>{/exp:replace}<br />
    <li>Wed: {exp:replace find="QUOTE"}{openinghours-wed}</li>{/exp:replace}<br />
    <li>Thu: {exp:replace find="QUOTE"}{openinghours-thu}</li>{/exp:replace}<br />
    <li>Fri:{exp:replace find="QUOTE"}{openinghours-fri}</li>{/exp:replace}<br />
    <li>Sat:{exp:replace find="QUOTE"}{openinghours-sat}</li>{/exp:replace}<br />
    <li>Sun:{exp:replace find="QUOTE"}{openinghours-sun}</li>{/exp:replace}<br />
    </ul><br />
    </div></p>
    
    <p></div><br />
    [removed]<br />
    //<![CDATA[<br />
    var mapviewer;<br />
    // Global variable to allow changeIcon() function (and others) to operate correctly:<br />
    var marker;</p>
    
    <p>function onLoad() { <br />
      //Add the map<br />
      mapviewer = MMFactory.createViewer( document.getElementById( 'mapviewer' ) );<br />
      mapviewer.goToPosition( new MMLocation( new MMLatLon( {exp:replace find="QUOTE"}{lat}{/exp:replace}, {exp:replace find="QUOTE"}{lon}{/exp:replace} ) , 15 ) );<br />
    addMarker();<br />
    }</p>
    
    <p>function addMarker() {<br />
        mapviewer.removeAllOverlays(); <br />
        var pos = mapviewer.getCurrentPosition();  <br />
        marker = mapviewer.createMarker( pos, {'label': 'Default marker', 'text' : 'x'} );<br />
        var el = document.createElement('h1');<br />
        el.appendChild ( document.createTextNode ('{exp:replace find="QUOTE"}{street}{/exp:replace}'));<br />
        marker.setInfoBoxContent(el);<br />
    }</p>
    
    <p>MMAttachEvent( window, 'load', onLoad );<br />
    //]]> <br />
    [removed]<br />
    {/exp:weblog:entries}<br />
    </body><br />
    </html>

    Thanks,
    Brett

  • #2 / Sep 16, 2010 6:37pm

    Brandon Jones

    5500 posts

    Hi Brett,

    As this is a How-to question with multiple approaches, I will move this to the CodeShare Corner for more feedback. Thanks.

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

ExpressionEngine News!

#eecms, #events, #releases