Jump to content

alexcapes

Members
  • Posts

    120
  • Joined

  • Last visited

Posts posted by alexcapes

  1. Thanks @netcarver

    I'll update here on progress. 

    The situation was that we had all our DNS on an old hosting company — I set this account to be closed and copied over all the DNS records to our new hosts (DigitalOcean).

    However the old account was taken offline earlier than expected so the TTL values are all high and so everything needs to propogate. Couple that with being locked out of DigitalOcean because I can't verify my login, means I'm stuck waiting to see if this all works out and everything comes back.

    Life lesson: switching anything to do with DNS should be done with great care and planned for. It's not nice when everyone is looking at you as why their email stopped working and there's nothing to do but... wait.

     

     

  2. Hi,

    I enabled hsts in the new .htaccess file in latest version of PW (as described here https://processwire.com/blog/posts/pw-3.0.135/#step-4-decide-whether-to-to-enable-hsts-section-9f)

    Everything seemed okay but realised my subdomains had gone offline ('This site can’t be reached') and now both our main business website has gone offline and our emails (done through Google Apps) have stopped working). 

    Could hsts be responsible for all this? I removed the new .htaccess and now have the old one, I also tried resetting Chrome to remove the hsts domains but nothing works.

    Funnily I can't access our hosting now (Digital Ocean) because I have no access to my email.

    Please can any help shine a light on this? Can hsts be this dangerous?!

     

    • Like 1
  3. Hi,

    I've been invited by Apple to use their 'News' service for a publication in the UK. https://www.apple.com/uk/news/

    A number of CMSs already have plugins to publish content via the API, however Processwire is not one (yet!)
    https://newsresources.apple.com/en/faq/66346243

    It's slightly beyond my technical abilities but would be very interested in anyone that is willing to look at developing a Processwire Module.

    (for reference here is the Apple News API documentation)

    Update: Chapter Three have created a PHP Apple News library here https://github.com/chapter-three/AppleNewsAPI

    • Like 1
  4. On 27/07/2017 at 0:27 AM, Robin S said:

    I can't reproduce that. Maybe you have some odd unicode character in your text that is confusing SmartyPants? Or an unclosed open quote before the sentence in question?

    2017-07-27_112215.png.1d8873a4843d47df2592513dd7bfe551.png

    Digging a bit (and by that I mean actually looking at the source!) it looks like this is not a SmartyPants issue. 

    I can see that the double quote is being encoded by Processwire incorrectly as a right double quotation mark.

    <p class='review'>&#8221;<i>How Music Works </i>is a melange of bookish musings on how music is shaped by the places it is played and the technology used to create and disseminate it”<br/><span class='review-source'>Danny Eccleston<br/><em>mojo</em></span>

    However the data source for this content (an XML file) the quotes look just to be normal double quotes

    <Text><![CDATA["<i>How Music Works </i>is a melange of bookish musings on how music is shaped by the places it is played and the technology used to create and disseminate it"]]></Text>

    So I'm not sure why Processwire would encode (incorrectly) the first double quotation mark (if before an HTML tag) and no others?

  5. 40 minutes ago, Robin S said:

    @alexcapes, are you looking for a solution that would allow non-superusers to restore accidentally trashed PageTable pages? Or is it just an occasional mistake that a superuser needs to fix on request? If it's just the latter you could restore the pages from the trash and use Version Control or Changelog to put the PageTable field back how it was before the deletion.

    This would be for super-users only as last resort to fix mistakes.

    I think using 'Version Control' may be a workable solution although it does feel a little like using a sledgehammer to crack a nut - I don't really need/want version control and it might add too much complication for the client - and I only need this 'restore' option on one single pagetable field.

    Just to note I don't think changelog offers any way to 'restore' the a previous state of a field. 

    *Update*
    Version Control can be switched on for specific fields only so I think this is going to be a workable solution for me. Thanks @Robin S

    *Update #2*
    Looks like Version Control is not compatible with PageTable fields.

     

     

  6. On 2017-6-13 at 1:08 AM, Robin S said:

    It would be possible to get the relationship at the time a page is trashed - for instance, with a PageTable field you could hook InputfieldPageTable::processInput() and get the pages about to be trashed. As for simple it depends on what you're comfortable with. To store the information in a self-contained way your module would need to create and use its own database table. There are existing modules you could look at as an example of how to do this, e.g. Template Access by Parents

    Thanks @Robin S I'll have a play around and see if I can get something working.

  7. On 2017-6-7 at 10:45 PM, Robin S said:

    It would be nice if restoring a page could simultaneously restore relationships for that page, but I'd say the current behaviour is not unexpected. The same limitation would apply if the page had been selected in a Page Reference field (which is PageTable field is like an extended version of).

    If you check the names of pages in the Trash you can see how the location and sort position of the original page is stored:

    2017-06-08_094236.png.4919b0a0b275399288a3fc0817070549.png

    I guess it's just not practical to keep all the relationship information that applied to a page in this kind of format.

    I wonder how difficult it would be to store the relationship info somewhere else and then add the page back to the PageTable if restored? Do you think it's doable with a simple module?

  8. Hi,

    I've noticed when I trash pages from a PageTable field, then restore them, they are restored to their original location, however the connection is broken with the PageTable field.

    Is this expected behaviour? Is there a way for it to maintain this relationship? Otherwise restoring it doesn't actually restore it to it's previous state.

    Note that in this case the parent pages for the PageTable field is not set as the direct parent.

     

     

     

    • Like 1
  9. Hi,

    I just updated a site to 3.0.61 and it's breaking uploading images from a URL via the API.

    I get the following error:

    Recoverable Fatal Error: Method ProcessWire\Pageimage::__toString() must return a string value

    The code getting the image is very simple:

    $new_edition->work_cover = $cover_url;
    $new_edition->save('work_cover');

    It works fine on 3.0.42 but returns the error on 3.0.61

     

     

  10. Hi, 

    I have a site search working correctly on a project, however I seem to be having issue when the search term contains characters such as question marks or brackets.

    I'm doing the following... 

    $q = $input->get->text('q');
    
    if($q) {
      $input->whitelist('q', $q);
      $q = $input->get->selectorValue('q');
    }
    
    $matches = "search_cache~={$q}, sort=-publish_date";

    This works correctly for everything except searches that include characters such as ? or ( )

    So for example a searches for the following (where the page title is "example title?")

    1. example title
    2. example title?

    The first one works as expected and the second returns 0 results.

    As the titles are very specific for a user to search, I need to make sure the search works with these kind of characters.

    How can I make sure search works with these kind of characters?

     

     

     

     

  11. <?$work_pages = new PageArray();?>
    
    <?$project_1 = $pages->get("parent=/work/projects, limit=1, sort=sort");
    $work_pages->add($project_1);
    // Code for Project 1 goes here
    
    $project_2 = $pages->get("parent=/work/projects, id!=$work_pages, limit=1, sort=sort");
    $work_pages->add($project_2);
    // Code for Project 2 goes here
    
    $project_3 = $pages->get("parent=/work/projects, id!=$work_pages, limit=1, sort=sort");
    $work_pages->add($project_3);
    // Code for Project 3 goes here
    // etc

    I have the above code which gets project pages then adds the project to an array to exclude from the next selector.

    I'm sure this was working fine but seems to have started including unpublished pages - if I unpublish or hide pages they still show up. I've done some troubleshooting and have excluded any caching issues - the code is definitely pulling in unpublished pages.

    Working on Processwire 2.8.35

     

  12. @Robin S I think I've found an issue with the module. 

    It seems to stop image fields from working correctly. When I upload images now I get a thumb + spinner but the spinner never stops.

    This is what I see in the inspector:

    Uncaught SyntaxError: Unexpected token < in JSON at position 0(…)
    parseJSON @ JqueryCore.js?v=1479135253:2
    (anonymous function) @ InputfieldImage.min.js?v=119-1479135253:1

    When I uninstall the module, image fields work as expected again.

    • Like 1
  13. 5 hours ago, adrian said:

    Not sure I understand exactly where you need these value to be displayed, but this module may or may not be useful: https://processwire.com/talk/topic/14439-dynamic-description-notes/

    I got what I needed working using RuntimeMarkup. Basically I needed to have two field values (book name and authors) from the containing page of a PageTable field page copied to the PageTable field page. These fields are needed to display in the Page field where you can select the 'featured' quote. Without the two fields in the dropdown you just have the quote which needs the context of the author and book name.

  14. 8 minutes ago, Robin S said:

    Looks like I didn't test my module for single Page fields. :rolleyes:

    Will get that sorted in an update soon. In the meantime just set the 'featured_on' Page field to 'multiple' and it should work.

    Ah ha! Yes it's working now! Thank you :)

    My final challenge on this is getting a couple of field values from the containing page of the quote into the custom page label format of 'quotes_featured'. I'm going to look at either RuntimeMarkup or FieldtypeReference for that challenge.

×
×
  • Create New...