Will client-side code work for you?
Search is made, page loads, JS sees a match, and redirects.
To avoid mayhem, set SimpleSearch to be strict, whole sentence search, so that you don't have multiple entries
$(".resultPageTitleLink").each(function(){
if($(this).text() == $("#searchField").val())
//alert($(this).text());//for debug
window.location.replace(this.href);
})
TinymceWrapper: Complete back/frontend content solution.
Harden your MODX site by
passwording your three main folders:
core, manager, connectors and renaming your
assets (thank me later!)
5 ways to sniff / hack your own sites; even with renamed/hidden folders, burst them all up, to see how secure you are not.
Thanks for this...but if my understanding is correct then this code would only execute on the results page anyway? I am looking to skip that altogether as the user might find this somewhat confusing? Or would if just be a flash of the page? If nothing better comes up through here then I will implement this.
Thanks again!
you could create a snippet like that:
<?php
$search = $modx->getOption('search',$_REQUEST,'');
if (!empty($search) && $object = $modx->getObject('modResource',array('published'=>'1','deleted'=>'0','pagetitle'=>$search))){
$url = $modx->makeUrl($object->get('id'));
$modx->sendRedirect($url);
}
and call it at the top of your search-landing-page.
Quote from: Bruno17 at Jul 15, 2015, 06:44 AMyou could create a snippet like that...
There is code, and then there is magic!!!
This looks awesome.
TinymceWrapper: Complete back/frontend content solution.
Harden your MODX site by
passwording your three main folders:
core, manager, connectors and renaming your
assets (thank me later!)
5 ways to sniff / hack your own sites; even with renamed/hidden folders, burst them all up, to see how secure you are not.
Cool idea, and an excellent example of what makes MODX so great.