Skip to content
This repository has been archived by the owner on Dec 6, 2019. It is now read-only.

Change from .tpl to .php #71

Open
nabeelio opened this issue Jul 16, 2012 · 11 comments
Open

Change from .tpl to .php #71

nabeelio opened this issue Jul 16, 2012 · 11 comments
Assignees

Comments

@nabeelio
Copy link
Member

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)

nabeelio added a commit that referenced this issue Jul 16, 2012
@ghost ghost assigned nabeelio Jul 16, 2012
nabeelio added a commit that referenced this issue Jul 16, 2012
nabeelio added a commit that referenced this issue Jul 16, 2012
@ghost
Copy link

ghost commented Jul 16, 2012

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
Copy link

ghost commented Jul 16, 2012

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
Copy link
Member

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
Copy link
Member Author

@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
Copy link
Member

Completely empty after adding that line. Huzzah

@nabeelio
Copy link
Member Author

@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
Copy link
Member

Yep, all looks fine!

@ghost
Copy link

ghost commented Jul 17, 2012

Few changes...

ref #72

@nabeelio
Copy link
Member Author

@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
Copy link

ghost commented Jul 17, 2012

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
Copy link
Member Author

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

@ghost
Copy link

ghost commented Jul 17, 2012

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
Copy link

ghost commented Jul 17, 2012

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
Copy link
Member Author

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
Copy link

ghost commented Jul 17, 2012

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

@nabeelio
Copy link
Member Author

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

@ghost
Copy link

ghost commented Jul 17, 2012

:), No worries.

@Oxymoron290
Copy link

pull request #96 is related

@Vansers
Copy link
Contributor

Vansers commented Apr 20, 2013

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants