nghi
-
Posts
57 -
Joined
-
Last visited
Posts posted by nghi
-
-
Ah I see. This is good to know.
I got the upload field to 'work' after further debugging the issue.
- 1
-
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.gifvWhat I'm actually experiencing...
http://i.imgur.com/4PnVPUs.gifvProcessWire 3.0.39
PHP 7.0Jason Huck explains the exact problem/situation I'm having.
QuoteI have a very similar situation. I'm trying to upload a CSV file to a custom admin page, created with the Admin Custom Pages module. I've constructed a simple form using the API. When I load the page, the form appears to render correctly, but it doesn't appear to be working 100% correctly.
• Drag and drop isn't working. The browser just offers to open the dragged file. There are no JS errors in the console and it looks as if all the required JS assets are included on the page. If I instead click the "Choose File" button and select a file, it does appear to select a file (if I hover over the "Choose File" button, it displays the selected filename).
• Submitting the form does upload the file, though overwrite isn't working. I get the following error when trying to re-upload the same file:
"Refused file [my filename] because it is already on the file system and owned by a different field."
@source https://processwire.com/talk/topic/12986-file-upload-via-inputfieldfile/#comment-125240
-
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.
-
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();
-
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.- 1
-
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? -
Hi,
which version of ProcessWire are you using ?
If you are under version 3.x.x, put this line at the begining of the file :
<?php namespace ProcessWire;
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.
-
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); ?>
-
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");
-
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
-
Haha you're right. I meant.
if($config->debug == false)
Thanks, kongondo, I'll use this for now.
-
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; }
-
Hi! I'm getting an "unrecognized path" error when my Editor user is trying to access his profile in the processwire admin. I've enabled the "Profile-edit" permission for his user role, but maybe that won't do it? Is this issue related to the one described above? I've recently moved my installation, but I'm getting the same error on the beta subdomain (where it was first installed).
Any clues?
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)
-
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 submitonce 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 ?>
-
Is there way to have multiple save presets for the search?
/admin/page/search/ -
I think evanmcd is getting this error? (2.4 for me).
-
As Adrian already mention you're already in the loop. So you'll need to reference $item instead of $page.
$read_test = ''; $design_tech = $page->design_technique; if($design_tech instanceof PageArray) { foreach($design_tech as $item) { $read_test = "<h4>" . $item->title . "</h4>"; } }
- 5
-
One of my co-workers found the cause for my problem. The suhosin.ini on our server had a max length of 64 characters and we had to increased it to 128.
- 3
-
Just going to add a note for something I noticed.
When building your selector don't use the revers() sorting/filtering function as makes renderPager() output nothing.
So use sort=something in the selector instead. I went with sort=created to sort the pages by created date.
I stumbled on this bug too?
Had to remove all the ->filters and concatenate them into a big string because renderpager() wouldnt function properly...supa weird
//$results = $pages->find("template=profile,sort=$sortby, limit=6"); //get results // if ($location) // $results->filter("pro_page_location.id='$location'"); // if ($practice_area) // $results->filter("pro_page_practice_area.id='$practice_area'"); // if ($language) // $results->filter("pro_page_language='$language'"); // if ($position) // $results->filter("pro_page_position='$position'"); if ($location) $filters .= ",pro_page_location.id=$location"; if ($practice_area) $filters .= ",pro_page_practice_area.id=$practice_area"; if ($language) $filters .= ",pro_page_language=$language"; if ($position) $filters .= ",pro_page_position=$position"; $results = $pages->find("template=profile,sort=$sortby, limit=6" . $filters);
-
Ugpraded two sites 2.5 but didn't stumble upon this problem. But you could file a bug on github.
Maybe you replaced your index.php and forgot to set the permissions? (Not sure about this one, but worth a try).
Currently its set to -rw-rw-r-- is that wrong? It's *@version 2.5
Have you checked site/assets/logs/ if anything is written in the logs there? What happens if you turn debug-mode on in site/config.php and try the same again?
I dont see any errors and debug is turn on. The images still cant be deleted on new image fields .
-
For a complete beginner who wants to build a website through a GUI. I would recommend wordpress.org. Selection of pre-made themes and you can do quick css edits and programming edits live (lol). A ton of good plugins like ACF for development & SEO to optimize your site.
Wordpress also got a lot better with roots + grunt. If you're serious about developing on that platform.
Otherwise Processwire is very easy to use for developers but you'll need a bit of programming experience when building the templates. Everything else can mostly be done with the gui in the backend.(building tables, fields, etc) -
I've upgraded to 2.5. I've notice that I cant delete images in new created image fields. Just wondering if im doing something wrong or anyone else have experience this ?
My old images fields are working fine...and when I make a clone of them they function properly. -
I have a weird issue.
If i use the cropimage field within a repeater. It works fine when logged in as a superuser.
but when log into another user without superuser role. I get the following error when trying to crop an image:
Strict Standards: Only variables should be passed by reference in /app/www/sites/sandbox/site/modules/ApeisaThumbnails/ProcessCropImage/ProcessCropImage.module on line 92TemplateFile: Not Editable
Do I need to register my custom role for this module to work? I'm not sure whats going on.
-
I'm currently trying out 2.5 and I notice that this issue hasn't been address. I just had a client upload a wrong image on their carousel and it immediately showed on the homepage. and they had to scramble to find a replacement image file. Since the field was setup to allow 1 image and it automatically delete the old one.
- 1
Issues with InputfieldFile not working through API
in General Support
Posted
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.