Monday, October 28, 2013

Create a GetSimple sitemap with return_i18n_page_structure function from I18N plugin

A custom sitemap can be easily generated using return_i18n_page_structure() function from I18N GetSimple plugin.

A "sidebar" component below generates a simple sitemap of a site built with GetSimple.


$items = return_i18n_page_structure(null, false, null);

foreach ($items as $item)
    $offset = $item['level'] * 16;
    $title = $item['title'];
    $url = $item['url'];

    echo "<li style=\"margin-left: {$offset}px;\"><a href=\"$url\">$title</a></li>\r\n";

P.S. return_i18n_page_structure() function is wrongly called return_i18n_structure() in I18N plugin documentation.

No comments:

Post a Comment