Displaying encoded and non-encoded data

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Displaying encoded and non-encoded data

Patrick Larkin-2
I'm really struggling with this and always have.

I need to two things with data pulled from MySQL:
1. Display links as HTML and not as encoded symbols
2. Display line breaks in multiple paragraph text

Both seem mutually exclusive.  :)

Here is a segment of code with lots of extra stuff taken out.  As an example, the contents of the "storyText" field is

<a href="http://www.google.com">Google</a>  (In database not encoded)

-------------

records(-InlineName='MyInline');

var('story') = field('StoryText');
var('story')->(Trim);

'<div class="homepage_2_alert">';
'<p>' + Encode_Break(var('story')) + '</p>';
'</div>';

/records;

-------------

You'd think this would work.  It shows encoded HTML and not a link.  If I take out the "Encode_Break", it shows a link but then loses all of the paragraph breaks.  I tried adding -EncodeNone in different places but I just seem to break everything.  Can someone help?





Patrick Larkin
Developer/Administrator of Special Systems / Webmaster
Bethlehem Area School District




#############################################################
This message is sent to you because you are subscribed to
  the mailing list Lasso
[hidden email]
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: Displaying encoded and non-encoded data

Marc Vos
How about:

$story = String_Replace($story, -find='\n', -replace='<br>');

- -
Marc

Sent from my iPhone

On 8 jan. 2013, at 18:19, Patrick Larkin <[hidden email]> wrote:

> I'm really struggling with this and always have.
>
> I need to two things with data pulled from MySQL:
> 1. Display links as HTML and not as encoded symbols
> 2. Display line breaks in multiple paragraph text
>
> Both seem mutually exclusive.  :)
>
> Here is a segment of code with lots of extra stuff taken out.  As an example, the contents of the "storyText" field is
>
> <a href="http://www.google.com">Google</a>  (In database not encoded)
>
> -------------
>
> records(-InlineName='MyInline');
>
> var('story') = field('StoryText');
> var('story')->(Trim);
>
> '<div class="homepage_2_alert">';
> '<p>' + Encode_Break(var('story')) + '</p>';
> '</div>';
>
> /records;
>
> -------------
>
> You'd think this would work.  It shows encoded HTML and not a link.  If I take out the "Encode_Break", it shows a link but then loses all of the paragraph breaks.  I tried adding -EncodeNone in different places but I just seem to break everything.  Can someone help?
>
>
>
>
>
> Patrick Larkin
> Developer/Administrator of Special Systems / Webmaster
> Bethlehem Area School District
>
>
>
>
> #############################################################
> This message is sent to you because you are subscribed to
>  the mailing list Lasso
> [hidden email]
> To unsubscribe, E-mail to: <[hidden email]>
> Send administrative queries to  <[hidden email]>
#############################################################
This message is sent to you because you are subscribed to
  the mailing list Lasso
[hidden email]
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: Displaying encoded and non-encoded data

Patrick Larkin-2
Thanks.  That seems to have done the trick.

Trying to use the built in tags and arguments too much I guess.  :)


On Jan 8, 2013, at 12:48 PM, Marc Vos wrote:

> How about:
>
> $story = String_Replace($story, -find='\n', -replace='<br>');
>
> - -
> Marc

#############################################################
This message is sent to you because you are subscribed to
  the mailing list Lasso
[hidden email]
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>