-
Posts
18 -
Joined
-
Last visited
Posts posted by siilak
-
-
Is there any example, how to use for posting a new page?
Example: axios.put("/api/post" ... -
On 12/24/2017 at 11:11 PM, pwuser1 said:
I want to make interactive websites with ajax as well.
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.
-
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); }
-
1
-
-
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); }
-
1
-
-
6 hours ago, microcipcip said:
@siilak Unfortunately I think I did not test the REST API with the file type, only with images. I think it requires changes to work with video type.
As I said in the first post in this threadThank you for a answer. In pagefields.php are good solution for a images. I also trying to write a file field part.
-
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"
-
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 } ?>
-
Really nice example. Thanks!
-
Yes, I made clean install and its ok now. I think it was my own fault.
-
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
-
Really love that theme.
I use Semantic UI on frontend pages also -
I see that in 3.0 version and love it
-
Really love this function
-
1
-
-
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
-
1
-
-
Hi and thanks for quick reply
I know that, my code looks funny but I'm front-end and design comes first
I end my 7 years marriage with drupal and PW is something new and much better for me.
Thanks mr-fan, first link is exactly what i need.
-
Hi
I can dsplay post author username
echo "Posted by "; echo $page->createdUser->name;
Its ok, but I also want to print user images
foreach ($page->createdUser->images as $userimage) { $thumb = $userimage->size(480, 480); echo "<img src='{$thumb->url}' alt='{$thumb->description}' />"; }
But its not working. Any help?
-
Module: RestApi
in Modules/Plugins
Posted
User registration example: