Jump to content

nghi

Members
  • Content Count

    57
  • Joined

  • Last visited

Community Reputation

20 Excellent

About nghi

  • Rank
    Full Member

Recent Profile Visitors

2,537 profile views
  1. Sorry I mis-spoke. The ajax bug is still appearing on pw3.0 but the file seems to be saving properly after submiting/post. I did run into a weird error. Saying the file already exist. and I had to add $csvFile->rename("data.csv"); when processing the form. The module I'm making is for a 2.5 pw. I was just dabbling around in 3.0. I hadn't had any problems in older ver. of pw.
  2. Ah I see. This is good to know. I got the upload field to 'work' after further debugging the issue.
  3. I'm currently making a module that upload/save a csv... Am I missing something? I'm having some difficulties getting this to work. $this->setFuel('processHeadline', "Import Programs"); $form = $this->modules->get("InputfieldForm"); $form->method = 'post'; $form->action = '../save/'; $field = $this->modules->get("InputfieldFile"); $field->name = 'file'; $field->label = 'Upload Program CSV'; $field->extensions = 'jpg png csv'; $field->maxFiles = 1; // $field->overwrite = true; // $field->required = true; $field->description = "Convert spreadsheets to CSV (Comma delimited) (*.csv) before uploading"; // $field->maxFileSize = 200000; $field->destinationPath = "./csv/"; // $field->type = 'file'; $form->add($field); $field = $this->modules->get("InputfieldButton"); $field->type = 'submit'; $field->value = 'Upload CSV'; $form->add($field); return $form->render(); I'm mimicking some code snippets from "Import Pages From CSV module" and that doesn't seem to be working either... so it kind of leads me to believe it could be an environment issue or processwire version. I also don't see any JS errors. Though when making fields through the backend/gui it seems to be working fine. What I'm expecting... http://i.imgur.com/mT2xsUo.gifv What I'm actually experiencing... http://i.imgur.com/4PnVPUs.gifv ProcessWire 3.0.39 PHP 7.0 Jason Huck explains the exact problem/situation I'm having. @source https://processwire.com/talk/topic/12986-file-upload-via-inputfieldfile/#comment-125240
  4. One of my co-workers brought up that I should being using php arrays instead of objects in *symfony framework when displaying information and when updating data I should keep them as objects. Doctrine has a neat function call hydrate array which converts the objects to a nice php array when executing a query. I was wondering if this matters in processwire as much? We use an older php ver 5.3 and Im not sure the performance between the 2 is different on higher ver.
  5. I figured out my problem. I had to uninstall and install my module again and my admin page seem to have been setup improperly in the __install(). Very weird, all I did was move a few lines. Not sure if the ordering matter but the below code work for me. When creating an admin page. $p = new Page(); $p->template = $this->templates->get("admin"); $p->name = self::PAGE_NAME; $p->parent = $this->pages->get($this->config->adminRootPageID)->child('name=setup'); $p->process = $this; $p->title = 'Variable Settings'; $p->save();
  6. I had this happen to me where a client used the repeater field out of it's planned scoped. (It was only suppose to have only 4 but it now has like 60 and the back end takes very long to load or eventually times out) You'll probably need to rebuild your records as a custom template page instead of using a repeater. You can write a script to move your data from the repeater field into your new custom template page.
  7. When I'm log-in as a super user my module appears under setup. But when I'm as another role (normal user) it doesn't appear. I'm quite confuse on how to setup the permission. Is there a module I can that I can look at as an example?
  8. I'm currently using the 3.0.8 dev ver. I'll add the namespace when I get home and see how that goes. *Update - Adding the namespace solve my problem thanks for the help.
  9. I'm getting this error below. I'm not sure what I'm doing wrong? (not sure if its overkill to include pw to the htaccess) Error Error: Call to undefined function wire() (line 5 of C:\wamp2\www\nghitest\parse.php) .htaccess RewriteRule ^([\w\d]{6})$ parse.php?parse=$1 [L] parse.php <?php require("./index.php"); $short_url = wire('sanitizer')->url($_GET["parse"]); $url = wire('database')->query("SELECT url FROM shorturl WHERE short_url='{$short_url}'")->fetch(); if ($url) header("location:" . $url); ?>
  10. Just wondering if this exist...? $pages->find("select all templates that don't have an existing template file"); $page->children("same sort of selector top");
  11. How do I achieve something like this? http://school.dev/employee/kim-mane http://school.dev/kim-mane I dont really want to have 200 employee in the root page so I chuck inside another page. Right now, the only way I can think of is making some changes to the .htaccess
  12. Haha you're right. I meant. if($config->debug == false) Thanks, kongondo, I'll use this for now.
  13. How do I disable the login page /proceswire entirely, with code. I'm not entirely sure where to write... (Mostly for prod and dev) I want to do something like this. if($config->debug == true) { //kick user from page; }
  14. A year late.... Just got this problem. The problem is you or someone... accidentally deleted the profile page under admin page. You'll need to recreate the page and under process select ProcessProfile. & under settings -> status -> hidden (check off)
  15. I'm using it in 2.5 and so is my co-worker. what gets me when setting up the config. input ip port ->click submit once page reloads then click index all pages. Though, we recently found some bugs with it including hidden pages but its working fine with some alternations. basic use create a search page /search/?q=test <?php if ($q = $sanitizer->selectorValue($input->get->q)) { $input->whitelist('q', $q); $matches = $modules->get("ElasticSearch")->search($q, 25); foreach($matches as $key => $match) { if ($match->isHidden()) $matches->remove($key); } } ?php> <?php if ( ! $q): ?> Type something. <?php elseif ($matches->count()): ?> <?php foreach ($matches as $m): ?> <a href='<?php echo $m->url ?>'><?php echo $m->title ?></a> <?php endforeach ?> <?php else: ?> no results found <?php endif ?>
×
×
  • Create New...