http://forum.cmsmadesimple.org/viewtopi ... 28&t=53903
Hi I am having the same issue that was mentioned in the previous unanswered thread. How to have my search results be only the menu text, and not the title text?
[SOLVED]Search results: menu text instead of title text
[SOLVED]Search results: menu text instead of title text
Last edited by RyanC on Fri Feb 10, 2012 6:54 pm, edited 1 time in total.
Re: Search results: menu text instead of title text
This is the code I'm using:
Code: Select all
{menu template="cssmenu.tpl"}
<div id="search">{search search_method="post" resultpage="search-results"}</div>
</div><!--navbar-->
</div><!--navContainer-->
</div><!--navWrap-->
<div id="inner">
<div id="productInfo">
<div id="searchResults">
{content block="searchResultsField"}
<div id="resultText">
<p>{$searchresultsfor} "{$phrase}"</p>
</div>
{if $itemcount > 0}
<ul>
{foreach from=$results item=entry}
<li><a href="{$entry->url}">{$entry->urltxt}</a> </li>
{/foreach}
</ul>
{else}
<p><strong>{$noresultsfound}</strong></p>
{/if}
</div><!--searchResults"-->
Re: Search results: menu text instead of title text
Could someone at least point me in the right direction? Is what I'm asking even possible?
Re: Search results: menu text instead of title text
Anyone? Is this possible?
Re: Search results: menu text instead of title text
UDT:
Using in Searchresult tmeplate:
Code: Select all
/**
* @params string $params['url']
*/
$gCms = cmsms();
$cntnt = cmsms()->GetContentOperations();
foreach ($cntnt->GetAllContent() as $page) {
if ($page->GetURL() == $params['url']) {
$return = ($page->menutext());
//print_r($page);
break;
}
}
if(!empty($params['assign'])){
$smarty = cmsms()->GetSmarty();
$smarty->assign(trim($params['assign']), $return);
}
else{
return $return;
}
Code: Select all
{udt_name_you_give url=$entry->url}
Re: Search results: menu text instead of title text
Thanks for that info. I'll give it a try soon. 

Re: Search results: menu text instead of title text
Hi,
I created a UDT called "menu_as_results" with the code you supplied. Could you tell me where in the template to actually put that line? I don't know php yet so I don't understand where these tags belong.
I created a UDT called "menu_as_results" with the code you supplied. Could you tell me where in the template to actually put that line? I don't know php yet so I don't understand where these tags belong.
Last edited by RyanC on Fri Feb 10, 2012 6:55 pm, edited 1 time in total.
Re: Search results: menu text instead of title text
uniqu3 wrote: Using in Searchresult tmeplate:
Re: Search results: menu text instead of title text
I got it, thanks!
I fixed it, this was the place to put the code:

I fixed it, this was the place to put the code:
Code: Select all
{foreach from=$results item=entry}
<li><a href="{$entry->url}">{menu_as_results url=$entry->url}</a> </li>