Jump to content

nghi

Members
  • Posts

    57
  • Joined

  • Last visited

Posts posted by nghi

  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. 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.

    Quote

    I 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

     

  3. 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.


     

  4. 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();
    
  5. 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.

    • Like 1
  6. 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);
    
    ?>  
    
  7. 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;
    }
    
    
  8. 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)

  9. 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 ?>
    
    
  10. 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);
    
  11. 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 :(.

  12. 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)

  13. 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 ?

    4crZoTH.gif

    My old images fields are working fine...and when I make a clone of them they function properly.

  14. 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 92

    •  TemplateFile: Not Editable

    Do I need to register my custom role for this module to work? I'm not sure whats going on.

×
×
  • Create New...