Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
QUESTION Displaying child pages on the same page as parent
#11
Hi D.O.

Thanks for posting this code.

I translated it from russian to english:

==================================

Working with sets of pages with different reciprocal relationships is fundamental when designing a website
that contains a significant amount of content.

The following snippet of PHP code can be used to display a list of child pages of the current page
in GetSimple CMS 3.4. For example, to build a list of subpages of a section.

<?php $page = get_page_slug ( false ); $children = getChildren ( $page ); echo '<ul>' ; foreach ( $children as $child ) { $url = generate_url ( $child ); echo '<li><a href="' . $url . '">' . returnPageField ( $child , 'title' ) . '</a></li>' ; } echo '</ul>' ; ?>

For code compatibility with GetSimple CMS 3.3, replace the call to the generate_url() function with find_url() :

$url = find_url ( $child , $page );

<?php $page = get_page_slug ( false ); $children = getChildren ( $page ); echo '<ul>' ; foreach ( $children as $child ) { $url = find_url ( $child ); echo '<li><a href="' . $url . '">' . returnPageField ( $child , 'title' ) . '</a></li>' ; } echo '</ul>' ; ?>

To use the code, you must place its call in the component or file of the page design template.
Reply


Messages In This Thread
RE: Displaying child pages on the same page as parent - by Felix - 2020-04-04, 00:22:27



Users browsing this thread: 1 Guest(s)