Shows the Script text only

images php coding issues or problems here.

Moderators: macek, egami, gesf

gracemesa
New php-forum User
New php-forum User
Posts: 4
Joined: Thu Mar 10, 2011 10:23 am

Shows the Script text only

Postby gracemesa » Thu Mar 10, 2011 10:37 am

I am using Microsoft Expression Web 4 and I downloaded a template that is all PHP files. When I put the files into Expression Web 4 and push preview, it shows the Text of the script. This is the Script that it is. Is there something wrong? I am very new to scripting and VERY new to PHP. Can someone help me out?

<?php
/**
* @package WordPress
* @subpackage Default_Theme
*/

// Do not delete these lines
if (!empty($_SERVER['SCRIPT_FILENAME']) && 'comments.php' == basename($_SERVER['SCRIPT_FILENAME']))
die ('Please do not load this page directly. Thanks!');

if ( post_password_required() ) { ?>
<p class="nocomments"><?php _e('This post is password protected. Enter the password to view comments.','nattywp'); ?></p>
<?php
return;
}
?>

<!-- You can start editing here. -->

<?php if ( have_comments() ) : ?>
<h2><?php comments_number(__('No Responses','nattywp'), __('One Response','nattywp'), __('% Responses','nattywp'));?></h2>
<div class="inner-text">

<?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // Are there comments to navigate through? ?>
<div class="navigation">
<div class="alignleft"><?php previous_comments_link( __( '<span class="meta-nav">&larr;</span> Older Comments', 'nattywp' ) ); ?></div>
<div class="alignright"><?php next_comments_link( __( 'Newer Comments <span class="meta-nav">&rarr;</span>', 'nattywp' ) ); ?></div>
</div><div style="clear:both;"></div>
<?php endif; // check for comment navigation ?>


<ul class="commentlist">
<?php wp_list_comments('style=ul&callback=mytheme_comment'); ?>
</ul>

<?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // Are there comments to navigate through? ?>
<div class="navigation">
<div class="alignleft"><?php previous_comments_link( __( '<span class="meta-nav">&larr;</span> Older Comments', 'nattywp' ) ); ?></div>
<div class="alignright"><?php next_comments_link( __( 'Newer Comments <span class="meta-nav">&rarr;</span>', 'nattywp' ) ); ?></div>
</div>
<?php endif; // check for comment navigation ?>
<div style="clear:both;"></div><br /><br />
</div>
<?php else : // this is displayed if there are no comments so far ?>

<?php if ('open' == $post->comment_status) : ?>
<!-- If comments are open, but there are no comments. -->

<?php else : // comments are closed ?>
<!-- If comments are closed. -->
<p class="nocomments"></p>

<?php endif; ?>
<?php endif; ?>

<?php
$defaults = array(
'id_form' => 'comment-form',
'id_submit' => 'submit',
'title_reply' => __( 'Leave a Reply', 'nattywp' ),
'title_reply_to' => __( 'Leave a Reply to %s', 'nattywp' ),
'cancel_reply_link' => __( 'Cancel reply', 'nattywp' ),
'label_submit' => __( 'Post Comment', 'nattywp' )
);

comment_form($defaults); ?>

johnj
php-forum Super User
php-forum Super User
Posts: 1805
Joined: Thu Mar 10, 2011 5:07 pm

Re: Shows the Script text only

Postby johnj » Sun Mar 13, 2011 8:58 pm

First,make sure you have PHP installed o your computer. If you have then test if it is working by using the following code:

<?php

phpinfo();

?>

Save these lines to a file called test.php and put it in your web root. Now access it by using a browser. If you can see all the php settings/configurations then php is installed on your machine. If php is not installed then it will show the text of the script.


Return to “PHP coding => Images”

Who is online

Users browsing this forum: No registered users and 1 guest