Jump to content

Orlando Hamsho

Members
  • Posts

    5
  • Joined

  • Last visited

About Orlando Hamsho

  • Birthday 03/17/1992

Contact Methods

  • Website URL
    www.orlandohamsho.com

Profile Information

  • Gender
    Male
  • Location
    Guadalajara Jalisco
  • Interests
    My hobbies include: Boxing, Brewing, Traveling and Corgis (But I guess the picture above kind of gives me away.) I’m also a huge fan of the Ketogenic diet.

Recent Profile Visitors

2,069 profile views

Orlando Hamsho's Achievements

Newbie

Newbie (2/6)

2

Reputation

  1. My question: How do I make a proper Image field in a process module? The situation: I'm making a process Module that requires you to upload an image. The problem: I can't seem to be able to save images through my process Module image Field. To further explain: The loading animation (pink bar filling up to 100%) doesn't trigger. When trying to save the page, I get sent to an error each time (which i've been slowly debugging), current one is: Error: Call to a member function first() on a non-object (line 435 of [path-to-wire-folder]/modules/Inputfield/InputfieldFile/InputfieldFile.module) This error message was shown because you are logged in as a Superuser. Error has been logged. Which currently corresponds to this code segment: //InputfieldFile Module //___processInputAddFile() function if($this->maxFiles == 1 && $total) { $pagefile = $this->value->first(); // This is the line. $description = $pagefile->description; $tags = $pagefile->tags; $rm = true; if($filename == $pagefile->basename) { // use overwrite mode rather than replace mode when single file and same filename if($this->overwrite) $rm = false; } if($rm) { if($this->overwrite) $this->processInputDeleteFile($pagefile); $this->singleFileReplacement = true; } } I also can't seem to find examples of how to do this in the existing modules (The MarkUpSEO one, for example, uses an URL field that it later processes on it's own). My code: // Image Field array( 'name' => 'example_image', // name of field 'type' => 'image', // type of field (any Inputfield module name) 'label' => $this->_('Example Image Field'), // field label 'description' => $this->_('Example Image Field'), 'required' => true, 'maxFiles'=> 1, 'destinationPath' => wire('config')->paths->ProcessExample."assets" ) The destinationPath i'm choosing is a folder named "assets" inside of my own module, but apparently there's something i'm missing to make it work. Thanks in advance for any help you can provide on this topic
  2. Thank you! You really helped a lot by pointing that out so we could fix it It was only Joshua and me on the project, working on it for about 5 months.
  3. Currently doing some cleanup on that very same project (Pretty close to launch and excited about it!) and that includes doing a little bit of optimization. For that reason i'm trying to minimize my PDO requests as well as image quality and such, but i'll work on it an issue at a time. Now I have this loop that takes a bunch of pages, modifies a value (In example: views) and then saves them again, before showing some of their content. Now this is something that I have to do for every page load on every page, it's a major feature of the site. Going through my queries I realize that for each one of these there's at least 3 queries that occur over and over again: We get the page. We modify the value. We save that page's field. I am doing this about 10 times a page, so the queries quickly stack up. I managed to get the first point down by getting all my required pages in a single swoop (a single albeit specific $pages->find). For step 2 I realize I do have to go and individually modify the value for each page, so what i'm asking here is: Once I have an array with all of my modified pages, is there a way I can save that same field in all of them at the same time? It would definitely be nice to decrease my queries by 9 or so through this method. Thanks in advance for any help you can provide.
  4. Thank you a lot guys, I had no idea this method even existed, guess you learn something new everyday . Sadly due to the way comments work (Them not being pages) the method doesn't seem to have the wanted effect, tried it a couple times and the result kept on being the same. This totally worked (with minor modifications) , I just completed the import of 1500+ comment dates on a single go after testing out this method. Now I do have some issues that pertain to my .csv's data, but those are another topic entirely. Thank you so much Wanze. Anyway, thanks to all of you guys for helping me out here, there really is always a way to work things around, even if it means thinking outside the box. It'll be nice being a part of this community
  5. I have been working on a considerably large project for a while which involves, amongst other things, importing quite a considerable amount of data from a wordpress site. Alas, through the means I have been given (CSV reading loops/ Direct SQL manipulation / The processwire wordpress import module, btw THANK YOU) I have managed to get most of it working and the site is nearly done... except for one thing. All of my comment's dates are set as the one in which they were created... on the new site. Now I do happen to have a CSV that contains all of the data I need to work with, and have even set up a quick test on a sample page with only a single comment. So, the problem here is that no matter how many times I save the field, the created time doesn't seem to change at all. Just to verify. $article = $pages->get("template=article,name=health-care-and-neighborhood-watch"); echo $article->title."__WPID: ".$article->post_id."<br>"; if (($handle = fopen("comments.csv", "r")) !== FALSE) { $article->of(false); while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) { //$data[1] is the article id; //$data[7] is the approval date, we're using that as created. if($data[1]==$article->post_id){ foreach($article->comments as $c){ if($c->cite==$data[2]&&$c->text=$data[8]){ echo "Previous date: ".date("Y-m-d",$c->created); $c->created=strtotime($data[7]); echo "<br>"."New and Improved date: ".date("Y-m-d",$c->created); } } } } if($article->save()){ echo "<br> SAVED! :)"; } fclose($handle); }else{ echo "File not found"; } I am targeting the right page. Output formatting is off. The page is supposedly even getting saved, but the created value for that comment does not seem to change in between different loops. Is there something I am missing to make my import happen? Or is there another way in which I can get my comments imported differently? I would very much appreciate this help.
×
×
  • Create New...