Skip to main content
Updated with mys solution.
Source Link
ZEDG
  • 55
  • 7

i have been pulling my hair out trying to understand this so any help is appreciated.

I have a channel 'Content' which is just the 'pages' of the site. My template groups are setup using only the 'index' template: template_group/template

eg,
coaching/index
management/index

And my navigation (done using Navee): template_group/entry1 (from 'Content' channel)

coaching/schools
coaching/instructors
management/forms

All straight forward. Now i have a simple search form which i want people to be able to search the entries on the site (from the 'Content' channel) but i need to know how to produce the correct search results page.

In channel preferences > path settings > channel URL ... ..my 'Content' channel does not have a specific url - since it is different depending on the template group.

eg, If i enter and save http://www.example.com/coaching/ into the field, then do a search for 'schools', the results display http://www.example.com/coaching/schools which is correct. But if i search 'forms' the results brings up http://www.example.com/coaching/forms instead of http://www.example.com/management/forms

So since the 'Content' channel does not have a specific 'Channel URL', how do i get search results to product the link to the correct page/entry??




UPDATE. My Solution.
I created categories for each of the six template groups, then assigned each page/entry to a category. I then used the below conditionals to produce the correct search results:
{if category_url_title == "ONE"}
<h3><a href="/ONE/{url_title}">{title}</a></h3>{/if}

{if category_url_title == "TWO"}
<h3><a href="/TWO/{url_title}">{title}</a></h3>{/if}

{if category_url_title == "THREE"}
<h3><a href="/THREE/{url_title}">{title}</a></h3>{/if}

etc, etc..

Ps. Using the above with {excerpt} just duplicated the excerpt from the first result, to each other result. So instead of excerpt i used a custom field (meta description text field).

i have been pulling my hair out trying to understand this so any help is appreciated.

I have a channel 'Content' which is just the 'pages' of the site. My template groups are setup using only the 'index' template: template_group/template

eg,
coaching/index
management/index

And my navigation (done using Navee): template_group/entry1 (from 'Content' channel)

coaching/schools
coaching/instructors
management/forms

All straight forward. Now i have a simple search form which i want people to be able to search the entries on the site (from the 'Content' channel) but i need to know how to produce the correct search results page.

In channel preferences > path settings > channel URL ... ..my 'Content' channel does not have a specific url - since it is different depending on the template group.

eg, If i enter and save http://www.example.com/coaching/ into the field, then do a search for 'schools', the results display http://www.example.com/coaching/schools which is correct. But if i search 'forms' the results brings up http://www.example.com/coaching/forms instead of http://www.example.com/management/forms

So since the 'Content' channel does not have a specific 'Channel URL', how do i get search results to product the link to the correct page/entry??




UPDATE. My Solution.
I created categories for each of the six template groups, then assigned each page/entry to a category. I then used the below conditionals to produce the correct search results:
{if category_url_title == "ONE"}
<h3><a href="/ONE/{url_title}">{title}</a></h3>{/if}

{if category_url_title == "TWO"}
<h3><a href="/TWO/{url_title}">{title}</a></h3>{/if}

{if category_url_title == "THREE"}
<h3><a href="/THREE/{url_title}">{title}</a></h3>{/if}

etc, etc..

i have been pulling my hair out trying to understand this so any help is appreciated.

I have a channel 'Content' which is just the 'pages' of the site. My template groups are setup using only the 'index' template: template_group/template

eg,
coaching/index
management/index

And my navigation (done using Navee): template_group/entry1 (from 'Content' channel)

coaching/schools
coaching/instructors
management/forms

All straight forward. Now i have a simple search form which i want people to be able to search the entries on the site (from the 'Content' channel) but i need to know how to produce the correct search results page.

In channel preferences > path settings > channel URL ... ..my 'Content' channel does not have a specific url - since it is different depending on the template group.

eg, If i enter and save http://www.example.com/coaching/ into the field, then do a search for 'schools', the results display http://www.example.com/coaching/schools which is correct. But if i search 'forms' the results brings up http://www.example.com/coaching/forms instead of http://www.example.com/management/forms

So since the 'Content' channel does not have a specific 'Channel URL', how do i get search results to product the link to the correct page/entry??




UPDATE. My Solution.
I created categories for each of the six template groups, then assigned each page/entry to a category. I then used the below conditionals to produce the correct search results:
{if category_url_title == "ONE"}
<h3><a href="/ONE/{url_title}">{title}</a></h3>{/if}

{if category_url_title == "TWO"}
<h3><a href="/TWO/{url_title}">{title}</a></h3>{/if}

{if category_url_title == "THREE"}
<h3><a href="/THREE/{url_title}">{title}</a></h3>{/if}

etc, etc..

Ps. Using the above with {excerpt} just duplicated the excerpt from the first result, to each other result. So instead of excerpt i used a custom field (meta description text field).

Updated with mys solution.
Source Link
ZEDG
  • 55
  • 7

i have been pulling my hair out trying to understand this so any help is appreciated.

I have a channel 'Content' which is just the 'pages' of the site. My template groups are setup using only the 'index' template: template_group/template

eg,
coaching/index
management/index

And my navigation (done using Navee): template_group/entry1 (from 'Content' channel)

coaching/schools
coaching/instructors
management/forms

All straight forward. Now i have a simple search form which i want people to be able to search the entries on the site (from the 'Content' channel) but i need to know how to produce the correct search results page.

In channel preferences > path settings > channel URL ... ..my 'Content' channel does not have a specific url - since it is different depending on the template group.

eg, If i enter and save http://www.site.com/coaching/http://www.example.com/coaching/ into the field, then do a search for 'schools', the results display http://www.site.com/coaching/schoolshttp://www.example.com/coaching/schools which is correct. But if i search 'forms' the results brings up http://www.site.com/coaching/formshttp://www.example.com/coaching/forms instead of http://www.site.com/management/formshttp://www.example.com/management/forms

So since the 'Content' channel does not have a specific 'Channel URL', how do i get search results to product the link to the correct page/entry??




UPDATE. My Solution.
I created categories for each of the six template groups, then assigned each page/entry to a category. I then used the below conditionals to produce the correct search results:
{if category_url_title == "ONE"}
<h3><a href="/ONE/{url_title}">{title}</a></h3>{/if}

{if category_url_title == "TWO"}
<h3><a href="/TWO/{url_title}">{title}</a></h3>{/if}

{if category_url_title == "THREE"}
<h3><a href="/THREE/{url_title}">{title}</a></h3>{/if}

etc, etc..

i have been pulling my hair out trying to understand this so any help is appreciated.

I have a channel 'Content' which is just the 'pages' of the site. My template groups are setup using only the 'index' template: template_group/template

eg,
coaching/index
management/index

And my navigation (done using Navee): template_group/entry1 (from 'Content' channel)

coaching/schools
coaching/instructors
management/forms

All straight forward. Now i have a simple search form which i want people to be able to search the entries on the site (from the 'Content' channel) but i need to know how to produce the correct search results page.

In channel preferences > path settings > channel URL ... ..my 'Content' channel does not have a specific url - since it is different depending on the template group.

eg, If i enter and save http://www.site.com/coaching/ into the field, then do a search for 'schools', the results display http://www.site.com/coaching/schools which is correct. But if i search 'forms' the results brings up http://www.site.com/coaching/forms instead of http://www.site.com/management/forms

So since the 'Content' channel does not have a specific 'Channel URL', how do i get search results to product the link to the correct page/entry??

i have been pulling my hair out trying to understand this so any help is appreciated.

I have a channel 'Content' which is just the 'pages' of the site. My template groups are setup using only the 'index' template: template_group/template

eg,
coaching/index
management/index

And my navigation (done using Navee): template_group/entry1 (from 'Content' channel)

coaching/schools
coaching/instructors
management/forms

All straight forward. Now i have a simple search form which i want people to be able to search the entries on the site (from the 'Content' channel) but i need to know how to produce the correct search results page.

In channel preferences > path settings > channel URL ... ..my 'Content' channel does not have a specific url - since it is different depending on the template group.

eg, If i enter and save http://www.example.com/coaching/ into the field, then do a search for 'schools', the results display http://www.example.com/coaching/schools which is correct. But if i search 'forms' the results brings up http://www.example.com/coaching/forms instead of http://www.example.com/management/forms

So since the 'Content' channel does not have a specific 'Channel URL', how do i get search results to product the link to the correct page/entry??




UPDATE. My Solution.
I created categories for each of the six template groups, then assigned each page/entry to a category. I then used the below conditionals to produce the correct search results:
{if category_url_title == "ONE"}
<h3><a href="/ONE/{url_title}">{title}</a></h3>{/if}

{if category_url_title == "TWO"}
<h3><a href="/TWO/{url_title}">{title}</a></h3>{/if}

{if category_url_title == "THREE"}
<h3><a href="/THREE/{url_title}">{title}</a></h3>{/if}

etc, etc..

Source Link
ZEDG
  • 55
  • 7

Displaying search results if more than one template group

i have been pulling my hair out trying to understand this so any help is appreciated.

I have a channel 'Content' which is just the 'pages' of the site. My template groups are setup using only the 'index' template: template_group/template

eg,
coaching/index
management/index

And my navigation (done using Navee): template_group/entry1 (from 'Content' channel)

coaching/schools
coaching/instructors
management/forms

All straight forward. Now i have a simple search form which i want people to be able to search the entries on the site (from the 'Content' channel) but i need to know how to produce the correct search results page.

In channel preferences > path settings > channel URL ... ..my 'Content' channel does not have a specific url - since it is different depending on the template group.

eg, If i enter and save http://www.site.com/coaching/ into the field, then do a search for 'schools', the results display http://www.site.com/coaching/schools which is correct. But if i search 'forms' the results brings up http://www.site.com/coaching/forms instead of http://www.site.com/management/forms

So since the 'Content' channel does not have a specific 'Channel URL', how do i get search results to product the link to the correct page/entry??