Posts by nightowl

    Thanks for replying Clive, and apologies for the delay in responding. It appears the issue may be caused by corruption of some of the database tables.


    I tried myisamchk (the check and repair tool) with various parameters and it made no difference. Running -r for recover resulted in it finding some errors and supposedly recovering them, only for the same thing to happen when it was run again.


    I am working on restoring the database from a copy.


    I think that it may have got corrupted when XAMPP crashed out. I was getting the error about not being able to create xampp-control.ini, a common issue it would seem. Each time I found the only way out was to end the process through Task Manager. I have rectified this and XAMPP now closes without issue.

    I am using XAMPP to test a site locally. When I edit a region then save it, all images in that region disappear. By this I mean it is as if I had not added any images. It was working as it should for a while until it started behaving like this.


    When the region is opened, all the images are present. On clicking 'Save' they disappear. On visiting the html page, the src of the img tag(s) is/are empty while that of alt is present. Clicking Undo on the region rolls it back and restores the image(s).


    On making any change to a text field and saving the region, such a change appears on the resulting HTML page, so it is saving.


    I am running XAMPP Control Panel V3.2.24 with PHP 7.3.25 and MariaDB V10.4.17 in Windows 7 SP1 Premium 64 bit.


    Examination of the JSON stored in the database for the two revisions reveals the following. These are excerpts which begin and end at the same point. As you can see, the latter is missing some data.


    The immediate prior revision, with the image present:

    Code
    1. "product_name":"Physio high back 24 hour task chair (PH1)","product_image":{"assetID":"8021","title":"Physio high back 24 hour task chair ph1 1","_default":"\/images\/seating\/physio-high-back-24-hour-task-chair-ph1-1.jpg","bucket":"imgSeating","path":"physio-high-back-24-hour-task-chair-ph1-1.jpg","size":11256,"w":327,"h":448,"mime":"image\/jpeg","sizes":{"thumb":{"w":"109","h":"150","target_w":150,"target_h":150,"density":2,"path":"physio-high-back-24-hour-task-chair-ph1-1-thumb@2x.jpg","size":8349,"mime":"","assetID":"8022"}}},"alt":"Physio high back 24 hour task chair (PH1)","price":"465.50"


    The latest revision where the image has disappeared:

    Code
    1. "product_name":"Physio high back 24 hour task chair (PH1)","product_image":{"assetID":"8021","title":"Physio high back 24 hour task chair ph1 1","_default":"\/images\/seating\/physio-high-back-24-hour-task-chair-ph1-1.jpg","bucket":"imgSeating"},"alt":"Physio high back 24 hour task chair (PH1)","price":"465.50"

    Thanks for your comments.


    The rewrite looks good for tidying up the URL. I came up with the following:


    <a href="<perch:search id="next_url" rewrite="/search/{page:%s/}" encode="false" /><perch:search id="search_key" encode="false" />">Next</a>


    This produces /search/2/satin where, in this example, '2' is the page number and 'satin' is the search. Obviously, I would want it the other way around, with search term followed by page number.


    The problem here, from what I can see, is that the rewrite can only be affected on the pagination query string because that alone is what next_url returns.

    Since writing the above, I've discovered /perch/templates/search/search-result.html. In it we have the following which generates the 'Page # of #' and the 'Previous' and/or 'Next' links where applicable:



    I was reading the Perch documentation page on Search Tags which says that search_key is the value that was searched for. I amended the hyperlink on line 9 of the above as follows (modified bit in red):


    <a href="<perch:search id="next_url" encode="false" />&q=<perch:search id="search_key" encode="false" />">Next</a>


    This works. But this template, as shipped with Perch, doesn't include the bit I've added, which suggests it's not necessary and should otherwise work.


    What am I missing?

    I am working on the website https://www.ianscottofficefurniture.co.uk/ which uses the search function. There are a couple of issues relating to the search function. The site is running Perch Runway 3.2 and the server has PHP 7.3.25.


    On entering a search term, e.g. satin, the first page of search results are displayed. The problem is that the hyperlink to the next page (at the bottom of that page) conveys only the page parameter – there is no q (search query) or go (whatever that does), i.e. the link is https://www.ianscottofficefurniture.co.uk/search.php?page=2


    How can I get it to generate the correct hyperlink, with search query?


    The second question is is it possible to search multiple directories? The options array of perch_content_search() allows searching of only part of the site, by defining from-path. Does this allow multiple paths or just one?


    The site was designed by someone else and originally had all the products in the /products/ directory. In my quest to shorten the URLs, removing the /products/ bit, I have moved some of the categories to the root. I have now realised that the search function isn't picking them up and that this is because from-path is set to '/products/' in search.php.


    I don't want the search function picking up the contact page, about page and so on, just the products. Is it possible to search multiple directories? Or might this explain why the products were placed in their own directory?


    What order does the search function output results? Is it simply in order that they were added to the site (i.e. by ascending page ID number)?