Jump to content

siilak

Members
  • Posts

    18
  • Joined

  • Last visited

About siilak

  • Birthday 04/28/1980

Contact Methods

  • Website URL
    http://siilak.com
  • Skype
    markosiilak

Profile Information

  • Gender
    Male
  • Location
    Tallinn, Estonia

Recent Profile Visitors

2,783 profile views

siilak's Achievements

Jr. Member

Jr. Member (3/6)

7

Reputation

  1. User registration example: public static function addUser($data) { RestApiHelper::checkAndSanitizeRequiredParameters($data, [ 'username|selectorValue', 'password|string', 'email|text', ]); $item = new User(); $item->setOutputFormatting(false); $item->name = $data->username; $item->pass = $data->password; $item->email = $data->email; $item->addRole('guest'); $item->save(); }
  2. Is there any example, how to use for posting a new page? Example: axios.put("/api/post" ...
  3. There are nice and easy examples in GitHub for using Processwire Rest API with Vue / Angular / React Whit them you can easily build nice websites with smooth page render, navigation and more.
  4. I also made function for Page Reference field in pagefields.php. private function getReference($p, $apiField) { $p->of(false); $pages = $apiField->name; $id = $p->get($pages); $apiFields = []; if ($id) { $output[$pages]['title'] = $id->title; $output[$pages]['name'] = $id->name; $output[$pages]['url'] = $id->url; return $output; } return $apiFields; } Then add this to function "getAllFields" else if ($apiFieldType instanceof FieldtypePage) { $apiFields = array_merge($this->getReference($p, $apiField), $apiFields); }
  5. There is a solution for filefield. In pagefields.php file add after image_fields 'file_fields' => [ 'fields' => ['description', 'httpUrl'], ], Then after private function getImages private function getFiles($p, $fld) { $fldName = $fld->name; $files = []; $i = 0; foreach ($p[$fldName] as $file) { $fileConf = $this->conf['file_fields']; foreach ($fileConf['fields'] as $fileField) { $files[$fldName][$i]['file'][$fileField] = $file[$fileField]; } $i++; } return $files; } Then make a change for field type if ($fldType instanceof FieldtypeImage) { $flds = array_merge($this->getImages($p, $fld), $flds); } else if ($fldType instanceof FieldtypeFile) { $flds = array_merge($this->getFiles($p, $fld), $flds); } else if ($fldType instanceof FieldtypeRepeater) { $flds = array_merge($this->getRepeaters($p, $fld), $flds); } else { $flds = array_merge($this->getFields($p, $fld), $flds); }
  6. Thank you for a answer. In pagefields.php are good solution for a images. I also trying to write a file field part.
  7. I added file field called "video". Result in API is "video": [ { "data": "filename.mp4", "description": "[\"\"]", "modified": "2018-04-22 23:08:59", "created": "2018-04-22 23:08:59", "filedata": null } ], But how I can show "data" field as a httpUrl with full path "/site/assets/files/PageID/filename.mp4"
  8. One good thing with a PW is you not need any modules to build something. For social media Icons you can use textfields and displaying is pure php and font awesome icons or with some front end framework (Foundation, bootstrap, uikit etc). For example: Make new field called instagram and you can display like this with Font Awesome: <?php if ($page->instagram) { ?> <a href="http://instagram.com/<?php echo $page->instagram; ?>" target="_blank"><i class="fa fa-2x fa-instagram"></i></a> <?php } ?>
  9. Really nice example. Thanks!
  10. Yes, I made clean install and its ok now. I think it was my own fault.
  11. Nice upgrade for a module. I tested it on latest ProcessWire DEV version and only error I get is Front-End Page Editor error. Added a video. Maybe there is a simple solution for that https://www.dropbox.com/s/ox5tzdkide3lrlp/error.mp4?dl=0
  12. Really love that theme. I use Semantic UI on frontend pages also
  13. I see that in 3.0 version and love it
  14. I made a template for add new page. Page is added under home page. <?php include('./_header.php'); ?> <?php // Load FormHelper module and also set wire('fh') variable $fcm = $modules->get('FrontendContentManager'); // add a new page based on a template and a parent object $parent = $pages->get('name=home'); $form = $fcm->add($parent, $parent->template); // jsConfig needed by ckeditor echo $fcm->JsConfig(); // outpunt needed scripts for inputfield modules, ... foreach ($config->styles as $file) { echo "<link type='text/css' href='$file' rel='stylesheet' />\n"; } foreach ($config->scripts as $file) { echo "<script type='text/javascript' src='$file'></script>\n"; } ?> <div class="uk-container uk-container-center"> <h1><?php echo $page->title; ?></h1> <?php // output the forom echo $form; ?> </div> <?php include('./_footer.php'); ?> and only result I get is this. Any help? https://www.dropbox.com/s/2mwtksa20qxs5bk/Screen%20Shot%202016-03-10%20at%2011.52.48.png?dl=0
×
×
  • Create New...