Posts: 8
Threads: 3
Joined: Aug 2009
How do I can get all the page-slug of every page I have created?
I want to get even the pages that were not added to the menu.
which function to use?
web design and internet marketing
Posts: 1,848
Threads: 86
Joined: Aug 2009
<?php
$data = menu_data();
print_r($data);
?>
-
Chris
Thanks for using GetSimple! - Download
Please do not email me directly for help regarding GetSimple. Please post all your questions/problems in the forum!
Posts: 8
Threads: 3
Joined: Aug 2009
<?php
$data = menu_data();
print_r($data);
?>
Can anyone write this code out to display as a Ul-Li list structure?
I'm little new to pHp ....thats why!
web design and internet marketing
Posts: 8
Threads: 2
Joined: Aug 2009
ccagle8 Wrote:<?php
$data = menu_data();
print_r($data);
?>
sure this works?
I only get the date of the current Page.
Posts: 8
Threads: 3
Joined: Aug 2009
hello stilgarBF
I have tried that code is working . I tried by putting as a component.
It output an array of the details of the pages but i couldn't make it as a UL list.
If you can do try and let me know.
web design and internet marketing
Posts: 20
Threads: 8
Joined: Aug 2009
Kumar, after you get the array back, YOU have to loop through it and build the unordered list / menu structure. Here is how I did it. I created a functions.php file in my theme folder and included it in my theme. Next, I put this function in my functions.php file.
Code:
function getMenu() {
$data = menu_data();
$output = array();
$output[] = '<ul>';
foreach( $data as $menu) {
$output[] = "<li><a href='" . $menu['url'] . "' title='" . $menu['title'] . "'>" . $menu['title'] . "</a></li>";
}
$output[] = '</ul>';
$menu_string = implode("\n", $output);
echo $menu_string;
}
In my theme file, I added
This isn't the only way to do it or even the best way, but it worked for me.
Regards,
Brian
Posts: 8
Threads: 3
Joined: Aug 2009
Hai bnowell
Thanks for your update. I'll try it out right now and let me respond you.
web design and internet marketing
Posts: 1,848
Threads: 86
Joined: Aug 2009
this is similar to this post:
http://get-simple.info/forum/viewtopic.php?id=105
the menu_data() function is still in it's infancy, and may change slightly from what is currently distributed with version 1.5. I would be cautious where you use this function because of that. This is the only function in this stage as it was added in 1.5 with no intention of it being used - i just accidentally mentioned it in one post, and now it has taken off...
-
Chris
Thanks for using GetSimple! - Download
Please do not email me directly for help regarding GetSimple. Please post all your questions/problems in the forum!