Page 1 of 1

Template Externalizer Tutorial

Posted: Wed May 23, 2012 7:43 am
by kendo451
I just posted a new tutorial about the Template Externalizer module over on Goran Ilic's blog:
http://www.i-do-this.com/blog/74/Template-Externalizer

Jocelyn has fixed all of the outstanding bugs in Externalizer with the latest release and it is really a breeze to use now.

Re: Template Externalizer Tutorial

Posted: Mon Feb 24, 2014 8:39 pm
by KitchM
Thank you for posting the fine overview of the module. It appears to be a very helpful addition.

However, after installation, and the use of your setup.php script (Thank you!), I still cannot get the darn thing to create the directory and put the templates and stylesheets in it.

Does anyone know if there is any reason why CMSMS or the environment might have something to do with the problem?

I am using CMSMS 1.11.10 thru Virtualmin 4.06Pro with LimeSurvey 2.05plus-build140212 and Simple Machines Forum 2.0.7 on a standard LAMP server with CentOS 6.5, Apache version 2.2.15, MySQL version 5.1.73, PHP version 5.3.3, and accessing it locally thru Firefox 27.0 on Fedora 20 with Xfce 4.10.1.

Re: Template Externalizer Tutorial

Posted: Tue Feb 25, 2014 12:12 am
by JohnnyB
However, after installation, and the use of your setup.php script
Did you install from your Module Manager or directly from the Development Forge? I don't remember a 'setup.php' script ?

You'll need to make sure the CMS (server) can write files and create a new directory in the /tmp/ directory. Maybe post your system information and the options set in the admin for the module.

Re: Template Externalizer Tutorial

Posted: Tue Feb 25, 2014 2:16 am
by KitchM
kendo451 thought it might be a permissions problem too, so he sent me the script. But it didn't help. Even if I created the directory with 777, externalizer still will not write the files into the directory.

I had to install manually from the Forge. The module manager could not access the server of modules above a particular letter. (See other post.)

Exportation folder : /home/mydomain/public_html/tmp/
CHMOD (write) : 0777
Template extension : html
Stylesheet extension : css
UDT extension : php
Operating time : 30

I am using CMSMS 1.11.10 thru Virtualmin 4.06Pro with LimeSurvey 2.05plus-build140212 and Simple Machines Forum 2.0.7 on a standard LAMP server with CentOS 6.5, Apache version 2.2.15, MySQL version 5.1.73, PHP version 5.3.3, and accessing it locally thru Firefox 27.0 on Fedora 20 with Xfce 4.10.1.

I hope that helps some. But I've run across permissions problems before. And what is annoying is that the module gives no feedback when it fails a process.

Re: Template Externalizer Tutorial

Posted: Tue Feb 25, 2014 4:02 pm
by JohnnyB
This is kind of off topic, but it seems like there are a few wonky things happening with other areas of the installation as well, right?

If I was in a similar position, I would create a new 'test' directory, new database, and download a fresh copy CMSMS 1.11.10. Then, install it in the new test directory following the default wizard (no hosting addon installation script service) to see if the same problems occur.

Then, do the same on your computer using a LAMP based server stack like xampp or wampserver to see if you get similar issues.

Re: Template Externalizer Tutorial

Posted: Tue Feb 25, 2014 9:38 pm
by KitchM
On my virtual server there are other domains. I have done fresh installs of CMSMS on others to test. However, the Template Exernalizer does not work on those either. These are fresh domains.

The problem appears to be that I don't know what the module is doing, and I have, to my knowledge, no way to track its steps as it processes. Therefore it seems impossible to me to figure it out.

Does it run a hidden script or something that one can step thru?

Re: Template Externalizer Tutorial

Posted: Tue Feb 25, 2014 9:50 pm
by calguy1000
create a udt like this:

Code: Select all

$config = cmsms()->GetConfig();
$dir = $config['root_path'].'/tmp/foo');
mkdir($dir);
$fn = "$dir/stuff.txt";
$stuff = 'some random data';
file_put_contents($fn,$stuff);
then run it. if that function fails then you'll know the problem. Make sure you have notifications turned on.

Re: Template Externalizer Tutorial

Posted: Tue Feb 25, 2014 10:52 pm
by KitchM
Underwater Demolitions Team? Universal Defense Target? I don't know UDT.

Re: Template Externalizer Tutorial

Posted: Wed Feb 26, 2014 12:14 am
by chandra
UDT = User Defined Tag >:D

Re: Template Externalizer Tutorial

Posted: Wed Feb 26, 2014 3:51 am
by KitchM
Sorry, but it won't take.

"Invalid code entered"

Re: Template Externalizer Tutorial

Posted: Wed Feb 26, 2014 1:45 pm
by JohnnyB
extra closing parenthesis...

Use this

Code: Select all

$config = cmsms()->GetConfig();
$dir = $config['root_path'].'/tmp/foo';
mkdir($dir);
$fn = "$dir/stuff.txt";
$stuff = 'some random data';
file_put_contents($fn,$stuff);
Run the UDT from the admin (the gear icon)
If you don't get any errors, white page, etc., go to tmp/foo/ and look for the file called, stuff.txt - open and it should have 'some random data' written into it.

If not, then PHP is not configured correctly....

Re: Template Externalizer Tutorial

Posted: Wed Feb 26, 2014 1:47 pm
by JohnnyB
On my virtual server there are other domains. I have done fresh installs of CMSMS on others to test. However, the Template Exernalizer does not work on those either. These are fresh domains.
Install the CMS on another server not using the ones above to really test things out. If it works better in that different environment/different server, then you know the problem is with the server environment...

Re: Template Externalizer Tutorial

Posted: Wed Feb 26, 2014 4:20 pm
by KitchM
The icon I see looks like a flower on the upper right bar. It says My Account, but don't see any significance there. Since I had to log in as administrator, I figured I was already okay.

The later code worked correctly to create the tag. I just named mine my_tag.

Then I went to Site Admin>Global Settings>Advanced Setup>Allow users to view notifications, and it was already checked on.

Then I went to Extensions>User Defined Tags and selected the little icon that hover-over stated was Run this User Defined Tag. That gave me a screen where I could select Run.

Nothing seemed to happen. So I cranked up Filezilla and logged into my server, and selected /home/mydomain/tmp and found nothing at all. I was getting a little worried until I looked a little deeper into /home/mydomain/public_html/tmp and found /foo/stuff.txt which included "some random data".

Success! All is good at that stage.

Re: Template Externalizer Tutorial

Posted: Wed Feb 26, 2014 5:47 pm
by JohnnyB
/home/mydomain/public_html/tmp and found /foo/stuff.txt which included "some random data".
Good. So did you see the 'externalizer' directory in your /tmp/ directory?
That is where the module dumps the template files.

Re: Template Externalizer Tutorial

Posted: Wed Feb 26, 2014 5:59 pm
by KitchM
No, I cannot.

There is:
/cache
/configs
/foo
/templates.c
.htaccess
index.html


But wait....
I got an idea. I re-activated the externalizer and refreshed the listing, darn if they didn't show up there.

I have now learned:
1. Where they are supposed to be
2. They only exist while it is active

Wow! Thank you for that. Huge help indeed.

If only someone had put that info in the instructions...........