Quantcast
Channel: C1 CMS Foundation - Open Source on .NET
Viewing all articles
Browse latest Browse all 2540

New Post: Simple Page Search

$
0
0
Hi,

You can extend the Search function and add additional parameter, for example named ParentPage (to search within Descendants of that page) :
1) edit function ~\App_Data\Razor\Composite\Search\SimplePageSearch\SearchResults.cshtml
2) add new input parameter:
 [FunctionParameter(Label = "Parent Page for Search", DefaultValue = null)]
  public NullableDataReference<IPage> ParentPage { get; set; }
3) add next code after the line #95:
if (ParentPage != null)
        {
            using (var con = new DataConnection())
            {
                var pagesIdsOfParentPage = con.SitemapNavigator.GetPageNodeById(ParentPage.Data.Id).GetPageIds(SitemapScope.DescendantsAndCurrent).ToList();
                combinedSearchResult = pagesIdsOfParentPage.Intersect(combinedSearchResult).ToList();
            }
        }

Viewing all articles
Browse latest Browse all 2540

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>