PDA

View Full Version : getting extra  


ids
01-06-07, 04:37 AM
Using this code:


<MvASSIGN NAME="l.link" VALUE="{l.sessionurl$'Screen='$g.Screen $'&'$'Store_Code='$g.Store_Code$'&'$'month='$g.month$'&day='$padl(l.this_day,2,'0')$'&year='$g.year}">
<MvASSIGN NAME="l.this_day_format" VALUE="{'<a href ="'$l.link$'"><font color="white"><b>'$l.this_day$'</b></font></a>'}">


When I place the output, the html looks something like:


<td bgcolor="" valign="bottom" width="2" height="1">
<a href = "http://127.0.0.1:8000/Merchant2/merchant.mv?Screen=OSEL&Store_Code=mystore&month=1&day=02&year=2007">2</a>
&nbsp;
</td>


The problem is the &nbsp; Please correct me, but I've concluded that Empressa (only Mia so far) is inserting this after the link. It's causing alignment issues in cells. like in the rendered html, the 2 doesn't actually appear with bottom alignment, it is, but the &nbsp; is pushing the text in cell up. Using a text editor, If you manually remove &nbsp; the alignment is perfect.

If I use in the function:
STANDARDOUTPUTLEVEL="html,compresswhitespace"> it doesn't appear. That would be fine if there weren't text in the actual document. So, this is my only option for the app:
STANDARDOUTPUTLEVEL="text,html,compresswhitespace">

I need to precisely control formatting in the cell. Is there any way to prevent the extra &nbsp; from being added to the rendered html?

BTW: I have tried using CSS but that hasn't helped so far. I've only tried with formatting attributes.

TIA

Scott

Scott McCollough
01-08-07, 07:41 PM
It would be helpful if you included more of the surrounding code; to get a bigger picture. In particular where the <td> and </td> are being generated.

I know from experience that you can have similar issues if the <a href> and </a> appear on separate lines in your code. It's because of word wrapping (or more to the point un-word wrapping) built into the browser.

If you have a long string of text to print, most people will put hard returns after x amount of characters so that the developer can read it all without scrolling. Browsers will automatically insert an extra space at the end of the line so that the last word from line one and the first word from line two do not merge when displayed. So in the case of links, if you have the </a> on a separate line, you will get a space at the end of the text for your link and it will look like this:

This is my link

This can also effect images.

Without seeing the surrounding code I can only guess, but you might try moving the </td> to the same line you output the link.

/Scott

ids
01-09-07, 07:12 AM
Thanks for the reply Scott. I wasn't sure I would get anything on this.

I can't really post the code until I sanitize a little. But I don't think it should matter. What if I had about 25 or 30 lines of code diseminating content before the </td> tag. There are many way to write the code, but maybe not in this case, I'll have to look at this again.

I'll phrase it this way, I don't think dynamically generated html from a Mivascript application should have extra tags/text/characters inserted just because tags are on different lines.

I don't have code to demonstrate the issue yet, but you seem to understand the scenario. I may be easy for you to verify this if you had some time, as I am inside of a few projects right now. I will try to create a snippet though.

Scott

Scott McCollough
01-09-07, 06:16 PM
My point wasn't that MivaScript adds the space, it's the browser itself. I don't know of a case where MivaScript adds extra characters by itself.

That's why I want to look at the surrounding code. Maybe track down what's generating the space.

/Scott

Vic - WolfPaw Computers
01-09-07, 06:25 PM
I would tend to disagree with that.

Many function returns pass a CR, LF or whitespace character after executing. I dont think it has anything to do with the browser.

I could be wrong, since I've never seen the Empresa source to know exactly how it's handling it...but seems to be that way from my experience.

Scott McCollough
01-11-07, 10:45 PM
At this point, without more code, there is not much to 'verify'. You've only shown us two MvASSIGN statements. Since the phantom space appears after you later MvEVAL this link, there are a number of ways that the extra space could have crept in.

* a later assign concatenates a space to the l.this_day_format variable
* there is a physical space in your code and STANDARDOUTPUTLEVEL="text"
* the space isn't part of the l.this_day_format variable, but from another variable. Maybe the one that holds the </td> tag (if it's a variable too).
* a completely unrelated function call that occurs between printing the link and printing the </td> inserts a space.

I realize that you can't just put up raw code without possibly revealing too much, but I'd just like more information to go on.

/Scott