Search code examples
renderingtemplatingimpresspages

Not able to convert vertical scrolling example to version 4


I tried it for a couple of days but I seem to be too stupid to adopt the vertical scrolling website example from the blog here:

http://www.impresspages.org/blog/creating-a-vertical-scrolling-website/

I already get stuck with changing the content rendering and creating a V4-compatible foreach part from the first code block:

/* SHOW ALL PAGES IN ONE */ 
if ($site->managementState() || $site->getCurrentZone()->getName() != 'menu1') {
  echo $site->generateBlock('main');
} else {
  $pages = $site->getZone('menu1')->getElements();
  foreach($pages as $pageKey => $page) {
    echo '<div class="scrollblock">';
    echo '<div id="page_'.$page->getId().'">';
    $publishedRevision = \Ip\Revision::getPublishedRevision('menu1', $page->getId());
    echo \Modules\standard\content_management\Model::generateBlock('main', $publishedRevision['revisionId'], $site->managementState());
    echo '</div>';
    echo '</div>';
  }
}
/* EOF SHOW ALL PAGES IN ONE */ 

Can anybody help me with this? I am pretty lost compared to Typo3 which I normally use.

Thank you and best regards,

doc


Solution

  • This works for me:

    if (ipIsManagementState()) {
    
        echo ipBlock('main');
    
    } else {
        $pages = ipContent()->getChildren('menu1');
        foreach($pages as $page) {
            $revision = \Ip\Internal\Revision::getPublishedRevision($page->getId());
            $content = \Ip\Internal\Content\Model::generateBlock('main', $revision['revisionId'], 0, 0);
    
            echo '<div class="scrollblock">';
            echo '<div id="page_'.$page->getId().'">';
            echo $content;
            echo '</div>';
            echo '</div>';
    
        }
    }