Ingolme

Moderator
  • Content count

    12,787
  • Joined

  • Last visited

  • Days Won

    299

Everything posted by Ingolme

  1. There are three aspects to take into account in a web page: Content: HTML Presentation: CSS Behavior: Javascript The same way we want to separate content from presentation, we also want to separate content from behavior. Javascript should only be inside <script> elements, CSS should only be in <style> or <link> elements and HTML should not be polluted with attributes concerning behavior and presentation. You wouldn't use align and bgcolor attributes, so why would you use onclick attributes? In your original code, otherTongue is restricted to the local scope of the function it was declared in, it's not accessible from outside. That's why the onchange event attribute can't find it, the event attribute is looking for a global function.
  2. animation-play-state doesn't refer to GIF files, it refers to CSS 3 animated properties. There is no way to stop an animated GIF from playing. If you want full control over animated images, you'll need a spritesheet and a Javascript code that animates the images. You can use <canvas> or set the background image of a fixed size box. With Javascript you can detect whether the window has been focused or blurred using the "focus" and "blur" event listeners on the window.
  3. That's because otherTongue is local to the scope of the function that runs after the document has finished loading, aside from the fact that it doesn't even exist until after the HTML has finished rendering. Either declare the function outside of $(document).ready() or assign the event handler using Javascript. I would discourage the use of HTML attributes for events, here's some self-contained Javascript that will work without having to download the entire jQuery library before running: window.addEventListener("DOMContentLoaded", assignEvents); function assignEvents() { document.getElementById("other").style.display = "none"; document.getElementById("tongue").addEventListener("click", otherTongue); } function otherTongue(e) { if(e.currentTarget.value == "other_tongue") { document.getElementById("other").display = ""; } }
  4. What CSS code did you use?
  5. There doesn't seem to be an option to remove those numbers, so you'll have to hide them with CSS, at least they're not links. The CSS for this kind of pager is easier: .pager-current { display: none; }
  6. If you're using Drupal 7 and Views UI then the pager options are in the middle column when editing views. You have the following options for pagers: Display a specified number of items Display all items Paged output, full pager Paged output, mini pager The mini pager option has only previous, next, first and last buttons.
  7. I've worked with Drupal before and it does have different pagination options, at least for the views.
  8. If you can afford to ignore Internet Explorer 10 and below, the :not() selector will do the job. .pagination > li:not(.prev):not(.next):not(.pager-first):not(.pager-last) { display: none; } If you want to support more browsers, you would first hide all the list items, then show the ones you need: .pagination > li { display: none; } .pagination > .prev, .pagination > .next, .pagination > .pager-first, .pagination > .pager-last { display: inline-block; /* Or whatever display they're supposed to have */ } But the best solution would actually be to prevent these links from appearing in the HTML in the first place, and the reason for that is that search engine robots may think you're trying to show different content to search engines than to the user. How are these links being generated?
  9. My code was using ob_get_clean() which deletes the buffer and returns its contents. It doesn't matter what code you use to send the mail, the string that you want to use is in the variable, you can do what you want with it: print it, store it in a database, send it in an e-mail...
  10. Do you know any Javascript or PHP?
  11. In your code, you have two different variables that both happen to have the same name, one of them is given a value while the other one is left empty. That's not a very good example.
  12. If you had error messages turned on you would see a lot of notices for undefined variables. PHP forgives many mistakes and tries to interpret what you do. If you forgot to declare the array but you're treating the variable as an array then it will implicitly create the array and throw a warning. Put this at the very beginning of your code: error_reporting(E_ALL); Then it will show you when you've done something wrong. If you're assigning a value before you use it, then you don't need to initialize it as an empty string, but take this example: if($_POST['has_name'] == 1) { $name = $_POST['name']; } echo $name; In this case, there's a chance that $name will not exist, so we would remedy that by setting $name to an empty string at the beginning: // Initialize variable $name = ''; // Give it a value under certain conditions if($_POST['has_name'] == 1) { $name = $_POST['name']; } // Print the value echo $name;
  13. You can't add something to a list if you haven't told the system that there's a list to be added to, so you have to declare $errors as an array before adding anything to it. The reason $name, $email and $message are being initialized is so that when something tries to use them it's guaranteed that they will exist. You're not allowed to use a variable that doesn't exist, it doesn't make sense. Take this example: echo $a; You're telling it to print the contents of variable $a, but you have not told it where $a is or what's in it, so the contents of $a is a mystery. It could print anything it wants and not be wrong, instead it chooses to throw a warning.
  14. You can adjust which part of the image shows up using background-position. I find setting background-position: 0 100%; does a good job.
  15. Changing the URL of the page is the easy part, but you'll need either Javascript or PHP for it. In Javascript, you can change the URL by setting the value of location.href. You can get the value of the text field by reading its value property. If you actually want to filter videos you'll need a more complex system.
  16. That error happens when you're trying to insert a new row into a table and a field you omitted does not allow null as a value. You can either change the field to allow null or give the field a value in the insert query.
  17. The best option would be to set the background size to "cover" rather than 100% 100%. You shouldn't ever change the aspect ratio of an image, it looks bad. You can read about the possible background-size values here: https://www.w3schools.com/cssref/css3_pr_background-size.asp
  18. A short and simple example would be this: // Template variables $name = 'John'; // Buffering ob_start(); include 'template.php'; $message = ob_get_clean(); // Send mail mail('john@example.com', 'Good evening', $message); template.php would look like this: <p>Hello, <?php echo $name; ?>.</p> <p>Thank you for signing up.</p>
  19. The most common approach is to use an SQL TEXT type field for posts. It can hold 65,536 characters which is usually more than enough. Forums are complex systems, they have many different parts to them: Users, forums, topics, posts and often a lot of other features. If you just want a forum it's best to use software that's already been built. If what you want is not a forum, then you first need to make a clear and complete specification of what you want and all the features it should contain. Projects don't begin with writing code, they begin with formally expressing what you actually want.
  20. You can use output buffering (ob_start() and ob_get_clean()) and include() to make use of an HTML template and store it in a variable. The template will have access to all the variables in the scope that include was called in.
  21. There's no security issue there because the only thing that can be "hacked" is whether the body element has a class attribute or not.
  22. The line-height property determines the space between lines of text. You can remove the line-height declarations. If the text is wrapping it's because the boxes aren't wide enough to fit it. You should increase the width of the box if you don't want the text to wrap.
  23. Buttons are inline elements, so they need to be centered by setting text-align on the parent element.
  24. Setting a relative position is going to mess up your layout, as well as using align-items. Use text-align to center the text. <div class ="container"> <div class ="itilblock" style= "width: 150px; line-height: 50px;">something and something else</div> <div class ="itilblock" style= "width: 200px; line-height: 30px;">something and something else</div> </div> div.itilblock { background-color: rgb(3,173,181); border-style: outset; text-align: center; color: white; height: 75px; padding: 3px; display: inline-block; } Remember that inline blocks have a small space between them unless the tags in the source code are on the same line with no space in between them.
  25. Goodness, no. In this case jQuery does not have some magical pre-built solution to the problem. You need to have a mousemove event. Each time the event fires, subtract the element's position from the mouse's position. That will give you a direction vector which you can use to generate text-shadow coordinates. There are details you need to take into account: The pivot point of the element starts off at the top left corner. You probably want the pivot point to be in the middle of the element, the middle is at [x + width/2, y + width/2] The vertical coordinates for text-shadow might be inverted.