Go to main content

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: 9,375
Website GitHub Mastodon Twitter

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 | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

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

etc
Developer
Registered: 2010-11-11
Posts: 5,674
Website GitHub

Re: flat scripts in 4.7.2

Hi Yiannis,

that should be format

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

Offline

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

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,375
Website GitHub Mastodon Twitter

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 | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

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

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,375
Website GitHub Mastodon Twitter

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 | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

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

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,375
Website GitHub Mastodon Twitter

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 | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

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

etc
Developer
Registered: 2010-11-11
Posts: 5,674
Website GitHub

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?

Offline

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

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,375
Website GitHub Mastodon Twitter

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 | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

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

etc
Developer
Registered: 2010-11-11
Posts: 5,674
Website GitHub

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.

Offline

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

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,375
Website GitHub Mastodon Twitter

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 | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

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

etc
Developer
Registered: 2010-11-11
Posts: 5,674
Website GitHub

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" />

Offline

#11 2018-12-27 15:58:05

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,375
Website GitHub Mastodon Twitter

Re: flat scripts in 4.7.2

So let me get this right as I know I am doing something wrong:)

I created a miscellaneous form and called it hello.

In the form I added

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

I guess that the url of the form is http://www.domain.tld/?f=hello but nothing seems to be parsing as visiting the url I only get an empty page.


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#12 2018-12-27 17:20:15

etc
Developer
Registered: 2010-11-11
Posts: 5,674
Website GitHub

Re: flat scripts in 4.7.2

colak wrote #315765:

I created a miscellaneous form and called it hello.

Only forms with a media type can be accessed this way, for privacy reasons. Otherwise, any of your pre-4.7.2 forms would be publicly exposed.

Offline

#13 2018-12-27 19:14:51

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,375
Website GitHub Mastodon Twitter

Re: flat scripts in 4.7.2

i see ^^. Intelligent foresight!

I gave the form an html media type and it works according to the label. I wish we had a how-to in the docs explaining all these. The docs and tips websites are great for tag basics and more advanced tag manipulation examples, but we have nowhere else but the forum to document these wonderful features.

I am by no means complaining. I’m just thinking aloud about the possibility of adding a section in the docs but I’m not sure if there will be enough interest from the people here to start a collaborative writing effort to make the docs site a more complete reference destination.


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#14 2018-12-27 21:08:37

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,439
Website GitHub

Re: flat scripts in 4.7.2

colak wrote #315784:

I’m not sure if there will be enough interest from the people here to start a collaborative writing effort to make the docs site a more complete reference destination.

I’m interested!

We need to document this stuff, curate the good tips and examples from the forums and put them in the official docs wherever makes most sense. So if you spot any cool examples or tidbits of info that could help, collect them and propose changes either directly committing to the pages if you can, or raise them as issues and then we can fold them into the docs.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Hire Txp Builders – finely-crafted code, design and Txp

Offline

#15 2018-12-28 08:56:50

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,375
Website GitHub Mastodon Twitter

Re: flat scripts in 4.7.2

Hi Stef, Unlike tags though this tip is about functionality. I guess that it could be added to FAQ but as features are becoming somewhat cryptic (see Example 8 I added a few weeks ago), the FAQ are becoming slightly irrelevant.

Thinking aloud again

What I would like to see developing is a user manual, presenting screen-shots of the installation process (starting with (s)ftp) to the use of tags when designing complex non blog and gallery sites. At the moment the vanilla front end template is excellent for blogs but it does not demonstrate the power and flexibility of txp as a CMS.

Furthermore, as txp is now and for some time has been a mature software, a tutorial on migrating large sites should also be included. Over 3 and a half years ago, I posted this one on textpattern.tips, but maybe a more generic version is needed.

In addition to the above chapters could include

  • Migrating a site from another blog system to txp (wp, joomla, etc)
  • txp concept basics (this could be a basic tutorial linking to the tag reference)
  • A step by step tutorial on the multi-site functionality (admittedly I have not used this as I still have no idea about what to expect)
  • Creating plugins (there is some documentation on this but is it up to date?)
  • Creating short-codes (There are numerous examples in the forum which I could collect, collate and sanitise).

All the above (except the plugin creation) should be geared for designers and hobbyists as I believe that it is the userbase we need to target for.


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

Board footer

Powered by FluxBB