Jump to content

Ingolme

Moderator
  • Posts

    14,901
  • Joined

  • Last visited

  • Days Won

    177

Everything posted by Ingolme

  1. If it's your own stylesheet, you should have the uncompressed version as well. You can show that one instead. If it's not yours, it is possible to improve the formatting using string manipulation in any programming language. That is something I'd recommend doing on the server-side instead of with Javascript. Somebody has already built such a program and you can see it here: https://www.cleancss.com/css-beautify/ There probably is a github project with the source code to do that, try searching around.
  2. Superglobals are literally PHP arrays. The only difference between a regular PHP array and a superglobal is that the superglobal is accessible from any scope. You can read all the details about arrays here: http://php.net/manual/en/language.types.array.php In PHP, arrays behave similar to the map structure in other languages. Here's a PHP sample of managing an array. not necessarily a superglobal, just any array. <?php $data = []; if(isset($data['something']) && $data['something'] == 'value') { echo 'The array contains the key "something" with value "value"'; } ?> Here's the same code using a map in Java: Map<String,String> data = new Map(); if(data.containsKey("something") && data.get("something").equals("value")) { System.out.println("The map contains the key \"something\" with the value \"value\""); } Notice that in both cases, we see whether the key exists before trying to retrieve a value associated with the key.
  3. It's not complicated. Keep your CSS the same, just change the HTML structure: https://www.w3schools.com/code/tryit.asp?filename=FOR65BU7Z5IV The structure is simple: one video element positioned in the background, all the rest of the content styled the same way as you would without a video background, but inside the <div class="content"> wrapper.
  4. For required fields, you can use the required attribute. If you want to send files then use a file type input. You'll need to handle the uploaded file on the server-side, so here's the tutorial page for handling file uploads with PHP: https://www.w3schools.com/php/php_file_upload.asp
  5. Ingolme

    How how how

    There isn't a specific name for those kinds of pages, you could refer to them as animated pages or interactive pages. They're very difficult to implement, they're mostly built using Javascript programming, but the simplest ones may be possible with complex usage of CSS animations. There isn't one way to do it, every page is different. You need to first design the page itself, then make a list of all the pieces that change over time and how they change. Once you have that list you can then program each of the elements.
  6. Move all page content, including the navbar, inside the <div class="content"> element. Your HTML structure is broken, so that will be the source of some layout problems. You should make sure your page has only one <head> tag and only one <body> tag. Make sure that your <meta> and <style> elements are all in the <head> section, while all of the visible page content itself is in the <body>
  7. Seeing as you can't use CSS, what is the HTML code you're using? You just need to add a style attribute to the element with the background color.
  8. Undefined variables and array keys have always been an error in PHP, whether or not the error messages are being hidden. PHP is a very forgiving language, in any other language undefined variables or properties would not even allow the code to compile. PHP has mechanisms to catch and fix attempts to access unallocated memory, but it comes at a cost, which is why the PHP engine sends warnings every time it fixes these mistakes. The problem with accessing undefined variables or properties is that PHP has to allocate memory for a variable that is never going to be used, the cost being the amount of memory allocated and the amount of processing time required to allocate that memory. Problems like this are why I would never recommend PHP or Javascript for somebody who wants to start learning programming. They allow the use of undefined variables and the variables do not have a strict data type assigned to them.
  9. Anytime you're checking for input values in POST, GET, or COOKIE you should use isset () to check that they exist before doing any operations with them. This is not new to PHP. My guess is that previously you had warnings turned off. Using empty () also works since it uses isset () internally.
  10. Ingolme

    using curl

    That's the curl command line tool. If you want to use their service with PHP, the easiest way is to use their PHP SDK. Most likely they have clear documentation in their tutorials for the PHP SDK. If you want to use PHP's implementation of curl, you'll have to learn to translate the command line language to PHP. All of this can be done by setting options with the curl_setopt() method. The manual page has a list of all the possible options. In the example you posted, it starts by indicating that the method is POST. In PHP the option for that is CURLOPT_POST. The following four items are HTTP headers. You can add headers in PHP using the CURLOPT_HTTPHEADER option. Following that is the request body, this would go in th <?php // Information needed for the request $api_key = 'XXXXXXXXXXXXXXXX'; $data = [ 'username' => 'cooldude6', 'password' => 'p_n7!-e8', 'phone' => '415-392-0202' ]; // Send a cURL request $request = curl_init('http://parseapi.back4app.com/parse/users'); curl_setopt(CURLOPT_POST, true); // This is a POST request curl_setopt(CURLOPT_HTTPHEADER, [ 'X-Parse-Application-Id: APPLICATION_ID', 'X-Parse-REST-API-Key: ' . $api_key, 'X-Parse-Revocable-Session: 1', 'Content-Type: application/json' ]); curl_setopt(CURLOPT_POSTFIELDS, json_encode($data)); curl_exec(); By default, PHP prints the curl response straight to the browser. If you want to store the result in a variable instead, you should read the PHP manual on how to use the CURLOPT_RETURNTRANSFER option.
  11. The styling of form elements is very restricted. You can read more about it here: https://developer.mozilla.org/en-US/docs/Learn/HTML/Forms/Styling_HTML_forms You can't style optgroup elements. If it's very important to give style to a structure similar to that one you'll have to create your own imitation of a dropdown using Javascript.
  12. Is Google Analytics not accurate enough for user tracking on your website?
  13. Create three columns, the middle one will have the content in it and the columns on the sides can have anything else. This page teaches how to create columns among other different layout techniques: https://www.w3schools.com/css/css_website_layout.asp
  14. Are you sure this is Java? You're using the word "OR" in your code and there are comparisons being done between different data types. I can't see where zip2Col is defined so I don't know what type of data it is. Assuming zip2Col is a string containing the data from the cell, the following Java code would meet your requirements: String cellValue = ""; if(zip2Col == null || zip2Col.isEmpty() || zip2Col.equals("0")) { cellValue = "baddata"; } if(!cellValue.equals("baddata")) { System.out.println("good data"); }
  15. Those are basic layout techniques. You can learn about different layout techniques here:https://www.w3schools.com/css/css_website_layout.asp
  16. If you don't know Python or Xpath, then what kind of answer are you expecting? Are you looking for somebody to build the software for you?
  17. The principle is the same. Have the video in a fixed position in the background while having the rest of the content scrollable in the foreground. Here's an example: https://www.w3schools.com/code/tryit.asp?filename=FOMFZ9OYGA7L
  18. There is no fast way to search an XML document, because the entire file needs to be loaded into memory and parsed before the search can even begin. You would need to create a file format that is optimized for searching, which is exactly what databases do. The search has to be done on the server-side as well, since transferring 40,000 records to the client before beginning the search is already a slow task.
  19. Get rid of the bootstrap stylesheet. That's the one that's adding all the additional styles that are breaking the nav bar.
  20. The problem is that both .navbar and .dropdown have "overflow: hidden" on them, which prevents any of their children from being visible if they escape the boundaries of their parents.
  21. I'm not sure what you mean by "insert" in this context. The issue you get when calling $.getScript() is that there's a time delay between the time the function is called and the time when the contents of the loaded file begin executing. The page would respond a lot faster if all functions were already available as soon as the page is loaded. You might want to consider if your page still works properly if Javascript had an issue while executing or failed to load.
  22. There's no reason why you can't include the same Javascript file in multiple pages. Declare all your functions in one file, then include the file on any page that needs to call any of the functions.
  23. You need to do some debugging. You can't just copy some code and give up when the code doesn't work. Look for solutions. You have one single condition to test for here: if($row['amount'] > 0) { header('Location: http://www.example.com/'); } If it redirects, then the count is greater than zero, if it does not redirect then the count is zero or less. You have to do some debugging to find out why this number is zero or less. To start off, print the number. Since it's not redirecting, my guess is that the number is zero, but you should check to make sure. Once you have verified that the number is actually zero then that's clear evidence that the database table does not have any rows that match your query. Maybe there's something wring with your query. The query has two inputs, $user_name and $password. Print out both their values, then check the database table for yourself using phpMyAdmin or similar software to see if there is a row that contains both of those values. There are two possibilities: The values you passed into the query are wrong or the database actually does not contain that data. I can't tell you why the code is not working, but I've just told you how you can find out.
  24. The main issue is the animation. If you eliminate the animation, you're eliminating the window of time in which the user can move the mouse over to a different element. It's a design flaw to have content that changes the location of elements on mouseover and mouseout events because it makes it difficult for the user to reach elements they want to get to. Whenever anything causes elements to shift around, it's always better to use click events for it so that any rearrangement that occurs was intended by the user.
  25. No, that wouldn't work. The function needs a name if you want to use it like that, and there's no guarantee that the file has been parsed yet when the callback is executed. If you want to go with the anonymous function, have it executed as soon as its declared like this: (function() { // Function content })(); // Executed immediately. // Load the external file, it runs on its own so nothing else needs to be done $.getScript('data.js'); I don't really get the point of loading a separate file containing Javascript, though. It's better to just load a script file containing all the functions when the page loads using a <script> tag and then call those functions by name whenever they're needed.
×
×
  • Create New...