Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2018-12-21 10:09:40

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

Re: Feedback to: Textpattern CMS 4.7.2 Released

Hmmm, so this is what I get

;[js]
;mediatype="application/javascript"
;title="JavaScript"
[js]
mediatype="application/javascript"
[json]
mediatype="application/json"
[svg]
mediatype="image/svg+xml"
[xml]
mediatype="application/xml"
[txt]
mediatype="text/plain"
[csv]
mediatype="text/csv"
[htm]
mediatype="text/html"
[html]
mediatype="text/html"

there seems to be a minor issue on FF as the text box does not auto-expand nor does it have any scroll bars. It corrected itself after I pressed the return button in the box.


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-21 10:21:59

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

Re: Feedback to: Textpattern CMS 4.7.2 Released

colak wrote #315667:

Hmmm, so this is what I get

That’s fine, the old preference has been converted to the new format. The first three lines are included as example. You can safely remove them and comment out the types you don’t use. You can also add new Form types as e.g.


[shortcode]
title="Short code"
;mediatype="Hardly needed but you can set it here"

there seems to be a minor issue on FF as the text box does not auto-expand nor does it have any scroll bars. It corrected itself after I pressed the return button in the box.

That’s a third-party script used for textarea auto-resizing, not our fault :-)

Offline

#15 2018-12-21 12:30:30

Pat64
Plugin Author
From: France
Registered: 2005-12-12
Posts: 1,634
GitHub Twitter

Re: Feedback to: Textpattern CMS 4.7.2 Released

Thank you Devs for this great version!

I’m sorry Oleg to be so stupid but I can’t figure out how to use this new (and very exciting) new feature…
How to use it, how to access to our ressources (set into this custom field)?


Patrick.

Github | CodePen | Codier | Simplr theme | Wait Me: a maintenance theme | [\a mi.ni.ma]: a “Low Tech” simple Blog theme.

Offline

#16 2018-12-21 13:18:35

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

Re: Feedback to: Textpattern CMS 4.7.2 Released

Pat64 wrote #315670:

how to access to our ressources (set into this custom field)?

No worries, there is much to say about it, the pophelp is probably not detailed enough.

So, suppose you have added js form type with application/javascript mediatype, intended to serve Javascript resources. Now go to Forms tab, create hello.js form of js type and save it, checking Export to disk box:

alert("Hello, world!");

This script will be accessible via two URLs:

  • path/to/site/index.php?f=hello.js will serve the parsed db version
  • path/to/theme/forms/js/hello.js will serve the unparsed flat file version

These URLs are produced by <txp:output_form form="hello.js" format="url" /> and <txp:output_form form="hello.js" format="flat.url" /> respectively.

You also have two ways of including hello.js via <script /> tag in your pages/forms/whatever:

  • <txp:output_form form="hello.js" format="script" /> (db version)
  • <txp:output_form form="hello.js" format="flat.script" /> (flat version)

The example above does not contain txp tags, so serving the flat version is preferable (faster), though not mandatory. But suppose that you need to personalize the script:

<txp:if_individual_article>
    alert("Hello, <txp:title escape />");
<txp:else />
    alert("Hello, <txp:site_name escape />!");
</txp:if_individual_article>

Then you must serve the db version, otherwise txp tags will not be parsed. In this case, you’d better call the form hello (without .js extension) to forbid the direct file access:

<txp:output_form form="hello" format="script" context="id" />

Notice context="id" attribute: it will generate an id-aware URL like ?id=123&f=hello, otherwise <txp:title /> will be undefined. You can use just context without any value to take care of all txp parameters (section, category etc).

Offline

#17 2018-12-21 17:35:53

Pat64
Plugin Author
From: France
Registered: 2005-12-12
Posts: 1,634
GitHub Twitter

Re: Feedback to: Textpattern CMS 4.7.2 Released

Okay!

What a good course ;)

I well understood. Thank you lot, Oleg.


Patrick.

Github | CodePen | Codier | Simplr theme | Wait Me: a maintenance theme | [\a mi.ni.ma]: a “Low Tech” simple Blog theme.

Offline

#18 2018-12-22 21:07:56

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

Re: Feedback to: Textpattern CMS 4.7.2 Released

I’m testing the latest release and I’m loving it!!! How can we deal with the svg files in forms so as to get valid html?

At the moment <txp:output_form form="image.svg" format="flat.image" /> does not parse an alt tag. I have tried <txp:output_form form="image.svg" format="flat.image" alt="my image" />. The parsing only shows <img src="/themes/mytheme/forms/svg/image.svg" />.

Using html directly is not an issue but it may become one when changing themes. Especially if the svg is in an article.

… Also:) does this update help us to do away with the rah_external plugin?

Last edited by colak (2018-12-22 21:26:23)


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

Offline

#19 2018-12-22 21:32:15

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

Re: Feedback to: Textpattern CMS 4.7.2 Released

colak wrote #315689:

I’m testing the latest release and I’m loving it!!! How can we deal with the svg files in forms so as to get valid html?

Like this

<img src="<txp:output_form form="image.svg" format="flat.url" />" alt="alt text" />

or format="url" if the image source contains txp tags.

… Also:) does this update help us to do away with the rah_external plugin?

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

Offline

#20 2018-12-23 08:11:11

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

Re: Feedback to: Textpattern CMS 4.7.2 Released

These are huge improvements!!! I am checking the output_form documentation and it seems that it needs a major update which I am willing to do but what formats does the tag support?


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

Offline

#21 2018-12-23 09:41:07

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,729
Website

Re: Feedback to: Textpattern CMS 4.7.2 Released

colak wrote #315692:

These are huge improvements!!!

Agreed! ?

but what formats does the tag support?

The code showing the options and sub-options is here.


TXP Builders – finely-crafted code, design and txp

Offline

#22 2018-12-23 19:21:17

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

Re: Feedback to: Textpattern CMS 4.7.2 Released

I added the attributes and I will add some examples tomorrow. What confuses me now is the options for context. I know id is one of them but I’m at loss about what else it could be except maybe what is listed here?


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

Offline

#23 2018-12-24 00:34:26

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

Re: Feedback to: Textpattern CMS 4.7.2 Released

colak wrote #315703:

I added the attributes and I will add some examples tomorrow. What confuses me now is the options for context. I know id is one of them but I’m at loss about what else it could be except maybe what is listed here?

Many thanks, Yiannis. The purpose of context attribute is to preserve txp and other context (article id, section, category, etc) in “external” resources. It is only relevant for db (not flat) served forms. The standard values are id, s, c, context, q, m, pg, p, month, author, but one can add other URL parameters if needed. For example,

<txp:output_form form="test" format="url" context="s, c" />

will generate (in messy mode) index.php?c=cat&f=test when called from index.php?c=cat&pg=2 URL, those populating <txp:category /> tag inside test form.

Offline

#24 2018-12-24 14:01:12

Pat64
Plugin Author
From: France
Registered: 2005-12-12
Posts: 1,634
GitHub Twitter

Re: Feedback to: Textpattern CMS 4.7.2 Released

…And can be useful to serve some front end AJAX process. Am I wrong, Oleg?


Patrick.

Github | CodePen | Codier | Simplr theme | Wait Me: a maintenance theme | [\a mi.ni.ma]: a “Low Tech” simple Blog theme.

Offline

Board footer

Powered by FluxBB