Jump to content

JoshoB

Members
  • Posts

    115
  • Joined

  • Last visited

About JoshoB

  • Birthday 01/27/1980

Profile Information

  • Gender
    Male

Recent Profile Visitors

3,007 profile views

JoshoB's Achievements

Sr. Member

Sr. Member (5/6)

24

Reputation

2

Community Answers

  1. Earlier message deleted: I made a mistake with the relative paths -- it all works now, great! Thank you! ?
  2. Sorry, wrong thread: I will have a look if I can reverse the order, but I think the problem will be the same, as PW will look for a URL that doesn't exist.
  3. I am also trying to make this work in ready.php to compile Bootstrap on-the-fly, but I get a weird error. Here is the code, adapted from the stuff so kindly shared earlier in the thread, with some modifications to make the file modification checks work (or so I thought): // Define the paths $inputScssPath = $config->paths->templates . "scss/custom.scss"; $bootstrapScssPath = $config->paths->templates . "bootstrap/scss"; $outputCssPath = $config->paths->templates . "styles/bootstrap_custom.css"; $outputMapPath = $config->paths->templates . "styles/bootstrap_custom.map"; // Check if the output CSS file exists and if any SCSS file has been modified $recompileRequired = !file_exists($outputCssPath); if (!$recompileRequired) { $outputCssMTime = filemtime($outputCssPath); $recompileRequired = false; // Find all .scss files in the /scss/ folder $watchFiles = $files->find( $config->paths->templates . "scss", ['extensions' => 'scss'] ); foreach ($watchFiles as $watchFile) { if (filemtime($watchFile) > $outputCssMTime) { $recompileRequired = true; break; } } } // Compile SCSS if recompilation is required if ($recompileRequired) { $scss = $modules->get('Scss'); $compiler = $modules->get('Scss')->compiler; if($compiler) die("Found module."); else die("Module not found!"); $compiler->setSourceMap($compiler::SOURCE_MAP_FILE); $compiler->setSourceMapOptions([ 'sourceMapURL' => $outputMapPath, 'sourceMapFilename' => $outputCssPath, 'sourceMapBasepath' => $config->paths->root, 'sourceRoot' => '/', ]); $compiler->addImportPath($bootstrapScssPath); $compiler->setOutputStyle("compressed"); // Get the result $result = $compiler->compileString('@import "'.$inputScssPath.'";', $config->paths->templates . "scss"); // Save the output in the proper files file_put_contents($outputMapPath, $result->getSourceMap()); file_put_contents($outputCssPath, $result->getCss()); } It kept giving me a fatal error at the line with $compiler->setSourceMap($compiler::SOURCE_MAP_FILE); (complains about NULL), so I added the check with the die statements: it cannot find the compiler for some reason. But if I change if($compiler) to if($scss) -- I added $scss for testing purposes -- it finds the latter just fine. Any idea what I am doing wrong here?
  4. I was using this to share early access to articles with Patreon users. However, Patreon now filters query strings from URLs, which is a PITA. I wanted to rework this module to use URL segments, so that any URL that ends in /preview/ becomes a preview link, but no dice: ProcessWire throws a 404 every time, regardless of what I try. Any suggestions or ideas? Thanks again. ?
  5. I am looking for an ecommerce solution with ProcessWire and this seems to fit the bill. Supporting the latest version of SnipCart and enforcing use of PHP 8 are both fine, I think.
  6. Still working on my CRM... I need to send emails with attachment. I am using the WireMailPHPMailer module. Everything seems to work fine, but sending an attachment doesn't work. The attachments are selected on the form from pages. Each of those page features a file field (called just "file") with a file, usually a PDF. In the e-mail form, I enter the sender, the addressee, the subject, the message, and then I select, from a dropdown, the attachment I want to attach to this message. However, clicking "send" will send the e-mail, but without an attachment. I think this code will make it more clear ($formAttachment is the ID that gets sent as a $_GET variable when the form is submitted, and "file" is the field that contains the selected file in question): $file = $pages->get("id=$formAttachment")->file; $mail->addAttachment($file->path, $file->name); Going step by step through the code, the error ProcessWire throws up is "Could not access file". I have been banging my head against this now for a week, so I am hoping that someone here can have a look and say, "Oh hey, you need to do this and it's fine." I am pretty sure it has to do with either permissions in the file structure (this is a file that gets upload to /assets/ for the page in question), or that my understanding of ProcessWire's "path" is completely off. Either way, any help would be greatly appreciated!
  7. Oh, cheers! I think I managed to solve it thanks to that thread. For posterity/future reference, this is what I wrote in the parent template: // Populate history_repeater with history from underlying pages, too foreach($page->children() as $child) { $page->history_repeater->add($child->history_repeater); } $page->history_repeater = $page->history_repeater->find("sort=-datetime");
  8. I am building a website that serves as a client management system. I have organisations (each a page) and they are parent pages to contacts (i.e. people). Both the organisations and the contacts beneath them have a repeater field, "history_repeater", that is used to store comments in. The repeaters consist of a date/time field ("datetime") and a comment field ("comment"). An organisation page should show the complete history for that organisation, i.e. add the "history_repeater" data from the underlying pages (contacts) to the main "history_repeater" field in the organisation page, and then reverse sort the results by "datetime". I cannot seem to figure out how to do this in a neat way without taking recourse to building an array. I think it should be doable with a simple selector and sort, but how escapes me at present. Does anyone have a solution for this? Thank you so much in advance.
  9. Edit (complete wipe of original message): I couldn't get this to function, so I've changed how I handled my authors to clean up the users for comments etc. This means I'm using the original database/install instead of a separate one for comments.
  10. Thanks everyone, this has all been really helpful!
  11. Excellent. What would be the best way to connect to the second database/website? Should I make another wire instance? I feel like it should be simple.
  12. Oh yeah, I am familiar with the database structure. I should have added that I want people to be signed in before they're allowed to post comments, so the website would see an influx of users. Currently, all "users" on the website are authors who write articles, and I would like to keep this list as small as possible. (I know I can use roles to manage the lists, but I would prefer a simpler solution.) There's also the issue of security: I don't want there to be any risk that a user is able to mess anything up, and I'd prefer to keep them out of the main database.
  13. Hello everyone, I manage a large site and would like to add the ability for visitors to add comments to articles. However, I also want to keep the core website database relatively "clean". So my idea was to install a fresh copy of ProcessWire to a subdomain (say, account.ancientworldmagazine.com), where users can register, sign in, and edit their profile. I could also sign in and manage comments. My idea is to load the new database into the website, so that a page can check if there's any pages with comments in the new database. So, for example, article X on my original website gets loaded, there's an if-statement that checks if there's a page in the new database with the field awm_page_id = $page->id (where $page is the article on the original website). If yes, it proceeds to load the comments from that database; if no, it creates a new page with the field awm_page_id = $page->id and people who are signed in can then start posting comments. So, is this feasible? Does it pose any security risks? Will it create unnecessary overhead and slow everything down? Am I better off just sacrificing the cleanliness of my website's database and enabling comments on there directly from the backend? I'd love to hear your thoughts.
  14. So I've been using FormBuilder on client websites, but now they want to be able to track the form output using Google Analytics. I have no idea how they should go about this. Any suggestions that I could pass onto them? Thank you very much!
×
×
  • Create New...