Jump to content

Peter Falkenberg Brown

  • Content Count

  • Joined

  • Last visited

  • Days Won


Peter Falkenberg Brown last won the day on November 28 2019

Peter Falkenberg Brown had the most liked content!

Community Reputation

173 Excellent

About Peter Falkenberg Brown

  • Rank
    Sr. Member

Contact Methods

  • Website URL

Profile Information

  • Gender
  • Location
    Maine, USA
  • Interests
    I'm a writer, speaker, and publisher.
    I also own a web programming consulting business at:
    I specialize in creating custom websites and web database applications.

Recent Profile Visitors

8,211 profile views
  1. Thanks, @jonatan... The solutions above worked perfectly. Because I already had ready.php code to set the name field to the ID, all I had to do was set the allowed template for children to "item" and then set the Name format for children to "Y-m-d-H-i-s." Voilà! Thanks again! Ain't ProcessWire Grand? Peter
  2. Thanks, @jonatan! If I put "id" in that field instead of title, will it automatically skip the name/title page and create the name based on the id? I should have specified more clearly: I want to skip that initial page completely and end up on the edit page, with the name field automatically filled in with the auto-increment ID. Thanks again, Peter
  3. Hi All, I thought I saw that a feature had been developed that allowed one to click "New" to add a new child page, and skip the name field page, and go directly to the edit page, with the name field already having the ID as the value. If that hasn't been developed, is there a way to do that? I've been scouring my posts and searching the forum because I know that I got advice from someone to set the name field to the ID using ready.php, using this code: $pages->addHookAfter('added', function(HookEvent $event) { $page = $event->arguments(0); if($page->template == 'item') { $page->setAndSave([ 'name' => $page->id, ]); } }); ... but I can't find the darn post in the forum. (I'm using the code above.) My client wants to skip the step where he has to add a fake name value (like 'n') which then gets overwritten by the ID, using the code above. Thanks! Peter
  4. Hi Folks, I am stuck, after scouring the API docs, module code, and forum questions. I'm trying to write code that upon the initial pressing of a search button will set the page number to something other than 1. For example, the query might return 50 pages, but I want to start by showing page 7, with the pagination boxes appearing on both sides of the highlighted box 7. Here's my code (setPageNum will only be used if it's an initial search button press (which I'll check with a hidden form field)). $results = $pages->find("$select_limit"); $pager = $modules->get('MarkupPagerNav'); $pager->setNumPageLinks($numPageLinks); $pager->setPageNum(7); $pagination = $pager->render($results); The returned pagination all looks good EXCEPT that it always starts at page 1 instead of page 7, like this: Any help would be greatly appreciated. Peter
  5. Back in 2005/6, I built a SSG/CMS combination application, based on a Perl Framework that I had written. The magazines' editors input their stories via a CMS login, and then, when they were done, they clicked a button that sent a special secure command to the server to run a script that generated all of the pages as static HTML files. It generated thousands of pages blazingly quickly. Having done that, I think ProcessWire with ProCache accomplishes the same thing, since it also writes HTML files. But... ProcessWire is SO much better than my application ever was, for so many reasons. ProcessWire with ProCache gives us the best of both worlds. Peter
  6. You're very welcome, @szabesz! (and thank you!) This thread started with my how-to questions about image migration. Besides the modules that @adrian and @kongondo mentioned, I didn't find any clear documentation about how to deal with image migration with comprehensive detail (I might have missed finding it). Of course, I read a number of pages about image scripting, but I didn't see info that covered all the bases. Adrian expressed skepticism about the stability of the module Kongondo mentioned, and Adrian's module didn't fit my specific needs, so I didn't use either of those modules, and decided to proceed with my own script. But my script didn't deal with cropped images (because I didn't have any), unless they're automatically brought over by the copy command I ran to bring in any image variations. Thus, my script might have missed some important things with images. I'm not sure. I'd love to see a how-to on this very topic, i.e. a comprehensive write-up of how to migrate images and catch every detail. My efforts were a "roll-your-own" attempt to do it, and it worked for me. But I have no confidence that I covered all the details of image migration. If I did, I'd love to hear about it. 🙂 Peter
  7. Hi All, I've added routines to the script to create a file of hrefs in the body field, and also a file of 301 redirects for an .htaccess file. There are so many edge cases with internal hrefs that I decided to edit them by hand, based on the list created. (For example, an href that links to a second internal PW page on the target domain that PW's url system on the source domain doesn't know about.) I also moved the chown command to include pages that didn't have images, because the file dir has to be owned by the domain and running the script as root ends up making the file dir owned by root. Again, I realize that this script may only serve a very small group of people who need to do exactly what I needed it for: to migrate many sections of pages from one PW domain to another PW domain that had a different section structure. I've successfully and quickly moved many sections and pages as of now, so I'm confident that the script is doing what I needed. If someone else finds it useful, that's grand. 🙂 Here it is, below. Click the "reveal hidden contents" icon below to see it. Peter
  8. Hi @szabesz, Good idea... I deleted the 1st version of the script and put the second one in a spoiler. I couldn't figure out how to delete an empty spoiler or code block. Do you know how? Edit: I figured it out: just go below the empty box and hit the backspace key until it's gone. 🙂 Thanks again, Peter
  9. Hi All, I've brought my wee script forward to the point of functionality for my use, minus a couple of things I'll be adding, like a routine to create a list of 301 redirects that I'll be pasting into my .htaccess file on the "old" domain. I'm also going to write a separate small script to click through pages to migrate that will create a list of href's in each page's body text, so that I can see if they have to be edited. In my case, and my experience, href's can have so many variations, including links to external pages, links to internal PW pages that have been moved *internally*, and links to PW pages that have moved to an external site (e.g. the site being migrated to, using a different url). So I'm not trying to incorporate href modification into the script at this time. I realize that Adrian @adrian has created a very complex and thorough blackbox module for migrations. My script is in no way a replacement for his *much more* sophisticated module. As I mentioned, and as I've noted in the script, I wrote this for a very narrow use-case that may only be useful to me. No idea, actually. I'm eager to dig deeper and deeper into ProcessWire, and move from my own procedural code method into object-oriented code. Lot's of catching up to do, since for the last 13 years I've been managing servers, etc, and didn't code all day, every day. But my oh my, I LOVE ProcessWire. What a joy to use. 🙂 EDIT: May 26, 2020: I've added the routines listed above to v1.1, pasted in a new response below, dated May 26. I also fixed an error with the chown action. See post further down, for the script. Peter
  10. Hi @adrian, I ran the exporter and importer on 1 page, and had the following issues: (I used Append as you suggested.) - The template file was still overwritten - the parent page was imported, probably because the parent page didn't exist in the target site (by design). (I only wanted to migrate the pages under one section to a new section in the target site.) - the images and pdf's were in the zip file but they did not upload to the files/ID dir - the links in the body text still had the old id in the source. - and when I selected "Edit Imported Content" it failed and produced an error - "Missing required ZIP or JSON Source" (when I didn't select that, the second time, it worked, but with the issues above) Yours, Peter
  11. Hi @kongondo, Great suggestion! So much better. On your comment about the find v. get -- you are correct, but that was just a test bit of code. My real export will have multiple pages via a find. Thanks VERY much for your help! Peter
  12. Thanks, @Ivan Gretsky and @kongondo, My old site is on PW 3.0.42, whereas the module is in 3.0.72. My new site is on 3.0.148. Looks like I'll have to upgrade. Peter
  13. Hi @kongondo, You wrote: I looked for that in my Modules setup and also on the PW modules page, and couldn't find it. Do you have a link to it? Thanks, Peter
  • Create New...