phpvms / phpvms_v2

Virtual Airline Management (not maintained)
http://www.phpvms.net
BSD 3-Clause "New" or "Revised" License
41 stars 46 forks source link

Change from .tpl to .php #71

Open nabeelio opened 12 years ago

nabeelio commented 12 years ago

Ongoing instructions (see commit logs)

Instructions:

Rename all .tpl files to .php

By hand if you're a masochist, or run in admin/templates, core/templates and in skin folders:

rename s/.tpl/.php/ *.tpl

Make code changes

core/classes/TemplateSet.class.php (line 48)

public $tpl_ext = 'php';

core/app.config.php (Line 30 ish), add the following:

define('IN_PHPVMS', true);

Also, find:

Config::Set('TPL_EXTENSION', '.tpl');

And change to:

Config::Set('TPL_EXTENSION', '.php');

Template changes

Add the following line to the top of every template file in core/templates, admin/templates and the templates in your skin:

<?php if(!defined('IN_PHPVMS') && IN_PHPVMS !== true) { die(); } ?>

Change to template engine

Note: If you do this change, you don't need to do the next step.

Find

public function getTemplate($tpl_name, $ret = false, $checkskin = true, $force_base = false) {

And add right below it:

if(substr_count($tpl_name, '.tpl') > 0) {
    $tpl_name = str_replace('.tpl', '.' . $this->tpl_ext, $tpl_name);
}

Remove extension references from function calls

See commit ### for details of changes (not completed yet)

ghost commented 12 years ago

Don't forget to change the install templates to PHP. got those errors.. and I changed all of the install templates to PHP and it worked.

Notice: The template file "htdocs\phpVMS_tpl/install/templates\header.php" doesn't exist in htdocs\phpVMS_tpl\core\classes\TemplateSet.class.php on line 231

Notice: The template file "htdocs\phpVMS_tpl/install/templates\s1_db_setup.php" doesn't exist in htdocs\phpVMS_tpl\core\classes\TemplateSet.class.php on line 231

Notice: The template file "htdocs\phpVMS_tpl/install/templates\footer.php" doesn't exist in htdocs\phpVMS_tpl\core\classes\TemplateSet.class.php on line 231

I'll keep you updated.

ghost commented 12 years ago

What the...

Nabeel, When I installed this VMS from Github, I filled out the MySQL info, and I got those errorrs...

Writing to "" table...

Table 'tpl.phpvms_news' doesn't exist Writing to "" table...

Table 'tpl.phpvms_airports' doesn't exist Writing to "" table...

Table 'tpl.phpvms_ranks' doesn't exist Writing to "" table...

Table 'tpl.phpvms_groups' doesn't exist Writing to "" table...

Table 'tpl.phpvms_groups' doesn't exist Writing to "" table...

Table 'tpl.phpvms_groups' doesn't exist Writing to "" table...

Table 'tpl.phpvms_settings' doesn't exist Writing to "" table...

Table 'tpl.phpvms_settings' doesn't exist Writing to "" table...

Table 'tpl.phpvms_settings' doesn't exist Writing to "" table...

Table 'tpl.phpvms_settings' doesn't exist Writing to "" table...

Table 'tpl.phpvms_settings' doesn't exist Writing to "" table...

Table 'tpl.phpvms_settings' doesn't exist Writing to "" table...

Table 'tpl.phpvms_settings' doesn't exist

Warning: file_get_contents(htdocs\phpVMS_tpl/install/templates/config.tpl) [function.file-get-contents]: failed to open stream: No such file or directory in htdocs\phpVMS_tpl\install\includes\Installer.class.php on line 110

The tables weren't created.

I suppose we need to fix a few things in the Installer.class.php.

tomsterritt commented 12 years ago

http://tomsterritt.com/phpvms/vms/core/templates/acarsmap.php Shows me a couple of lines of code in the source:

<script type="text/javascript">
var acars_map_defaults = {
    autozoom: true,
    zoom: 4,
    center: new google.maps.LatLng("
nabeelio commented 12 years ago

@tomsterritt If you add this line, does it show anything?

<?php if(!defined('IN_PHPVMS') && IN_PHPVMS !== true) { die(); } ?>

@Vansers Yeah, I have to fix the clean install stuff, I'll try to do that today. This was more meant as a patch to existing installs.

Thanks guys!

tomsterritt commented 12 years ago

Completely empty after adding that line. Huzzah

nabeelio commented 12 years ago

@tomsterritt Awesome! And the template still works as normal on the ACARS page? I'm going to push a commit with this change in all templates

tomsterritt commented 12 years ago

Yep, all looks fine!

ghost commented 12 years ago

Few changes...

ref #72

nabeelio commented 12 years ago

@Vansers When you commit/push request next time, include the ticket # in the commit (like I did above) and it will include it directly into this ticket... no biggie :)

How does everything look? I fixed the database stuff.

ghost commented 12 years ago

When I went to /core/templates/acarsmap.php in the web browser, got this error message...

Notice: Use of undefined constant IN_PHPVMS - assumed 'IN_PHPVMS' in htdocs\test\core\templates\acarsmap.php on line 1

nabeelio commented 12 years ago

And it still works from the acars page? Great. I'll clean up the instructions. I gotta clean up the template code next.

ghost commented 12 years ago

Just got this in the Admin Center. Blank pages, with texts and error.

'Notice: The template file "htdocs\test\/admin/lib/layout\header.php" doesn't exist in htdocs\test\core\classes\TemplateSet.class.php on line 231'

We forgot the header.tpl and the footer.tpl to be changed. Should that been done?

ghost commented 12 years ago

Changed the header.tpl and footer.tpl to it's php. It's all good.

I think everything looks fine so far! Well done Nabeel!

nabeelio commented 12 years ago

Ahh yeah, those two - the new version doesn't use that anymore so that's why I missed it. Those do also need to be changed, yes - any .tpl files

ghost commented 12 years ago

Are we talking about the Admin Center layout? They still use header and footer.

nabeelio commented 12 years ago

Oh, woops. Guess I missed that one... :)

ghost commented 12 years ago

:), No worries.

Oxymoron290 commented 11 years ago

pull request #96 is related

Vansers commented 11 years ago

I guess this is completed? Maybe we should close or not?