2015-01-21, 19:26:13
(2015-01-21, 08:50:32)Tyblitz Wrote: I'm a great supporter of i18n but for a PHP noob like me the documentation on mvlcek.bplaced.net didn't really suffice, especially not about the output of the return_i18n_menu_data function.
Yes, the description is for programmers and rather short ;-)
You can always use the PHP function print_r to output a variable, e.g. the returned structure of return_i18n_menu_data.
(2015-01-21, 08:50:32)Tyblitz Wrote: So after a day of PHP research and fiddling with i18n plugins in GetSimple, I wrote a more comprehensive piece of documentation here: http://codepen.io/Webketje/full/VYbxmy/. Feel free to check it out (especially Martin, as you may point me to errors, if any).
Nice work. However, the $slug need not be the current page: there are use cases where this is not the case, e.g. http://mvlcek.bplaced.net/get-simple/mul...v-multiple.
You could also use custom rendering and not output the link for items with child pages, e.g.
Code:
<li class="<?php echo $item->classes; ?>">
<?php if ($item->hasChildren) { ?>
<a href="<?php echo htmlspecialchars($item->link); ?>">
<?php echo htmlspecialchars($item->text); ?>
</a>
<?php } else { ?>
<?php echo htmlspecialchars($item->text); ?>
<?php } ?>
<?php if ($item->isOpen) { ?>
<ul><?php $item->outputChildren(); ?></ul>
<?php } ?>
</li>