Jump to content

adrian

PW-Moderators
  • Posts

    11,262
  • Joined

  • Last visited

  • Days Won

    374

Everything posted by adrian

  1. Not really answering your question, but I think these days, this module (http://modules.processwire.com/modules/search-engine/) by @teppo might be a better approach to what you're trying to achieve.
  2. Something like this should get you going. This is stolen from a recent import I did which worked well. This assumes you have a field called "images" that you want the images uploaded to. I have also done more complex versions of this when the source HTML image tags have width and height tags - you can use those to resize the images using the PW API and embed that version back into the HTML. $dom = new \DOMDocument(); @$dom->loadHTML(mb_convert_encoding($html, 'HTML-ENTITIES', 'UTF-8')); foreach($dom->getElementsByTagName('img') as $img) { // grab image from the external URL and add to images field try { $np->images->add('http://olddomain.com/' . $img->getAttribute('src')); if($img->getAttribute('alt') != '') { $np->images->last()->description = $img->getAttribute('alt'); } $img->setAttribute('src', $np->images->last()->url()); } catch(\Exception $e) { // in case remote image can't be downloaded } } return preg_replace('/^<!DOCTYPE.+?>/', '', str_replace( array('<html>', '</html>', '<body>', '</body>', '<p>&amp;n<p>', '<p><p>', '</p></p>'), array('', '', '', '', '<p>', '<p>', '</p>'), $dom->saveHTML()));
  3. What about Tracy's PW Info panel - finds the page and provides edit, view, and open links. Maybe you want for site editors, in which case this obviously isn't very useful, but I use this many times a day during development.
  4. Surely you'll also want to find all images and automatically upload them to the assets/files/xxxx for the new page and then rewrite the img src to the new path. Maybe also grab the alt tag and add that to the description field in PW. Personally I would go with DOMDocument over a regex for this, but both would work.
  5. Is a new AJAX bar showing at all (even without a Dumps panel entry). If it's not, then it's probably an issue with Nette forms not sending the 'X-Requested-With': 'XMLHttpRequest' Or maybe it's related to that - if it's an AJAX form submission and then you do a redirect afterwards, that a) seems to defeat the reason for an ajax submission, and b) is probably why the AJAX bar is lost. Does it show in the ajax bar if you don't do the redirect? Not sure about that - I'll look a little later and after I hear back about those possible reasons for #1
  6. Sorry, I have no idea cause that should result in the same thing. If you do feel like debugging, you'll see that the way I handle renaming when the settings is hidden is to move the name field to the Content tab and then hide it (https://github.com/adrianbj/PageRenameOptions/blob/8665aca5023417163841603fda8037df2ccbe245/PageRenameOptions.module#L95-L98) You could check to see that the field is correctly being placed there and that it is changing when the title is changed. The easiest way to do that is to use the browser dev console with this after you've changed the title. $('#Inputfield__pw_page_name').val(); If not, then at this point I'll need to hear from someone else.
  7. Via the System tab setting, or are you applying via a hook or something? Fair enough ? - if anyone else is having issues with this not working, please let me know.
  8. Hey @bernhard - it works for me. How are you disabling the settings tab?
  9. Perhaps @Robin S's similar module (https://github.com/Toutouwai/FieldtypeRuntimeOnly) might work?
  10. That dev version number is automatically updated from Github (AFAIK) but not sure how often it is called. It is showing 3.0.155 as of right now. Regardless it will always download the latest dev version.
  11. If you work with deeply nested / large JSON data and you use Adminer, the latest update will allow you to speed things up significantly with a few new config options. I've also included a PR to the JSON preview plugin which this functionality relies on - my changes ensure the max text length setting is applied to json that is kept as a string due to the max level setting.
  12. @toni - the docs show (https://processwire.com/api/ref/page/references/) that you can use a selector exactly as you are describing. Did you try to see if it works as you want?
  13. In reality, that getImageInfoSVG() method should probably try to get the dimensions from the viewbox attribute in the SVG (if actual width and height attributes are not available), before it resorts to using imagick to get them. That would remove the need to rasterize just to get the dimensions.
  14. Sorry, I thought you were calling a "good host" a luxury. Anyway, I am sure there are no ill feelings - sorry if I over-analyzed things ?
  15. New toggle arrow to collapse / show the snippets side pane with the state remembered via cookie. VS
  16. Fair enough - it just sounded strange to call a good host a luxury in response to Eydun's attempt to help, and also to keep bringing up that set_time_limit error. Not everyone reading this thread will know about the other thread where we figured out the cause of that error so it just confounds those trying to help you here - make sense?
  17. You can get a VPS at Linode or Digital Ocean for $5 / month. Throw Server Pilot on that and you have a great setup with all the control you need.
  18. Yeah, that should be plenty. There can be lots of reasons for the SQL error - that is just one of them. You may need to dig further to discover the cause, but next I would check mysql's set max_allowed_packet setting. Also, be sure to Google the that error as there are lots of suggestions on what to check.
  19. This is why I keep saying that PW is not going to be compatible with one.com - there are several places in the core that use it.
  20. When I was getting this it turned out to be a PHP memory limit issue. What is it currently set at?
  21. I think this is what you need: https://processwire.com/blog/posts/multi-instance-pw3/
  22. Just a quick update to you all know that there is a new keyboard shortcut for reloading a snippet from disk, clearing previous output, and running the code which should be a nice time saver and also prevent you from accidentally running old code in the console that hasn't been updated from the disk version when you are using an external editor. I have also rejigged the execution of code when "Run" is called vs injecting. Hopefully the visual cues of the button changing from "Run" to "Inject" and the status in the header showing "Inject @ Ready" makes it more obvious what is going to happen when. Another update is that the Dumps Recorder panel now stores its data in a file so that it will survive across sessions which may be useful if you are hooking certain session methods and other scenarios where the normal Dumps panel is not showing your bd() calls.
  23. Thanks @houseofdeadleg for those settings. 1) Testing here I am not seeing any problems, but I have committed a new version that should fix that notice that is showing up in your CSV export. 2) The field pairing options are available if you define Configurable Pages under the "Where editing tools are available and separately configurable" section. You then define the field pairing on the settings tab of the page whose children you are exporting. 3) You don't need to share sensitive data - please just create a minimum test case CSV file that shows the problem with only the first line importing. Also, are you on Windows, Linux, or MacOS? I am thinking it might be a lined ending issue. Also, what PHP version are you running?
  24. @houseofdeadleg - can you send me the module settings data - this module (http://modules.processwire.com/modules/module-settings-import-export/) makes it really easy. Otherwise, if you have Tracy installed, open up the BCE module settings page and then open the Adminer panel and copy the json from the data field. Can you also post (here or PM) the CSV that you are trying to import that only imports the first line.
  25. Yeah, that makes sense ? Ok, so after spending way too much time, it's not specifically a Tracy issue. If you do a Tracy log call, eg: $this->addHookAfter('Session::loginSuccess', function(HookEvent $event) { l('Session::loginSuccess'); }); then it works fine. The issue is that dumps are stored in a variable and added to as needed during the current request. But it seems like PW hasn't actually started its session at Session::loginSuccess. If you try the same bd() call at Session::init then it works as expected. $this->addHookAfter('Session::init', function(HookEvent $event) { bd('Session::init'); // works }); So, I looked into the possibility of making it possible to do bd() calls and have them carry over to the next PW session (after the login has actually started the session) and there are possibilities, but I think they all come with downsides. I think it might help the Dumps Recorder panel though in that I'll be able to make it keep data over sessions, so I might consider that. I'll mull it over for a bit. As a reminder (almost just for myself), Session::loginSuccess does work on some setups (eg my local dev environment), so there must be some differences in how sessions are handled that is impacting this.
×
×
  • Create New...