Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-01-28 20:28:12

pieman
Member
From: Bristol, UK
Registered: 2005-09-22
Posts: 491
Website

strip line breaks from beginning of form outputs

Hello

I’m feeding parameters to a Flash mp3 player and I’m running into problems because the 2nd time (and subsequent times) a form is called it prepends a line break which chokes the Flash movie.

In this example, there are 3 files attached to an article, all of which which I want to feed to the player.

In my article form I’m using two different file forms (files_name and files_description) which loop through the file IDs to output the file-names first, then the corresponding file descriptions (as required by the Flash player).

<param name="FlashVars" value="mp3=<txp:upm_article_file_list form="files_name" />&amp;title=<txp:upm_article_file_list form="files_description" />&amp;height=70&amp;width=282"/>

There are no spaces or breaks in the two file forms – they contain only the relevent <txp:file_download_ /> tags. But in the output, where I need this:

<param name="FlashVars" value="mp3=legs.mp3|arms.mp3|hands.mp3|&amp;title=Legs|Arms|Hands|&amp;height=70&amp;width=282 "/>

I’m getting this instead:

<param name="FlashVars" value="mp3=legs.mp3|
arms.mp3|
hands.mp3|&amp;title=Legs|
Arms|
Hands|&amp;height=70&amp;width=282 "/>

And the player doesn’t like that. I find it strange that if there’s only one file to iterate over then no line break is generated – it only happens after first time each form is called.

The options I can see are:
  1. trim the \ns with php trim – which I’ve tried with no success (due to paltry php skills)
  2. point the Flash movie to some XML – which it is also built to handle, but which I initially presumed would be the more complicated option
  3. find a plugin / hack to strip the breaks

all suggestions gratefully received…

Stu

Offline

#2 2009-01-28 21:14:00

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,453
Website GitHub

Re: strip line breaks from beginning of form outputs

Has upm_article_file_list got a break attribute? It might be set to <br /> by default.


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

Txp Builders – finely-crafted code, design and Txp

Offline

#3 2009-01-28 21:44:39

pieman
Member
From: Bristol, UK
Registered: 2005-09-22
Posts: 491
Website

Re: strip line breaks from beginning of form outputs

It does, it is, and I hadn’t defined it, so you’d expect it to output a <br />

But in fact it doesn’t output any html element between outputs. I tried to set break="" to be sure but that didn’t affect anything.

To be clear, there isn’t any code getting in the way, just pesky line breaks. Does that make sense?

Offline

Board footer

Powered by FluxBB