Forums / Setup & design / How to direct the searchresult to the right page/place

How to direct the searchresult to the right page/place

Author Message

Tor Olav Steinsvoll

Saturday 02 August 2003 10:17:19 am

Hi. I hope someone can help me. I have put a search-field on top of my frontpage and the search works just fine, both ways, simple and advanced. I get the results that I want.

What my problem is: How can I direct the results of the search to the right page/place? The result of the search brakes up my page and my menu on the left side disappears.

(I have not created my own copies of search.tpl and adv....search.tpl. I use the ones that comes with the installation.)

Regards from Tor Olav

David Jones

Friday 08 December 2006 3:02:49 am

I need the answer to this question.

Does anybody know?

Jon Staines

Friday 08 December 2006 8:22:04 am

If it is just stopping the menu from disappearing then I had the same problem. If there are further page breaks then can you explain how it broke?

For the missing menu on a search page I've used 2 different solutions depending on the site. If your menu is always the same, ie only one level or you use flyout menus so always have to load the whole thing then I used something like (where xxxxx is the root of the tree):

    {let root_node=fetch( content, node, hash( node_id, 2 ) )
         menuitems=fetch( content, list, hash( parent_node_id, xxxxx,
                                               class_filter_type, include,
                                               class_filter_array, ezini( 'MenuContentSettings', 'LeftIdentifierList', 'menu.ini' ),
                                               sort_by, $root_node.sort_array ) )}
{* MOZILLA MENU *}
<div id="leftmenu-design">
    <ul class="flyout1" id="nav-flyout">
    {section var=menu loop=$menuitems}

The li entry goes here, or have a further lookup based on the node id of this entry if you want more levels for flyouts.

    {/section}
    </ul>
</div>

If your design drops into sublevels of the menu so you need it to know the what node you are in for pages other than the search, then try:

{let docs=treemenu( $module_result.path,
                    is_set( $module_result.node_id )|choose( 2, $module_result.node_id ),
                    ezini( 'MenuContentSettings', 'LeftIdentifierList', 'menu.ini' ),
                    0, 5 )
                    depth=1
                    last_level=0}
        {if eq($:docs|count(),0)}
          {let root_node=fetch( content, node, hash( node_id, 2 ) )
               menuitems=fetch( content, list, hash( parent_node_id, 2,
                                                     class_filter_type, include,
                                                     class_filter_array, ezini( 'MenuContentSettings', 'LeftIdentifierList', 'menu.ini' ),
                                                     sort_by, $root_node.sort_array ) )}
            {section var=menu loop=$menuitems}
              <li class="menu-level-0"><a href={$menu.url_alias|ezurl}>{$menu.name}</a></li>
            {/section}
        {else}
          {section var=menu loop=$:docs last-value}

Normal menu template code in here

          {/section}
        {/if}
{/let}

In this, it checks if there would be results to form the tree and if it fails, a search page, then it just loads the default tree starting from node 2.

Hope this points you in the right direction.