Template Externalizer Tutorial

Do something cool with CMS? Show us ...
This board is for 'Answers', and the discussion of answers... Not for questions.
Locked
kendo451

Template Externalizer Tutorial

Post 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.
KitchM
Power Poster
Power Poster
Posts: 328
Joined: Mon Dec 02, 2013 3:26 am

Re: Template Externalizer Tutorial

Post 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.
JohnnyB
Dev Team Member
Dev Team Member
Posts: 729
Joined: Tue Nov 21, 2006 5:05 pm
Location: OH, USA

Re: Template Externalizer Tutorial

Post 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.
"The art of life lies in a constant readjustment to our surroundings." -Okakura Kakuzo

--
LinkedIn profile
--
I only speak/write in English so I may not translate well on International posts.
--
KitchM
Power Poster
Power Poster
Posts: 328
Joined: Mon Dec 02, 2013 3:26 am

Re: Template Externalizer Tutorial

Post 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.
JohnnyB
Dev Team Member
Dev Team Member
Posts: 729
Joined: Tue Nov 21, 2006 5:05 pm
Location: OH, USA

Re: Template Externalizer Tutorial

Post 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.
"The art of life lies in a constant readjustment to our surroundings." -Okakura Kakuzo

--
LinkedIn profile
--
I only speak/write in English so I may not translate well on International posts.
--
KitchM
Power Poster
Power Poster
Posts: 328
Joined: Mon Dec 02, 2013 3:26 am

Re: Template Externalizer Tutorial

Post 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?
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: Template Externalizer Tutorial

Post 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.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
KitchM
Power Poster
Power Poster
Posts: 328
Joined: Mon Dec 02, 2013 3:26 am

Re: Template Externalizer Tutorial

Post by KitchM »

Underwater Demolitions Team? Universal Defense Target? I don't know UDT.
chandra

Re: Template Externalizer Tutorial

Post by chandra »

UDT = User Defined Tag >:D
KitchM
Power Poster
Power Poster
Posts: 328
Joined: Mon Dec 02, 2013 3:26 am

Re: Template Externalizer Tutorial

Post by KitchM »

Sorry, but it won't take.

"Invalid code entered"
JohnnyB
Dev Team Member
Dev Team Member
Posts: 729
Joined: Tue Nov 21, 2006 5:05 pm
Location: OH, USA

Re: Template Externalizer Tutorial

Post 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....
"The art of life lies in a constant readjustment to our surroundings." -Okakura Kakuzo

--
LinkedIn profile
--
I only speak/write in English so I may not translate well on International posts.
--
JohnnyB
Dev Team Member
Dev Team Member
Posts: 729
Joined: Tue Nov 21, 2006 5:05 pm
Location: OH, USA

Re: Template Externalizer Tutorial

Post 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...
"The art of life lies in a constant readjustment to our surroundings." -Okakura Kakuzo

--
LinkedIn profile
--
I only speak/write in English so I may not translate well on International posts.
--
KitchM
Power Poster
Power Poster
Posts: 328
Joined: Mon Dec 02, 2013 3:26 am

Re: Template Externalizer Tutorial

Post 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.
JohnnyB
Dev Team Member
Dev Team Member
Posts: 729
Joined: Tue Nov 21, 2006 5:05 pm
Location: OH, USA

Re: Template Externalizer Tutorial

Post 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.
"The art of life lies in a constant readjustment to our surroundings." -Okakura Kakuzo

--
LinkedIn profile
--
I only speak/write in English so I may not translate well on International posts.
--
KitchM
Power Poster
Power Poster
Posts: 328
Joined: Mon Dec 02, 2013 3:26 am

Re: Template Externalizer Tutorial

Post 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...........
Locked

Return to “Tips and Tricks”