Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-09-08 10:17:56

juanjonavarro
Plugin Author
From: Valencia, Spain
Registered: 2005-05-16
Posts: 485
Website

jnm_wrap

<code><txp:jnm_wrap></code> wraps the content after a certain world or custom field.

Info and download

Options:

  • after = Wraps afer this word.
  • aftercustom = Wraps after the content of this custom field.
Examples:
  • <code><txp:jnm_wrap after=“is”></code>Textpattern is great<code></txp:jnm_wrap></code>
    Display “Textpattern is<code><br/></code> great”.
  • <code><txp:jnm_wrap aftercustom=“custom1”><txp:title /></txp:jnm_wrap></code>
    Display the title of the article with a br after the content of custom field “custom1”.

History:

0.1
  • Initial Release

Last edited by juanjonavarro (2014-03-25 19:12:34)

Offline

#2 2006-09-08 14:22:43

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

Re: jnm_wrap

Thanks, Juanjo, for taking care of this matter and writing the appropriate plugin!
It gives authors a certain control over the behavior of a headline at a point of time when designers don’t have it anymore. It makes customization of wrapping possible without affecting the given headline for other uses. For a newspaper-like layout, for instance, it does an important job.
I’ve been waiting for such a function.

Ah forgotten: I’ve tested it in conjunction with nhn_typotuner, which I use for textiling headlines and changing “quotation marks” to &laquo;quotation marks&raquo;, and there seem to be no interferences between them, no matter which of the two container tags is applied closer to < txp:title>.

Last edited by uli (2006-09-08 16:02:56)


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

Offline

#3 2006-09-23 18:24:13

jayrope
Plugin Author
From: Berlin
Registered: 2006-07-06
Posts: 687
Website Mastodon

Re: jnm_wrap

juanjo, this is a great plug.
i have one suggestion: would you also implement a wrapfeature according to a certain number of characters (wrap after full words, of course)
i am already thinkign how to do that, but lack the php to recognize full words (probably counting blanks in the end??)

just an idea. otherwise: awesome!


A hole turned upside down is a dome, when there’s also gravity.

Offline

#4 2006-09-25 10:07:58

juanjonavarro
Plugin Author
From: Valencia, Spain
Registered: 2005-05-16
Posts: 485
Website

Re: jnm_wrap

Do you want to insert a br after a certain number of characters? Something like an “afterchars” parameters?

Example:

Title: <code>This is the title of the article</code>

Tag: <code><txp:jnm_wrap afterchars=“9”><txp:title /></txp:jnm_wrap></code>

Result: <code>This is the<br/>title of the article</code>

Is this ok?

Offline

#5 2006-09-25 10:27:38

jayrope
Plugin Author
From: Berlin
Registered: 2006-07-06
Posts: 687
Website Mastodon

Re: jnm_wrap

juanjo, yes!
with respect to whitespaces would be perfect!
that way one can use sidebar entries for instance using the full width of it.

thanx mucho in advance!


A hole turned upside down is a dome, when there’s also gravity.

Offline

#6 2006-09-25 10:54:22

juanjonavarro
Plugin Author
From: Valencia, Spain
Registered: 2005-05-16
Posts: 485
Website

Re: jnm_wrap

jayrope, can you test this version ?

I included an “afterpos” attribute.

Offline

#7 2006-09-25 11:20:06

jayrope
Plugin Author
From: Berlin
Registered: 2006-07-06
Posts: 687
Website Mastodon

Re: jnm_wrap

junajo, muchas gracias for the fast response!
will have ot test tomorrow, though. i need to solve some server speed issues first.
will report tomorrow late afternoonish.


A hole turned upside down is a dome, when there’s also gravity.

Offline

#8 2006-09-25 13:12:23

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

Re: jnm_wrap

hi juanjo,
i found some time to test v.0.2, and it still seems to work as usual, but i had the impression that it overwrites the old version. could this have happened? I’m not quite sure as I didn’t control my plugins before installing jnm_wrap, but I use jnm_wrap commands in several of my forms and thus wouldn’t delete the plugin intentionally.

you made jnm_wrap break lines “afterpos”, i.e. you implemented something like a minlength value for a max linelength. IMO this seems to be not too self explaining. Maybe I didn’t understand jayrope’s wish above, but my consideration is, a “beforepos” or let’s call it “maxlength” might be the value that is easier to understand and to handle: treated this way a value of 65 would say “65 letters, not a single one more!”
nevertheless: good job.


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

Offline

#9 2006-09-25 14:47:05

juanjonavarro
Plugin Author
From: Valencia, Spain
Registered: 2005-05-16
Posts: 485
Website

Re: jnm_wrap

uli, when you install the new version of a plugin, it overwrites the old version, yes. If you want to reinstall the old version, you need to install it.

Do you think is better to have two attributes, “beforepos” and “afterpos”?

Offline

#10 2006-09-26 09:24:29

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

Re: jnm_wrap

juanjonavarro:

Do you think is better to have two attributes, “beforepos” and “afterpos”?

i just remarked that a beforepos can be done by limiting the element’s width. so there should be no real need for it. (request to speak retired ;) but maybe jayrope has one.

in order to keep terminology user friendly, i’d suggest naming the attribute(s) like something that is already known from (x)html/css, which would be min-/maxlength. but this is just a proposal, it is your piece of work, which i only use gratefully.


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

Offline

#11 2006-09-26 11:02:28

jayrope
Plugin Author
From: Berlin
Registered: 2006-07-06
Posts: 687
Website Mastodon

Re: jnm_wrap

hey juanjo,

v.02 gives me the following error (in 4.0.4 beta/4.0-20060831 ):

<code>tag_error <txp:jnm_wrap afterchars=“15”> -> Textpattern Notice: Unknown tag attribute: afterchars on line 582</code>

—-
afterchars or maxchars: i definately ment the amount of chars, not a length in pixels or pica or em. – that thing would be good for headlines, you know.

no hurry, though, i might look into this later myself.


A hole turned upside down is a dome, when there’s also gravity.

Offline

#12 2006-09-26 11:05:19

juanjonavarro
Plugin Author
From: Valencia, Spain
Registered: 2005-05-16
Posts: 485
Website

Re: jnm_wrap

Use “afterpos” instead.

Offline

Board footer

Powered by FluxBB