Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Red11

Members
  • Joined

  • Last visited

  1. Hi there, I am trying to remove controls from vimeo videos. Adding &controls=0 no longer seems to work. It seems this is achieved now by accessing the videos via api. I have no experiene with api's. I understand how to create an app in vimeo and generate the token, and add the following code to display the video's, but there's a chunk in the middle - I assume where the site retrieves the data from the api - that I am missing. <div id="made-in-ny"></div> <script src="https://player.vimeo.com/api/player.js"></script> <script> const options = { id: 59777392, width: 640, loop: true }; const player = new Vimeo.Player('made-in-ny', options); Can you help?
  2. Hi all, I have 2 pieces to my htaccess that seem to have conflicting interests. The first block is what I have added as the site is built with Vue and the tutorial suggested this. The second is from my old site and forwards requests without 'www' to the address with 'www'. <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.html$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.html [L] RewriteCond %{HTTP_HOST} ^address.co.uk [NC] RewriteRule ^(.*)$ http://www.address.co.uk/$1 [L,R=301,NC] </IfModule> The non 'www' url forwards correctly when on the homepage, but if someone directly accesses a sub page without adding 'www' it simply just stalls on loading. Is this easy to overcome? At worst I will the second part for the time being, but would be great to know if there is a simple solution to this. Thanks
  3. Thanks for the helpful advice. As the site in question is fairly small with a UK-only audience I will definitely be keeping them on the site...
  4. Hi there, Been hearing a bit about using 3rd party image hosting websites and the benefits. I am interested in trialling it on a website, because of its apparent speed efficiency being able to supply viewer with webp images if they can support it, and at the correct size. But have a couple of questions: - Is it benificial on small websites or just larger ones? (was going to try it on a small static site built with Vue) - Is it a lot of work to configure? I was thinking of going with https://imagekit.io/, but if the benefits are only slight for the work involved, will leave this for a larger project. Thanks
  5. Thanks NOCK I will look into this.
  6. that is true the information is not sensitive in any way, more just a case of being able to block the average user. As the rest of the site does not use databases, I am wondering if there are any alternative methods to DB or cookies?
  7. Hi there, I have built a site sith Vue.js and wanted to protect some pages with a password. From what I have seen, using .htaccess is a good method. But... Is there a (relatively) secure way when a user has entered the password they don't need to again for the rest of the visit? I was thinking storing a cookie or something, but is this easily hackable? Thanks
  8. ok, thanks for asking the question, because it highlighted to me that category was not even available from where I thought it was... Going to have to rethink. Thanks
  9. I am new to PHP, and have been dropped in to a job a little out of my depth to try and work something out. I have a list of items and quantities from different departments. I am trying to count the number of items from a certain group of departments in that list, and assign that number to a variable. eg: item 1 has qty of 1 and is from category_id 2 item 2 has qty of 1 and is from category_id 5 item 3 has qty of 1 and is from category_id 3 How would I get that to work from the following? $group1 = function () { return array_sum( return array_map( function ($item) { return count(array_intersect($item->product->category_id, [2, 3])) ? $item->qty : 0; }, ) ), }; Thanks
  10. Ah I think my error is not coming from this bit of code... Thanks for the resource link though that will be helpful for future tests
  11. I am aiming for the following: .white { color: #fff !important; } .white-bg { background-color: #fff !important; } .white-border { border-color: #fff !important; } .purple { color: #20123a !important; } .purple-bg { background-color: #20123a !important; } .purple-border { border-color: #20123a !important; } etc.. Thanks
  12. Hi all, I am fairly to new SCSS, and trying to create 3 classes each for a set of 5 name and value pairs. It works, but the outputted css shows each class 5 times! So something is being wrongly referenced here: $colours: ( white: #fff, purple: #20123a, green: #39C271, duskblue: #000473, skyblue: #41B8BC ); @each $name, $value in $colours { .#{$name} { color: $value !important; } .#{$name}-bg { background-color: $value !important; } .#{$name}-border { border-color: $value !important; } } Let me know what I am doing wrong here! Thanks
  13. Below is the php form handler if this helps at all: <?php $name = $phone = $package = $beatQuote = $uploadedFile = $message = ""; if ($_SERVER["REQUEST_METHOD"] == "POST") { $name = test_input($_POST["name"]); $phone = test_input($_POST["phone"]); $package = test_input($_POST["package"]); $quote = $_POST["quote"]; $message = $_POST["message"]; $uploadStatus = 1; if(!empty($_FILES["attachment"]["name"])){ $targetDir = "uploads/"; $fileName = basename($_FILES["attachment"]["name"]); $targetFilePath = $targetDir . $fileName; $fileType = pathinfo($targetFilePath,PATHINFO_EXTENSION); $allowTypes = array('pdf', 'doc', 'docx'); if(in_array($fileType, $allowTypes)){ if(move_uploaded_file($_FILES["attachment"]["tmp_name"], $targetFilePath)){ $uploadedFile = $targetFilePath; }else{ $uploadStatus = 0; echo json_encode(array('success' => 0)); } }else{ $uploadStatus = 0; echo json_encode(array('success' => 0)); } } if ($uploadStatus = 1) { $toEmail = 'email@address.co.uk'; $emailSubject = 'Contact Page Enquiry'; $headers = 'From: Contact Page <noreply>'; $bodyParagraphs = '<h2>Contact Request Submitted</h2> <p><b>Name:</b> '.$name.'</p> <p><b>Phone:</b> '.$phone.'</p> <p><b>Package Of Interest:</b> '.$package.'</p> <p><b>Customer Ticked Beat Quote Box:</b> '.$beatQuote.'</p> <p>'.$message.'</p>'; if (!empty($uploadedFile) && file_exists($uploadedFile)){ $semi_rand = md5(time()); $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x"; $headers .= "\nMIME-Version: 1.0\n" . "Content-Type: multipart/mixed;\n" . " boundary=\"{$mime_boundary}\""; $message = "--{$mime_boundary}\n" . "Content-Type: text/html; charset=\"UTF-8\"\n" . "Content-Transfer-Encoding: 7bit\n\n" . $bodyParagraphs . "\n\n"; if(is_file($uploadedFile)){ $message .= "--{$mime_boundary}\n"; $fp = @fopen($uploadedFile,"rb"); $data = @fread($fp,filesize($uploadedFile)); @fclose($fp); $data = chunk_split(base64_encode($data)); $message .= "Content-Type: application/octet-stream; name=\"".basename($uploadedFile)."\"\n" . "Content-Description: ".basename($uploadedFile)."\n" . "Content-Disposition: attachment;\n" . " filename=\"".basename($uploadedFile)."\"; size=".filesize($uploadedFile).";\n" . "Content-Transfer-Encoding: base64\n\n" . $data . "\n\n"; } $message .= "--{$mime_boundary}--"; $returnpath = "-f" . $email; $mail = mail($toEmail, $emailSubject, $message, $headers, $returnpath); @unlink($uploadedFile); } else { $headers .= "\r\n". "MIME-Version: 1.0"; $headers .= "\r\n". "Content-type:text/html;charset=UTF-8"; $mail = mail($toEmail, $emailSubject, $bodyParagraphs, $headers); } if ($mail) { echo json_encode(array('success' => 1)); } else { echo json_encode(array('success' => 0)); } } } function test_input($data) { $data = trim($data); $data = stripslashes($data); $data = htmlspecialchars($data); return $data; } ?>
  14. Hi there, I have created a webform, which when submitted sends to email. I have included ajax to handle the notifications. But it's not quite working when a file is attached. It sends to email fine when it's just text If I include the form handler contactForm.php directly in the html page with the form, it sends the form attachment fine. If I include a console.log(file) just above the ajax, it does display the file data Below is the code in question: <form enctype="multipart/form-data" method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>"> <input class="file-input" id="fileUpload" name="attachment" type="file"> $('form').submit(function(e) { e.preventDefault(); var formData = new FormData(this); if($('#fileUpload').prop('files').length > 0) { file =$('#fileUpload').prop('files')[0]; formData.append("attachment", file); } console.log(file); $.ajax({ type: "POST", url: '/_partial/contactForm.php', data: formData, success: function(response){ var jsonData = JSON.parse(response); if (jsonData.success == "1") { $('.notification').fadeIn(function(){ $(this).addClass("is-success"); $(this).text("Thank you for your interest. We will get back to you soon."); $(this).delay(5000).fadeOut(); }); } else { $('.notification').fadeIn(function(){ $(this).addClass("is-danger"); $(this).text("Something went wrong. Please try again later"); $(this).delay(5000).fadeOut(); }); } }, cache: false, processData: false, contentType: false, }); $(this).trigger("reset"); }); Please let me know if anything looks suspect!
  15. Is there considered a standard for structuring a flat, static website directory structure these days? I mean in the past it was simple index.html /images /js /css but now with compiled files etc, would something like the following be acceptable? index.html /source /scss /js /images /images /js /css

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.