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.

find and replace {auto_path} in search results

August 28, 2010 5:49pm

Subscribe [2]
  • #1 / Aug 28, 2010 5:49pm

    Lachlan Munday

    29 posts

    I have a site that has multiple sites running off it. Each site is just held in it’s own template group.

    http://www.mysite.com/event1/
    http://www.mysite.com/event2/

    Each event site uses the same channels such as News, Videos Photos etc. and i use Status’s to define the sites.

    Problem is when I use the search on each site, the results come out using the {auto_path} and i can only set the auto_path URL to one site.

    For example my Search Results URL for the news channel in the admin is http://www.mysite.com/event1/news-article/

    The problem is that this stuffs up the search results on my http://www.mysite.com/event2/search-results/ page as it sends the user to http://www.mysite.com/event1/news-article/story_title.

    Is there a way to a edit the address on the fly, i would love to just reference the {segement_1} some how.

    any advice would be greatly appreciated.

  • #2 / Aug 30, 2010 8:44am

    Sue Crocker

    26054 posts

    Hi, Lachlan.

    See this line from the default search results template?

    <td class="{switch}" width="30%" valign="top"><b><a href="http://{auto_path}">{title}</a></b></td>

    You don’t *have* to use {auto_path} you could hard code the results to go to:

    <td class="{switch}" width="30%" valign="top"><b><a href="http://www.mysite.com/event2/news-article/{url_title}">{title}</a></b></td>

    Does that help?

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

ExpressionEngine News!

#eecms, #events, #releases