Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2013-10-26 17:31:35

JimJoe
Member
From: United States
Registered: 2010-01-30
Posts: 573
Website

txp 4.4.1, too much code on page, save blanks template

I have using a div/ul menu for my textpattern sites. It is the Free Style menu at this link

Today I was adding more menu links. When the save completed, the template went blank.

My previous default template has 1224 lines of text. It saves fine and the site navigation menu works fine as well.

The changes run the line count up to 1363 lines of text. When I click on the save button, the text goes away and the template becomes blank.

I’ll be adding probably at least another 1000 lines of text, of the site navigation menus.

I did try using the server side includes, as a txt file, but it doesn’t seem to work on my web host.

Is there a maximum line count for the default/archive templates ?

If there is, I’ll work with my web host to determine what can be done.

Thanks for your help.

{Edited title to better suit topic’s contents. – Uli}

Last edited by uli (2014-01-07 21:59:57)

Offline

#2 2013-10-26 17:55:22

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,315

Re: txp 4.4.1, too much code on page, save blanks template

The code field of txp_page is of type ‘text’ which can take up to 65kb. So you might indeed have hit the maximum value. Try splitting your menu into forms which each can take the same amount of code as the pages can.


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#3 2013-10-26 18:02:30

JimJoe
Member
From: United States
Registered: 2010-01-30
Posts: 573
Website

Re: txp 4.4.1, too much code on page, save blanks template

Yeah, the 1363 line file is 65.12 kilobytes. Just slightly over the limit.

I’ll dig around on the ‘net and see how I can include the div/ul/il menu as a template. SSI is no longer in use on my web host.

If anyone is curious as to what menu I’m using

Offline

#4 2013-10-26 18:42:21

JimJoe
Member
From: United States
Registered: 2010-01-30
Posts: 573
Website

Re: txp 4.4.1, too much code on page, save blanks template

Interesting.

Part of the site navigation menu is a javascript it uses for configuration. To shorten the site navigaiton menu and get it under 65 kilobytes, I wanted to put the js in a separate file.

I can call the js file from html, but not from the default/archive template in textpattern.

The templates pull the two other menu items I reference, just not that one file. One js and one css file are pulled, but not the second js file.

I’m going to take out some of the comments from the js file that isn’t laoded to get it under the 65kb maximum and keep working on this.

Offline

#5 2013-10-26 19:19:12

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,315

Re: txp 4.4.1, too much code on page, save blanks template

JimJoe wrote:

To shorten the site navigaiton menu and get it under 65 kilobytes, I wanted to put the js in a separate file.

The attempt is in the right direction, just use forms (Admin > Presentation > Forms), not files, and integrate their contents with output_form tags like <txp:output_form form="your_js" /> into your page template.


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#6 2013-10-26 20:18:46

JimJoe
Member
From: United States
Registered: 2010-01-30
Posts: 573
Website

Re: txp 4.4.1, too much code on page, save blanks template

That worked ! Thanks !

Offline

#7 2013-10-29 08:51:01

gaekwad
Server grease monkey
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 4,355
GitHub

Re: txp 4.4.1, too much code on page, save blanks template

Uli is right in saying that splitting into forms is a good idea. Another thing to try, if you’re so inclined, would be to change the table field type from TEXT to MEDIUMTEXT which raises the limit to a higher level (16M instead of 64K). This might not be best practise, depending on your school of thought, but as an immediate fix (bodge) it’s worked for me in the past.

Offline

#8 2013-10-29 21:08:42

JimJoe
Member
From: United States
Registered: 2010-01-30
Posts: 573
Website

Re: txp 4.4.1, too much code on page, save blanks template

Thanks ! I’m kinda wrapped up in doing other things at the moment, but since I plan on working on my drive-in mnovie theater site, along with the Traveller planet maps, I’ll need plenty of navigation menu space.

I have been wondering if the site navigation menu will work as a form ?

Offline

#9 2013-10-30 09:52:32

gaekwad
Server grease monkey
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 4,355
GitHub

Re: txp 4.4.1, too much code on page, save blanks template

JimJoe wrote:

I have been wondering if the site navigation menu will work as a form ?

I can’t see a reason why it shouldn’t (ugh, double negative). What you want to do is quite normal for Textpattern, insofar as you can break out the reusable components into forms and call them from pages. I ran into the same issue as you regarding form size limit, mostly because I went from having tons of small forms to having far fewer larger ones. The trade of was less of a brain-ache on my part of having to remember what form did what, but I did run into this size limit problem. I now try to avoid the large form limit because I don’t know if a future upgrade will switch my MEDIUMTEXT tables back to a smaller format and truncate them. I am fairly sure this won’t happen, but I can’t be certain.

Offline

#10 2013-10-30 10:54:47

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: txp 4.4.1, too much code on page, save blanks template

gaekwad wrote:

I am fairly sure this won’t happen, but I can’t be certain.

It may happen if we ever change database structure.

truncate them

We actually are not responsible of how your content is managed; your server configuration, and database format and engine is. There are three things that can happen:

  • Your installation either complete breaks. The update either dies on fatai error, or skips the updates (both leading to broken database).
  • Templates are saved as empty.
  • They get truncated.

That depends on whether you are running MySQL in strict mode and version, and what table type. We always expect that the core database structure is not altered, and it’s not like we could even predict that, if you have done so. We mostly just avoid altering the structure if not need and when we do, we try to just up the fields in backwards compatible fashion. But even then, those updates can fail if you have altered the structure; for instance, we update VARCHAR field to TEXT, but you have changed it to MEDIUMTEXT, the content goes over the limit and the update breaks.

Last edited by Gocom (2013-10-30 10:56:30)

Offline

#11 2013-10-30 11:12:15

gaekwad
Server grease monkey
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 4,355
GitHub

Re: txp 4.4.1, too much code on page, save blanks template

Gocom wrote:

[…] for instance, we update VARCHAR field to TEXT, but you have changed it to MEDIUMTEXT, the content goes over the limit and the update breaks.

^^ This. I’m not in the habit of biting the hand that feeds, hence my advice about not screwing with stuff, it it’s avoidable.

Offline

#12 2013-10-30 20:03:53

JimJoe
Member
From: United States
Registered: 2010-01-30
Posts: 573
Website

Re: txp 4.4.1, too much code on page, save blanks template

I’ll check into it.

Offline

Board footer

Powered by FluxBB