views:

1089

answers:

3

I have some content, that I want to appear on multiple pages of my typo3 site. I could just insert this into the template, but I also want that content to be editable in the Rich Text Editor.

So I had the idea of creating a hidden page, but I don't know how to insert this content into a template.

Does it require the select typoscript statement?

Also, as a follow up question, can I add something to say, only include pages that have this page id as their immediate parent in the page hierarchy.

+1  A: 

From Include typo3 content elements on every page:

temp.foo = RECORDS
temp.foo {
    tables = tt_content
    source = ID # Enter the object's ID here
}

Note the ID is the content record ID, not the page ID.

But that doesn't answer the question of how to only include pages/records with a certain parent.

Tom Viner
+1  A: 

I didn't quite get the second question. If you want to include some record only to pages under some other page, then this will obviously work:

[PIDinRootline = pages-uid, pages-uid, ...]
temp.foo = RECORDS
temp.foo {
    tables = tt_content
    source = ID # Enter the object's ID here
}
[end]

On the other hand, if you want to include all records from pages, being children of some other page, then try something like:

1 = CONTENT
  1.table = tt_content
  1.select {
    pidInList = parent-uid
  }

Don't know if I got you right though. Dmitri.

Dmitri
A: 

You can set up a hidden page and then "import" the content elements on a given page via typoscript on the pages (or the entire page tree below) as needed. The "trick" is to use the colPos with the select-statement. With this you can even put multiple (different) content elements in one (hidden) page that show up on different pages (depending on the setting of the column they are "in".

Example:

  • Create a hidden (or system) page (here example-pageid = $PID_STATIC)
  • Create a content element on this page (text)
  • Edit this content element to be shown on the right column (right equals colPos=2)
  • Put the following typoscript into the template on which you want the content element to be shown. You can set the pid (pageId) in the constants via PID_STATIC or "hardcode" it into the typoscript.

.

lib.aditionalcontent = COA
lib.aditionalcontent { 
   10 = CONTENT
    10 {
        table = tt_content
        select.where = colPos = 2
        select.orderBy = sorting
        select.pidInList = {$PID_STATIC}
    }
  • Add the element lib.aditionalcontent into your template where the content should be shown. For example:

.

page.10 = TEMPLATE
page.10.template = FILE
page.10.template.file = fileadmin/maintemplate.htm
page.10.workOnSubpart = DOCUMENT_BODY
page.10.marks.ADITIONAL_CONTENT < lib.aditionalcontent

.

Watch out, that you set the colPos according to the column that you have set the content element into, otherwise it just will not show.

You can use different columns to do this for different content that has to show up/should not show up on a particular page.

This also works with sytemfolders and non-hidden pages.

If you use TemplaVoila, this should also work although you have to switch to the listview to see and set the colum for the content element (if not hidden for this non-admin user).

To find out which colPos-number is which position of the column go to the phpMyAdmin and search for the field "colPos" in the *tt_content* table.

lagopixel