Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.
Run encoded TPL files on Smarty 3.1x

 
Post new topic   Reply to topic    Smarty Forum Index -> Tips and Tricks
View previous topic :: View next topic  
Author Message
gencer
Smarty Rookie


Joined: 03 Dec 2011
Posts: 5

PostPosted: Sat Dec 03, 2011 9:14 pm    Post subject: Run encoded TPL files on Smarty 3.1x Reply with quote

I can't see this patch (trick) around so im sharing it.

This is for "how to get work encoded tpl files on smarty 3.1".

1. Open sysplugins/smarty_internal_resource_file.php

2. Find this function: getContent (line: 62)
It looks like this:
Code:

public function getContent(Smarty_Template_Source $source)
    {
        if ($source->timestamp) {
            return file_get_contents($source->filepath);
        }
        if ($source instanceof Smarty_Config_Source) {
            throw new SmartyException("Unable to read config {$source->type} '{$source->name}'");
        }
        throw new SmartyException("Unable to read template {$source->type} '{$source->name}'");
    }


3. Replace this function with this one:
Code:

public function getContent(Smarty_Template_Source $source)
    {
        if ($source->timestamp) {
            if (function_exists('ioncube_read_file')) {
                return ioncube_read_file($source->filepath);
            } else {
                return file_get_contents($source->filepath);
            }
        }
        if ($source instanceof Smarty_Config_Source) {
            throw new SmartyException("Unable to read config {$source->type} '{$source->name}'");
        }
        throw new SmartyException("Unable to read template {$source->type} '{$source->name}'");
    }


4. Done.

Remember. Smarty and template file(s) must be encoded at the same time with same encoder settings. One smarty encoded file can't open other (unrelated) encoded tpl.

Regards.
Back to top
View user's profile Send private message
bimal
Smarty Elite


Joined: 19 Apr 2007
Posts: 420
Location: Kathmandu, Nepal

PostPosted: Thu Dec 22, 2011 10:03 am    Post subject: iconcube encoded templates but missing loader Reply with quote

Thank you for your tricks.

IonCube is not generally available on all the servers. This may lead to an issue that your distributed templates are encoded, but the system does not have iconcube loader.

Cannot guess what happens next Wink. When your deployment server is ready, go for encoded templates as you wish.
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> Tips and Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP