Jump to content

Marvin

Members
  • Posts

    22
  • Joined

  • Last visited

Recent Profile Visitors

739 profile views

Marvin's Achievements

Jr. Member

Jr. Member (3/6)

3

Reputation

  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
×
×
  • Create New...