Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2008-06-26 13:36:38

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

Re: When creating a site with TXP, I rarely find myself...

I’ve never developed one: How can I (or somebody using a multilingual site) profit from applying txp:text?


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

Offline

#14 2008-06-26 14:43:33

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: When creating a site with TXP, I rarely find myself...

You could add strings to the language file for often used – longish – text items and call them with <txp:text />.
For example if you tend to use this is the truth, the whole truth and nothing but the truth a lot, you add this string

truth => this is the truth, the whole truth and nothing but the truth

and wherever you want it to appear call it with

<txp:text item="truth" />

;)
(You’d have to load the language file into the db of course, or directly add it to the db.)

The advantage is indeed more obvious when using the MLP pack.

Offline

#15 2008-06-26 15:07:13

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

Re: When creating a site with TXP, I rarely find myself...

Ah, alright, I see! Will keep this in mind, can come in handy :)

Does it also have access to other text strings?

Edit BTW, a smart way to change truths really quickly and globally ;))

Last edited by uli (2008-06-26 15:09:00)


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

Offline

#16 2008-06-26 15:23:46

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: When creating a site with TXP, I rarely find myself...

uli wrote:

Ah, alright, I see! Will keep this in mind, can come in handy :)

To be honest, I’ve never found a use for it ;)

Does it also have access to other text strings?

As far as I know you can use all strings in the lang table: e.g. <txp:text item="need_details" /> will display Inevitably, we need a few details :)

BTW, a smart way to change truths really quickly and globally ;))

Hmm… I’m beginning to see whole new possibilities. Change your mind site wide…

political_preference =>

Offline

#17 2008-06-26 15:39:23

masa
Member
From: Asturias, Spain
Registered: 2005-11-25
Posts: 1,091

Re: When creating a site with TXP, I rarely find myself...

I’m still puzzled. I’d rather use a form for this kind of snippet, as forms can be easily edited from the backend.

Textbook doesn’t even mention where the strings are stored.

Offline

#18 2008-06-26 15:50:31

jm
Plugin Author
From: Missoula, MT
Registered: 2005-11-27
Posts: 1,746
Website

Re: When creating a site with TXP, I rarely find myself...

masa wrote:

Textbook doesn’t even mention where the strings are stored.

It uses the language file (or if you push your own strings onto $textarray) e.g., <txp:text item="tab_presentation"/>.

Offline

#19 2008-06-26 15:54:00

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

Re: When creating a site with TXP, I rarely find myself...

Els wrote:

political_preference =>

Don’t even need to leave values blank intentionally, you can change everything in the wink of an eye ;)

To be honest, I’ve never found a use for it ;)

I’m always good for mis-using “intended uses”. My mind’s spinning wildly: Put paths to images in the values (e.g. for diagrams), and you have language specific illustrations. Not that I’ve ever needed this, I just store such things in the depths of my brain cells. Mere luxury ;) But can come in handy (mantra against forgetfulness ;)


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

Offline

#20 2008-06-26 16:06:31

thebombsite
Archived Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

Re: When creating a site with TXP, I rarely find myself...

Brain cells? Are we supposed to have those things? Don’t tell the politicians about this. ;)


Stuart

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

#21 2008-06-26 16:44:24

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

Re: When creating a site with TXP, I rarely find myself...

jm wrote:

It uses the language file (or if you push your own strings onto $textarray) e.g., <txp:text item="tab_presentation"/>.

I’ve a gut feeling this can’t be the intended use, in terms of “originally intended”. As Martin states, what you and Els/Steve have mentioned here isn’t even documented.

I’m wondering at all because I’ve found this snippet <txp:section_list default_title='<txp:text item="home" />' include_default="1" wraptag="ul" break="li"> at a highly official place, with the shiny (almost unused) txp:text tag right in the middle. … Why that?


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

Offline

#22 2008-06-26 17:14:51

thebombsite
Archived Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

Re: When creating a site with TXP, I rarely find myself...

That may be a simple example of the new tag parser in action allowing tags within tags.


Stuart

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

#23 2008-06-26 17:19:58

net-carver
Archived Plugin Author
Registered: 2006-03-08
Posts: 1,648

Re: When creating a site with TXP, I rarely find myself...

Els wrote:

As far as I know you can use all strings in the lang table: e.g. <txp:text item="need_details" /> will display Inevitably, we need a few details :)

Not quite. On the public face of your site, only those strings from the txp_langs table that are marked as public or common will get loaded. If you try outputting an admin-side or setup string you’ll just get its name, not the associated text.

Uli

You’re right about the possibility of using this for language-specific stuff. That’s basically what the MLP Pack does with its concept of snippets.


Steve

Offline

#24 2008-06-26 17:26:21

jm
Plugin Author
From: Missoula, MT
Registered: 2005-11-27
Posts: 1,746
Website

Re: When creating a site with TXP, I rarely find myself...

uli wrote:

I’ve a gut feeling this can’t be the intended use, in terms of “originally intended”. As Martin states, what you and Els/Steve have mentioned here isn’t even documented.

The text function feeds the item value into gTxt(), which is used to output values from the lang table ($textarray). gTxt() doesn’t care if item is a valid key in $textarray though, so it’ll output whatever you feed it. (As far as I can tell at least – net-carver is the gTxt() pro around here!)

Offline

Board footer

Powered by FluxBB