Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2018-12-26 09:20:59

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 7,164
Website

flat scripts in 4.7.2

I am changing our site to use the flat files but javascripts seem not to be working when using <script src="<txp:output_form form="jquery.js" context="flat.url" />"></script> in spite of the fact that the source shows them just fine.

These include the videos, especially when they are under a jquery script which loads a number of them, and the slideshow on the top of most pages. Sample url demonstrates both issues. Any advice would be very much appreciated.


Yiannis
——————————
neme.org | hblack.net | LABS | State Machines | Respbublika! | NeMe @ github

Online

#2 2018-12-26 09:35:11

etc
Developer
Registered: 2010-11-11
Posts: 3,131
Website

Re: flat scripts in 4.7.2

Hi Yiannis,

that should be format

<txp:output_form form="jquery.js" format="flat.script" />

etc_[ query | search | pagination | date | tree | cache ]

Offline

#3 2018-12-26 09:52:27

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 7,164
Website

Re: flat scripts in 4.7.2

Hi Oleg,

Thanks so much for the response. Unfortunately it does not seem to be it. I have changed all instances with your suggestion but it did not make any difference.


Yiannis
——————————
neme.org | hblack.net | LABS | State Machines | Respbublika! | NeMe @ github

Online

#4 2018-12-26 10:08:58

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 7,164
Website

Re: flat scripts in 4.7.2

I am also checking the console which seems to be giving me these errors which were not there before. All I did was to copy/paste all the js scripts from spf_javascript to the forms under the JS (Application/Javascript) form type.

SyntaxError: missing ) in parenthetical jquery.js:4:1250
ReferenceError: jQuery is not defined[Learn More] responsiveslides.js:8:1
<anonymous>
http://www.neme.org/themes/neme960/forms/js/responsiveslides.js:8:1
ReferenceError: $ is not defined[Learn More] the-idea-of-the-avant-garde:583:1
<anonymous>
http://www.neme.org/events/the-idea-of-the-avant-garde:583:1
ReferenceError: jQuery is not defined[Learn More] bxslider.js:1:1
<anonymous>
http://www.neme.org/themes/neme960/forms/js/bxslider.js:1:1
ReferenceError: $ is not defined[Learn More] the-idea-of-the-avant-garde:602:1
<anonymous>
http://www.neme.org/events/the-idea-of-the-avant-garde:602:1

Yiannis
——————————
neme.org | hblack.net | LABS | State Machines | Respbublika! | NeMe @ github

Online

#5 2018-12-26 10:24:01

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 7,164
Website

Re: flat scripts in 4.7.2

To make it work, I had to delete all scripts in the themes js folder, replace them with the original flat files and am still calling them with <txp:output_form form="jquery.js" format="flat.script" />. Would this imply that there is something wrong with the way the JS is saved?


Yiannis
——————————
neme.org | hblack.net | LABS | State Machines | Respbublika! | NeMe @ github

Online

#6 2018-12-26 11:30:09

etc
Developer
Registered: 2010-11-11
Posts: 3,131
Website

Re: flat scripts in 4.7.2

colak wrote #315742:

Would this imply that there is something wrong with the way the JS is saved?

I hope no, I had no problem as far with any of my scripts. But storing a globally used third-party jquery.js as form is rather unusual. Do you really need to modify it, ever?


etc_[ query | search | pagination | date | tree | cache ]

Offline

#7 2018-12-26 15:51:47

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 7,164
Website

Re: flat scripts in 4.7.2

etc wrote #315743:

I hope no, I had no problem as far with any of my scripts. But storing a globally used third-party jquery.js as form is rather unusual. Do you really need to modify it, ever?

I do not remember ever modifying it but isn’t the idea of the themes that we can just take that folder and distribute it as a complete site template? The problem with adding the jquery or any other such scripts afterwords is the otherwise very useful Delete unused templates from disk on export in the themes tab.1

1 Admittedly I did not test Update from Disc yet.


Yiannis
——————————
neme.org | hblack.net | LABS | State Machines | Respbublika! | NeMe @ github

Online

#8 2018-12-26 16:03:21

etc
Developer
Registered: 2010-11-11
Posts: 3,131
Website

Re: flat scripts in 4.7.2

colak wrote #315748:

isn’t the idea of the themes that we can just take that folder and distribute it as a complete site template?

It suffices to include <script src="path/to/cdn/jquery.js"></script> in your templates. Chances are, this (widely used) script is already in users cache, saving them extra download. Or put it in some separate directory not overwritten by themes manager.


etc_[ query | search | pagination | date | tree | cache ]

Offline

#9 2018-12-26 17:11:16

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 7,164
Website

Re: flat scripts in 4.7.2

etc wrote #315749:

Or put it in some separate directory not overwritten by themes manager.

Does the manager override the whole of the themes directory or could I just have a folder in there, call it javascripts, and serve the large scripts from it?

Also:)… I am trying to phase out the rah_external_output plugin. To my question in this post you wrote:

Yes, jointly with <txp:header /> tag.

But I’m not sure how to make it work.


Yiannis
——————————
neme.org | hblack.net | LABS | State Machines | Respbublika! | NeMe @ github

Online

#10 2018-12-27 12:54:27

etc
Developer
Registered: 2010-11-11
Posts: 3,131
Website

Re: flat scripts in 4.7.2

colak wrote #315750:

Does the manager override the whole of the themes directory or could I just have a folder in there, call it javascripts, and serve the large scripts from it?

AFAIK, only forms, pages and styles folders are synced. Everything else inside themes folders is kept intact.

But I’m not sure how to make it work.

In rah_external_output forms you can set headers this way:

;Cache-Control: no-cache, no-store, must-revalidate

In 4.7.2 this is done with

<txp:header name="Cache-Control" value=" no-cache, no-store, must-revalidate" />

etc_[ query | search | pagination | date | tree | cache ]

Offline

Board footer

Powered by FluxBB