Jump to content

Ingolme

Moderator
  • Posts

    14,901
  • Joined

  • Last visited

  • Days Won

    177

Everything posted by Ingolme

  1. I could find out if its possible. But what I would be doing, essentially, is searching Google to find out what Geshi is, and then reading through Geshi's documentation to see what functions it has. If the documentation isn't clear enough I would search for "geshi highlight line" in Google and it probably will bring a few search results from stackoverflow. If none of these procedures provided a way to do it, then I could be reasonably certain it can't be done. These are all things you're capable of doing, so try it out. If you tried and had no luck I can then repeat the procedure myself to see if I get different results.
  2. Ingolme

    PHP text & images

    It's possible using data URLs as the src attribute of the <img> element: https://developer.mozilla.org/en-US/docs/Web/HTTP/data_URIs I don't recommend it because older versions of Internet Explorer wouldn't support it and because it could really slow down the page loading depending on how large the images are. Normally, the page continues loading while requests for images are being processed but by using Data URLs, the image has to be fully loaded before loading the next element in the page. Also, base64 encoding increases the size of the image by 33%. Just include the PHP files in the src attribute of the <img> elements.
  3. The reason your page is loading so slowly is that you're sending the data of 5000 records to the client. That takes some time to load. jQuery can only work with data that has already be sent from the server, so it cannot be used as a solution to the slow loading times. You could reduce the content length a little bit by removing the inline style attributes from the elements you're generating and using a stylesheet to apply it instead (something you should be doing anyways), it would reduce the data by over 200 kilobytes.You can move all that Javascript you're generating into a generalized function and assign event handlers from a script tag somewhere else on the page instead of using event attributes. These changes probably would not decrease the download time enough. What would really solve the problem is to reduce the amount of data you're sending. 5000 records is a whole lot, sending 50 at a time would be more reasonable.
  4. The people in the admin area of a website are also users. Perhaps there are different levels of administrative permissions and a person of the lower level finds a way to hack the system so they can do things they normally are not allowed to do. It's also to avoid unnecessary error messages from showing up to people who don't know PHP and are just trying to manage their website. Any information that is not hardcoded into your program has a chance of being tampered with. I don't use prepared statements if there are no variables at all in the query, like when creating a table or just counting rows.
  5. SQL is the language you use to limit the amount of results you get and to order them. You use the LIMIT and ORDER BY clauses. Like I said, search for PHP pagination tutorials.
  6. You need a PHP solution. jQuery still requires the entire table to be downloaded before doing the pagination.
  7. Search for PHP pagination tutorials on your preferred search engine. The concept of pagination was invented for this reason.
  8. There are many possible solutions. If the light blue part is actually part of the image, then you can't make it larger, but you can set the background color of the list item to the same color as the background of the image. You can use padding to increase the width and height of the list item. Personally, I would use transparent PNG images for the icons so that any color could be used in the background. I would use icons as background images so that text could be placed in the links instead. It's important to have text in your links so that search engines and screen readers can know what the link is. People with visual disabilities have programs that read the text out to them, if there is no text, they cannot "click" on the link.
  9. There are multiple problems. First of all, your SQL query might not work because you should be using the AND operator in your query: WHERE id='$id' AND password='$password' Secondly, the mysql library is deprecated due to security vulnerabilities. Use MySQLi or PDO Third, and very important, you're wide open for hacking. You have not sanitized the data coming from the user, so they can easily get in without a password. Search for "SQL injection" on your favorite search engine. If they use "' OR 1" as their ID they can access your secret page without needing a password I hope your page admin_option.php is checking to make sure that the user is logged in before showing anything. If not, people can simply type admin_option.php in their browser and get to the page, bypassing the login system.
  10. Setting padding to "auto" does nothing, so you can remove all that. The "auto" value for margin only applies to the left and right margins, so you can remove half of your margin rules as well. Types of elements There are two major types of elements: inline and block. Inline elements behave like a letter in text. They can have content to the left and right of them. Examples of inline elements are <span>, <a>, <strong>, <em>, <small>. Block elements force other page content below or above them. They can have width, height, margin and padding. Examples of block elements are <div>, <h1> to <h6>, <p>, <header>, <footer>, <section> and others. Shorthand forms of CSS properties Most CSS properties have a shorthand form. Margin, padding, border properties, background, fonts. For your case, the ones you should pay attention to are margin and padding. They can take one value, two values, three values or four values. One value: All sides have 10px margin: 10px; Two values: Top and bottom have 10px left and right have 20px. margin: 10px 20px; Three values: Top has 10px, left and right have 20px, bottom has 30px. margin: 10px 20px 30px; Four values: Starting from the top, move clockwise: top 10px, right 15px, bottom 20px and left 40px. margin: 10px 15px 20px 40px; Centering content How you center something depends on what kind of element it is. Block elements are centered if they have a specified width and you set their left and right margins to "auto". <div id="box">A centered box</div>#box { width: 500px; margin: 0 auto; background-color: #EEE;} Inline elements are centered if their parent element has text-align set to "center" <div id="box"> <a href="#">Centered link</a></div>#box { text-align: center;}
  11. Your calljsonp() function is not doing an AJAX request, it's just including a script tag onto the page, so you can't use the $.ajax method. If you want to do a true AJAX request, read about $.ajax in the documentation. http://api.jquery.com/jQuery.ajax/ The AJAX method needs parameters to indicate type (GET or POST), URL, data type (jsonp in your case) and other parameters.
  12. I'm not sure what you're toggling. If you're changing the DOM then there's probably a property in the DOM that tells you what state you're in and you only need one function. Here's an example of toggling the display of an element function toggleDisplay() { var element = document.getElementById("myElement"); if(element.style.display == "none") { element.style.display = ""; } else { element.style.display = "none"; }} I hardly ever see a need for actually toggling between two different functions, there probably is a better solution to your problem but to create that solution we need to know the specifics of your poblem. If it really is necessary to toggle between two functions here's a way to avoid global variables: function Toggle(f1, f2) { var toggle = false; this.run = function() { if(toggle) { f2(); } else { f1(); } toggle = !toggle; }}// How to use it:var t = new Toggle(show, hide);t.run(); // Calls show()t.run(); // Now calls hide()
  13. What does "n div per row" mean?
  14. Thank you. On ordinary forums, I'd feel that post count was a number of little significance, but W3Schools is a special place. On W3Schools, each post in my history means a little bit more knowledge gained by an aspiring web developer. My purpose here is to help people learn and I feel I'm doing a decent job at it. There are other forum members who deserve the attention more than I do. Among them, Justsomeguy and boen_robot.
  15. 500 means that there's a syntax error in the htaccess file. I think the $1 in your RewriteCond is probably the problem. $ signifies a backreference and is used as the second parameter after a regular expression. I'm not sure if RewriteCond uses backreferences or if it's just RewriteRule that does. Where did you find this code?
  16. The caption associates the text with the image, without the figure and figcaption elements search engines can only try to make guesses as to what text belongs to the image and which doesn't. It's not just SEO, accessibility tools can also use the figure and figcaption elements to let visually impaired users know that the image and text are related.
  17. You can tell which elements and attributes not to use by using the W3C validator on your code. http://validator.w3.org/ The attributes and elements you're using are actually from HTML 3.2, they were deprecated in HTML 4.01.
  18. Put the border on the <img> element itself. You could use the descendent selector: /* Any <img> that is inside an element with class="one" */.one img { border-style: solid; border-color: brown; border-width: 10px;} You should remove the background attribute from the <body> element and put it into your CSS as body { background-image: url(/background_images/b2.gif);} The <center> tag is deprecated as well, you can substitute it with text-align: center in your CSS. If what you want to center is a box instead of text, put "margin: 0 auto" as its CSS. This will only work if the element has a defined width. It's important to move away from presentational HTML elements and attributes now so that it does not become a habit that's hard to break away from in the future. Don't use tables for layout, learn about CSS layouts using margin, padding, float and other CSS properties. I believe the W3Schools CSS tutorial has some page or another talking about it.
  19. You have a <form> element right after your <body> tag that doesn't need to be there. You can't have two different elements with the same ID attribute. IDs can only occur once in a document. Your "Web page address" form field is repeated twice, once in the "contact information" section and once in the "personal information" section. Remove one of them. Some of the other errors are just a side effect of the first few errors.
  20. You can try using the find and replace feature of your text editor. There's nothing like variables in the HTML specification. If your site is PHP you can have just one file with all the navigation links in it and include the file in all your pages.
  21. There probably is not a lot of competition for using your name as a keyword, so I don't think you have to worry about that. But if you want to rank high for keywords like "BBC writer" or "Drama writer" you have much more competition.
  22. Like this: function doSomething() { // Do something}$(document).ready(doSomething);$(window).resize(doSomething);
  23. Search engines are the primary way that people find websites. It's not that there's some person at Google that doesn't like your site, but that your site will be further down in search results. Statistics have shown that a majority of people searching never look beyond the first page of results. If your business has a dependency on this website, you likely will want to make sure the website is as easy to find as possible.
  24. The ID "slideLink" is on several different elements. It's impossible to predict which of the elements the browser will return when searching for that ID.
  25. The width and height are used by the browser to reserve space for the image before the image has even started downloading.
×
×
  • Create New...