Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 07/14/2021 in all areas

  1. Hello wonderful people, I've recently started using devdocs.io as my go-to reference for various programming languages and libraries; it's a great resource. Would be nice to see PW's API documentation in there too, but I don't yet know what needs to be done for this to happen. In the meantime, enjoy the docs :)
    3 points
  2. I can't say that I have a strong opinion here either. Also not sure if I grasp the whole context — when you say "routing" and mention URL segments, does that mean that you create routes automatically based on page structure (I assume so but...) or that there's a separate routing setup for front-end and page structure is only reflected in the data? Or do you mean something different with this? ? This may or may not be related, but one thing to consider is whether you want Symprowire to be "all in", or rather something that can be used only for some parts of the site. Couple of examples from other MVC(ish) solutions: Template Engine Factory hooks before Page::render and replaces the response, but also provides hookable method (TemplateEngineFactory::shouldRenderPage) for preventing it from rendering the page, in which case the site will fall back to the regular rendering flow (whatever that happens to be). Wireframe takes an entirely different approach: instead of a hook ("enabled by default") you need to point templates that you want to render via it to the front controller file via Alternate Template Filename setting (more details in the docs). Essentially it's disabled by default. Wireframe is my pet project and something we've used for our production sites for a while now, so that's what I'm mostly familiar with. I intentionally decided not to use hooks, since I felt it was best to let the developer decide if they want to use Wireframe for everything, just a small part of the site, or something in between. In fact it's possible to skip the MVC structure entirely, and just use Wireframe for its partials and/or components ?‍♂️ Template Engine Factory may be a bit closer to Symprowire feature wise, although Symprowire clearly has a much larger scope (and is more opinionated). So not sure if any of what I've said here applies as-is ?
    3 points
  3. I did exactly the same thing a year or two ago. Here's the script I used (I've simplified the selector and a couple of other things, and added one comment). The script moves the image description and the ImageExtra field 'credit' to the new 'photo_caption' and 'photo_credit' fields. I don't know if you're familiar with running such scripts, but you simply put the script somewhere on your server and enter its URL in your browser. It might be a good idea to test with the saves commented out. <?php // Amend depending on where this script file is located include("../index.php"); $selectedRecords = $wire->pages->find("template=my-template"); echo "Pages with images: " . count($selectedRecords) . "<br/>"; $recordsProcessed = 0; foreach($selectedRecords as $thisRecord) { echo $thisRecord->title . "<br/>"; $recordsProcessed += 1; if(count($thisRecord->article_images)) { $thisRecord->of(false); foreach($thisRecord->article_images as $image) { $description = $image->description; $credit = $image->credit; $image->photo_caption = $description; $image->photo_credit = $credit; $thisRecord->save('article_images'); } $thisRecord->save(); } } echo "<p>Records processed: {$recordsProcessed}</p>"; ?> This was written for a one-off task, so I did nothing to refine it, but it worked. Note that at the time both saves were necessary, though I think this has been resolved now and, depending on which version of PW you are running, you may be able just to save the whole record - but it'd probably be easier to leave it as it is!
    3 points
  4. Wow... thanks again @teppo! https://weekly.pw/issue/374/
    2 points
  5. According to their trello board for new suggestions: Project must have >5k stars on GitHub or equivalent The star count for processwire is currently under 700, so this is a long way to get there.
    2 points
  6. Currently you could get this from the versionControlRevisions() method of the page. The value of said property is an array of all existing revisions, or null if none were found, so passing it to count() will tell you how many of those there were: echo count($page->versionControlRevisions());
    1 point
  7. The script should be a standalone PHP file, not placed in a template. So, for example, you might name the script "fix-images.php" and put the file in /site/. Then, if you normally access the site at https://www.mysite.com, run the script by accessing https://mysite.com/site/fix-images.php . For more details, take a look at this page (particularly the last section): https://processwire.com/docs/front-end/include/
    1 point
  8. Working Full-Time on the Module for this week after getting it running its just good old Symfony Development to make the Glue hold tight on ProcessWire. I plan to build a Blog with Symprowire next to see if everything works as expected. I added a small Project over at Github to keep you informed. Will continue to post release notes. For now, I edited the 1st Post as this would be my Base to develop the Blog.
    1 point
  9. Yes! That seems to work! Thank you once again! This is my code that works: $input->whitelist('q', $q); $input->whitelist('tag', $tag); $input->whitelist('sort', $sort); $pagination = $mypage->renderPager(array( 'nextItemLabel' => "next", 'previousItemLabel' => "prev" ));
    1 point
  10. Have you tried setting the whitelist separately? $input->whitelist('q', $q); $pagination = $mypage->renderPager(array( 'nextItemLabel' => "next", 'previousItemLabel' => "prev" ));
    1 point
  11. @kaz Determine what template(s) you want to use pagination with. Go to Admin > Setup > Templates > [Your Template] > URLs, and check the box for: Allow Page Numbers. Save. https://processwire.com/docs/front-end/markup-pager-nav/
    1 point
  12. Hi @kaz please check the settings for the template you are using this on. I think you need to turn on the "Allow Page Numbers" option in the settings. I've not tried it, but I hope that helps.
    1 point
  13. Hi @cb2004 https://processwire.com/api/ref/page/#pwapi-methods-manipulation $page->addUrl($url)
    1 point
  14. Thank you Bill and Mark, you've been most helpfull.
    1 point
×
×
  • Create New...