Can I set my search result page headers dynamically to include the search phrase?

I don’t even know how to write an example of this, sorry.

I want my search result pages to include the search term in the h1 on the page.
In my current site, I am able to simply echo the URL parameter in the page, but it’s a numerical value (like ‘1309’) that corresponds to a placeName in a joined table. The real ‘placeName’ appears in the GridView on the page, but I don’t know how to use that data outside the gridView.

Is there a way to do it?

In Yii2 gridView has a Caption property, which sounds like it would serve for this use, but I don’t think that property existed in Yii 1.

(And yes, still working on a Yii 1 site in 2023.)

  1. You have the data.
  2. I think you can extend from CGridView and override methods you need.
1 Like