TYPO3 lib HTML and TEXT code - global-variables

I want to show i LIB on my page, but it will be showed on the page all my sits, but not the site with Uid = 3
So in my main TS i have, this
[globalVar = TSFE:id <> 3]
.....
[end]
My question is now, how do i setup a lib, thats have some text and HTML content in it..
Lets say that its this i want to show
<div class="ProductListTitle_style1">
my text my text
<p> text text text... </p>
</div>

You can use lib = COA in combination with TEXT and IMAGE
lib.b = COA
lib.b {
wrap = <div class="ProductListTitle_style1">|</div>
10 = TEXT
10.value = my text my text
20 = TEXT
20.value = text text text...
20.wrap = <p>|</p>
30 = IMAGE
30.file = path/to/file.png
30.altText = My image
30.width = 300
}
Before TYPO3 6.0 you could use lib = HTML.
lib.a = HTML
lib.a.value (
<div class="ProductListTitle_style1">
my text my text
<p> text text text... </p>
</div>
)
You can also combine the two possibilities
lib.c = COA
lib.c {
wrap = <div class="ProductListTitle_style1">|</div>
10 = TEXT
10.value = my text my text
20 = HTML
20.value = <p> text text text... </p>
}

Just for clarification: In TYPO3 4.5+, the Content Objects TEXT and HTML have the same functionality. So you can of course put HTML tags in a TEXT object:
lib.something = TEXT
lib.something.value = <p>My Text</p>
Since both objects could do the same since TYPO3 4.5, the HTML cObject was deprecated and removed in 6.0.
As for Thomas question about COA: A COA is a "content object array" and thus an array of content elements. A COA is used when more than one content needs to be combined in one TypoScript object. So if you just have one object (as in my example above), you don't need a COA, but if you have more than one content, use it (as in hildende's first example).

Related

Add a footer on Migradoc last page

I need to add a footer on the MigraDoc.
The following code adds footer to all the pages.
The page has a header which needs to appear on each page.
Document document = new Document();
PdfDocumentRenderer pdfRenderer = new PdfDocumentRenderer(false);
Section HeaderSection = document.AddSection();
HeaderSection.PageSetup.DifferentFirstPageHeaderFooter = false;
MigraDoc.DocumentObjectModel.Shapes.Image image = HeaderSection.Headers.Primary.AddImage("../images/logo.jpg");
image.Height = new Unit(65);
image.Width = new Unit(150);
image.LockAspectRatio = false;
image.RelativeVertical = RelativeVertical.Line;
image.RelativeHorizontal = RelativeHorizontal.Margin;
Paragraph ParaHead1 = HeaderSection.AddParagraph();
Parahead1.AddFormattedText("..dfg");
Table table = HeaderSection.Footers.Primary.AddTable();
table.Borders.Width = 0;
Column column = table.AddColumn();
column.Width =Unit.FromPoint(300);
column.Format.Alignment = ParagraphAlignment.Left;
Column column1 = table.AddColumn();
column1.Width = Unit.FromPoint(200);
column1.Format.Alignment = ParagraphAlignment.Left;
Row row = table.AddRow();
Cell cell = row.Cells[0];
cell.AddParagraph("Regards,");
cell = row.Cells[1];
Paragraph para1 = cell.AddParagraph();
para1.AddFormattedText("Support Team");
I need the footer table to appear only on the last page.
I don't want add to add the last paragraph as the table as the footer as that will cause the footer to appear just appear the text.
The content on the page is dynamic.
You cannot use the MigraDoc footers for a footer on the last page only.
To achieve this effect, you have to add the text to the main body - or draw the footer later using PDFsharp.
You can use a TextFrame to have the footer at a fixed location, but you must take care that the TextFrame will not overlap with other main body content.
To answer the question from the comment:
To have the "footer" directly below the content, just add it to the main body in any form you like (table, paragraph, ...)
To have the footer at an absolute position (e.g. using a TextFrame): I recommend adding an empty dummy paragraph to the main body text (if needed) to make sure the footer does not overlap with the main body; the height of the dummy paragraph will be the height of the footer that overlaps with the main body area of the document
The approach I used was to add a flag to PageSetup within a Section.
The flag tells the engine to replace last page header and footer with the ones specified by the LastPageHeader and LastPageFooter keywords.
This is an example of section supporting last page header and footer ( it uses a special Migradoc/xml syntax, but it's supported with the original mddl as well):
<Section>
<Attributes>
<PageSetup PageHeight="29.7cm" PageWidth="21cm" Orientation="Portrait" DifferentLastPageHeaderFooter="true"/>
</Attributes>
<LastPageHeader>
....
</LastPageHeader>
<LastPageFooter>
....
</LastPageFooter>
</Section>
A fork supporting this functionality is available here: https://github.com/emazv72/MigraDoc
Note that LastPageHeader and LastPageFooter only work with PDF, not with RTF.

Setting spaces between mdl grids

I have recently learnt material design lite
I am using MDL grids in my html page to make three uniform divisions in a single row.
<div class = "mdl-grid" >
<div class = " mdl-cell mdl-cell--4-col">
some text
</div>
<div class = " mdl-cell mdl-cell--4-col">
some another text
</div>
<div class = " mdl-cell mdl-cell--4-col">
more text
</div>
</div>
But in second division, Instead of adding some text, I want to let the division be empty .That is only left(first div) and right(third div) divisions are populated with some text but the middle one (second div) remains empty space.
How can we do this using mdl?
PS: We can use margin property and delete the middle division.But I want to do this in MDL way.

div with overflow on the left and left aligned showing the end of the text

trying to set up css doing the following:
Imagine we have two equal parallel divs with text in it:
<div class="xy">Example</div>
<div class="xy">This.is.a.example.of.a.long.Text</div>
The divs are wider than "Example" but less wide than "This.is.a.example.of.a.long.Text".
Now I want to see these texts left-aligned, so that the odd space is behind "Example" on the ride side.
But i also want to use
text-overflow:ellipsis
with the longer text in a way that I will see the end of the text.
So it should look like:
"Example "
"...ample.of.a.long.Text"
How do I do this?
I was just curious to your question and give it a try in java script as follows,
Demo
var maxChar = 20,
dots = '. . . ',
toTrim = $('.toTrim'),
toTrimLength = toTrim.text().length,
getChar = toTrimLength - maxChar;
if(toTrimLength > maxChar){
var newString = dots + toTrim.text().slice(getChar)
toTrim.text(newString);
}
I guess you still need to modify this to suite your requirement.
Also add the same string in title attr to see full text when hovering and if you want to do it even better. change text-overflow on :hover
this article will help you http://html5hub.com/ellipse-my-text/#i.6k1nyg11zqdiar

Convert HTML Email into plain text, is it possible to add colour / style

We currently have a bad situation where I need to change HTML Body content from a CMS and convert it to plain text so it can go into the body of an emailto.
private static string StripHtmlToAscii(string mergeEmailBody)
{
var asciiEmailBody = mergeEmailBody;
asciiEmailBody = asciiEmailBody.Replace("<br />", "%0D%0A").Replace("<br/>", "%0D%0A").Replace("+", "%20").Replace(" ", "%20").Replace("<p>", "").Replace("</p>", "%0D%0A%0D%0A").Replace("<br>", "%0D%0A");
return asciiEmailBody;
}
See above..
I am wondering is it possible to add style like bold or colour to a plain text email ?
No, plain text is plain text, it will only accept text. The only way you can add colour is by sending an HTML email

In actionscript 3 how can I edit a textArea after applying a styleSheet?

Here is a portion of my code:
var styles:String = ".keyword{color: #ff0000;} .comment{color: #00ff00;}";
var myStyleSheet:StyleSheet = new StyleSheet();
myStyleSheet.parseCSS(styles);
myTextArea.htmlText = '<span class = "keyword"> red </span> uncolored <span class = "comment"> green text</span>';
Everything is fine till this point, i can edit my text, of course everything is showed in black, and the html-tags are ignored. But when I put this code in myTextArea.styleSheet = myStyleSheet;
my text will be colored as i want it to be, but the textArea will become uneditable (no blinking pointer, no reaction on keyboard press).
After each keyboard-press (or if the time between two key-presses is bigger than x milliseconds ) i will re-render the textArea.text and append the <span class = "keyword"> where needed </span> tags and put it into the textArea.htmlText, but can't seem to figure it out how to do it when style is applied.
Sadly enough css and text input are incompatible. The only workaround is to use TextFormat instead. Sorry for being disappointing...

Resources