Jump to content

Ingolme

Moderator
  • Posts

    14,901
  • Joined

  • Last visited

  • Days Won

    177

Everything posted by Ingolme

  1. If all you want to do is add space between the elements, you need CSS. You can add padding to the left of the link.
  2. It doesn't matter which element you use because you can use CSS to change the padding or margin of the element. If it's a link, use <a>. The element you use should describe the content. If any of the elements in the table on this page matches the meaning of your text, then use them. If nothing can properly describe your content then use <div> for block display and <span> for inline display. You should never choose an HTML element based on how it looks, but based on how well it describes the content. Use CSS to change how an element looks.
  3. I assume this is a horizontal menu. To center items in a horizontal menu, remove float, set their display to inline-block and then set the text-align of the parent to "center".
  4. 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.
  5. 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.
  6. 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 = ""; } }
  7. What CSS code did you use?
  8. 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; }
  9. 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.
  10. I've worked with Drupal before and it does have different pagination options, at least for the views.
  11. 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?
  12. 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...
  13. Do you know any Javascript or PHP?
  14. 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.
  15. 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;
  16. 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.
  17. You can adjust which part of the image shows up using background-position. I find setting background-position: 0 100%; does a good job.
  18. 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.
  19. 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.
  20. 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
  21. 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>
  22. Ingolme

    Is this a long?

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