Jump to content

hellomoto

Members
  • Posts

    355
  • Joined

Everything posted by hellomoto

  1. I also tried $up = $pages->get('name=inquiries,include=hidden');
  2. Hi Adrian, I know sorry I'm just eager to overcome this and get it online. Yes to your first Q, I don't know about the others. It doesn't appear to be loading as I just added this $up = $pages->get('/inquiries/'); $up->title .= "-"; $up->save(); before if($input->post->submit) {} so no matter what when I send the form Inquiries page in the admin should become "Inquiries-" and it did not.
  3. I have a single-page website with a contact form: <div id="wrap_form"> <form id="inquire" action="" class="uk-form"> <div class="uk-grid uk-grid-collapse"> <input type="text" id="i_name" name="name" class="uk-width" placeholder="Your Name" maxlength="250" required /> <input type="text" id="i_phone" name="phone" class="uk-width" placeholder="###-###-####" pattern="^[2-9]\d{2}-\d{3}-\d{4}$" required /> <input type="text" id="i_email" name="email" class="uk-width" placeholder="Email" pattern="/^[a-zA-Z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/" maxlength="250" /> <input type="text" id="i_zipcode" name="zipcode" class="uk-width" placeholder="Zip Code" pattern="\d{5}-?(\d{4})?" /> <select name="scope" id="i_scope" class="uk-width" multiple required> <option value="" disabled>Representing...</option> <option value="residential">Residence</option> <option value="commercial">Business</option> </select> <textarea name="message" id="i_message" class="uk-width" placeholder="Message" rows="4" required></textarea> <input type="submit" name="submit" id="submit" class="uk-button uk-width" value="Send" /> <!--button type="submit" name="submit" id="submit" class="uk-button uk-width">Send <i class="fa fa-send"></i></button--> </div> </form> </div> Above is from contact.php template partial included in my _main.php output, which includes this script in the body closing: $(function() { $('.error').hide(); $("#inquire").submit(function(e) { e.preventDefault(); // validate and process form here $('.error').hide(); //var name = $("input[name='name']").val(); var name = $("input#i_name").val(); if (name == "") { $("label#name_error").show(); $("input[name='name']").focus(); return false; } //var phone = $("input[name='phone']").val(); var phone = $("input#i_phone").val(); if (phone == "") { $("label#phone_error").show(); $("input[name='phone']").focus(); //return false; } //var email = $("input[name='email']").val(); var email = $("input#i_email").val(); //var zipcode = $("input[name='zipcode']").val(); var zipcode = $("input#i_zipcode").val(); //var scope = $("select[name='scope']").val(); var scope = $("select#i_scope").val(); if (scope == "") { $("label#scope_error").show(); $("select[name='scope']").focus(); //return false; } //var message = $("textarea[name='message']").val(); var message = $("textarea#i_message").val(); if (phone == "") { $("label#message_error").show(); $("textarea[name='message']").focus(); //return false; } var dataString = 'name=' + name + '&phone=' + phone + '&email=' + email + 'zipcode=' + zipcode + 'scope=' + scope + 'message=' + message; //alert (dataString); return false; $.ajax({ type: "POST", url: "./inquiries/", data: dataString, success: function() { $('#wrap_form').html("<div id='inquired'></div>"); $('#inquired').html("<h3>Inquiry submitted!</h3>") .append("<p>Thanks, " + name + "! We will be in touch soon.</p>") .hide() .fadeIn(1500, function() { $('#inquired p').append(" <i class='fa fa-check' style='color:green'></i>"); }); } }); //return false; }); }); I tried submitting directly to a php file in templates which is forbidden so I saw that this worked for someone and no longer get an error; the form seems to submit from the frontend, however nothing results from it in the admin. Here's my inquiries.php template file: <?php $mailTo = $pages->get('/contact/')->contact_email; // sanitize form values or create empty $data = array( 'name' => $sanitizer->text($input->post->name), 'phone' => $sanitizer->text($input->post->phone), 'email' => $sanitizer->email($input->post->email), 'zipcode' => $sanitizer->text($input->post->zipcode), 'scope' => $sanitizer->text($input->post->scope), 'message' => $sanitizer->textarea($input->post->message), ); $error = ''; if($input->post->submit) { $up = $pages->get('/inquiries/'); $up->title .= "+"; $up->save(); $msg = "Name: $data[name]\n" . "Phone: $data[phone]\n" . "Email: $data[email]\n" . "Zip Code: $data[zipcode]\n" . "Job Type: $data[scope]\n" . "Message: $data[message]"; $p = new Page(); $p->title = date('Y/m/d H:i:s'); $p->parent = $pages->get('/inquiries/'); $p->template = 'inquiry'; $p->message = $msg; $p->save(); } I added the inquiries title appendage bit just for testing, but it just doesn't happen. How can I make this work/better test?
  4. I installed in PW 2.7 and have tried this, before going into stupid alterations that make the module not even worth having, might as well write one fresh: foreach($pages->get('/services/')->children as $s) { echo $s->feel(); } which returns In case you couldn't tell $s is indeed a page object. What's the problem? How do I fix it? This is the block starting on l298: foreach ($customOptions as $key => $unused) { if (strpos($key, 'data-') === 0) { $attributes[$key] = $key . ' = "' . wire('sanitizer')->textarea($customOptions[$key]) . '"'; } } Commenting it out gets rid of the error but apparently the feel element itself is hidden by default, I tried overwriting the output in the plugin but I do not want to do that, how can I get this to simply work? Please & thanks
  5. No. I deleted PaymentInvoice.module and it said I had an unclosed comment on the new module I was working on...... so I closed that comment and now the site loads. However if I put PaymentInvoice back in modules, it breaks again with the original error. I refreshed the modules and put it back, now seems to work. Thanks =[
  6. There is no reason for this to have happened, I was not working on anything related to this: I deleted the site cache and it's still happening. The whole site is broken. This is what happened last time and I had to rebuild. Now I'll have to again. I really need to use version control this time for sure. But nonetheless, I wasn't even working on these files.
  7. Need your kindly tips and guidance: So I need for the configuration to have a field for every existing [template=]supplier, for matching with a dir (not already matched) within the module directory which contains the import & update scripts for that supplier. Then on the admin page created by this module under Admin > Setup, all of the Suppliers need to be listed with corresponding links to Import or Update where available (for those matched to a directory); and when one of those actions is executed it should load the results log in an iframe. But, how? Here is what I have so far, yet to try activated: <?php /** * Process Products Data (0.0.1) * Scrapes imports products, and updates pricing, availability variations synchronized with data feeds. Process tailored per source account/supplier. * * @author * * ProcessWire 3.x * Copyright (C) 2011 by Ryan Cramer * Licensed under GNU/GPL v2, see LICENSE.TXT * * http://www.processwire.com * http://www.ryancramer.com * */ class ImportProductsData extends Process implements ConfigurableModule { public static function getModuleInfo() { return array( 'title' => "Process Products Data", 'version' => "0.0.1", 'summary' => "Scrapes &amp; imports products, and updates pricing, availability &amp; variations synchronized with data feeds. Process tailored per source account/supplier.", 'permission' => array(""), 'autoload' => false, 'singular' => true, 'permanent' => false, 'permission' => 'products-impupd', 'requires' => array("PHP>=5.4.0", "ProcessWire>=2.5.28", ""), //'installs' => array(""), ); } const PAGE_NAME = 'products-impupd'; static public function getDefaults() { return array( ); } public function init() { // $this->addStyle("custom.css"); // $this->addScript("custom.js"); // $this->addHookAfter("class::function", $this, "yourFunction"); } public function ___install() { // Create page "Product Data ImpUpd" under Setup $page = $this->pages->get('template=admin, name='.self::PAGE_NAME); if (!$page->id) { $page = new Page(); $page->template = 'admin'; $page->parent = $this->pages->get($this->config->adminRootPageID)->child('name=setup'); $page->title = 'Products Import&amp;Update'; $page->name = self::PAGE_NAME; $page->process = $this; $page->save(); // tell the user we created this page $this->message("Created Page: {$page->path}"); } } public function ___uninstall() { // Del page ImpUpd under Setup //$moduleID = $this->modules->getModuleID($this); $page = $this->pages->get('template=admin, name='.self::PAGE_NAME); if($page->id) { // if we found the page, let the user know and delete it $this->wire('pages')->delete($page, true); $this->message($this->_('Deleted Page: ') . $page->path); } } static public function getModuleConfigInputfields(array $data) { $inputfields = new InputfieldWrapper(); $defaults = self::getDefaults(); $data = array_merge($defaults, $data); return $inputfields; // foreach supplier select data set dir (each w/ import & update fct) // defaults = supplier.name // once selected execute import or update & log // in iframe & display results [log] } }
  8. That's the thing though, it keeps flip flopping, at least for me. Has anybody gotten this result: http://imgur.com/BmLrfP3 ? This doesn't happen on my development instance. Szabesz, I tried the hard reload but couldn't find the option on Mac; I hit cmd+shift+R and thought that does it. Just can't be sure. Interesting addendum: lays out legit upon resizing the window...
  9. Okay szabesz it's not that strange though. I provided screenshots of right and wrong way if you're uncertain.
  10. Now I just did a hard reload on the page and it came back dumpy again=\\\
  11. I just reloaded the page (although I had a number of times just before that last update above, but minutes ago) and now it looks fine.
  12. Now it's working. I don't know what happened. Edit: Now it's not, again. Haven't made any changes since the original upload. http://imgur.com/BmLrfP3
  13. I can't tell what's wrong; my local development version appears just fine, but I copy over the site files and db online and the homepage content is not being contained. This is what it should look like (same site in the same browser, running on my localhost): http://imgur.com/UFZFzrd What could be the problem here? Sorry to bring up something so irrelevant to PW here, I just know that you all are a valiant and helpful group, and no one on StackExchange seems to even know what I'm talking about. Thanks a lot.
  14. I have a script derived from this thread that used to work but now I'm trying to run it on a dev branch project and I get this error message: Here's the code: <pre><?php ini_set('max_execution_time', 60 * 5); // 5 minutes, increase as needed include("./index.php"); $dir = new DirectoryIterator(wire('config')->paths->files); foreach ($dir as $file) { if ($file->isDot() || !$file->isDir()) { continue; } $id = $file->getFilename(); if (!ctype_digit("$id")) { continue; } $page = wire('pages')->get((int) $id); if (!$page->id) { echo "Orphaned directory: " . wire('config')->urls->files . "$id/" . $file->getBasename() . "\n"; continue; } // determine which files are valid for the page $valid = array(); foreach ($page->template->fieldgroup as $field) { if ($field->type instanceof FieldtypeFile) { foreach ($page->get($field->name) as $file) { $valid[] = $file->basename; if ($field->type instanceof FieldtypeImage) { foreach ($file->getVariations() as $f) { //$valid[] = $f->basename; } } // keep thumbnails: /* if ($field->type instanceof FieldtypeCropImage) { $crops = $field->getArray(); $crops = $crops['thumbSetting']; $crops_a = explode("\n", $crops); // ie. thumbname,200,200 (name,width,height) foreach ($crops_a as $crop) { $crop = explode(",", $crop); $prefix = wire('sanitizer')->name($crop[0]); $valid[] = $prefix . "_" . $file->basename; } }*/ } } } // now find all the files present on the page // identify those that are not part of our $valid array $d = new DirectoryIterator($page->filesManager->path); foreach ($d as $f) { if ($f->isDot() || !$f->isFile()) { continue; } if (!in_array($f->getFilename(), $valid)) { echo "Orphaned file: " . wire('config')->urls->files . "$id/" . $f->getBasename() . "\n"; // unlink($f->getPathname()); } } wire('pages')->uncache($page); // just in case we need the memory } I tried preceding the wire in mention with a $ and also with Processwire/ respectively. Processwire/wire returns this: and $wire : Why is this?
  15. Hi, would you be able to help me add views to your Changelog module? I've tried and posted my attempt on the forum thread. I would greatly appreciate it, I'm sure others would as well. Much thanks for having made it in the first place.

  16. I got the site to load finally, by replacing the htaccess with a fresh copy -- but now none of the assets/styles are being loaded, as $config->urls->root points to localhost instead of localhost/mysite, where PW is installed. How do I fix this? And why is all this only happening now... I've never run into these permissions or migrations problems before, despite the setup being relatively new, I've managed both so far, up until now. I can't think of anything I did that might have had this effect. Maybe I'll switch to AMPPS or MAMP or something.
  17. Thanks, but it's not the same. Also worthy of note is that if I try to go to /admin or /xxx, /*, the filename of the empty download matches whatever that is.
  18. I'm doing this because I lost my backups and am trying to copy a site from its live server online onto my localhost. But when I copy over the files, import the db and change the connection settings in the site config, then try to access it, it just downloads a blank file called "download" (no extension). That's it, that's all. What could be the problem?
  19. After a full day of failed attempts at setting up a pro, Vagrant-based development environment on my Macbook, I settled for good old XAMPP. Some sites were migrated over successfully, as well as a fresh PW project installed (dev branch). However, for some reason now, as I try installing another fresh copy (dev or stable), I get this error: File system is not writable by this installer. So I rename the site profile manually, but then I need to fix the permissions for site/config.php and site/assets/. How exactly do I do this? I've tried chmod in Terminal, and messing around in the file/directory Get Info window, although I'm not sure which user or group to edit. Either way, I'm not getting anywhere. Please help. Thanks.
  20. Apparently it's due to some customizing I did to ProcessChangelog, somehow... I only tried to add views to the records...
  21. If attempted on pages admin view, simply loads forever; if on page edit, reloads the page editor URL as blank. On dev branch
  22. I was able to add pageviews before and now on a fresh install of PW3 without the previous successful attempt to draw from, here's what I have for ProcessChangelogHooks.module: Somehow with this I'm unable to publish or unpublish pages; if attempted on the pages admin view it just loads forever, on the page editor it reloads the editor blank and doesn't work.
×
×
  • Create New...