Created
November 9, 2012 11:31
-
-
Save sarahhodne/4045247 to your computer and use it in GitHub Desktop.
phpMyMenu - My first ever open source project published September 2006. I was 13 years old at the time, please don't judge me.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Load the XML file containing layout and items int the variable $menu | |
$menu = simplexml_load_file("menu.xml"); | |
// Making an array of words to replace | |
$search = array ( 'LT', 'GT', 'REPLACE_LINK', 'REPLACE_TEXT' ); | |
// The words to replace them with | |
$replace_with = array ( '<', '>'); | |
$pre = str_replace($search, $replace_with, $menu->layout->pre); | |
echo $pre; | |
// Print one line for every item | |
foreach ($menu->menuItems->menuItem as $menuItem) { | |
$replace_with = array('<', '>', $menuItem->mIlink, $menuItem->mItext); | |
$line = str_replace($search, $replace_with, $menu->layout->line); | |
echo $line; | |
} | |
$replace_with = array ( '<', '>'); | |
$post = str_replace($search, $replace_with, $menu->layout->post); | |
echo $post; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment