Jump to content

falkencreative

Advanced Member
  • Posts

    4,419
  • Joined

  • Last visited

  • Days Won

    27

Posts posted by falkencreative

  1. At least for me, I think of it this way:

     

    -- I use <article> for a block of related text content, for content that is intended to be read together (for example, a blog post and the post title). I usually think of an RSS feed: would this content be something you would consider posting on an RSS feed? Does it stand on its own, without the need for additional context? I usually would use only one article tag per page, to specify what I consider to be the most important content on the page.

     

    -- I use <section> like I would use a <div> tag, but I think of it as a more specific div, something that indicates a grouping of related content. For example, I might have a banner section, or a main section (that might contain an article and a sidebar), etc. I use it to group chunks of related content and code, and I'll use divs within the section for less semantically important items.

     

     

    On your site, considering it's limited content, I would probably make #main, #me, #work and #contact <sections>. I'd make the #footer a <footer>. And unless you have a page that has a more significant amount of content, I wouldn't have any <article> tags at all.

  2. I suppose technically, it would be put in the libraries folder. But I wouldn't consider it a helper, since my undertstanding is that most helpers are there to add minor functionality within the views. In this case, you'd want to build out a template library that controls how/what views are displayed.

    • Upvote 1
  3. Not sure who you have been talking to... but "Front End Server Side" makes no sense to me. My understanding is that it's usually split between front end (often called "client side": HTML/CSS/JS) and backend (often called "server side": PHP/.NET/Ruby/etc.). PHP is definitely a backend language, since it's processed by the server on the "back end" before it gets displayed to the visitor.

  4. Are you following any specific tutorials? Or is this your own code?

     

    The first thing I notice is this section:

    if($_SESSION['cart'][$i]['id'] === $tmp_product['id'])
    {
    // adds to the already there qty: preincrement actually I think
    $_SESSION['cart'][$i]['qty'] += $tmp_product['qty']; 
    }

    I'm not sure how the use of $i there makes sense... you'll just end up with random numbers (from the for loop) with no specific meaning in your array. Are you sure that isn't supposed to be $id instead? Since that would make a lot more sense.

  5. Think of SASS/SCSS as a server-powered version of CSS. It gives you an alternate syntax to use, with stuff like includes, variables, etc to make CSS more powerful and easier to work with, then exports out to regular CSS.

     

    Here's the CSS version, though frankly it only adds style, not functionality, so you really don't need it.

    .accordion {
      margin: 50px;
    }
    .accordion dt, .accordion dd {
      padding: 10px;
      border: 1px solid black;
      border-bottom: 0;
    }
    .accordion dt:last-of-type, .accordion dd:last-of-type {
      border-bottom: 1px solid black;
    }
    .accordion dt a, .accordion dd a {
      display: block;
      color: black;
      font-weight: bold;
    }
    .accordion dd {
      border-top: 0;
      font-size: 12px;
    }
    .accordion dd:last-of-type {
      border-top: 1px solid white;
      position: relative;
      top: -1px;
    }
    
    a {
      text-decoration: none;
    }
    

    For the jQuery, that's Javascript, so you'd paste it inside of script tags with the usual jquery ready block, so it runs the code once the page has loaded (http://api.jquery.com/ready/). Make sure you are including jquery in the project, if you haven't already.

    <script>
    (function($) {
    
      var allPanels = $('.accordion > dd').hide();
    
      $('.accordion > dt > a').click(function() {
        allPanels.slideUp();
        $(this).parent().next().slideDown();
        return false;
      });
    
    })(jQuery);
    </script>
    

    You can view the source of the example here, in case that's helpful: view-source:http://s.codepen.io/css-tricks/fullpage/LufJE?

  6. Are you sure that list is the right way to format it? I'd likely suggest using a definition list, where clicking on the definition term reveals the description (which in your case, would include your interior list). You could also use the link below for the way you have things structured -- you just have to pick a different element to open instead of the next() item.

     

    This should be pretty straightforward and easy for us to work with? http://css-tricks.com/snippets/jquery/simple-jquery-accordion/

  7. Probably the easiest way to do it would be to use CSS to hide .fp_edit_type and .fp_edit_link (or whatever class your site uses, in case you have changed the "fp" prefix) when the page first loads. You could do this directly with CSS (ideally), or with a call on page load to 

     

    $('#edit_toggle').click();

     

    You'll also need to change the "Preview Page" link to be "Edit Page" when the page first loads.

  8. Jan,

     

    Probably the easiest way to handle that would be to add a new column in your database called "locked" or similar. It would contain either 1 (yes, the row is locked and cannot be changed), or 0 (no, the row isn't locked and is editable.) When you are creating your table and retrieving the data from the database, you use PHP to check the "locked" value, and choose to show or hide the editing controls based on that value.

     

    Hope that helps get you started?

  9. I'm moving cross country right now, so my time is unfortunately a bit limited. However, you might check out these two tutorials, which both show pagination:

     

    http://www.phpfreaks.com/tutorial/basic-pagination (simplest -- I'd look at this one first)

    http://www.killersites.com/community/index.php?/topic/3064-basic-php-system-view-edit-add-delete-records-with-mysqli/ (a little simpler, look at the "view-paginated.php" file)

    http://code.tutsplus.com/tutorials/how-to-paginate-data-with-php--net-2928 (a bit more complicated, with a pagination class)

     

    Basically, the key things you need to do:

     

    -- Do a query that gets the number of all products, and compare that against the number of products you want to show per page, to get the number of total paginated pages

    -- Instead of displaying all products, you want to retrieve specific products using LIMIT to determine where in the list of products you want to start from, and the number you need to retrieve

    -- You can set and retrieve which paginated page the visitor is on by using a $_GET variable in the URL

     

    Hope that gets you started?

  10. When I look through your code, it looks like the only reason you are getting this error is if this returns false:

    if($_FILES['image']['name'] != "")

    So the next step would be to figure out if the $_FILES array is completely empty, and if so, resolve the error. This is a pretty good overview of the essentials regarding what is necessary in order to upload a file: http://www.w3schools.com/php/php_file_upload.asp

     

    Are you sure you are using the proper 

    enctype="multipart/form-data"

    on your form? That is required to upload a file. Is your input for your file named correctly? For example, your input has to be named "image" in order for this to work properly.

  11. OK. So if the user's ID isn't created yet, that's going to be the first step. You'll need to:

     

    -- make sure that the user's information is completely valid

    -- make sure the user's image is a valid type/size (assuming that the registration form includes both the user's information and an image upload

    -- insert the user's information into the database

    -- with the info inserted, use http://php.net/manual/en/mysqli.insert-id.php to get the last used id (the student's id)

    -- upload the image

     

    Personally, my suggestion would be to keep the registration process as short and as simple as possible, and save any non-essential information, such as a profile photo, for a "Edit Account" or "Edit Profile" page once they have logged in. 

  12. This is the line that sets the final file name, which is currently the student id, and underscore, and the image name.

    if(move_uploaded_file($userfile_tmp_name, $archive_dir .'/'. $student_id .'_'. $imagename .'.'. $ext)){

    If you want to name the image just the student id, you would need to remove the 

    '_'. $imagename .

    portion. If the filename isn't being saved with the student id currently, you need to make sure that the $student_id value is set. Who is actually doing the uploading? The student themselves? An admin user? If it's the student themselves, do you set a session variable that holds their student ID when they log in? If so, you can set $student_id to the value of that session variable.

×
×
  • Create New...