Scala - Digital Signage Software [Logo]
Languages: EnglishGermanPolishJapaneseNorwegianFrench
  Markets Products Partners Services Support About Us  
Scala Support Scala Celebrates 20 Years of Innovation and Leadership

Formatting content from database/vbs?

Thursday, 03/29/2007 -- by Jenn. Subject: Formatting content from database/vbs?

I am pulling 3 fields from a database using a vb script - article title, article date, and article body. I have an ASP page on our intranet where people are typing this info into the database.

I need to know what type of codes I can use inside the database content for line breaks. I tried "<br>" which Scala just printed out. When I hit "Enter" the database shows it as having a line break but Scala shows squares (probably unrecognized character). How can I allow people to put linebreaks in the article body so Scala knows it should jump to the next line when displaying it?

Thanks!
Jenn

Thursday, 03/29/2007 -- by Marvin Droogsma. Subject: Line breaks

Last time I had to do this, I used the following line in VBscript:

eventtext=Replace(eventtext,"{newline character}",vbNewLine)

Or try using the ^n characters when exchanging variables.

This doesn't work in textfiles though. You have to use a special piece of scalascripting for that.

Thursday, 03/29/2007 -- by Jenn. Subject: Reply

Thanks! However, the "vbNewLine" is giving me the same issue as a hard return did. It jumps to the next line but puts a square before it does. I would like to use HTML, so to explain it better: (change all square brackets to GT/LT - kept rendering the br tags - lol)

In database:
Hello[br]World

In WinScript:
sParagraph = replace(objRs("sParagraph"),"[br]",vbNewLine)

While Playing the Slides:
Hello (square)
World

I guess I am looking for something that won't give me the square but will still give me the linebreak. Ideas?

Jenn

Friday, 03/30/2007 -- by Marvin Droogsma. Subject: Square

Strange... I don't get any squares. Migth be the font or some setting. Anyway, have you tried chr(13) instead of vbnewline?
And the ^n ? (Native Scala newline char)

Friday, 03/30/2007 -- by Marvin Droogsma. Subject: Example for textfile

When using newlines in textfiles, the solution would be something like this:

In Vbscript I do this:

                         
' Create a maximum of twenty lines (adjust by demand)
' where /n should be >br<
' Varnames are in Dutch, sorry ;o)

tel=0
i=0
i=InStr(i+1,ItemTekst,"\n")
While i>0
tel=tel+1
i=InStr(i+1,ItemTekst,"\n")
Wend
For i=tel+1 To 20
ItemTekst=ItemTekst & "\n"
Next
ItemTekst=ItemTekst & " "
If Left(ItemTekst,2)="\n" Then
ItemTekst=" " & ItemTekst
End If

Now you have a text or variable with a maximum of twenty newlines.
In Scala we have to convert these newlines characters to the internal newline. We do this with the following script:
(adjust to nr of lines you want)

      Sequence:
      textvar1 = left(line3,search(line3,1,"\n")-1)+"^n"+right(line3,length(line3)-search(line3,1,"\n")-1);
      textvar1 = left(textvar1,search(textvar1,1,"\n")-1)+"^n"+right(textvar1,length(textvar1)-search(textvar1,1,"\n")-1);
      textvar1 = left(textvar1,search(textvar1,1,"\n")-1)+"^n"+right(textvar1,length(textvar1)-search(textvar1,1,"\n")-1);
      textvar1 = left(textvar1,search(textvar1,1,"\n")-1)+"^n"+right(textvar1,length(textvar1)-search(textvar1,1,"\n")-1);
      textvar1 = left(textvar1,search(textvar1,1,"\n")-1)+"^n"+right(textvar1,length(textvar1)-search(textvar1,1,"\n")-1);
      textvar1 = left(textvar1,search(textvar1,1,"\n")-1)+"^n"+right(textvar1,length(textvar1)-search(textvar1,1,"\n")-1);
      textvar1 = left(textvar1,search(textvar1,1,"\n")-1)+"^n"+right(textvar1,length(textvar1)-search(textvar1,1,"\n")-1);
      textvar1 = left(textvar1,search(textvar1,1,"\n")-1)+"^n"+right(textvar1,length(textvar1)-search(textvar1,1,"\n")-1);
      textvar1 = left(textvar1,search(textvar1,1,"\n")-1)+"^n"+right(textvar1,length(textvar1)-search(textvar1,1,"\n")-1);
      textvar1 = left(textvar1,search(textvar1,1,"\n")-1)+"^n"+right(textvar1,length(textvar1)-search(textvar1,1,"\n")-1);
      textvar1 = left(textvar1,search(textvar1,1,"\n")-1)+"^n"+right(textvar1,length(textvar1)-search(textvar1,1,"\n")-1);
      textvar1 = left(textvar1,search(textvar1,1,"\n")-1)+"^n"+right(textvar1,length(textvar1)-search(textvar1,1,"\n")-1);
      textvar1 = left(textvar1,search(textvar1,1,"\n")-1)+"^n"+right(textvar1,length(textvar1)-search(textvar1,1,"\n")-1);
      textvar1 = left(textvar1,search(textvar1,1,"\n")-1)+"^n"+right(textvar1,length(textvar1)-search(textvar1,1,"\n")-1);
      textvar1 = left(textvar1,search(textvar1,1,"\n")-1)+"^n"+right(textvar1,length(textvar1)-search(textvar1,1,"\n")-1);
      textvar1 = left(textvar1,search(textvar1,1,"\n")-1)+"^n"+right(textvar1,length(textvar1)-search(textvar1,1,"\n")-1);
      textvar1 = left(textvar1,search(textvar1,1,"\n")-1)+"^n"+right(textvar1,length(textvar1)-search(textvar1,1,"\n")-1);
      textvar1 = left(textvar1,search(textvar1,1,"\n")-1)+"^n"+right(textvar1,length(textvar1)-search(textvar1,1,"\n")-1);
      textvar1 = left(textvar1,search(textvar1,1,"\n")-1)+"^n"+right(textvar1,length(textvar1)-search(textvar1,1,"\n")-1);
      textvar1 = left(textvar1,search(textvar1,1,"\n")-1)+"^n"+right(textvar1,length(textvar1)-search(textvar1,1,"\n")-1);

Hope this might help you out someday.

Friday, 03/30/2007 -- by Marvin Droogsma. Subject: Solution

Sorry, I made a mistake. Use ^n in a variable (I forgot the n) and then it works just fine. I shouldn't be posting after midnight after enjoying a fine wine... I just lead you astray... ;o)

Friday, 03/30/2007 -- by Jenn. Subject: Aha!

I couldn't get ^n to work - using it without quote in the replace funciton caused a VB error and using it with quotes in the replace function just stuck the ^n and part of my text.

However, the chr(13) worked - thank you so much!

Friday, 03/30/2007 -- by Jenn. Subject: Are there other formatting codes?

Does scala have its own codes (like the ^n mentioned) that I can use inside content to do further formatting - like bold, italics, font sizing, font colors?

I would love to allow people to format their text going into the db using HTML tags then when I pull it out for Scala I could replace those tags with whatever Scala uses to do the same thing. Possible or pipe dream?

Jenn

Friday, 03/30/2007 -- by Marvin Droogsma. Subject: Html

Oh sure you can! But as far as I know only in a crawl...
Download this example (for IC3)
http://www.scala.com/advancedscripting/infochannel3/CrawlStyles.zip

I'll look through my docs to try and find an easy way to use this on normal text.

Marvin


Back: Conditional Branching not working after 1st time

   Discussions 2005 Index   
(Page 70 of 230)

Next: April Fool Joke Gone didn't succeed...

Additional Information
Request DVD - Concepts and demo
Contact Scala Sales
Search