Results 1 to 25 of 26

Thread: PHP - URL

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Banned
    Join Date: Jan:2009
    Location: -
    Posts: 126

    PHP - URL

    PHP URL index.php index.php?page=aboutus index.php?aboutus

  2. #2
    Registered User tedych's Avatar
    Join Date: Nov:2003
    Location:
    Posts: 17,654
    . " ".

    , URL Rewriting ( mod_rewrite ), , , .

    ?page=aboutus
    $_GET['page'];

  3. #3
    Banned
    Join Date: Jan:2009
    Location: -
    Posts: 126
    index.php index.php?ne6tosi PHP (html css jacascript)

    ---------- 22:17 ---------- 22:03 ----------

    Quote Originally Posted by tedych View Post
    . " ".

    , URL Rewriting ( mod_rewrite ), , , .

    ?page=aboutus
    $_GET['page'];
    index.php ?page=aboutus

    $_GET['page'];

  4. #4
    Registered User tedych's Avatar
    Join Date: Nov:2003
    Location:
    Posts: 17,654
    , .. - .
    - (index.php ):

    <?php
    $page = '';
    if (isset($_GET['page'])) $page = $_GET['page'];
    if (!$page) {
    ?>

    , . , .. .

    <?php
    }

    if ($page == 'aboutus') {
    ?>

    -, index.php?page=aboutus

    <?php
    }
    ?>

    ..

    page=XXXX, ( page).
    - :

    <?php
    $page = '';
    if (isset($_GET['page'])) $page = $_GET['page'];

    if (!$page) include 'index.html';

    if ($page == 'aboutus') include 'aboutus.html';

    if ($page == 'products') include 'products.html';

    ?>

    ..
    , else-, , 2-3-4 -, switch, . else - .

  5. #5
    mKrotiFy's Avatar
    Join Date: Oct:2010
    Location: , 💪
    Posts: 1,062
    - . - .
    PHP Code:
    <?php
    $page 
    $_GET['page'];
    switch (
    $page){
        default: 
            echo 
    "kakvo da se pokazva, kogato promenlivata page e prazna..";
        break;
        
        case 
    "aboutus":
            echo 
    "about us";
        break;
        
        case 
    "another_page":
            echo 
    "nqkva druga stranica";
        break;
    }
    echo include- , , -.

  6. #6
    Registered User
    Join Date: Jul:2006
    Location:
    Posts: 1,071
    ?
    PHP Code:
    $page = isset($_GET['page']) ? $_GET['page'] : ''
    Tedych, .

  7. #7
    Registered User tedych's Avatar
    Join Date: Nov:2003
    Location:
    Posts: 17,654
    mKrotiFy, , (). - break-.
    else- , , .

    mialy, . , , 2 , .
    .. . .

  8. #8
    Registered User
    Join Date: Jul:2005
    Location: Sofiq
    Posts: 2,798
    if , switch ... case .

  9. #9
    Registered User tedych's Avatar
    Join Date: Nov:2003
    Location:
    Posts: 17,654
    switch .
    , if - .
    if (....) {
    -->operator;
    }



    switch (...) {
    -->case 123:
    -->-->operator;
    -->-->operator;
    -->break;

    --case ....
    }

    . , 1-2-3 - .

  10. #10
    Registered User
    Join Date: Jul:2006
    Location:
    Posts: 1,071
    :
    PHP Code:
    switch($neshto) {
    case 
    'blabla':
        
    code...;
        
    code...;
        break;

    case 
    'blabla2':
        
    code...;

    default: 
    //    ,    

    Coding Styles Linux . , switch-a case- . , case 'opa': { ...; break }. C ( ISO 99), .

    , , , ... PHP , IF, ==, === ()! , =

  11. #11
    Registered User tedych's Avatar
    Join Date: Nov:2003
    Location:
    Posts: 17,654
    , 2 3 "" ( ) PHP, .
    , , .
    , , $str == '0', empty($str), .
    ..
    foreach , , .

  12. #12
    Registered User
    Join Date: Jul:2005
    Location: Sofiq
    Posts: 2,798
    php foreach, - n .
    Code:
    $a = false OR true;var_dump($a); -> false
    , . OR, AND, XOR.

  13. #13
    hmm BornToDrink's Avatar
    Join Date: Aug:2005
    Location: .
    Posts: 11,573
    foreach- , ?
    Hey, mother, I come bearing a gift. I'll give you a hint. It's in my diaper and it's not a toaster.
    .

  14. #14
    Registered User
    Join Date: Jul:2005
    Location: Sofiq
    Posts: 2,798
    foreach .
    Code:
    foreach($arr as $val) print $val; -> $val    .
    ,
    Code:
    foreach($arr as $value)
    . , . , .

  15. #15
    Registered User tedych's Avatar
    Join Date: Nov:2003
    Location:
    Posts: 17,654
    , , , $val foreach, ..

    , ( ).
    foreach ($arr as $index=>$value)
    '0', '1', .. , $index .
    ( ), , .
    , , .
    .

  16. #16
    hmm BornToDrink's Avatar
    Join Date: Aug:2005
    Location: .
    Posts: 11,573
    , , $val, .
    JS , - - .

    WTF is this:
    Code:
    function test (param)
    {
        //       (   )       : :D
        if (param == null)
            param = 0;
    }
    
    test();
    Hey, mother, I come bearing a gift. I'll give you a hint. It's in my diaper and it's not a toaster.
    .

  17. #17
    Registered User
    Join Date: Jul:2005
    Location: Sofiq
    Posts: 2,798
    Quote Originally Posted by BornToDrink View Post
    , , $val, .
    JS , - - .

    WTF is this:
    Code:
    function test (param)
    {
        //       (   )       : :D
        if (param == null)
            param = 0;
    }
    
    test();

    JS ? , IE4 param e name space.

    JS, . .

  18. #18
    Mire-x
    Join Date: Apr:2005
    Location: Sofia
    Posts: 763
    Quote Originally Posted by _ShadoW_ View Post
    JS ? , IE4 param e name space.

    JS, . .
    . - Firefox 3.6.15, Opera 11.01 IE 7.0 . , , typeof(param) == 'undefined', param == null ( , , param !== null - undefined, - object). .. (undefined == object !?), " ". param , 'undefined'. : test(); var param; ( param, ), test('abc'); var param = 'abc';.

    JS? .
    (10b) || !(10b)

  19. #19
    Registered User
    Join Date: Jul:2005
    Location: Sofiq
    Posts: 2,798
    , .
    Code:
    function test (param) {
        if (param == null)
            param = 0;
    }
    
    test();
    console.log(param); -> ReferenceError: param is not defined
    Code:
    var param;
    function test (param) {
        if (param == null)
            param = 0;
    }
    
    test();
    console.log(param); -> undefined

    :
    Code:
    function test (param) {
    	try {
    		eval('('+param+')');
    	} catch(e) {
    		eval('(var '+param+' = 0)');
    	}
    }
    
    test('alabala');
    console.log(alabala); -> 0

  20. #20
    hmm BornToDrink's Avatar
    Join Date: Aug:2005
    Location: .
    Posts: 11,573
    Quote Originally Posted by _ShadoW_ View Post
    , .
    Code:
    function test (param) {
        if (param == null)
            param = 0;
    }
    
    test();
    console.log(param); -> ReferenceError: param is not defined
    To , param {}
    :
    Code:
    function test (param) {
    
    console.log(param);
        if (param == null)
            param = 0;
    		
    console.log(param);
    }
    
    test();
    , , ( C, PHP...), .. , , - "".

    A , :

    Code:
    var SomeVar = {
        testvar: 5,
        testvar2: 8,
    
        someMethod: function (param) {
            return (param + SomeVar.testvar2);
        }
        //, ....
    }
    
    alert(SomeVar.someMethod(5));
    Hey, mother, I come bearing a gift. I'll give you a hint. It's in my diaper and it's not a toaster.
    .

  21. #21
    Mire-x
    Join Date: Apr:2005
    Location: Sofia
    Posts: 763
    , :
    Code:
    function test(param)
    {
       document.write('typeof(param): ' + typeof(param) + '<br />');
       document.write('typeof(null): ' + typeof(null) + '<br />');
       document.write('(param == null): ' + (param == null).toString() + '<br />');
       document.write('(param === null): ' + (param === null).toString() + '<hr />');
       if (param == null) param = 0;
       document.write('param: ' + param + '<hr />');
    }
    
    test();
    Quote Originally Posted by Firefox 3.6.15, Opera 11.01, IE 7.0
    typeof(param): undefined
    typeof(null): object
    (param == null): true
    (param === null): false
    param: 0
    (10b) || !(10b)

  22. #22
    Registered User
    Join Date: Jul:2005
    Location: Sofiq
    Posts: 2,798
    Quote Originally Posted by Tarvin View Post
    , :
    Code:
    function test(param)
    {
       document.write('typeof(param): ' + typeof(param) + '<br />');
       document.write('typeof(null): ' + typeof(null) + '<br />');
       document.write('(param == null): ' + (param == null).toString() + '<br />');
       document.write('(param === null): ' + (param === null).toString() + '<hr />');
       if (param == null) param = 0;
       document.write('param: ' + param + '<hr />');
    }
    
    test();
    , , . , , , . , eval window. - .

    :
    Code:
    function Test(param) {
    	!param && (param = 0);
    	console.log(param);
    }
    
    Test(); -> 0
    Test(1); -> 1

  23. #23
    hmm BornToDrink's Avatar
    Join Date: Aug:2005
    Location: .
    Posts: 11,573
    , :
    Code:
    function test (param) {
    	document.write(param+'<br>');
    }
    test(47944811969396736); //47944811969396740
    test('47944811969396736'); //47944811969396736
    , , .
    Hey, mother, I come bearing a gift. I'll give you a hint. It's in my diaper and it's not a toaster.
    .

  24. #24
    Registered User
    Join Date: Jul:2005
    Location: Sofiq
    Posts: 2,798
    . 34654576346756745764567457645764 3.4654576346756744e+31 -

  25. #25
    ! vbTheKing's Avatar
    Join Date: Sep:2003
    Location:
    Posts: 4,138
    JS Integer 2^53, - integer, float. - .

    EDIT:>>
    - :
    http://blog.vjeux.com/2010/javascrip...er-limits.html

    EDIT.2:>>
    test(), , string, .
    ''? * *
    - !
    ...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Copyright © 1999-2011 . .
iskamPC.com | mobility.BG | Bloody's Techblog | | 3D Vision Blog |