wildteen88 Posted December 27, 2008 Share Posted December 27, 2008 Umm, looking at the source code of your site. The PHP code is visible. Which means, 1. Your webhost/hosting account does not support PHP. Check this with your webhost. Or, 2. The file you have placed your PHP code in does not end in an .php extension, eg you have added the code to index.html rather than index.php. PHP code will only be parsed within .php files. Quote Link to comment Share on other sites More sharing options...
Jack.C Posted January 1, 2009 Author Share Posted January 1, 2009 Umm, looking at the source code of your site. The PHP code is visible. Which means, 1. Your webhost/hosting account does not support PHP. Check this with your webhost. Or, 2. The file you have placed your PHP code in does not end in an .php extension, eg you have added the code to index.html rather than index.php. PHP code will only be parsed within .php files. It's a tpl file, that's what this whole discussion has been about. How do you include php in tpl files, I did what you said, and thus got that result. So: 1. PHP is allowed on my webhost, infact everything there IS php. 2. It does not end in .php because I did exactly as you said above. Point blank, I asked how to include php files using <?php include("file.php");?> Inside of a tpl file. Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted January 3, 2009 Share Posted January 3, 2009 You cannot place PHP code within .tpl files as by default PHP code is only parsed within .php files. If you want to parse PHP code within any other file you'll have to modify the servers configuration. The easiest way is to do this using an .htaccess file. First create a new file called .htaccess in your sites root directory (where you upload your site files to). And add the following configuration. AddType application/x-httpd-php .php .tpl If your hosts allows this change to me made your site should load without any errors appearing. If an Error 500 is displayed then you are unable to modify the servers configuration. In which case you'll have no other option but to modify your script so it uses .php files rather than .tpl files Quote Link to comment Share on other sites More sharing options...
Jack.C Posted January 4, 2009 Author Share Posted January 4, 2009 You cannot place PHP code within .tpl files as by default PHP code is only parsed within .php files. If you want to parse PHP code within any other file you'll have to modify the servers configuration. The easiest way is to do this using an .htaccess file. First create a new file called .htaccess in your sites root directory (where you upload your site files to). And add the following configuration. AddType application/x-httpd-php .php .tpl If your hosts allows this change to me made your site should load without any errors appearing. If an Error 500 is displayed then you are unable to modify the servers configuration. In which case you'll have no other option but to modify your script so it uses .php files rather than .tpl files The servers configuration is already configured as above. as I've said, I've gotten PHP code to work properly inside of a .tpl file. And all I'm trying to accomplish here is find a simple and easy way to make it so I don't have to create several files with the same exact code. I did not do this script, therefore I don't have a clue. What is the simple way to include a header in several .tpl files without having to add it to each and every .tpl file? For instance, here is a .tpl file with PHP code inside of it working: http://watch.thetvstop.com/templates/stats.tpl The problem is, when I use <?php include ("/file.tpl or /file.php");?> it won't display anything. Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted January 4, 2009 Share Posted January 4, 2009 Looks like you site is using some form of PHP template script (earlier identified as ITX which is a PHP Pear package). PHP code is not being parsed within your .tpl files, tags such as {content}, {Movies} etc is not anything to do with PHP. I think we need to first understand how your site is setup before we suggest anything, as currently we're going round in circles. Can you post the contents of index.php here. Quote Link to comment Share on other sites More sharing options...
Jack.C Posted January 4, 2009 Author Share Posted January 4, 2009 <?php session_start(); DEFINE('movies', 'access'); DEFINE('witAdmin', '1'); require_once('witadmin/conf/config_u.php'); require_once('classes/common.php'); $p = new output(); require_once('classes/movies.php'); $m = new movies(); if(isset($_GET['handle_ajax'])) { if(isset($_GET['view_links'], $_GET['category_id'])) { $m->show_links($_GET['category_id']); } elseif(isset($_GET['add_link'], $_GET['category_id'], $_GET['title'], $_GET['link'])) { $m->add_link($_GET['category_id'], $_GET['link'], $_GET['title']); } else die('No result'); } else { if(isset($_GET['movie_id'])) $m->show_movie(); else $m->movie_list(); } if(isset($m) && is_object($m)) { $p->output = $m->output; } $p->show_overall(); ?> Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted January 5, 2009 Share Posted January 5, 2009 Can you post common.php and movies.php too Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.