Jump to content

Create a page that embeds search results?


Prank

Recommended Posts

Posted

On my old 3.x board, I could embed search results into a page to have a topic page (good for SEO).

For example, this page would have 'topic1' search results on it, so you could just link people to site.com/topic1.

Is there any easy was on 4.x to do the same thing? I'm desperate to make some topic pages to link to.

Thanks,

Christian

Posted

I created a block that seriously *almost* works.

 

{{
  $query = \IPS\Content\Search\Query::init();
  $query->setLimit( 20 );
  $title = "Search Term";
  $results = $query->search( $title );
  $count = $results->count( TRUE );
  $termArray = $query->termAsWordsArray( $title );
  $baseUrl = \IPS\Http\Url::internal( 'app=core&module=search&controller=search', 'front', 'search' );
  $pagination = trim( \IPS\Theme::i()->getTemplate( 'global', 'core', 'global' )->pagination( $baseUrl, 1, 1, 0 ) );
  

}}

{template="resultStream" group="search" params="$results, $pagination, $baseUrl"}

But that bottom line kills it. I've tried returning the template in PHP also. Page just times out. 

Can anybody tell me what I'm doing wrong?

Thanks,

Christian

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...