Open accordion block and highlight text in search result
Permalink
I looked for this type of info on the forums and didn't see anything.
Has anyone seen or been involved with making a search results page, etc, open accordion blocks and highlight the search text, to make it easier to find/get the info searched for?
Update:
I have the highlighting of the search query text working. Now I'm just trying to get the accordion panel with the search query text to expand open when visiting the page from the search results.
I added the query string item "query" to the search template used for the results page, and that's what I'm reading to highlight the relevant text, but I'm stuck on opening the accordion panel. Below is my view (add-on lg_accordion_content).
Jason
Has anyone seen or been involved with making a search results page, etc, open accordion blocks and highlight the search text, to make it easier to find/get the info searched for?
Update:
I have the highlighting of the search query text working. Now I'm just trying to get the accordion panel with the search query text to expand open when visiting the page from the search results.
I added the query string item "query" to the search template used for the results page, and that's what I'm reading to highlight the relevant text, but I'm stuck on opening the accordion panel. Below is my view (add-on lg_accordion_content).
<?php defined('C5_EXECUTE') or die("Access Denied."); ?> <div id="accordion-container"> <?php if (!empty($field_1_textbox_text)): ?> <h2 class="accordion-header"><?php echo htmlentities($field_1_textbox_text, ENT_QUOTES, APP_CHARSET); ?></h2> <?php endif; ?> <?php if (!empty($field_2_wysiwyg_content)): ?> <?php // Obfuscate email addresses in href links $field_2_wysiwyg_content = preg_replace_callback('/(<a[^>]*href=")(mailto:)([^"]+)/', create_function('$matches','return $matches[1] . "#NOSPAM:" . TransparentEmailObfuscationPackage::mb_strrev(str_replace("&","&",$matches[3]));'), $field_2_wysiwyg_content); // Obfuscate email adresses in text // regex inspired byhttps://pureform.wordpress.com/2008/01/04/matching-a-word-characters... $field_2_wysiwyg_content = preg_replace_callback('/\b[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]+\b(?!([^<]+)?>)/i', create_function('$matches','return "<span style=\"unicode-bidi:bidi-override; direction: rtl;\" class=\"transparent-email-obfuscation-unreverse\">" . strrev($matches[0]) . "</span>";'),$field_2_wysiwyg_content);
Viewing 15 lines of 32 lines. View entire code block.
Jason