Jump to content

terryds

Members
  • Posts

    174
  • Joined

  • Last visited

Posts posted by terryds

  1. Look at this one first

     

    <tag1>
    <tag2><label>Name:<input type="text" name="name" id="name"></label></tag2>
    <tag2><label>Email:<input type="email" name="email" id="email"></label></tag2>
    <tag2><label>Telephone:<input type="tel" name="tel" id="tel"></label></tag2>
    <tag2><label>Comment<br><textarea rows="4" cols="60" maxlength="300" name="comment" placeholder="No more than 300 characters long"></textarea></label></tag2>
    </tag1>
    Could you please tell me what tag should i use ? I'm thinking of ul,ol,p,div,dl .. But, i don't know which one to choose...
  2. Why should we use

     

    <!--[if !IE]><!-->

    <style> /* table-related media query stuff only */ </style>

    /* Or an external stylesheet or whatever */

    <!--<![endif]-->

    instead of

    <!--[if !IE]>

    <style> /* table-related media query stuff only */ </style>

    /* Or an external stylesheet or whatever */

    <![endif]-->

    ?

  3. I see that if we want to use html5shiv, we should use :

     

    <!--[if lt IE 9]><script src="dist/html5shiv.js"></script><![endif]-->

     

    And, i see this snippet on http://css-tricks.com/responsive-data-tables/ :

     

    <!--[if !IE]><!-->

    <style> /* table-related media query stuff only */ </style>

    /* Or an external stylesheet or whatever */

    <!--<![endif]-->

     

    I see the conditional 'if' statement appears in a square bracket in the html comment...

     

    My questions are

     

    1. Is it actually HTML comment ? I am doubt about it because HTML comment tag should be <!-- comment -->...

    2. Will the conditional statement be understood by the browser though it is in the HTML comment ?

    3. The second of my example (responsive data table snippet) has a complicated HTML comment...

    I don't understand what that means...

    <!--[if !IE]><!-->

    <!--<![endif]-->

    4. Is there any site that gives a tutorial for this case ? I wonder if there are more statements that can be put in HTML comment...
    Thanks for any answers....
  4. I see a tutorial about designing a website using html5 and css3 at http://www.pvmgarage.com/2010/04/touch-the-future-create-an-elegant-website-with-hmtl-5-and-css3/

     

    Then i see the demo at http://www.pvmgarage.com/downloads/portfolio/

     

    But, the screenshot of the template in the tutorial isnt the same as the demo....

     

    The demo template is so scrambled...

     

    And, i see the comment in the HTML code.. It says that it is useful to create 960px limit.

     

    Can you tell me how to make it?

  5. Actually, i want to make an upload loading page.. So, i want the notice like 'Please wait, your file is being sent to the server', then after the upload finishes loading, it will say 'Your file has been uploaded'.. Can you tell me how to make it ? It uses output buffering,right?

  6. Here is my code

    <?php ob_start();?><!DOCTYPE html><html><head><title>Output Buffering</title></head><body><p>I'm the first to load</p><?php ob_flush();sleep(2) ?><p>I'm the second to load after 2s</p><?php ob_end_flush();sleep(2); ?></body></html>
    When i load the page, the two paragraph loads at the same time...
    What i want is that the first paragraph come first, and right after 2 secs, the second paragraph appears..
    Can you tell me how to fix that?
  7. What if i use interface?

     

     

    <?phpinterface Pet{protected function happy();protected function angry();protected function isSpoiled();}

     

    And then, i implement the dog class and the cat class....

    So, what's the difference between interface and abstract class ?

  8. What's the difference between

     

    function &return_fish() {
    $fish = "Fish";
    return $fish;
    }
    $fish_ref =&return_fish();
    And
    function return_fish() {
    $fish = "Fish";
    return $fish;
    }
    $fish_ref = return_fish();
    I see that the first one is returning by reference...
    But, i don't understand what 'returning by refence' means... I'm sorry i'm not so good at English
    Can you give me an example to show that they are different ?

     

  9. I'm thinking of measuring the character length using strlen(), and, if it's more than 300 characters, cut the string using substr(), then, add a link that will set $_GET['more'], and when the $_GET['more'] is set, it will return the string ...

  10. Umm... But, the code didn't work as what i want, it gives me 'aaaa' not as what i want :

     

    <?php
    class MyPDOException extends Exception {
    public function __construct($msg, $code=0) {
    parent::__construct($msg, $code);
    }
    public function __toString() {
    return __CLASS__ . ": [{$this->code}]: {$this->message}";
    }
    }
    try {
    throw new MyPDOException('aaaa',2013);
    }
    catch (MyPDOException $e) {
    echo $e->getMessage();
    }
    Can you tell me how to make it work so i can throw MyPDOException : [2013] : aaaa ?
  11. How to make a custom exception class ?

     

    <?php
    class MyPDOException extends Exception {
    public function __construct($msg, $code=NULL) {
    $err = $msg;
    if (isset($code)) {
    $err .= " Error code: " . $code;
    }
    return $err;
    }
    try {
    throw new MyPDOException('aaaa');
    }
    catch (MyPDOException $e) {
    echo $e->getMessage();
    }
    But, when the script is execute, it gives me a blank page, not 'aaaa' .... Can you tell me how to make custom exceptions so it can work properly?
  12. That's the same result ! i've tested it !

     

    Yay ! I get the deal!

     

    The PDO::FETCH_BOTH sets the pdo fetch method... so when we fetch the queried sql, it will use PDO::FETCH_BOTH

  13. I found this in someone's code

     

    $query = $this->db->query($string, PDO::FETCH_BOTH);

     

     

    The query statement there is using PDO::FETCH_BOTH...

     

    What i know that we use PDO::FETCH_BOTH in fetch statement only....

     

    Can you tell me the use of it?

     

    Does it fetch the queried string directly ?

     

    But, i do a test, then i see nothing's special

     

    try {
    $sql = 'SELECT * from author WHERE 1';
    $s = $pdo->query($sql, PDO::FETCH_BOTH);
    }
    catch (PDOException $e) {
    echo "Error";
    exit();
    }
    var_dump($s);
    It shows up like this :
    object(PDOStatement)[3]public 'queryString' => string 'SELECT * from author WHERE 1' (length=28)
    So, what's the deal of using PDO::FETCH_BOTH in a query statement ?
×
×
  • Create New...