Code Monkey home page Code Monkey logo

Comments (6)

mojojuju avatar mojojuju commented on June 9, 2024

You can create a typoscript object which can then be called from a modified template to show the 3 most recent news items in the footer..

edit: you can actually use the typoscript_code extension to put the following in a content-element in one of the footer columns of your web site.

The following example shows the three most recent news items:

temp.latest3news < tt_content.menu.20.news
temp.latest3news.special.value >
temp.latest3news.special.value = 123
temp.latest3news.1.alternativeSortingField = uid DESC
temp.latest3news.maxItems = 3

Replace "123" with the page that has your news items.

from bootstrap_package.

benjaminkott avatar benjaminkott commented on June 9, 2024

I must agree that the current news example is quite complex if you dont have advanced knowledge on typoscript. Its maybe a good idea to provide a more simple example like show topnews xxx.

I will provide a second special menu with more simple rendering that will fit your needs that is easier to understand

from bootstrap_package.

tpbillund avatar tpbillund commented on June 9, 2024

Hi benjaminkott

If i have a page and I want to add a menu from the Base.ts file CTYPE: Menu, but I need that one in the Base.ts for another page and then i need to make some changes to the other menu.

How can I add a "Special Menus" -> "Display subpagesas News Entries" and then get it to use another copy of the CTYPE: MENU ? where du i place the new menu (under the main CTYPE: MENU in the base.ts fil).

What i want to copy and changes is, this code but i need to make two, bc. I have another place where I need a "Special Menus" -> "Display subpagesas News Entries" but with another layout.

#####################

CTYPE: MENU

#####################
tt_content.menu.20 {
news < .default
news {
maxItems = {$page.theme.news.pagination.itemsperpage}
begin.stdWrap.cObject = COA
begin.stdWrap.cObject {
5 = LOAD_REGISTER
5 {
paginateCounter.cObject = CONTENT
paginateCounter.cObject {
table = pages
select {
pidInList.field = pages
where.insertData = 1
selectFields = COUNT() AS counter
}
renderObj = TEXT
renderObj {
field = counter
wrap = |
}
}
paginateMaxPage.cObject = TEXT
paginateMaxPage.cObject {
data = register:paginateCounter
stdWrap.wrap = |/{$page.theme.news.pagination.itemsperpage}
stdWrap.wrap.insertData = 1
prioriCalc = 1
round.roundType = ceil
round.decimals = 0
}
paginateMaxPageAdd.cObject = TEXT
paginateMaxPageAdd.cObject {
data = register:paginateMaxPage
stdWrap.wrap = |+1
stdWrap.insertData = 1
prioriCalc = 1
}
paginateCurrentPage.cObject = TEXT
paginateCurrentPage.cObject {
data = GP:page
override = 1
override.if {
value.data = GP:page
isLessThan = 0
isGreaterThan.data = register:paginateMaxPageAdd
negate = 1
}
}
paginateStart.cObject = TEXT
paginateStart.cObject {
data = register:paginateCurrentPage
stdWrap.wrap = (|-1)
{$page.theme.news.pagination.itemsperpage}
stdWrap.insertData = 1
prioriCalc = 1
}
paginatePreviousPage.cObject = TEXT
paginatePreviousPage.cObject {
data = register:paginateCurrentPage
stdWrap.wrap = |-1
stdWrap.wrap {
override = |
override.if {
value = 1
equals.data = register:paginateCurrentPage
}
}
prioriCalc = intval
}
paginateNextPage.cObject = TEXT
paginateNextPage.cObject {
data = register:paginateCurrentPage
stdWrap.wrap = |+1
stdWrap.wrap {
override = |
override.if {
value.data = register:paginateMaxPage
equals.data = register:paginateCurrentPage
}
}
prioriCalc = intval
}
}
30 = TEXT
30 {
data = register:paginateStart
}
}
special = directory
stdWrap {
prepend >
outerWrap = |
append = COA
append {
10 = COA
10 {
##################
## PREVIOUS BTN ##
##################
10 = COA
10 {
10 = COA
10 {
10 = TEXT
10.value = <li
20 = TEXT
20 {
value = disabled
noTrimWrap = | class="|"|
if {
value.data = register:paginateCurrentPage
equals = 1
}
}
30 = TEXT
30.value = >
}
20 = TEXT
20 {
value = «
typolink {
parameter.data = page:uid
additionalParams = &page={register:paginatePreviousPage}
additionalParams.insertData = 1
}
}
30 = TEXT
30.value =
}
###########
## PAGES ##
###########
20 = TEXT
20 {
value =
split {
token = ,
cObjNum = 1
min.stdWrap.cObject = COA
min.stdWrap.cObject {
10 = TEXT
10 {
data = register:paginateMaxPage
}
}
1 {
5 = LOAD_REGISTER
5 {
currPageLink.cObject = TEXT
currPageLink.cObject {
data = register:SPLIT_COUNT
stdWrap.wrap = |+1
prioriCalc = intval
}
}
10 = COA
10 {
10 = TEXT
10.value = <li
20 = TEXT
20 {
value = active
noTrimWrap = | class="|"|
if {
value.data = register:currPageLink
equals.data = register:paginateCurrentPage
}
}
30 = TEXT
30.value = >
}
20 = TEXT
20 {
data = register:currPageLink
typolink {
parameter.data = page:uid
additionalParams = &page={register:currPageLink}
additionalParams {
insertData = 1
}
}
}
30 = TEXT
30.value =
}
}
}
##############
## NEXT BTN ##
##############
30 < .10
30 {
10.20.if.value.data = register:paginateMaxPage
10.20.if.equals.data = register:paginateCurrentPage
20.value = »
20.typolink.additionalParams = &page={register:paginateNextPage}
}
wrap =


    |

if {
value = {$page.theme.news.pagination.itemsperpage}
value.insertData = 1
isGreaterThan.data = register:paginateCounter
}
}

        }
    }
    1 {
        alternativeSortingField=starttime DESC
        NO {
            wrapItemAndSub = <article class="news-item">|</article> |*| <article class="news-item">|</article>  |*| <article class="news-item">|</article>
            doNotLinkIt = 1
            doNotShowLink = 1
            stdWrap2 {
                cObject < tt_content.textpic
                cObject {
                    10.if.isLessThan.field >
                    10.if.isLessThan = {$page.theme.news.list.imageorient}
                    10.10 = < lib.newsheader
                    20 < tt_content.image.20
                    20 {
                        preRenderRegisters {
                            allImageCaptions.cObject {
                                references {
                                    table = pages
                                    fieldName = media
                                }
                            }
                        }
                        addClassesCol.override.cObject.10.key.field >
                        addClassesCol.override.cObject.10.key = {$page.theme.news.list.imagecols}
                        addClassesCol.override.if.isGreaterThan.field >
                        addClassesCol.override.if.isGreaterThan = {$page.theme.news.list.imagecols}
                        layout {
                            key.field >
                            key = {$page.theme.news.list.imageorient}
                            25.override = <div class="image-header-{$page.theme.news.list.header_layout} image-beside-right image-beside###CLASSES###">###IMAGES######TEXT###</div>
                            25.override.if.isTrue.field = title
                            26.override = <div class="image-header-{$page.theme.news.list.header_layout} image-beside-left image-beside###CLASSES###">###IMAGES######TEXT###</div>
                            26.override.if.isTrue.field = title
                        }
                        textPos.field >
                        textPos = {$page.theme.news.list.imageorient}
                        maxW = {$page.theme.news.list.maxW}
                        maxWInText = {$page.theme.news.list.maxWInText}
                        imgList.cObject.references < tt_content.menu.20.news.1.NO.stdWrap2.cObject.20.preRenderRegisters.allImageCaptions.cObject.references
                        text < tt_content.textpic.20.text
                        text {
                            10 {
                                if.isGreaterThan.field >
                                if.isGreaterThan = {$page.theme.news.list.imageorient}
                                10 = < lib.newsheader
                            }
                            20.field = abstract
                            20.editIcons >
                        }
                    }
                }
            }
        }
    }
}

}

from bootstrap_package.

brrrrrrrt avatar brrrrrrrt commented on June 9, 2024

the following adds a Menutype labeled Display 3 latest subpages as news entries in the Backend, in the Frontend you get a Bootstrap row with 3 columns containing the 3 latest News (see warpItemAndSub = ... col-md-4). If you change maxItems to 4, you need to adjust wrapItemAndSub to use col-md-3. With 5 Columns on a 12-Grid maybe a bit trickier ;)

first you need to include this to your TS Setup:

#####################
#### CTYPE: MENU ####
#####################
tt_content.menu.20 {
    news3 < .default
    news3 {
        maxItems = 3
        special = directory
        stdWrap {
            prepend >
            outerWrap = |
        }
        1 {
            alternativeSortingField=starttime DESC
            NO {
                wrapItemAndSub = <div class="row"><div class="col-md-4">|</div> |*| <div class="col-md-4">|</div>  |*| <div class="col-md-4">|</div></div><hr>
                doNotLinkIt = 1
                doNotShowLink = 1
                stdWrap2 {
                    cObject < tt_content.textpic
                    cObject {
                        10.if.isLessThan.field >
                        10.if.isLessThan = {$page.theme.news.list.imageorient}
                        10.10 = < lib.newsheader
                        20 < tt_content.image.20
                        20 {
                            preRenderRegisters {
                                allImageCaptions.cObject {
                                    references {
                                        table = pages
                                        fieldName = media
                                    }
                                }
                            }
                            addClassesCol.override.cObject.10.key.field >
                            addClassesCol.override.cObject.10.key = {$page.theme.news.list.imagecols}
                            addClassesCol.override.if.isGreaterThan.field >
                            addClassesCol.override.if.isGreaterThan = {$page.theme.news.list.imagecols}
                            layout {
                                key.field >
                                key = {$page.theme.news.list.imageorient}
                                25.override = <div class="image-header-{$page.theme.news.list.header_layout} image-center image-below">###IMAGES######TEXT###</div>
                                25.override.if.isTrue.field = title
                                26.override = <div class="image-header-{$page.theme.news.list.header_layout} image-center image-below">###IMAGES######TEXT###</div>
                                26.override.if.isTrue.field = title
                            }
                            textPos.field >
                            textPos = {$page.theme.news.list.imageorient}
                            maxW = 500
                            maxWInText = 500
                            imgList.cObject.references < tt_content.menu.20.news3.1.NO.stdWrap2.cObject.20.preRenderRegisters.allImageCaptions.cObject.references
                            text < tt_content.textpic.20.text
                            text {
                                10 {
                                    if.isGreaterThan.field >
                                    if.isGreaterThan = {$page.theme.news.list.imageorient}
                                    10 = < lib.newsheader
                                }
                                20.field = abstract
                                20.editIcons >
                            }
                        }
                    }
                }
            }
        }
    }
}

second you need to add this to your Page-TS-Config in order to get the Menuitem in the Backend:

#################
#### TCEFORM ####
#################
TCEFORM {
    tt_content {
        menu_type {
            addItems {
            news3 = Display 3 latest subpages as news entries
            }
        }
    }
}

from bootstrap_package.

cedricziel avatar cedricziel commented on June 9, 2024

Is this still relevant with current versions? If so, can you pull request a solution that pleases you?

from bootstrap_package.

benjaminkott avatar benjaminkott commented on June 9, 2024

@cedricziel i´ve decided to drop these news listing, as it was only an extensive typoscript example that almost nobody understood - i think a basic news implementation will be more usefull

from bootstrap_package.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.