-
Posts
533 -
Joined
-
Last visited
Everything posted by adrianmak
-
pages searching is not working properly for asian text
adrianmak replied to adrianmak's topic in General Support
I figured out the problem. Instead of using operator ~=, I should use %= to search properly -
I found that search with substring of asian text is not working properly Some substring can be found but some are not. Here is a demo of this issue. Searching a japanese page
-
could not get post to an external php script
adrianmak replied to adrianmak's topic in General Support
@Adrian, your code works. From reading the api doc https://processwire.com/api/include/ $temp_var = $wire->input->post->search; $temp_var = wire('input')->post->search; Aren't they equivalent ? --------------------------- Read again from my op, I putted a $ sign for the input, that's why it is not working -
search <?php $page->body .= "Content Search<br/> <p> <form action='/pw1/query2.php' method='post'> <input type='text' id='search' autocomplete='off' name='search'> <input type='submit' value='submit'> </form> <p> <h4 id='results-text'>Showing results for: <b id='search-string'>Array</b></h4> <div id='results'></div> "; include("./main.php"); query2.php <?php // ProcessWire bootstrap include('index.php'); $temp_var = $wire->$input->post->search; //$temp_var = $_POST["search"]; echo($temp_var); When form submitted to query2.php, no form value echoed. if I use PHP built-in $_POST , submitted value is echoed.
-
could a ajax submit call directly to a php script ?
adrianmak replied to adrianmak's topic in General Support
You are correct. -
could a ajax submit call directly to a php script ?
adrianmak replied to adrianmak's topic in General Support
No, the query.php is just an external php file put under the webroot of pw installation folder i.e I could direct access thru http://test.local/pw1/query.php /pw1 is a sub-folder of webroot, where pw installed. -
i'm going to create a live content search. Typing in a text field will return search result on the fly. for testing purpose, I search on another database query,php <?php /************************************************ The Search PHP File ************************************************/ /************************************************ MySQL Connect ************************************************/ // Credentials $dbhost = "127.0.0.1"; $dbname = "ajaxsearch"; $dbuser = "root"; $dbpass = "root"; // Connection global $tutorial_db; $tutorial_db = new mysqli(); $tutorial_db->connect($dbhost, $dbuser, $dbpass, $dbname); $tutorial_db->set_charset("utf8"); // Check Connection if ($tutorial_db->connect_errno) { printf("Connect failed: %s\n", $tutorial_db->connect_error); exit(); } /************************************************ Search Functionality ************************************************/ // Define Output HTML Formating $html = ''; $html .= '<li class="result">'; $html .= '<a target="_blank" href="urlString">'; $html .= '<h3>nameString</h3>'; $html .= '<h4>functionString</h4>'; $html .= '</a>'; $html .= '</li>'; // Get Search $search_string = preg_replace("/[^A-Za-z0-9]/", " ", $_POST['query']); $search_string = $tutorial_db->real_escape_string($search_string); // Check Length More Than One Character if (strlen($search_string) >= 1 && $search_string !== ' ') { // Build Query $query = 'SELECT * FROM search WHERE function LIKE "%'.$search_string.'%" OR name LIKE "%'.$search_string.'%"'; // Do Search $result = $tutorial_db->query($query); while($results = $result->fetch_array()) { $result_array[] = $results; } // Check If We Have Results if (isset($result_array)) { foreach ($result_array as $result) { // Format Output Strings And Hightlight Matches $display_function = preg_replace("/".$search_string."/i", "<b class='highlight'>".$search_string."</b>", $result['function']); $display_name = preg_replace("/".$search_string."/i", "<b class='highlight'>".$search_string."</b>", $result['name']); $display_url = 'http://php.net/manual-lookup.php?pattern='.urlencode($result['function']).'〈=en'; // Insert Name $output = str_replace('nameString', $display_name, $html); // Insert Function $output = str_replace('functionString', $display_function, $output); // Insert URL $output = str_replace('urlString', $display_url, $output); // Output echo($output); } }else{ // Format No Results Output $output = str_replace('urlString', 'javascript:void(0);', $html); $output = str_replace('nameString', '<b>No Results Found.</b>', $output); $output = str_replace('functionString', 'Sorry :(', $output); // Output echo($output); } } ?> custom.js /* JS File */ // Start Ready $(document).ready(function() { // Icon Click Focus $('div.icon').click(function(){ $('input#search').focus(); }); // Live Search // On Search Submit and Get Results function search() { var query_value = $('input#search').val(); $('b#search-string').text(query_value); if(query_value !== ''){ $.ajax({ type: "POST", url: "query.php", data: { query: query_value }, cache: false, success: function(html){ $("ul#results").html(html); } }); }return false; } //$("input#search").live("keyup", function(e) { $("input#search").on("keyup", function(e) { // Set Timeout clearTimeout($.data(this, 'timer')); // Set Search String var search_string = $(this).val(); // Do Search if (search_string == '') { $("ul#results").fadeOut(); $('h4#results-text').fadeOut(); }else{ $("ul#results").fadeIn(); $('h4#results-text').fadeIn(); $(this).data('timer', setTimeout(search, 100)); }; }); }); While I step thru the js, it seems the query.php is not executed (or not found ?). As I input a random text, it should display "No Results Found." on the page.
-
I want to add a custom js for a specific page. instead of adding this js in master output template, how to add a js file to that template ?
-
support pw 2.5 ?
-
I don't quit get it. It is good to have a tutorial video, instead of module demonstration
-
it could be good to make a installation profile for others for learning
-
why not cart items stored in session ? any other consideration ?
-
without using the ListerPro paid module, how could i build such a management interface ?
-
which implementation is better for different queries mysite.com/brandname mysite.com/product-type mysite.com/men mysite.com/women using URL segment or create each of them with a page
-
Like SKU of a product in a e-commerce website ? I could not find related field option in the admin ui.
-
This setup good enough for a site selling one kind of product. How about multiple kinds of product ? for example an apparel store, computer store
-
I'm wondering Nico's module could be easily to extend to work with Page module
-
I submitted multi-language issue on page reference field https://github.com/ryancramerdesign/ProcessWire/issues/889
-
A sidetrack with the ux. Since my local pw test site is configured as a mult-language, I found that those tags created by Page reference field will not make other languages active of tag.
-
That's method inspired me
-
There is a jq plugin https://github.com/aehlke/tag-it I'm thinking of how to write a module with this plugin. ps I'm just learning the front-end development of pw. I have zero knowledge on pw's module development.
-
my concern is, free tagging with comma separator ux are being used by all web application over the world, where ppl is already familar with
-
I have tried all the options of Input (Tab) > Input Field Type. They are not work as I desired. Most of them are provided a list box type.
-
I have setup free tagging. However the tag input behaviour different than most I used. Now, I could input one by one, instead of a single line separate with commas
-
If my understanding is correct, each tag is a page store under /config/tags/ That's is +config/tags/ -apple -banana -orange -lemon right ? Then, what is in /config ?