Jump to content

hellomoto

Members
  • Posts

    355
  • Joined

Community Answers

  1. hellomoto's post in Deleting file field's files via API not working or timing out was marked as the answer   
    This worked
    protected function addNewTracks($event) { $page = $event->arguments[0]; $pages = wire('pages'); if($page->template == 'tracks' && count($page->tracks_upload) > 0) { foreach($page->tracks_upload as $t) { $basename = str_replace(".{$t->ext}",'',$t->name); $p = new Page; $p->parent = $pages->get('/tracks/'); $p->template = 'track'; $p->title = $basename; $p->addStatus(Page::statusUnpublished)->save(); $p->audio->add($t->filename); $p->save(); $p->name = $p->id; $p->save(); $this->message("Added new track {$p->title} by {$p->createdUser->name}"); } $page->tracks_upload->removeAll(); $page->save(); } }
  2. hellomoto's post in Error: Call to a member function getTag() on a non-object was marked as the answer   
    $block is a single item in the repeater field "home_blox". $block->pg is the Page field within the repeater. Image field is named "images".
    This worked:
    foreach($page->home_blox as $block) { $bgimg = ''; $pg = $block->pg; if($pg->images->getTag('blockbg')) { $bgimg = "<img src='{$pg->images->getTag('blockbg')->url}'/>"; }
  3. hellomoto's post in Module to generate app fields, templates, and roles -- what to hook? was marked as the answer   
    Hey thanks guys. I've realized the ease of simply exporting a site profile, which is serving me well. Someone else pointed Migrator out to me too, but with the profile export I haven't even gotten around to trying that yet... I do have it installed...
  4. hellomoto's post in How to install an exported site profile? was marked as the answer   
    I just ended up installing my exported site profile this time around and luckily it worked perfectly anyway. That wasn't too long ago, I'm ok to continue from here.
  5. hellomoto's post in Populating field defaults... can only update value, not input? was marked as the answer   
    Had to tack ->save() on to the statement setting the field...
  6. hellomoto's post in Admin appearance changed slightly? (e.g., new "edit template" link alongside every page) was marked as the answer   
    I'd installed Custom Page List and forgotten.
×
×
  • Create New...