Posts: 5
Threads: 2
Joined: Dec 2010
Hello!
I have a question. I want to style my menu like this:
http://poetzsch-sirch.de/main/index.php
I have rebuilt the template with div's, but now I am wondering how to insert that |.
Can anyone help me?
Thanks,
Martin
Posts: 1,204
Threads: 30
Joined: Jun 2010
If you constructed your menu basing on divs (every button is a stand alone div) then just add a left/right border to the div, or create a margin between divs, so a background color behind those divs will work as a |
ps. you should create navigation menu basing on lists, not divs.
Addons: blue business theme, Online Visitors, Notepad
Posts: 5
Threads: 2
Joined: Dec 2010
2010-12-04, 04:17:00
(This post was last modified: 2010-12-05, 05:59:22 by corey11rios.)
yojoe Wrote:If you constructed your menu basing on divs (every button is a stand alone div) then just add a left/right border to the div, or create a margin between divs, so a background color behind those divs will work as a |
ps. you should create navigation menu basing on lists, not divs.
I have done it with lists. I created an <ul> and inserted the php-code:
<?php get_navigation(return_page_slug()); ?>
But how to solve the Problem with div's?
Thanks,
Martin
Posts: 5
Threads: 2
Joined: Dec 2010
Posts: 1,204
Threads: 30
Joined: Jun 2010
Help with what ?
I answered you how to solve your problem with divs
Quote:...add a left/right border to the div, or create a margin between divs...
Or is there something I didn't understand ?
Addons: blue business theme, Online Visitors, Notepad
Posts: 5
Threads: 2
Joined: Dec 2010
I have done it with lists! I dont use divs for the menu, as you advised me.
Thanks,
Martin
Posts: 5
Threads: 0
Joined: Apr 2011
I have a sample solution for the child menu!
Only replacement function!
Code: function get_navigation($currentpage) {
$menu = '';
$path = GSDATAPAGESPATH;
$dir_handle = opendir($path) or die("Unable to open $path");
$filenames = array();
while ($filename = readdir($dir_handle)) {
$filenames[] = $filename;
}
$count="0";
$pagesArray = array();
if (count($filenames) != 0) {
foreach ($filenames as $file) {
if ($file == "." || $file == ".." || is_dir($path . $file) || $file == ".htaccess" ) {
} else {
$data = getXML($path . $file);
if ($data->private != 'Y') {
$pagesArray[$count]['menuStatus'] = $data->menuStatus;
if ($data->menuStatus == 'Y') {
$menuNum = $menuNum + 1;
}
$pagesArray[$count]['menuOrder'] = $data->menuOrder;
$pagesArray[$count]['menu'] = strip_decode($data->menu);
$pagesArray[$count]['url'] = $data->url;
$pagesArray[$count]['title'] = strip_decode($data->title);
$pagesArray[$count]['parent'] = $data->parent;
$count++;
}
}
}
}
$pagesSorted = subval_sort($pagesArray,'menuOrder');
$subpagesSorted = subval_sort($pagesArray,'title');
if (count($pagesSorted) != 0) {
$menu .= '<ul class="sf-menu">';
$menu .= "\n";
foreach ($pagesSorted as $page) {
if ($page['menuStatus'] == 'Y') {
if ($page['menu'] == '') { $page['menu'] = $page['title']; }
if ($page['title'] == '') { $page['title'] = $page['menu']; }
$menuNumL = $menuNumL + 1;
if ($menuNumL == 1) {
$li = 'li class="first"';
} else {
if ($menuNumL != $menuNum) {
$li = 'li';
} else {
$li = 'li class="last"';
$menuNumL = 0;
}
}
$url_nav = $page['url'];
if ("$currentpage" == "$url_nav") {
$menu .= ' <'.$li.'>';
$menu .= "\n";
$menu .= ' <a href="'. find_url($page['url'],$page['parent']) . '" class="current"><span class="span-main">'.$page['menu'].'</span></a>';
$menu .= "\n";
} else {
$menu .= ' <'.$li.'>';
$menu .= "\n";
$menu .= ' <a href="'. find_url($page['url'],$page['parent']) . '" class="main"><span class="span-main">'.$page['menu'].'</span></a>';
$menu .= "\n";
}
foreach ($pagesSorted as $subpage) {
$pageRif = $subpage['parent'];
if ("$pageRif" == "$url_nav") {
$pageNum = $pageNum + 1;
}
}
if ($pageNum != 0) {
$menu .= " <ul>\n";
foreach ($pagesSorted as $subpage) {
$SubRif = $subpage['parent'];
if ($subpage['menu'] == '') { $subpage['menu'] = $subpage['title']; }
if ($subpage['title'] == '') { $subpage['title'] = $subpage['menu']; }
if ("$SubRif" == "$url_nav") {
$liNum = $liNum + 1;
if ($liNum != $pageNum) {
$menu .= ' <li><a href="'. find_url($subpage['url'],$subpage['parent']) . '">'.$subpage['menu'].'</a></li>';
$menu .= "\n";
} else {
$menu .= ' <li class="last"><a href="'. find_url($subpage['url'],$subpage['parent']) . '">'.$subpage['menu'].'</a></li>';
$menu .= "\n";
$liNum = 0;
}
}
}
$menu .= " </ul>\n";
$menu .= " </li>\n";
} else {
$menu .= " </li>\n";
}
$pageNum = 0;
}
}
}
$menu .= "</ul>\n";
$menuNum = 0;
closedir($dir_handle);
echo exec_filter('menuitems',$menu);
}
update our ul > li tag system.
if you have a few problem send me our html menu code. I can adjust position tag's.
sorry my english!
greating's
Posts: 2,928
Threads: 195
Joined: Feb 2011
nitramf Wrote:I have done it with lists! I dont use divs for the menu, as you advised me.
Thanks,
Martin
why not give a right or left border to LI? or a margin, like suggested?
Posts: 5
Threads: 0
Joined: Apr 2011
Connie Wrote:nitramf Wrote:I have done it with lists! I dont use divs for the menu, as you advised me.
Thanks,
Martin
why not give a right or left border to LI? or a margin, like suggested?
Normally the style of the menu is the default css file.
the example I posted refers to a complex type of menu!
Usually the menu menufish.js are much easier to manage:
Code: <ul>
<li><a href="#">link</a>
<ul>
<li><a href="#">link</a></li>
<li><a href="#">link</a></li>
</ul>
</li>
</ul>
http://www.cagayandeorodreamhomes.com/te...htroom/03/
This is a example complex menù
I adapted the function for this type of menu where, in addition to the current page, there are classes daa manage (the fist and the last menu)
I remind you that if you have a special menu for which to create the appropriate function, you can send the part of html code on the menu only.
Sincerely
Posts: 5
Threads: 0
Joined: Apr 2011
2011-04-16, 17:07:07
(This post was last modified: 2011-04-16, 17:07:57 by felipemartins81.)
If you have multiple themes for same site is not replace the function of the original menu. Be sufficient to integrate the function in the function.php file and rename the it from get_navigation ($ CurrentPage) to get_nametheme_navigation ($ CurrentPage)
Posts: 1
Threads: 0
Joined: Apr 2011
i really need this for my Web design . thanks
Posts: 5
Threads: 0
Joined: Apr 2011
2011-04-18, 19:30:18
(This post was last modified: 2011-04-18, 19:47:43 by felipemartins81.)
joel14santos5 Wrote:i really need this for my Web design . thanks
I saw your site but I did not find any sub page in your menu.
This function for the no complex child menu (only current class end list child)
Code: function get_custom_navigation($currentpage) {
$menu = '';
$path = GSDATAPAGESPATH;
$dir_handle = opendir($path) or die("Unable to open $path");
$filenames = array();
while ($filename = readdir($dir_handle)) {
$filenames[] = $filename;
}
$count="0";
$pagesArray = array();
if (count($filenames) != 0) {
foreach ($filenames as $file) {
if ($file == "." || $file == ".." || is_dir($path . $file) || $file == ".htaccess" ) {
} else {
$data = getXML($path . $file);
if ($data->private != 'Y') {
$pagesArray[$count]['menuStatus'] = $data->menuStatus;
$pagesArray[$count]['menuOrder'] = $data->menuOrder;
$pagesArray[$count]['menu'] = strip_decode($data->menu);
$pagesArray[$count]['url'] = $data->url;
$pagesArray[$count]['title'] = strip_decode($data->title);
$pagesArray[$count]['parent'] = $data->parent;
$count++;
}
}
}
}
$pagesSorted = subval_sort($pagesArray,'menuOrder');
$subpagesSorted = subval_sort($pagesArray,'title');
if (count($pagesSorted) != 0) {
foreach ($pagesSorted as $page) {
$sel = '';
$classes = '';
$url_nav = $page['url'];
if ($page['menuStatus'] == 'Y') {
if ($page['menu'] == '') { $page['menu'] = $page['title']; }
if ($page['title'] == '') { $page['title'] = $page['menu']; }
if ("$currentpage" == "$url_nav") {
$menu .= '<li class="current"><a href="'. find_url($page['url'],$page['parent']) . '" title="'. strip_quotes($page['title']) .'">'.$page['menu'].'</a>';
} else {
$menu .= '<li><a href="'. find_url($page['url'],$page['parent']) . '" title="'. strip_quotes($page['title']) .'">'.$page['menu'].'</a>';
}
foreach ($subpagesSorted as $subpage) {
$pageRif = $subpage['parent'];
if ("$pageRif" == "$url_nav") {
$pageNum = $pageNum + 1;
}
}
if ($pageNum != 0) {
$menu .= '<ul>';
foreach ($subpagesSorted as $subpage) {
$subPageRif = $subpage['parent'];
if ($subpage['menu'] == '') { $subpage['menu'] = $subpage['title']; }
if ($subpage['title'] == '') { $subpage['title'] = $subpage['menu']; }
if ("$subPageRif" == "$url_nav") {
$menu .= '<li><a href="'. find_url($subpage['url'],$subpage['parent']) . '" title="'. strip_quotes($subpage['title']) .'">'.$subpage['menu'].'</a></li>';
}
}
$menu .= '</ul>';
$menu .= '</li>';
} else {
$menu .= '</li>';
}
$pageNum = 0;
}
}
}
closedir($dir_handle);
echo exec_filter('menuitems',$menu);
}
Example html menu child code
Code: <ul>
<li class="current"><a href="#">link</a>
<ul>
<li><a href="#">link</a></li>
<li><a href="#">link</a></li>
</ul>
</li>
<li><a href="#">link</a>
</ul>
Copy end paste it in the funcion theme file or in the theme function in admin/inc/
Replace get_navigation($currentpage) >> get_custom_navigation($currentpage) in the theme template file.
by gsit (always disposal)
a new admin interface in working:
|