Jump to content

Marvin

Members
  • Posts

    22
  • Joined

  • Last visited

Everything posted by Marvin

  1. Hi @Jan Romero, Thanks for replying, sorry my late reply. Oh i see now, but i still confuse about something, i try to learn with trying make some pages, template, and fields at processwire, when i create a templates, theres a menu to import fields from antoher templates, how it works? I mean i try to import some fields from a template call theme_song, and at theme_song has a field, theme, and have value like Christmast, Easter, and etc. When i import the field from theme song to another template, is the value will import it too? Thank you
  2. Hi @Jan Romero, Thanks for the feedback Yes, i mean i'm try to create one table at database, that will be a parent table, and on table again that will be a child table and the value of child table is a detail from parent table, and they have a inheritance relationship. Hmm, so i can't do it with a processwire? So if i have a data, like for example sell and buy transaction, that has a invoice number and so many items, what can i do, for it? I mean can i, create a website using a processwire with a data like that? Thank you very much NB : Sorry if you can't understand with my question my english not well enough ?
  3. Hello, excuse me I'm new at processwire, i want to ask about a master detail system (Inheritance system) using a processwire. Can we create a Inheritance table using a processwire, and how we create it? Thank you for the help
  4. Hi @Marco Ro, sorry for may late reply, yes i can share it this is my function to upload an image and a file at the same time if(!$original || !$indonesia || !$other || !$composer){ $note = "Data tidak lengkap"; } else { $newFile = new WireUpload("song_files"); $newFile->setMaxFiles(1); $newFile->setOverwrite(false); $newFile->setDestinationPath($upload_path); $newFile->setValidExtensions(array('pdf','docx','doc')); $files = $newFile->execute(); if(!count($files)) { $newFile->error("No files received, so not creating page."); return false; } $newImg = new WireUpload("img_files"); $newImg->setMaxFiles(1); $newImg->setOverwrite(false); $newImg->setDestinationPath($upload_path); $newImg->setValidExtensions(array('jpeg','jpg','png','gif')); $images = $newImg->execute(); if(!count($images)) { $newImg->error("No files received, so not creating page."); return false; } $newPage = new Page(); $newPage->template = "files"; $newPage->parent = $pages->get("/files/"); $newPage->title = $original; $newPage->text_1 = $indonesia; $newPage->text_2 = $other; $newPage->text_3 = $composer; $newPage->text_4 = $video; $newPage->text_5 = $audio; $newPage->of(false); $newPage->save(); foreach($files as $filename) { $filepath = $upload_path . '/' . $filename; $newPage->files->add($filepath); $newPage->message("Add file : $filename"); unlink($filepath); } foreach($images as $filename) { //add this foreach iteration to upload an image $filepath = $upload_path.'/'.$filename; $newPage->images->add($filepath); $newPage->message("Add Image : $filename"); unlink($filepath); } $newPage->save(); }
  5. Hi, I'm still new at processwire, i want to ask, i was create a website with sign in system, but i want to add a access roles/permission for each user at my website. For now, i just can create a login user without any permission and the user data became as a pages in my processwire. Here i attach my code for login <?php $note = $note2 = $hidden =""; if($input->get->id == "logout") { $session->remove('login_id'); } if($input->post->submit) { $email = $sanitizer->email($input->post->email); $pass = $sanitizer->text($input->post->pass); $result = $pages->find("email=$email, text_1=$pass"); if(!$email || !$pass) { $note = "Data belum lengkap"; } else { if($result->count > 0) { $session->login_id = "$result"; $hidden = "style = 'diplay:none'"; $url=$pages->get("/files/")->httpUrl; header("Location:$url"); die(); } else { $note = "Akun tidak ditemukan"; } } } ?> And this code for login form <div class="frow-container"> <div class="frow centered mt-50"> <div class="col-md-1-3"> <div class="box p-40 shadow-light"> <h2 class="mb-20 text-center" <?=$hidden?>>Database Partitur<br>GII HIT</h2> <form method="post" <?=$hidden?>> <label>Username <input type="text" name="email"></label> <label>Password <input type="password" name="pass"></label> <input type="submit" name="submit" value="Masuk"> </form> <p class="notif"><?=$note;?></p> <div class="text-center"><?=$note2;?></div> </div> </div> </div> </div> Just for remember, my user data now is a pages, and i cannot give any permission to user data. Thank you very much for help.
  6. Hi @monchu Sorry for last update, i was trying your solution, but that doesn't help, now i can't login to my website, anymore and your link is empty, don't have any source code for example, are you give a right link? Because when i get into it, it just empty, and i didn't find anything from it
  7. Hi @monchu, Sorry i late reply, ok thanks for suggetion, i will try your suggestion and will update very soon for the result, but i want to ask one thing, how i can call hook at login.php? Thank you very much
  8. Hi @monchu Kabar baik, bagaimana denganmu? (I'm fine thank you, how about you?) So, i need to add the hook function, should i create a file name ready.php or i can search at my processwire installation folder?
  9. Hello, My name Marvin and i'm still new at ProcessWire development, i want to change my website authentication system using a PHP and Processwire, i tried to search some reference but get stuck of it, all i want to do just add some roles access to my website authentication system, can some one help me with a suggestion? Thank you very much before. Here i attach my code below This for authentication, i create a user like the other template. (I mean as a pages). <?php $note = $note2 = $hidden =""; if($input->get->id == "logout") { $session->remove('login_id'); } if($input->post->submit) { $name = $sanitizer->email($input->post->login_name); $pass = $sanitizer->text($input->post->login_pass); $result = $pages->find("email=$email, text_1=$pass"); if(!$email || !$pass) { $note = "Data belum lengkap"; } else { if($result->count > 0) { $session->login_id = "$result"; $hidden = "style = 'diplay:none'"; $url=$pages->get("/files/")->httpUrl; header("Location:$url"); die(); } else { $note = "Akun tidak ditemukan"; } } } ?> And this is a Login Form <div class="frow-container"> <div class="frow centered mt-50"> <div class="col-md-1-3"> <div class="box p-40 shadow-light"> <h2 class="mb-20 text-center" <?=$hidden?>>Database Partitur<br>GII HIT</h2> <form method="post" <?=$hidden?>> <label>Username <input type="text" name="login_name"></label> <label>Password <input type="password" name="login_pass"></label> <input type="submit" name="submit" value="Masuk"> </form> <p class="notif"><?=$note;?></p> <div class="text-center"><?=$note2;?></div> </div> </div> </div> </div>
  10. Hi @MoritzLost, i has solved a problem, thanks for your solution, it's very help me. After i saw my code again, i realise that no function to proccessing an image and after i make it, the image is uploading, but i still create another function, so i can upload a $newImg and $newFiles with one function. Thank you for your help
  11. Hi @MoritzLost Sorry my late reply, i was busy yesterday. Thank you for your suggest i will report i later, so i need to create a function for proccessing $newImg and $newFile then Uploading with create $newPage at the same time Thank you very much, i will try it and make an update very soon
  12. Hi, My name is Marvin, and i want to ask about a processwire, i'm new at processwire, and want to learn make a website using a php and processwire, but i have a problem. My problem is, when i want to uploading an image file, and a document file like a pdf, or doc, but every time i upload it, my image didn't upload to the back-end, just doc file was uploaded to the back-end. Any suggestion where i was wrong? Thank you NB : i attach my code below This is for uploading process <?php $note = $note2 = $hidden =""; if($input->post->submit){ $upload_path = $config->paths->assets.'files/upload/'; if(!is_dir($upload_path)){ if(!wireMkdir($upload_path)) throw new WireException("No upload path"); } $original = $sanitizer->text($input->post->original); $indonesia = $sanitizer->text($input->post->indonesia); $other = $sanitizer->text($input->post->other); $composer = $sanitizer->text($input->post->composer); if(!$original || !$indonesia || !$other || !$composer){ $note = "Data tidak lengkap"; } else { $newFile = new WireUpload("song_files"); $newFile->setMaxFiles(1); $newFile->setOverwrite(false); $newFile->setDestinationPath($upload_path); $newFile->setValidExtensions(array('pdf','docx','doc')); $files = $newFile->execute(); if(!count($files)) { $newFile->error("No files received, so not creating page."); return false; } $newImg = new WireUpload("img_files"); $newImg->setMaxFiles(1); $newImg->setOverwrite(false); $newImg->setDestinationPath($upload_path); $newImg->setValidExtensions(array('jpeg','jpg','png','gif')); $images = $newImg->execute(); if(!count($images)) { $newImg->error("No files received, so not creating page."); return false; } $newPage = new Page(); $newPage->template = "files"; $newPage->parent = $pages->get("/files/"); $newPage->title = $original; $newPage->text_1 = $indonesia; $newPage->text_2 = $other; $newPage->text_3 = $composer; $newPage->of(false); $newPage->save(); foreach($files as $filename) { $filepath = $upload_path . '/' . $filename; $newPage->files->add($filepath); $newPage->message("Add file : $filename"); unlink($filepath); } $newPage->save(); } } ?> And this if for a form <div class="frow-container"> <form method="post" enctype="multipart/form-data"> <div class="frow mt-10"> <div class="col-md-1-1"> <a href="<?= $pages->get("/files/")->httpUrl ?>"><i class="fas fa-arrow-left"></i> Kembali ke Files</a> </div> <div class="frow gutters col-md-1-1"> <div class="col-md-1-2 mt-15"> <label>Original Song Title <input type="text" name="original"></label> <label>Indonesia Song Title <input type="text" name="indonesia"></label> <label>Other Song Title <input type="text" name="other"></label> <label>Composer <input type="text" name="composer"></label> <label>File <input type="file" name="song_files"></label> </div> <div class="col-md-1-2 mt-15"> <label>Youtube Video Code <input type="text" name="video"></label> <label>Audio Video Code <input type="text" name="audio"></label> <label>Image <input type="file" id="attach" name="img_files" accept="image/jpg,image/jpeg/,image/gif,image/png"></label> </div> <input type="submit" name="submit" value="Save"> </div> </div> </form> </div> Thank you very much for all help
  13. Hi @kongondo, I solved it, i can change a width and height of my image using a css, but now i have one more issue, that is, when i upload an image and a file at the same time, there just a file save it to the processwire, but for image i have to save it manually from back-end. Any suggestion for it? Thank you very much
  14. Hi @kongondo It's ok, sorry for my late reply too, i had job to do, lately. I have field for files like for .docx or .pdf, and i have a field for images, but when i try to add a image, from a form the image seems not add to the images field, but that was add to a files field. And for your code your suggest, is it place inside foreach iteration or make new foreach iteration? For resize a image i don't get any error message, just when i try to reload my page, its showing the result the image cannot resize width or height either, like image i attach below. Thank you
  15. Hello @kongondo Thanks for reply, i have been try your suggestion, but the size not change, should i use get->filename() to change it? I mean should i get a filename first and then i set width and height using `$image->width([value])` and `$image->height([value])`? Thank you
  16. Hello, my name Marvin, i want to ask something. I'm new at processwire, and still learn it, i try yo showing an image, at a table, the image was show, but i can't resize the image please HELP Here i attach, my code belor <?php $num = 1; foreach($pages->get("/files/")->children as $child) { $current = $child === $page ? " class='current'" : ''; $result = $child->images; // $result->width(900); // $result->height(100); foreach($result as $items){ foreach($pages->get($child->name)->files as $file) { // $file = $child->files; // echo $file->name; echo "<tr><td>".$num++.".</td><td>".$child->title."</td><td>".$child->text_1."</td><td>".$child->text_2."</td><td>".$child->text_3."</td><td><a href='".$file->httpUrl."'>".$file->name."</a></td><td><img src='".$items->url."'></td></tr>"; } } } ?>
  17. Hello i hava a same problem, but a little bit different. When everyone in here get a 403 Error when migarting from xampp to live server, i get 403 error when i testing my website at a xampp Any suggestion for that? Here i attach my code where i get an error code foreach($pages->get("/files/")->children as $child) { $page == $child; $pdf = $child->files; echo $pdf->httpUrl; //the url not show anything, but whenif i use $pdf->url, the url will show a file path directory echo "<tr><td>".$num++.".</td><td>".$child->title."</td><td>".$child->text_1."</td><td>".$child->text_2."</td><td>".$child->text_3."</td><td><a href='".$pdf->url."'</a>".$child->files."</td></tr>"; //when i click a url i get 403 error code }
  18. Hello, I'm new at process wire and i want to make an web using upload file and showing it at the table as a link to open it at the new tab. I wa succed while upload a file, but how i showing it as a link at the table to open it at the new tab of my browser? Any suggestion may helpfull Here i attach my code below : This code is for upload it to back-end (process wire) <?php $note = $note2 = $hidden =""; if($input->post->submit){ $upload_path = $config->paths->assets.'files/upload/'; if(!is_dir($upload_path)){ if(!wireMkdir($upload_path)) throw new WireException("No upload path"); } $original = $sanitizer->text($input->post->original); $indonesia = $sanitizer->text($input->post->indonesia); $other = $sanitizer->text($input->post->other); $composer = $sanitizer->text($input->post->composer); if(!$original || !$indonesia || !$other || !$composer){ $note = "Data tidak lengkap"; } else { $newFile = new WireUpload("song_files"); $newFile->setMaxFiles(1); $newFile->setOverwrite(false); $newFile->setDestinationPath($upload_path); $newFile->setValidExtensions(array('pdf','docx','doc')); $files = $newFile->execute(); if(!count($files)) { $newFile->error("No files received, so not creating page."); return false; } $newImg = new WireUpload("img_files"); $newImg->setMaxFiles(1); $newImg->setOverwrite(false); $newImg->setDestinationPath($upload_path); $newImg->setValidExtensions(array('jpeg','jpg','png','gif')); $files = $newImg->execute(); if(!count($files)) { $newImg->error("No files received, so not creating page."); return false; } $newPage = new Page(); $newPage->template = "files"; $newPage->parent = $pages->get("/files/"); $newPage->title = $original; $newPage->text_1 = $indonesia; $newPage->text_2 = $other; $newPage->text_3 = $composer; $newPage->of(false); $newPage->save(); foreach($files as $filename) { $filepath = $upload_path . $filename; $newPage->files->add($filepath); $newPage->message("Add file : $filename"); unlink($filepath); } $newPage->save(); } } ?> and this code to showing it as a link at the table <table class="border"> <tr> <th>No.</th> <th>Original Song Title</th> <th>Indonesia Song Title</th> <th>Other Song Title</th> <th>Composer</th> <th>File (pdf)</th> </tr> <?php $num = 1; $song; foreach($pages->get("/files/")->children as $child) { //showing every child at files parent directory $page == $child; $song = $pages->get("/files/".$child->id."/")->files; //showing uploaded files at child directory echo $child->id; echo "<tr><td>".$num++.".</td><td>".$child->title."</td><td>".$child->text_1."</td><td>".$child->text_2."</td><td>".$child->text_3."</td><td><a href='".$song->httpUrl."'</a>".$song->name."</td></tr>"; } ?> </table> Thank you for any suggestion
  19. I have been try your sugestion but it doesn't work either, because i have page in another page, when i try your sugest, the page didn;t show, but file is show, what i'm trying to make is a subfolder system. Thanks
  20. so it has to be, nested foreach? Should i add echo between foreach? Thanks
  21. Oh sorry, i attach wrong code, this is my code where the result is error, Oh and sorry if i didn't understand what do you mean, because my english not good as well. Thanks
  22. Hello, i want to ask, i maintain a website that using a processwire and php, and i want to make an archive at my website using a subfolder system, but when i try, the sebfolder is show but when i click the files in that subfolder not show, and my browser just show me an error Invalid argument supplied for foreach(), i don't know why it error Here i attach my code and my screenshoot website : This is my code This is result of my website This is my error
×
×
  • Create New...