Posts by Sociopathic Sunshine

This is an archived version of FeralFront. While you can surf through all the content that was ever created on FeralFront, no new content can be created.
If you'd like some free FeralFront memorabilia to look back on fondly, see this thread from Dynamo (if this message is still here, we still have memorabilia): https://feralfront.com/thread/2669184-free-feralfront-memorabilia/.


    No, it's fine! It's probably my fault for not looking first, haha! I'm a fast typer so I should have everything done quickly.


    EDIT: Speaking of which, I'm done XD


    Hey, I just checked it out. It looks like you answered the questions in there that I'm looking to have answered in the thread for all of us to enjoy. :P When you copy them over, can you do me a favor and explain them in your own words? I just want to know that you understand what they do. :P If you don't quite grasp what they are for, we can all work together to make sure you get it all figured out. :)


    In your Cloud 9 HTML file, I'm looking to see the HTML you'd use to create a page that looks the image I posted on page 2 (reply 15).


    Great start so far! Let me know if you have any other questions.


    ah, quick question--I've been out a lot today, this is my first chance to work o this. If we're using HTML, does that work in the PHP cloud nine project you asked us to open? And--I cannot see an attached image, I'm sorry. I think it's a glitch of Community Assistants that we can't see attached images but I'm not too sure.


    Try going to this link to see the image: http://feralfront.com/index.ph…798.0;attach=359802;image


    Yes, HTML will work just fanciful in your PHP project. Most of what PHP does is calculating/deciding things, which it then outputs to the user using HTML. Just a create a file and go to town. :)


    I'm not familiar with an element "<text>". Perhaps you meant to use a <p> tag?


    Don't be a afraid to throw new lines in your HTML to keep things clear. Ex) put your "ul" on its own line.


    It looks like you forgot to include some of your elements (<html>, and <head> for example). Take a look here for some information: http://www.w3schools.com/html/html5_intro.asp


    Heading tags (h1, h2, etc) should generally not be individual adjusted. Ex) The bold tag you're using for your h2. I can see where that may have come from, though, based on the image.


    You're off to a great start! Don't give up now. :)


    We don't need house the p tags yet. :)


    I made some formatting changes to your HTML. When looking at the changes, note the below.


      [li]Always indent things 1 tab at a time[/li]
      [li]Don't use spaces when indenting[/li]
      [li]Always make sure the closing tag of an element is on the same indentation level as the opening tag[/li]
      [li]Increase your indenting 1 level each time you open a tag[/li]
      [li]Decrease your indenting 1 level each time you close a tag[/li]


    Overall, it looks like you put all the information in this thread to good use. :P

    [fancypost borderwidth=0px; height: 283px; width: 167pt; border-top: 3pt solid #333333; border-bottom: 3pt solid #333333; border-left: 3pt solid #333333; background-image: url(http://i.imgur.com/TxR8T09.png); background-position: center;][fancypost borderwidth=0px; background-color: #DFE0C8; width: 170pt; font-family: georgia; font-size: 27px; text-align: center; padding: 5 10 5 10; line-height: 20px; margin-top: 10px; margin-left: -19px; margin-top: 225px; color: #000000; opacity: 0.6; letter-spacing: -1pt;]JAMES[/fancypost]

    [/fancypost]
    [fancypost borderwidth=0px; background: #2e2e2e; width: 195pt; height: 260px; margin-left: -4px;][fancypost borderwidth=0px; margin-left: -7pt; font-size: 8pt; width: 187pt; height: 240px; overflow: auto; color: #000000; text-align: justify; border-top: 3pt solid #383838; border-bottom: 3pt solid #383838;]I don't know how to fix that.
    [/fancypost][/fancypost]

    [fancypost borderwidth=0px; background: #242424; width: 40px; color: #dbd2bc; font-family: arial; font-size: 7pt; text-align: center; margin-left: -4px;]NOLL[/fancypost] [fancypost borderwidth=0px; background: #242424; width: 40px; color: #dbd2bc; font-family: arial; font-size: 7pt; text-align: center; margin-left: -2px; margin-left: -1px;]KS[/fancypost] [fancypost borderwidth=0px; background: #242424; width: 40px; color: #dbd2bc; font-family: arial; font-size: 7pt; text-align: center; margin-left: -2px; margin-left: -1px;]15 YRS[/fancypost] [fancypost borderwidth=0px; background: #242424; width: 40px; color: #dbd2bc; font-family: arial; font-size: 7pt; text-align: center; margin-left: -2px; margin-left: -1px;]MALE[/fancypost]


    I've requested access, you should have a notice somewhere, perhaps in an email. :)

    Assignment 2:


    The amount of wasted space was probably one of the first things you noticed about our first HTML example. In our second go-round we're going to learn how to fix, or at least improve, this situation, at least a little.


    For this next assignment we're going to learn about the "div" and "span" elements, and how we use them to apply CSS styling.


    The magic of the web normally depends on "styling", which is CSS (Cascading Style Sheets). Normally, you want to apply styling to a single element, or a group of elements. When styling elements you have 2 primary option for specifying the area or section you want to apply styles to.


    The first choice is the "<div>" tag. Generally you use divs for layout, to put a group of elements in a specific position. For example, you'd use divs (and a bit of styling) to create multiple columns on an HTML page. Divs are "block" level elements, meaning that, unless you do special styling, a div and it's content will take up the full width of the page. Anything after a div (including other divs) will drop down to the next "row" of the page.


    The second choice is the "<span>" tag. Generally you use spans to apply styling to a specific item or piece of text. For example, you could use a span tag to make a specific word in a sentence red, in order to draw attention to that word.


    Spans are also useful for applying bolding, italics, and underlines to text. Generally speaking, you want to avoid using "<b>", "<i>", and "<u>" tags, and instead use a span to style your text as bold, italic, or underline. This is so you can easily update what "bold" means on your site, without modifying the browsers basic understanding of CSS styling.


    The other pieces of information you need to be aware of to properly apply styling to your elements are the "id" and "class" attributes -- an attribute is simply a particular piece of information that you attach to an element. For example, to create a div with the id of "left_column" and the class of "column", you'd use <div id="left_column" class="column"></div>.


    Just like divs and spans, ids and classes both have a specific purpose. An id ("left_column" in our example above) can only appear on the page once. It is used to specifically identify an element. When using an id, you should use it on something you intend to have only one of on the page (such as our "left_column" above).


    Classes ("column" in our example above), on the other hand, are used when you plan to have many things you want to apply the same styling to. For example, you'd use a class named "bold" to apply bolding to every piece of text that should be bolded. In this particular example you'd use a span, as you want to apply styling to a very specific thing.


    In order to apply styling using ids and classes, we'll load in a separate stylesheet file and define some styling for ids and classes. I have an example of how to load in a separate stylesheet in a below image, and an example of how to define styles for ids and classes directly below.


    We apply styles to ids by putting a # and then the id of the element . Ex)
    #left_column{
    property: value;
    }


    We apply styles to classes by putting a . and then the class of the element. Ex)
    .column{
    property: value;
    }


    In the above cases, note that you'll replace property with a valid CSS property and replace value with a valid value for the given property


    As a note, you can also apply styling directly to an element using the "style" attribute. I won't go much into how this works, except to state that you should not do this. It is very rarely the best way to accomplish a given task.


    For this assignment, we're going to update our HTML from assignment 1 to have 2 columns. All of our current content will be placed in the left column, and we'll add an image to the right column.


    Instructions:


      [li]Use a "link" element to load in a stylesheet (using the images below as guidance)[/li]
      [li]Create 2 divs, the 1st with an id of "left_column" and the 2nd with an id of "right_column"[/li]
      [li]Give both divs a class of "column"[/li]
      [li]Put all of our current content into the "left_column" div[/li]
      [li]Find an image you like and use a "img" element to put it into the "right_column"[/li]
      [li]Apply a class attribute to your image and then apply "width: 100%;" to that class in our stylesheet[/li]
      [li]Apply "float: left" to the "column" class (again, in our stylesheet)
      [/li][li]Apply "width: 50%" to the "column" class (again, in our stylesheet)[/li]
      [li]Use Google liberally when you aren't sure of something, it's a programmers best friend[/li]


    When naming your ids and classes, always make them descriptive. For example, for the class that will apply the style of "width: 100%", you might name the class "width_100".


    This is a lot of new information (which I wrote in a bit of a rush), feel free to ask questions in this thread so we can help each other out.


    images:
    Creating a special folder for your stylesheets: http://i364.photobucket.com/al…%20at%2010.49.29%20AM.png


    Adding a stylesheet in the head: http://i364.photobucket.com/al…%20at%2010.52.00%20AM.png


    Example of what you should see when done:
    http://i364.photobucket.com/al…%20at%2010.52.18%20AM.png

    When it comes to CSS classes, remember that they can't actually have spaces. Ex) class="class name here" would give the element 3 separate classes ("class", "name", and "here").


    In the example above, we could make it a single class name by adding hyphens (-) or underscores (_). Ex) class="class-name-here" or class="class_name_here".


    Thanks for helping out Frost!


    I'm at a conference at present so I don't have the proper time to explain the issues I saw. However, please look at the changes I made (anywhere you see purple on the left side).


    The main issue was was that your css file was named "base css" instead of "base.css" (also note the change I made to the CSS link tag) :)

    [fancypost borderwidth=0px; height: 283px; width: 167pt; border-top: 3pt solid #333333; border-bottom: 3pt solid #333333; border-left: 3pt solid #333333; background-image: url(http://i.imgur.com/TxR8T09.png); background-position: center;][fancypost borderwidth=0px; background-color: #DFE0C8; width: 170pt; font-family: georgia; font-size: 27px; text-align: center; padding: 5 10 5 10; line-height: 20px; margin-top: 10px; margin-left: -19px; margin-top: 225px; color: #000000; opacity: 0.6; letter-spacing: -1pt;]JAMES[/fancypost]

    [/fancypost]
    [fancypost borderwidth=0px; background: #2e2e2e; width: 195pt; height: 260px; margin-left: -4px;][fancypost borderwidth=0px; margin-left: -7pt; font-size: 8pt; width: 187pt; height: 240px; overflow: auto; color: #000000; text-align: justify; border-top: 3pt solid #383838; border-bottom: 3pt solid #383838;]I've started just try to work through it still.
    [/fancypost][/fancypost]

    [fancypost borderwidth=0px; background: #242424; width: 40px; color: #dbd2bc; font-family: arial; font-size: 7pt; text-align: center; margin-left: -4px;]NOLL[/fancypost] [fancypost borderwidth=0px; background: #242424; width: 40px; color: #dbd2bc; font-family: arial; font-size: 7pt; text-align: center; margin-left: -2px; margin-left: -1px;]KS[/fancypost] [fancypost borderwidth=0px; background: #242424; width: 40px; color: #dbd2bc; font-family: arial; font-size: 7pt; text-align: center; margin-left: -2px; margin-left: -1px;]15 YRS[/fancypost] [fancypost borderwidth=0px; background: #242424; width: 40px; color: #dbd2bc; font-family: arial; font-size: 7pt; text-align: center; margin-left: -2px; margin-left: -1px;]MALE[/fancypost]


    If anything trips you up for more than 10-15 minutes, let us know and we'll help you out. :)

    I'm going to be creating a new assignment in a little bit. For those who haven't finished the present one (or are starting new) please continue asking questions. If you're embarrassed to ask questions in this thread (you really, really shouldn't be, we all started at the beginning) you can PM me.


    I'd also like you to read through and understand (at least on some level) this link. It explains how CSS precedence works, which is a very important part of CSS. You likely aren't going to understand it all at first, but it's a link you can come back to over time. http://vanseodesign.com/css/cs…ity-inheritance-cascaade/

    We're moving along at a decent pace here, as I know all of you guys want to start actually "programming". As always, bring any questions to the thread and we'll get them taken care of right-quick.


    For our next assignment (which will simply build off of our previous assignment) we're going to modify our web page to show a random picture from a list of images. When our page loads, instead of loading the same image every time, it'll choose a random image from a list we give it, and load that.


    A heads up, we're learning quite a few concepts here, and I'm intentionally trying to give you only as much information as you absolutely need to stumble through the assignment. I fully expect that you guys will have questions.


    We need to know a few things before we can accomplish our goal:
    [list type=decimal]
    [li]How to tell the server that we're going to do some PHP[/li]
    [li]How to store a "list" of image urls[/li]
    [li]How to get a random image url from our "list"[/li]
    [li]How to use our random image url in our HTML[/li]
    [/list]


    1) How to tell the server we're going to do some PHP
    This is a pretty easy part. We tell the server what's PHP and what isn't by wrapping our PHP in "php tags". This information can be found in the PHP documentation, which is very good, and very complete. For example, this is the documentation for PHP tags: http://php.net/manual/en/language.basic-syntax.phptags.php


    The take-away from the link is that we declare when we start using PHP by putting "<?php" in our HTML document. We then declare when we stop using PHP by putting "?>" in our HTML document. Something to remember: You only want to add "?>" when it wouldn't be the last line of your file. The reasoning for this isn't important yet, but it'll likely save you some headache down the line.


    2) How to store a list of image urls
    The best way to store a list in PHP is using an "array". An array is a structure used in programming that can hold a "list" of information. Arrays get a lot more complex, but this is really all we need know about them for now.


    Arrays are assigned to a "variable", and then accessed via that variable. The following link does a good job of explaining what variables are and how to use them (please read it before continuing): http://www.w3schools.com/php/php_variables.asp After you've read what variables are, you'll want to read about what arrays are and how to use those (please read it before continuing): http://www.w3schools.com/php/php_arrays.asp Once you have read through this information, use what you've learned to create an array of urls to some of your favorite images (I'd suggest 5-10 image urls).


    3) How to get a random image url from our "list"
    It's at this point that we'll have to use our first PHP functions! First we need to put our thinking hats on to figure out how we'd do this. To teach us a little about how to think like programmers, we'll think of our array as a deck of cards.


    In real life, when we want to choose a "random" card from a deck, we'll spread out the cards in our hands and then pick one. What are we really doing here? We're using our eyes to gather information (how many cards their are), and then we choose a random card from all those available. Unfortunately, PHP doesn't have eyes, so we need to be PHP's eyes in this case.


    So, what information is it that we gather using our eyes? We look down at the cards and we determine how many cards their are to choose from. In order to choose a random card from the deck, we need to know how big the deck is. This is the same for PHP when you want to pick a random item, called an element in a PHP array, from a list, called an array in PHP. In PHP we use functions to perform "actions". The action might be "find out how big that deck of cards is" or it might be "calculate this number cubed".


    Now, PHP is also very exacting. While you and I may be okay with knowing "Yeah, we have, like 35 cards or something", PHP isn't cool with that. PHP needs to know exactly how many cards are in the deck. What do you do when you want to know exactly how many of something their are? You count them!


    So, before we can randomly choose an element from our array, we need to know how big our array is, we need count the elements in our array. PHP has a function to do just that! The documentation for that function can be found here: http://php.net/manual/en/function.count.php


    The documentation at php.net can be a little overwhelming, and the description at the top can be vague if you don't know what's going on. In these cases, it's generally easiest to just to scroll down a little bit to the "examples".


    Like I described above, functions accomplish tasks, they tell PHP to perform some action. In the case of count, we're telling PHP to perform the action of counting all the elements in an array. What does PHP need in order to count all the elements in an array? The array, of course!


    In order for a function to do anything, we generally need to give that function some information. We do this by passing in information. When you pass information into a function, each piece of information is called a parameter.


    When we call the count function, we need to pass it 1 parameter, the array we want to count the elements in. You can see examples of this in the php.net documentation I posted above.


    Okay, so when choosing a random card, what action do we need to perform after we know how many cards their are? We need to choose one at random. How do we choose a random number in PHP? We use the rand function! The documentation can be found here: http://php.net/manual/en/function.rand.php The rand function can be called in a couple of different ways, but the way we're going to call it involves giving it 2 parameters (2 pieces of information) and telling it to give us a random integer (integer meaning we want a whole number, as opposed to a decimal number) between a minimum and a maximum.


    The first parameter we need to pass into the function is the minimum integer we'd be willing to get back. Conventional wisdom would tell us that the smallest number of something we could have is 1, but that conventional wisdom doesn't serve us well here. In PHP, arrays start at 0. That means the first element of the array will be accessed by asking php for the 0th element of an array. If this sounds confusing, just know that, when working with PHP arrays, you'll start counting from 0, instead of from 1.


    So, we now know that we want a random integer, where the smallest possible integer we get back is 0. What else do we need to know to call our rand function? The maximum integer we'd be willing to get back. The maximum integer should refer to the last element in our array of image urls. Conventional wisdom might say that the last element in the PHP array would be equal to the number of elements in that array. Unfortunately, that conventional wisdom is, once again, incorrect when we're thinking about PHP arrays. Since our PHP array starts at 0, the last element is actually 1 less than the number of elements in our array. So, the maximum integer we'll want returned by rand is the number of elements in our array - 1.


    Once we have our min and our max, we can call rand and get a random integer between 0 and the length of array (the number of elements in the array) - 1. We can then use this random integer turned by rand to access an element of the array and use it when building our html img tag. Information on how to concatonate strings can be found in the PHP documentation here: http://php.net/manual/en/language.operators.string.php Then, after we concatenate the string, we'll nee dot "echo" the string out, meaning we'll tell PHP to use the string in our html. Information on echo can be found here: http://php.net/manual/en/function.echo.php


    After we've done all these things, we've essentially told PHP the following: When I load the page, take a random url from my list of urls and use it to create some html.


    Now, I'm going to be blunt. I expect everyone in this thread to fail super-duper-ridiculously-hard on this assignment. I not only expect that you'll ask questions, I'm going to demand it. If you struggle for more than 5 minutes with any specific part, come back and ask a question. I want you guys to succeed, but I also want to keep this thread moving along at a good pace.


    When moving at the pace we're moving, failing is completely unavoidable. However, I'm not going to leave you face down in the mud. I'm going to come back, pick you up, dust you off, and get you moving again after showing you what you tripped over. However, like PHP, I don't have eyes to see where or when you're having trouble, I need you to tell me.