Jump to content

Ingolme

Moderator
  • Posts

    14,901
  • Joined

  • Last visited

  • Days Won

    177

Everything posted by Ingolme

  1. alert() is a function, it should be using brackets (), not curly braces{}. This is a syntax error: createArticleHeader(text= "Article Heading"). Javascript is not like PHP, you cannot give default values to the function arguments (unless this is an ECMAScript 6 or 7 feature I wasn't aware of, I still wouldn't recommend using it for compatibility reasons).
  2. You cannot use the path of a file that is on your computer. The image has to be hosted online.
  3. There isn't a taxonomy for fonts, just categories. The two main types of fonts are serif and sans serif. Serif fonts are decorated with little lines off the tips of the letters. These little decorations are called "serifs". sans serif fonts do not have these decorations, from French "sans serif" meaning "without serifs." Almost all fonts fall under the serif or sans serif categories, but there are a few other categories for the less common fonts. Cursive fonts are ones that look like handwriting or calligraphy and fantasy fonts are very decorated and stylized. The final category is called system-ui and it's for fonts that have things like math symbols and windings. Those are all of the generic categories of fonts. You can't guarantee that a font will look exactly the way you want it to, but you have to specify a generic font so that, if the user does not have your preferred font installed, the browser has an idea of the category of font you intended to use and select an appropriate one. The font-family rule allows you to specify multiple fonts, this is so that you can tell it to search for other similar fonts (that you know of) in case the main one you were looking for is not available on the user's computer. An example might be the classic font-family: Arial, Helvetica, sans-serif (some people might tell me Helvetica should go first, but that's a matter of preference). Windows computers generally have Arial installed, while the most similar font to it on a Mac is Helvetica. If the computer does not have any of the two installed, the "sans-serif" tells the browser to find any san-serif font it has available. If you want to make sure people see something similar to the font you want, you should look online for the name of a few fonts that are installed on a majority of computers which look similar enough to your font and add it to the font-family list.
  4. You would need to wrap each of the Chinese words in an element, <span> or anything else, which has a lang="ch" attribute.
  5. The text of each language should be wrapped in an element with a class or some other attribute to define the language. For semantic reasons, you can use lang="en" for English and lang="ch" for Chinese, then you can select all elements of the language and give them a specific font family. If you use the lang attribute to define the language contained in an element then you can use the :lang() selector as in the following CSS: :lang(en) { font-family: [English fonts] } :lang(ch) { font-family: [Chinese fonts] }
  6. You're restricted to whichever fonts are installed on the user's computer. You can list any number of fonts in your font-family declaration, but you have to specify a generic font for if the user does not have any of them. The generic fonts are serif, sans-serif, monospace, cursive, fantasy and system-ui. Your font declaration could look something like this, assuming that all of these are names of fonts that look the way you want them to. font-family: "AR PL UKai CN", "regular script", "kaiti", "kaishu", "zhengshu", "zhengkai", cursive; From the style of font you've shown, cursive probably matches it best, but on Windows cursive tends to be Comic Sans, so you might want to use serif instead.
  7. Remove this from your CSS and replace it with a more specific rule that only targets the elements you want it to: li { float: left; }
  8. If you use CSS to set a large line-height to the <li> elements you won't need the <br> elements. You can also use margin or padding, there are a lot of options with CSS to style anything. You really should never need a <br /> element anywhere, but especially not as direct children of a <ul> element.
  9. You cannot make the iframe's height match its content with CSS. You will need Javascript to measure the height of the content and set the frame's height. This only works if both pages belong to the same domain.
  10. The content of the page in the iframe is inside a wrapper with a white background, while the document itself does not have a set background color. Because of that, the white ends where the content does.
  11. It's not clear what the issue is. Is this image the way you want it to look or are you highlighting what's wrong? What code are you using?
  12. I don't know what the full requirements of your software are, but your code should look something like this: $type2 = 'Some default value'; $type_link = 'Another default value'; if(isset($typeChunks[0]) { $type2 = $typeChunks[0]; } if(isset($typeChunks[1]) { $type_link = $typeChunks[1]; } I'm also not sure why you've wrapped brackets around every single statement, they're not needed. There are also inconsistencies in your variable naming, you should either use all underscores ($type_link, $type_chunks) or all camel case ($typeLink, $typeChunks).
  13. The $total_type string does not have a "|" character in it. Any time you're dealing with an array of unknown length, you should use isset() to determine if an element exists before using it.
  14. It's an issue with invalid HTML. Pass your code through the validator and fix all the errors it shows: https://validator.w3.org/ Tags should be closed in the opposite order they were opened. If you opened with <b><u> then you have to close with </u></b>, not with </b></u>. Here's a list of some of the errors on your page: <!DOCTYPE! html> should be <!DOCTYPE html> The <title> tag does not have a style attribute. The <u> tag is deprecated and should not be used. You can use CSS to replace it. Tags are not closed in the right order. <marquee> is deprecated and should not be used anymore. You can use CSS animations to replace it. Here's a list of things that aren't technically errors, but you should do to follow best practices: Avoid the use of style attributes, put all of your CSS in the stylesheet. Avoid the use of <b> and <i> tags to style blocks of text. Use CSS to change the style. <br> does not need a closing tag, you can remove the </br>.
  15. You shouldn't use a table. Just set min-height rather than height. This solution won't work for tables.
  16. Probably due to an unclosed <a> tag, but you'll have to show your code for me to be sure.
  17. HTTPS is not necessary for the main site since there is no sensitive information passed to or from it, but I do agree that the forum should be encrypted.
  18. Yes, you should always have server-side validation and I would highly recommend having your form work properly without AJAX before adding AJAX functionality.
  19. No, themes and templates are simply the part of the software that determines how the data will appear visually on your site. If you're good at it, you can build a drag and drop editor into your theme, it varies depending on which CMS you use. As an example, Wordpress has a lot of documentation on how to build themes for it and there's a lot of code involved. Not just HTML and CSS, but also PHP. https://codex.wordpress.org/Theme_Development
  20. There's no easy way to just add a CMS to your existing site. You have to build the front end again using the theme and template system provided by the CMS, so you'll be doing a lot of work either way. You may be able to keep some of your CSS, but the HTML will probably have to be created from scratch.
  21. You'd start off with multiple <input type="file"> elements, you'd have some PHP code which gets the files from the $_FILES array and saves them into specific directories. You would then have some code to write the paths of the saved files into the database along with any other information about the image. On other pages of your site, you would have some code that pulls image information from the database and prints <img> tags with the saved paths. Here are the tutorials you should read to accomplish these tasks. Form Handling File Uploading Database Tutorial (12 pages) All this assumes you know the basics: variables, loops, functions. If you don't know the basics, just read the whole PHP tutorial from start to end.
  22. First, you need to include the file of the class you're going to use. The second thing is that you have to have a leading backslash to indicate that Base is in the global scope. <?php namespace Base2; require_once 'path/to/Section.php'; class Base2 extends \Base\Section { // ... } I am not sure why you are both extending a class and then instantiating the same class inside the extended object. You either do one or the other, not both. In this case, just delete the test() method from Base2 because it already has this method inherited.
  23. It's correct to wrap property names in quotes in Javascript. JSON stands for "JavaScript Object Notation", after all. If the JSON is in a string as when returned by AJAX, you need to use JSON.parse() to read it, but if you can just have the JSON right in the code itself, you won't need to parse it.
  24. That's because HTML attribute values have to be surrounded by quotation marks.
  25. The reason is that the keys haven't changed. You should use a foreach() loop where possible to iterate through arrays. I rarely ever use a for loop. If you would like to reassign the indices after the call to array_unique(), you can use array_values(). Then you can use a classic for() loop. $unique_even_numbers = array_values(array_unique($even_numbers));
×
×
  • Create New...