Jump to content


  • Posts

  • Joined

Everything posted by hellomoto

  1. I have the template enabled in the module settings and the page is viewable. I would rather not have the ID in the download URL though. Currently I have the GET variable set to 'pdf', so it's ?pdf={id}. Since I'm linking from the page, can't it simply be ?pdf=1 for the pdf of the current page..? Thanks.
  2. I want to implement tables with Dynatable populated via ajax. Here's what I could muster: if($config->ajax) { $results = $pages->find($sanitizer->selector()); foreach($results as $r) $array[] = [ $r->title, $r->modified ]; header("Content-type: application/json"); echo json_encode($array); exit; } $content .= <<<EOT <table id="my-ajax-table"></table> <script> $("#my-ajax-table").dynatable({ dataset: { ajax: true, ajaxUrl: '.', ajaxOnLoad: true, records: [] } }); </script> EOT; But that's really nothing. Pro tips?
  3. I have reduced the module to this and the same error persists: <?php class PortalDashboard extends Process implements Module { public static function getModuleInfo() { return array( 'title' => "Portal Dashboard", 'version' => "0.1", //'permission' => array("page-lister"), 'autoload' => false, 'singular' => true, 'permanent' => false, 'requires' => array("PHP>=5.4.0", "ProcessWire>=3.0", "CatCoCustoms"), ); } public function init() {} In the red: Furthermore When I uninstall the aforementioned module this doesn't happen, oddly enough. What could be the problem?
  4. and on the frontend my map is ghost; $modUrl = wire('config')->urls->siteModules.'MarkupLeafletMap/'; $styles = array_merge($styles, [ "leaflet" => "https://unpkg.com/leaflet@1.0.3/dist/leaflet.css", "leaflet-markercluster" => "{$modUrl}assets/leaflet-markercluster/MarkerCluster.css", ]); $scriptsH = array_merge($scriptsH, [ "leaflet" => "https://unpkg.com/leaflet@1.0.3/dist/leaflet.js", "leaflet-providers" => "{$modUrl}assets/leaflet-providers/leaflet-providers.js", "geocoder" => "{$modUrl}Control.Geocoder.js", ]); $map = $modules->get('MarkupLeafletMap'); $content .= $map->render($page, 'geolocation', ['height' => '500px']); returns visibly blank <div id="mleafletmap1" class="MarkupLeafletMap" style="width: 100%; height: 500px;"></div>
  5. Nope! When there's a value input the map appears dutifully marked, however the Address input is still disabled, and clicking on it opens a search input within the map.
  6. Oh is it only supposed to populate via api?
  7. I'm in PW 3.0.42 and in the page editor the entire fieldset is disabled, can't click on it, no map (just gray with +- zoom buttons).
  8. I have this $pdf = $modules->get('Pages2Pdf')->render(array( 'title' => 'PDF', 'markup' => '<a href=\'{url}\' target=\'_blank\'>{title}</a>', 'page_id' => '', )); $content .= <<<EOT <script type="text/javascript"> $("h1").append(" <small>[$pdf]</small>");</script> </script> EOT; which outputs to /?pdf={pid} but clicking the link just opens the current page in a new tab, no PDF.
  9. In PW 3.0.42 when editing a user this error appears up top:
  10. When I click on any of the actions in the list I get this: Anyone know why
  11. Right, I tried using that with ../'s in the value to grab from the module's directory to no avail. Here is the module IN PROGRESS: https://bitbucket.org/chimmel/pw-import-everything (It's pretty sloppy.) The file in question is import/csv.class.php. I appreciate any and all feedback regarding the makeup of this module.
  12. I have this happening in the template file: if(file_exists($filepath)) echo $filepath; echo "<a href='$filepath'>csv</a>"; $file = fopen($filepath, 'r'); print_r(fgetcsv($file, 0, ',', '"')); fclose($file); where $filepath = $this->source->url (in a class method). So it's the page's attached CSV file's URL. The link works and downloads the file, which supposedly doesn't exist, according to the preceding line. Why??
  13. Pressing problem at initial posting: I am working on a module that runs/previews (for pub/unpub) imports on importer page view. The template has to be in site/templates, so far as I know, so one is created there on install which includes a file to run from within the module, but then when it's run and tries to read the importer csv file it cannot, since it's in the admin, I guess... Is it possible to set the template page to a file in the module directory? Will that work? https://bitbucket.org/chimmel/pw-import-everything
  14. I'm trying this basic example on my localhost: $mail = wireMail(); $numSent = $mail->to($toEmail)->subject($subject)->body($textBody)->send(); Is there a way to tell whether it's working, other than setting the $toEmail to my email address, or is there something I can do to my localhost, since I'm not receiving the email? I'm using FastComet hosting... SSL/TLS settings... to my Gmail... from AMPPS... Any tips?
  15. Okay I need one that allows PHP so that I can display data directly from MySQL. Lost, do you know how can I work yours correctly, considering what I've already attempted?
  16. Lost I tried having it run this file <?php namespace ProcessWire; ?> <script src="https://cdnjs.cloudflare.com/ajax/libs/Dynatable/0.3.1/jquery.dynatable.min.js"></script> <?php $q = wire('database')->query('SELECT * FROM cc_vpv WHERE id = ' . wire('page')->id); echo 'Pageviews= '; print_r($q); ?> unsuccessfully, I know I'm probably just doing something wrong. kixe why isn't yours in the Modules directory? I'll give it a go, thanks guys.
  17. PWaddict I suspected that and installed Languages Support. Prior to doing so it was actually producing a different error earlier up in the module file. Forgot to mention that. But installing it didn't solve the problem for me.
  18. Well I added this now it works not ideal and wasn't needed before but whatever if($template == 'boat_vessel') $p->name = wire('sanitizer')->pageName($r['boat_model']) . '-' . wire('sanitizer')->pageName($r['title']); else $p->name = wire('sanitizer')->pageName($r['title']);
  19. Love this module but I'm having an issue. This import script worked for me outside my module, but now I'm including it inside a module, and getting the following error upon install: Culprit file: <?php namespace ProcessWire; importUsers(__DIR__.'/data/users.csv'); function importUsers($filepath) { $csv = array_map('str_getcsv', file($filepath)); array_walk($csv, function(&$a) use ($csv) { $a = array_combine($csv[0], $a); # set header keys }); array_shift($csv); # remove column header //echo '<pre>'; print_r($csv); echo '</pre>'; foreach($csv as $r) { $u = new User(); $u->of(false); foreach($r as $k=>$v) { $v = trim($v); if($k == 'name') { if($v == '') $u->$k = wire('sanitizer')->pageName($u->email); else $u->name = wire('sanitizer')->pageName($v); continue; } if(wire('fields')->get('name='.$k)) { $fieldtype = wire('fields')->get('name='.$k)->type; if($fieldtype == 'FieldtypeMapMarker') { $u->$k->address = (string)$v; } elseif($fieldtype == 'FieldtypeImage') { $imgs = explode('|', $v); foreach($imgs as $i) { $u->$k = $i; } } elseif(in_array($fieldtype, ['FieldtypeText', 'FieldtypeTextarea', 'FieldtypeInteger', 'FieldtypeCheckbox', 'FieldtypePassword', 'FieldtypeEmail'])) $u->$k = $v; } if($k == 'roles') { $roles = explode('|', $v); foreach($roles as $role) { $u->addRole($role); } } } if(!$u->hasRole('guest')) $u->addRole('guest'); $u->save(); //echo '<br>'; if($u->password == '') { $u->password = crypt($u->email, $u->id); $u->save(); } } } // email users welcome & verify $mmpid = wire('pages')->get('template.name=mamo_makes')->id; importCSV(__DIR__.'/data/manufacturers.csv', 'mamo_manufacturer', $mmpid); //importCSV(__DIR__.'/data/models.csv', 'mamo_model', 0, $mmpid); //importCSV(__DIR__.'/data/vessels.csv', 'boat_vessel', wire('pages')->get('template.name=boat_index')->id, 0); function importCSV($filepath, $template, $parent_id = null, $grandparent_id = null) { $csv = array_map('str_getcsv', file($filepath)); array_walk($csv, function(&$a) use ($csv) { $a = array_combine($csv[0], $a); # set header keys }); array_shift($csv); # remove column header //echo '<pre>'; print_r($csv); echo '</pre>'; foreach($csv as $r) { $p = new Page(); $p->template = $template; if($parent_id !== 0||null) { $p->parent_id = $parent_id; } elseif($parent_id == 0||null) { //echo $r['parent'].' '; $parent = wire('sanitizer')->pageName($r['parent']); $parent = str_replace('---','-',$parent); //echo $parent.' ';//echo $grandparent_id.'gp '; $parent = wire('pages')->get('title=' . $r['parent'] . ', parent_id=' . $grandparent_id)->id; //echo $parent.'p '; $p->parent_id = $parent; unset($r['parent']); } $p->save(); $p->of(false); foreach($r as $k=>$v) { $v = trim($v); $fieldtype = wire('fields')->get('name='.$k)->type; if($fieldtype == 'FieldtypeMapMarker') { $p->$k->address = (string)$v; } elseif($fieldtype == 'FieldtypeImage') { $imgs = explode('|', $v); foreach($imgs as $i) { $p->$k = $i; } } else $p->$k = $v; } $p->save(); //echo '<br>'; } } The above portion (users) runs through ok. It's the latter section that produces the error. What is the string being referred to, how can I remedy this? Any ideas as to how I can troubleshoot?? Thanks a ton.
  20. I have a fieldsettab I want to populate with two collapsable fields that are for display not input. One will display data directly from an extra MySQL table (corresponding with PW pages) and the other will list certain PW pages. How do I go about this? I wanted to lay them out using Dynatable, one per each field. Thanks.
  21. I have this installed on PW3 and my supposed pages2pdf link simply loads the page with the get variable specified ={page.id}, not as a PDF. What could be the matter?
  • Create New...