2 of 2
2
How do I change where search results point?
Posted: 23 May 2008 11:22 AM   [ Ignore ]   [ # 19 ]  
Grad Student
Rank
Total Posts:  79
Joined  04-28-2008
Lisa Wess - 23 May 2008 10:49 AM

There isn’t a specific documentation that discusses the search results this way.  However, I think what will help is if you read The Importance of Semantics.  This will explain how ExpressionEngine interacts with the URL in order to present the correct data on your site.  It does this with the search results, which is why your last segment has the URL title, not the index. 

As a note here, if you used a template other than index, then it would be index.php/mysite/template_name/url_title

ExpressionEngine simply drops the index template because it is not needed - it is assumed in this case.

Just one other comment - you posted at 3:30am thne 8:48am.  I do need to ask that you give us a little longer than just the first few hours of early morning, before you bump a post or assume that a non-answer means impossible.  I can assure you that if it’s not possible, we will tell you that at least, and try to supply some way to reach your goals.

Thanks, mork.  We’ll all get this worked out together. =)

Hi Lisa,

Thanks for the reply. I wasn’t bumping the thread, but I am keen to get this worked out - -it’s about 6.30pm here and I should have stopped work by now - but I appreciate the time difference between us confused

I’ve read the semantics article, it seems that I need the link to go to a ”multi-entry page” rather than a single one, which it is doing at the moment. Is it possible to amend the search results page to get it to point at the ‘shop’ page for example, which comtains multiple entries, rather than a ‘single entry’?

<li><b><a href="{auto_path}">{title}</a></b> from <em>{weblog}</em><br/>{excerpt}<br/></li>

At the moment the single entries are displayed seemingly randomly, so, for example, I have a left hand column list of ‘latest posts’ on all my pages, and sometimes the single entry has the items listed, and sometimes it doesn’t.

This is why I either need to change the results location to the multi entry page, or create a standalone ‘single entry’ page. If you could give me a link that can show me how to create one of these then I can hopefully end my two day saga on this single feature.

I guess what I need is a step by step tutorial or guide for dummies like me to creating the basic pages for a search, results, and single entry display. Is there one available?

Thanks.

Profile
 
 
Posted: 23 May 2008 11:45 AM   [ Ignore ]   [ # 20 ]  
Moderator
Avatar
RankRankRankRankRankRankRankRank
Total Posts:  32857
Joined  05-14-2004

mork - perhaps we could back up a bit.  The search module is used to search weblog entries. When you search, you’ll receive a list of entries that meet that criteria. The search results Path is then intended to allow people to click on the search result (re: weblog entry) that they want to read.  For that purpose, you need the single-entry page; not the multi-entry page.

Now, what is your goal here? You want to take them to a multi-entry page?  Or, as you mention later on, is the goal to use a single entry page, but you’re not sure on how to do that? 

As per the semantics article (the first one in the series), a single entry page and a multiple entry page can be the same template - the difference is simply having the URL Title in segment 3.  If this isn’t working for you (and it sounds like it isn’t, hence the confusion!), then please post the code you are using in your mysite/index template, so that we can try to diagnose where the problem is.

Thank you, mork!

 Signature 
Profile
MSG
 
 
Posted: 23 May 2008 12:00 PM   [ Ignore ]   [ # 21 ]  
Grad Student
Rank
Total Posts:  79
Joined  04-28-2008
Lisa Wess - 23 May 2008 11:45 AM

mork - perhaps we could back up a bit.  The search module is used to search weblog entries. When you search, you’ll receive a list of entries that meet that criteria. The search results Path is then intended to allow people to click on the search result (re: weblog entry) that they want to read.  For that purpose, you need the single-entry page; not the multi-entry page.

Now, what is your goal here? You want to take them to a multi-entry page?  Or, as you mention later on, is the goal to use a single entry page, but you’re not sure on how to do that? 

As per the semantics article (the first one in the series), a single entry page and a multiple entry page can be the same template - the difference is simply having the URL Title in segment 3.  If this isn’t working for you (and it sounds like it isn’t, hence the confusion!), then please post the code you are using in your mysite/index template, so that we can try to diagnose where the problem is.

Thank you, mork!

Hi Lisa,

My index page is the general home page. It contains an introduction into the company, and several weblogs for recent information. Would this page be used to display the search results or can I specify and create a new blank template?

My goal is just to get the thing to work. I would prefer to be able to direct visitors to a specific page that contains all that particular weblogs entries - e.g. the ‘shop’ page that I mentioned earlier, but if this isn’t possible then for sanitys sake I’m happy to build a new single entry page. I just need to know how to do this - I’ve been searching the documentation for two days and I can’t find anything.

I’ve used embeds to hold the navigation and other items, as per the Boyink tutorial:

{embed="includes/html_header" my_page_title="Home"}
<body>
<
div id="container">
        <
div id="tophome">    
{embed="includes/logo_title"}     
        
{embed
="includes/main_nav" my_location="home"}     
            
    
</div>    
    <
div id="contentcontainer">    
        <
div id="content">
    
{exp:weblog:entries weblog="home" disable="catgories|member_data|pagination|trackbacks" sort="asc" }
<h1>{title}</h1>
{body} {/exp:weblog:entries}
            
<div class="greybox">
            <
h2>Dates for your Diary</h2>  

    
{exp:weblog:entries weblog="diary" disable="catgories|member_data|pagination|trackbacks" sort="asc" }
<h3>{title}</h3>
{body} {/exp:weblog:entries}
            
</div>
      </
div>
  <
div id="right">
{embed="includes/latest_news"}
{embed
="includes/latest_products"}        
      
</div>
    </
div>        
{embed="includes/footer"}              
    
</div>    
   </
body>
</
html>

Here is my search results page:

<h2> {exp:search:total_results} Result(s) for {exp:search:keywords}</h2>
<
ul>
{exp:search:search_results switch="resultRowTwo|resultRowOne"}
<li><b><a href="{auto_path}">{title}</a></b> from <em>{weblog}</em><br/>{excerpt}<br/></li>
{/exp:search:search_results}
</ul>

Thanks.

Profile
 
 
Posted: 23 May 2008 12:09 PM   [ Ignore ]   [ # 22 ]  
Moderator
Avatar
RankRankRankRankRankRankRankRank
Total Posts:  32857
Joined  05-14-2004

The search results have to point to a single entry page.  Multi entry pages change, based on the criteria in the opening weblog entries tag - so if you use a multi-entry page, the search results may never actually get the expected results.  If you want to always return a certain template, then a search may not be the right method here.

For your search results:

My index page is the general home page. It contains an introduction into the company, and several weblogs for recent information. Would this page be used to display the search results or can I specify and create a new blank template?

The answer here is either. For instance, this code from your template:

{exp:weblog:entries weblog="home" disable="catgories|member_data|pagination|trackbacks" sort="asc" }
<h1>{title}</h1>
{body} {/exp:weblog:entries}

Other than the typo of disable=“catgories” (should be categories), this will work for either a single-entry or multi-entry page.  If you visit it with just the template name in segment_2 (or leave off index, so no segment 2), then you’ll get all the entries returned as per your sort=“asc” and other parameters.  If you visit it with a URL title in segment 3 (mysite/index/url_title) then you’ll get a single entry.

Now, my personal preference is to use a different template for my single-entry pages; I like the finer-grained, clean control.  But that is not necessary and is purely personal preference.  Perhaps during the learning stage, a separate template would be easier - then you can make an informed decision down the line.

 Signature 
Profile
MSG
 
 
Posted: 23 May 2008 12:30 PM   [ Ignore ]   [ # 23 ]  
Grad Student
Rank
Total Posts:  79
Joined  04-28-2008

Aha! Hehe!

I think I’ve got it.

I’ve created a new template using the code you suggested (the typo must be from the boyink tutorial) and tweaked the entries weblog to ‘products’, as an example, updated the weblog admin url to point to the new template, and viola it has displayed the new entry.

I guess I’ve got two options now - I can either create single entry pages for each section, and amend the weblog details as I did above for each template, or I could find a way to use a single page that can display entries from any weblog. I’m guessing this is the more sensible option…how do I amend the code so it works with multiple blogs?

Thanks for your help and patience Lisa….I’m nearly there!

wink

Profile
 
 
Posted: 23 May 2008 12:35 PM   [ Ignore ]   [ # 24 ]  
Moderator
Avatar
RankRankRankRankRankRankRankRank
Total Posts:  32857
Joined  05-14-2004

I highly recommend becoming intimate with the weblog= parameter. =)  If you use multiple weblogs, that parameter will be your new best friend.

Ultimately, if you use different templates or the same template is informed by other factors - are they greatly different in overall look and feel?  Or are they essentially the same, with just different data?  Do you need to restrict viewing access by different member groups?  If so, you need two templates.

Etc.  These things do clarify over time, I promise, and we are (as you have seen) here to help in the process.

Are you all set as far as the questions in this thread?  We like to keep separate issues separate, so they’re easy to follow (both for you and I in the thread; and for future viewers).  So if this issue is clarified for you, I’ll resolve it and you can start a new thread with more questions, as those light bulbs continue to turn on. =)

 Signature 
Profile
MSG
 
 
Posted: 23 May 2008 01:39 PM   [ Ignore ]   [ # 25 ]  
Grad Student
Rank
Total Posts:  79
Joined  04-28-2008

Hi Lisa,

Yes I’ve got enough info to be able to create a single entry page now. By leaving out the weblog=“weblogname”  bit the page will work with any weblog. I have set up different field groups for some weblogs, so I would need to create templates to work with each of these, but I should be able to work out how to do this now.

Thanks again for your help   smile

Profile
 
 
Posted: 23 May 2008 01:56 PM   [ Ignore ]   [ # 26 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  15368
Joined  05-15-2004

Glad to see you’re all set for the time being. If anything else, related or not, comes up, kindly start a new thread. Thank you.

 Signature 

Everything will be good in the end. If it’s not good, it’s not the end.

Profile
MSG
 
 
   
2 of 2
2
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 09:33 AM
Total Registered Members: 64908 Total Logged-in Users: 37
Total Topics: 81852 Total Anonymous Users: 25
Total Replies: 440059 Total Guests: 239
Total Posts: 521911    
Members ( View Memberlist )