default userpic

Maximum Size for Template files?

Vote 0 Votes

Hi Everyone,

I'm running in the annoying problem of loosing parts of my templates and suspect a size restriction as the cause.

When I've a template that is rather large I quite often loose the x-endlines of that template file while saving without getting any errors - just loosing the lines.

This applies to MT 4.21 Pro/Com, MTOS 4.21 but applied to MT 3.x as well.

The problem is also persistent with smaller template files if I use "Save&Publish" instead of "Save" and than "Publish" in MT 4.21 (OS or Pro/Com).

For larger template sizes it even occurs using Save first.

Is there a way to configure maximum template sizes through config directives or by changing sth. in the database or server setup? (MT is hosted on it's own server)

So far I only came up with the idea to swap out some parts of a file into several module templates to avoid these annoyances.

Any help or ideas greatly appreciated.

Thanks, Chris

Reported on Movable Type 4.2

8 Replies

| Add a Reply
  • You'd have to have a very big template to reach the maximum size, since it's a mediumtext field in MySQL. How many bytes/kb are these templates? A few dozen kb max? I'd recommend you file a bug report too if you get this on a clean installation.

    As a rule of thumb, it's a great idea with 4.21 to break things up into modules because that will increase publishing performance if the modules are ones that can be rationally set to be cached. For example, I have most of my sidebar widgets cached and the performance boost is probably literally approaching an order of magnitude when I do a full site rebuild.

    One last thing, could you explain by what you mean when you say "lose x-endlines?" Are you saying that part of the template markup is truncated, or that trailing end lines are truncated?

  • Hi Mike,

    thanks for your reply and your suggestions.


    One template where this occurs has a size of approx. 12kb.

    I'm rather a noob concerning MySQL but isn't the max size of a MEDIUMTEXT field 2^24 Bytes?

    While looking at the template that lost some data, it rather looks like the maxsize here is 2^16 Bytes, therefor I loose everything that is exceeding this value (about half of the template with a size of approx. 12kb is lost in my case).

    This data applies to MT 3.x - funny is, that this template was published correctly in the first instance but now if I open the template for editing, about half of the lines are lost.


    In MT 4.21 this problem also occured with much smaller template files - but only if I used "Save & Publish", as stated above (concerning the smaller files, it's also occuring using "Save" with larger files).

    > Are you saying that part of the template markup is
    > truncated,...


    Yes, that is what is happening.


    So far, I will use divide to conquer this problem - but it would be wise for MT to alert a warning if the template file exceeds a somehow somewhere defined maxvalue for a string size.


    PS: Sorry, no idea, why Markdown isn't working here.

  • If it's occurring with much smaller templates, it's probably a problem with your installation of Movable Type. Have you tried doing a fresh installation of 4.21 if you copied 4.21 originally over on top of 3.3?

  • Since you mention MT, I'll guess that this is an upgraded installation. In MT3, the template_text column used the TEXT type, *not* MEDIUMTEXT. I have run into this limitation with TEXT several times, so I can certainly see that you may be hitting it, too. Change the field type and you should be golden.

  • Based on what Dan said, after backing up your database, try this: ALTER TABLE mt_template MODIFY template_text MEDIUMTEXT;

  • Hi Dan, Hi Mike,

    thank you for your replies.

    I actually had two different installs of MT - the old version 3.x is still the productive one while a new install (MT 4.21) is for testing purposes before migrating/upgrading (using different directories and databases).

    Your explanations about template_text max size defined by TEXT instead of MEDIUMTEXT is surely the answer regarding any problems I had with large template files regarding MT 3.x.

    I still do not understand what is happening regarding MT 4.21, where this problems occurs even with small template files, but only while using "Save&Publish" instead of saving first and publishing then.

    I can't produce a routine that allows to reproduce this misbehavior in every instance - sometimes only half a template file gets saved while hitting "Save&Publish", sometimes the full template file gets saved. Will try to keep you updated if I find out what is causing this behavior (maybe it's just the server?).

    • My memory is being jogged a little. I want to say that I remember reading on [ProNet](http://www.sixapart.com/pronet/) about a similar problem when some version of the Google Toolbar (or something like that) was installed. That's vague, but perhaps some searching will get you to the answer.

Add a Reply

If you need to share template code, replace all the "<" signs with "&lt;" or use this utility.

Forum Groups

1773 6162

Last Topic: Excluding categories from blog by kholechek on Feb 9, 2012

86 302

Last Topic: website entries by masoud on Oct 26, 2011

1428 5076

Last Topic: Stupid Question? How to make a static homepage by Jeremy on Feb 3, 2012

694 2908

Last Topic: Blogspot to Movable Type by sdude on Feb 8, 2012

84 291

Last Topic: How to have some other characters in entry basename automatically written by Afshin Haghighatnia on Dec 22, 2011

173 737

Last Topic: About the MT version stated in HTML source by Alex E. Schneider on Feb 7, 2012

190 565

Last Topic: Analytics Reporting by michael webster on Feb 5, 2012

48 210

Last Topic: An idea and also a request by Afshin Haghighatnia on Jun 29, 2011

64 246

Last Topic: jQuery in MT 5.1 still at 1.4 - why? by perlmonkey on May 25, 2011

code.sixapart.com

137 478

Last Topic: Getting a thumbnail with xpath by Peter on Mar 13, 2011

222 716

Last Topic: Custom Field for Asset Not Appearing by android on Feb 9, 2012