Details
-
Improvement
-
Resolution: Won't Do
-
Major
-
None
-
5.4.4
-
None
-
None
Description
There are many situations in real projects, where page scripts needs to render components from another page.
Situations where there are news pages in a dedicated top level tree in "website" workspace which then get concretely linked by other pages that rendered their content/components.
Like a news pages pool (I'm aware that its explicit not a news content-app, as the content of such a news is different on every news page).
Many things can be achieved, by rendering areas (their components) from other pages.
Here a code example form the page script for reproducing the message:
<!DOCTYPE html> <html xml:lang="en" lang="en" class="no-js"> <head> [@cms.page /] <meta name="viewport" content="width=device-width, initial-scale=1"> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <link rel="stylesheet" href="${ctx.contextPath}/.resources/training-templating-basic/webresources/bootstrap.css" media="screen"> </head> <body> <div class="container"> <div class="panel panel-info"> <div class="panel-heading"> <h3 class="panel-title">${content.title!"No title saved yet"}</h3> </div> <div class="panel-body"> <p>${content.abstract!"No abstract saved yet"}</p> </div> </div> [#-- this soul be a dynamic link fetched form 'content' to such a news taget page --] [#assign areaNode = cmsfn.contentByPath("/travel/about/company/main")! /] [#-- this is the main part, rendering the components of another page. --] [#list cmsfn.children(areaNode) as componentNodeOfTheArea] [@cms.component content=componentNodeOfTheArea /] [/#list] </div> </body> </html>
See the attached print screen to see the message.
Checklists
Acceptance criteria