Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-30-2013, 08:33 PM   PM User | #1
flashawd
New to the CF scene

 
Join Date: Jan 2013
Posts: 3
Thanks: 2
Thanked 0 Times in 0 Posts
flashawd is an unknown quantity at this point
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
flashawd is offline   Reply With Quote
Old 01-30-2013, 08:58 PM   PM User | #2
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,635
Thanks: 4
Thanked 2,448 Times in 2,417 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
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.
__________________
As of PHP 5.5, the MySQL library has been officially deprecated. It is recommended to move to either MySQLi or PDO libraries for your mysql connectivity. See here for help choosing which interface you prefer: http://php.net/manual/en/mysqlinfo.api.choosing.php
Fou-Lu is offline   Reply With Quote
Users who have thanked Fou-Lu for this post:
flashawd (01-31-2013)
Old 01-30-2013, 11:03 PM   PM User | #3
flashawd
New to the CF scene

 
Join Date: Jan 2013
Posts: 3
Thanks: 2
Thanked 0 Times in 0 Posts
flashawd is an unknown quantity at this point
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);

?>
flashawd is offline   Reply With Quote
Old 01-30-2013, 11:19 PM   PM User | #4
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,635
Thanks: 4
Thanked 2,448 Times in 2,417 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
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.
__________________
As of PHP 5.5, the MySQL library has been officially deprecated. It is recommended to move to either MySQLi or PDO libraries for your mysql connectivity. See here for help choosing which interface you prefer: http://php.net/manual/en/mysqlinfo.api.choosing.php
Fou-Lu is offline   Reply With Quote
Users who have thanked Fou-Lu for this post:
flashawd (01-31-2013)
Old 01-30-2013, 11:26 PM   PM User | #5
flashawd
New to the CF scene

 
Join Date: Jan 2013
Posts: 3
Thanks: 2
Thanked 0 Times in 0 Posts
flashawd is an unknown quantity at this point
Thank you, I really appreciate you taking the time to help. Talk soon - Eric
flashawd is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:59 AM.


Advertisement
Log in to turn off these ads.