Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Jan 2013
    Posts
    3
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Can't find the code on a "view source" on the index.php

    Hello - I am new to the forum and also PHP - I was on www.w3schools.com - learning the basics. My issue is when I do a "view source" of an index.php page in a browser I am able to see all the coding on that page (html and css), and also see where I need to modify some text. When I download this page "index.php" from the server - it is not what I am seeing in the "view source" - it is strictly a "<?php...?> with only PHP code on the page. I searched the forum to try to find the answer, but kind of hard to work the problem, so nothing really came up. Thanks for any help for this PHP newbie. Thank you for any help.

    Thanks - Eric

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    Yep, that's normal behaviour.
    PHP code is pre-processed on the server, and the results are sent to the client. The client then interprets it. Typically, this is used in a web environment, so PHP generates the dynamic content and sends the results in HTML:
    PHP Code:
    <?php

    if (date("a") == "pm")
    {
        
    $sPartOfDay "evening";
    }
    else
    {
        
    $sPartOfDay "morning";
    }

    printf('<p>good %s</p>'$sPartOfDay);
    ?>
    Would be the PHP code, and what the browser sees is:
    Code:
    <p>good afternoon</p>
    or good morning if its 'am'. So what you see in the browser is only what is printed or echo'd to the browser, or anything outside of <?php and ?> tags.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 
    Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)

  • Users who have thanked Fou-Lu for this post:

    flashawd (01-31-2013)

  • #3
    New to the CF scene
    Join Date
    Jan 2013
    Posts
    3
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Thank you very much for your quick reply. Great explanation, that was kind of my understanding when I was on w3schools.com. In this case is it calling on another file - that I need to look at? (see below) I basically just need to change the copyright date and phone numbers on the front of the site. ;-) This is what is on the index.php that I am working with. Thanks again, pretty interesting stuff - will be fun to really get into it.

    <?php
    // SESSION START/CONTINUE
    @ session_start();

    // SECURITY/CONFIG
    define('IN_MAIN',true);
    $path_site = './';
    $page = 'index';

    // INCLUDES
    require_once($path_site.'inc/database.php');
    require_once($path_site.'inc/constants.php');
    require_once($path_site.'inc/common.php');

    // LOGIC \\
    if(isset($_SESSION['user']['id'])) { redirect($path_site.'networks.php'); exit(); }

    $CONTENT = replace_output( file_get_contents(PATH_CB.'home'.EXT_CB), array(
    'path_site'=>$path_site
    ));

    // OUTPUT \\
    $OUTPUT = replace_output( file_get_contents(PATH_TPL.'main'.EXT_TPL), array(
    'path_site'=>$path_site,
    'sbu'=>SITE_BASEURL,
    'meta_kw'=>SITE_KEYWORDS,
    'meta_desc'=>SITE_DESC,
    'meta_title'=>SITE_TITLE,
    'nav_list'=>get_nav_list(),
    'content'=>$CONTENT
    ));
    print($OUTPUT);

    ?>

  • #4
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    Yep, this is using a framework of some type.
    Check in the constants.php and common.php files for settings. There may be a config file elsewhere for it as well.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 
    Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)

  • Users who have thanked Fou-Lu for this post:

    flashawd (01-31-2013)

  • #5
    New to the CF scene
    Join Date
    Jan 2013
    Posts
    3
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Thank you, I really appreciate you taking the time to help. Talk soon - Eric


  •  

    Posting Permissions

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