-
Posts
364 -
Joined
Everything posted by hellomoto
-
How to create a select field via API with templates as its options?
hellomoto replied to hellomoto's topic in API & Templates
Man I had this working perfectly in a major project I was working on and LOST... for Make (choose from pages of template) and subsequent Model (choose from pages of template under Make). I know it wasn't that complicated... or I couldn't have done it... -
Would anyone here be able and inspired to develop a ProcessWire equivalent to the WordPress plugin WP All Import Pro? or to help me do so? This is what I'm envisioning... Upon installation the module creates an admin page titled "Import & Update". On the module config page you can specify allowed templates to run this on, otherwise allowing any. Include the following PHP libraries: hQuery for web scraping, Csv for CSV handling, and Parser for XML. Create template "import-update". On the "Import & Update" page, a list of current import/updaters will be displayed (0 initially), each with corresponding links to "edit" or "run". When you "Add New", this be the "import-update" template (with all module-specific fields tagged "impupd"): title destination (req.): parent, template source (req.): type (web, csv, xml) location (url, file, text) if web: opt. index URL & link selector, + paginator selector if csv: opt. ignore 1st row if xml: req. individual item node xpath actions (check): import (if none matching UID) update (if matching UID & field values differ) save() [req. here in flow] map (repeater): input (select fields from specified template to affect) intake (corresponding DOM selectors / CSV col. letters/headers / xpath per field) (req.) UID (unique ID; field reference to compare against, from selected input fields) (req.) Lazy Cron interval Scripts can be run via the import-update template; keep logs; show preview (iframe/ajax) for manual runs. ...
-
WireAction PageAction base classes for modules
hellomoto posted a topic in Module/Plugin Development
I want to write a quick little module that regenerate all images in /site/assets/files/ on request. I figure I'll just have a button on the module configuration page to run the script. So do I start it out like so?: class ImgRegen extends WireData implements Module {} singular=true, autoload=false. Sound right so far? Then how do I add this button to the config page to run the script? Need I make it a native PW field, since it doesn't store any data? Thank you all -
True that thanks Robin S
-
In my page editor only the map is showing for the field, no inputs. PW 2.7.2
-
Help with frontend ajax form submission on same page
hellomoto replied to hellomoto's topic in General Support
bump bump bump it up -
Layout wonky in Chrome upon migrating to production server
hellomoto replied to hellomoto's topic in Getting Started
Ok gotcha, I just noticed it screwing up again. It's included now and seems to help the situation. Thank you very much -
Layout wonky in Chrome upon migrating to production server
hellomoto replied to hellomoto's topic in Getting Started
It's weird if I refresh the page it doesn't seem to do any good unless I reload via clicking the site title. BUT thank YOU flydev, that seems to be the trick indeed! Good lookin' out. (If anyone does observe my layout still misbehaving please do inform me.) -
Help with frontend ajax form submission on same page
hellomoto replied to hellomoto's topic in General Support
I also tried $up = $pages->get('name=inquiries,include=hidden'); -
Help with frontend ajax form submission on same page
hellomoto replied to hellomoto's topic in General Support
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. -
Help with frontend ajax form submission on same page
hellomoto replied to hellomoto's topic in General Support
bump -
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?
-
5.6
-
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
-
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 =[
- 3 replies
-
- fatal error
- debug
-
(and 1 more)
Tagged with:
-
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.
- 3 replies
-
- fatal error
- debug
-
(and 1 more)
Tagged with:
-
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 & imports products, and updates pricing, availability & 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&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] } }
-
- admin templating
- config
-
(and 2 more)
Tagged with:
-
Layout wonky in Chrome upon migrating to production server
hellomoto replied to hellomoto's topic in Getting Started
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... -
Layout wonky in Chrome upon migrating to production server
hellomoto replied to hellomoto's topic in Getting Started
Okay szabesz it's not that strange though. I provided screenshots of right and wrong way if you're uncertain. -
Layout wonky in Chrome upon migrating to production server
hellomoto replied to hellomoto's topic in Getting Started
Now I just did a hard reload on the page and it came back dumpy again=\\\ -
Layout wonky in Chrome upon migrating to production server
hellomoto replied to hellomoto's topic in Getting Started
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. -
Layout wonky in Chrome upon migrating to production server
hellomoto replied to hellomoto's topic in Getting Started
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 -
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.
-
delete orphaned files/images from site/assets/files
hellomoto replied to interrobang's topic in General Support
That was it, thanks!