Please login or register.

Login with username, password and session length
Advanced search  

News:

Latest sNews - sNews 1.7 - with its own forums - for discussion and user mods.

Pages: [1] 2

Author Topic: Multi level tabbed menu using pages/categories as top level  (Read 7836 times)

jean01

  • Newbie
  • *
  • Karma: 0
  • Posts: 46
Multi level tabbed menu using pages/categories as top level
« on: March 10, 2009, 03:14:31 AM »

Here is my tabbed drop down menu system.  It is for a site that uses a small number of categories so that the pages and categories can form the top level tabs.

It is implemented on my test site for a client that is currently at
http://jeankorte.com/
When the client site is implemented (this week) I will update this link.

The software I used is:
•   A sliding doors tabbed menu system based on the one from CSS Tab Designer -download free from http://www.snapfiles.com/get/CSSTabDesigner.html

•   The All Levels Navigational Menu (v2.1) from Dynamic Drive download from http://www.dynamicdrive.com/dynamicindex1/ddlevelsmenu/index.htm

Note that Dynamic Drive also has an All Levels Menu Generator with 12 varieties of horizontal menu at http://www.dynamicdrive.com/dynamicindex1/ddlevelsmenu/generator.htm .  Not all of these will work unchanged with my code – some of them have their hooks to the menu software in different places and so you would have to modify my Sitemap mod to suit.

The menu system has a vertical option which would make more sense if you had many categories.

Note that for this menu system to display properly, your document MUST BE XHTML STRICT otherwise there will be stray areas at the top/bottom of the sublinks.  Also, your sub link boxes must be formatted so they are wide enough to contain you longest article/subcategory name.  Longer names will break the formatting.

To make this software work, I made a copy of the sitemap() function and modified it to generate the lists required by this menu.  This menu requires that the top level menu items be written where the menu will appear.  However, the article, subcategory and ‘sub-articles’ lists need to be separate and initially written to the very bottom of the page.  The menu CSS formats these display: none; until they are needed.

At the same time, I created a separate list of article links.  If you don’t want these, you can delete them.  How I use them is I put the list in a scrollable box on the admin page.  This way, if I want insert a hyperlink in an article referring to another article, I have the page addresses right there so I can just copy/paste them into the article without fumbling around going back and forth to copy the page link.  Yes, I’d rather spend 2 hours writing a program to do this than spend 5 minutes locating the link!!

Anyhow, here is my function (variation of sitemap() ) that creates the menu lists:
Code: [Select]
<?php
// Navigation site map
function nav_sitemap($exclude=false) {
if(!$exclude)$exclude = array();
//Functions to write lists
function makeA($url,$ltext,$rel=''){
    return '<a'.mAttr('href',$url).mAttr('rel',$rel).">$ltext</a>";
}
function mAttr($name,$value){
    return ($value)?$name='$value' ":'';
}
function makeLI($ltext,$cat=false){
$reqcat=isset($_GET['category'])?substr($_GET['category'],0,stripos($_GET['category'],'/')):'';
$current " id='current' ";
$id = ( $reqcat === $cat OR ( !isset($_GET['category']) && $cat == 'home' ))?$current:'';
return "<li$id>$ltext</li>\n";
}
function makeUL($items,$id='',$class=''){
    $list is_array($items)?implode('',$items):$items;
    return '<ul'.mAttr('id',$id).mAttr('class',$class).">\n$list</ul>\n";
}
function makeLinkText($href){
return makeA($href,$href)."<br /><br />\n";
}
$linktext ='';
//Fixed page nav links
  
if(!in_array('home',$exclude)){
$topitems['home'] = makeLI(makeA(_SITE,'Home'),'home');
$linktext .= makeLinkText('./');
}
  if(!
in_array('archive',$exclude)){
$topitems['archive'] = makeLI(makeA(_SITE.'archive/','Archive'),'archive');
$linktext .= makeLinkText('archive/');
}
if(!in_array('contact',$exclude)){
$topitems['contact'] = makeLI(makeA(_SITE.'contact/','Contact'),'contact');
$linktext .= makeLinkText('contact/');
}
  if(!
in_array('sitemap',$exclude)){
$topitems['sitemap'] = makeLI(makeA(_SITE.'sitemap/','Sitemap'),'sitemap');
$linktext .= makeLinkText('sitemap/');
}

$query "SELECT title,seftitle
FROM "
._PRE.'articles'."
WHERE position = 3
AND published = 1
AND visible = 'YES'
ORDER BY artorder ASC, date, id"
;
$result mysql_query($query);
while ($r mysql_fetch_array($result)) {
//Page nav links
if(!in_array($r['seftitle'],$exclude)){
$topitems[$category_title] = makeLI(makeA(_SITE.$r['seftitle'].'/',$r['title'],$r['seftitle']),$r['seftitle']);
$linktext .= makeLinkText($r['seftitle'])."<br />\n";
}
}


$art_query 'SELECT title, seftitle, date
FROM '
._PRE.'articles'.'
WHERE position = 1
AND published = 1
AND visible = \'YES\''
;

$cat_query 'SELECT id, name, seftitle, description, subcat
FROM '
._PRE.'categories'.'
WHERE published = \'YES\'
AND subcat = 0
ORDER BY catorder,id'
;
$cat_result mysql_query($cat_query);

  if (
mysql_num_rows($cat_result) != 0) {
  
while ($c mysql_fetch_array($cat_result)) {
$category_title $c['seftitle'];      
      if(
in_array($category_title,$exclude) )continue;      
      
//Category link
$topitems[$category_title] = makeLI(makeA(_SITE.$category_title.'/',$c['name'],$category_title),$category_title);
$linktext .= makeLinkText($category_title.'/');
$catid $c['id'];
$query $art_query.' AND category = '.$catid.' ORDER BY artorder ASC';
$result mysql_query($query);
while ($r mysql_fetch_array($result)) {
        
//Category link
$catlist[$category_title][] = makeLI(makeA(_SITE.$category_title.'/'.$r['seftitle'],$r['title']));
$linktext .= makeLinkText($category_title.'/'.$r['seftitle'].'/');
}

$subcat_result mysql_query('SELECT id, name, seftitle, description, subcat
FROM '
._PRE.'categories'.'
WHERE published = \'YES\'
AND subcat = '
.$c['id'].'
ORDER BY catorder ASC'
);

while ($s mysql_fetch_array($subcat_result)) {
$subcat_title $s['seftitle'];
$subcat_name $s['name'];
        
//Subcategory link
$subcatitem makeA(_SITE.$category_title.'/'.$subcat_title.'/',$subcat_name);
$linktext .= makeLinkText($category_title.'/'.$subcat_title.'/');
        
$subcatid $s['id'];
        
$query $art_query.' AND category = '.$subcatid.' ORDER BY artorder ASC';
$artresult mysql_query($query);
while ($r mysql_fetch_array($artresult)) {
          
//Subcategory article list item
$subcatlist[$category_title][$subcat_title][]
=makeLI(makeA(_SITE.$category_title.'/'.$subcat_title.'/'.$r['seftitle'].'/',$r['title']) );
$linktext .= makeLinkText($category_title.'/'.$subcat_title.'/'.$r['seftitle'].'/');
}
//Subcategory list of articles
$subcatitem .= makeUL($subcatlist[$category_title][$subcat_title]);
//Subcategory link list item
$catlist[$category_title][] makeLI($subcatitem);
//end subcategory articles
}
// List of all articles, subcategories and subcategory articles for a category
$navitems['sub'] .= makeUL($catlist[$category_title],$category_title,'ddsubmenustyle');
}
}
// Make top menu list for tabs
$navitems['top'] = makeUL($topitems,'','noprint');

// $navitems array used if (_ADMIN) while menus may be changing

 
// Menu is written to files for regular use
  // Remove id='current' before writing to file - it will be determined when the page is loaded
  
$current " id='current' ";
  
$navitems_nocurrent str_replace($current,'',$navitems['top']);
  
$bytes file_put_contents(F_ROOT.'includes/topNavLinks.txt',$navitems_nocurrent,LOCK_EX);
  
$bytes file_put_contents(F_ROOT.'includes/subNavLinks.txt',$navitems['sub'],LOCK_EX);  
  
$bytes file_put_contents(F_ROOT.'includes/linktext.txt',$linktext,LOCK_EX);
  
//Return current values for use in page if _ADMIN
  
return $navitems;
}
?>


The above function DOES NOT replace the sitemap() function.  I just put it in a separate file that I included in my template.

My list of links is in the variable $linktext written to the file linktext.txt so you can comment out / delete references to this if you don’t need it.

The links for the top of the page are put into the variable $navitems['top'] and written to the file named topNavLinks.txt

The rest of the links are put in the variable $navitems['sub'] and written to the file namedsubNavLinks.txt

When _ADMIN is false, the files are read and the links displayed from there.  However, if _ADMIN is true, because content is changing, the links are created anew with each page refresh and written again to the files.  For the _ADMIN user, the links are written to the page from $navitems instead of being read in from the files.

Install the menu system using the instructions given at the Dynamic Drive site.

In my template, at the top of the page, where I have the top menus my logic is
Code: [Select]
<?php
      $exclude 
= array('archive','sitemap','welcome','general');
if(!_ADMIN){
// Read navigation links from file
$nav_links['top']=file_get_contents('topNavLinks.txt',FILE_USE_INCLUDE_PATH);
$nav_array explode("\n",$nav_links['top']);
foreach ($nav_array as $key=>$value) {
    if(!empty($categorySEF) AND stripos($nav_array[$key],"/$categorySEF") ) {
     $nav_array[$key] = str_ireplace('<li>',"<li id='current' >",$nav_array[$key]);
          
}else if((empty($categorySEF) OR in_array($categorySEF,$exclude)) AND stripos($nav_array[$key],"home")) {
           
        $nav_array[$key] = str_ireplace('<li>',"<li id='current' >",$nav_array[$key]);
           
}
}
     $nav_links['top'] = implode("\n",$nav_array);
} else {
// Create new navigation links
// They will be saved by nav_sitemap() 
include 'snews/navSiteMap.php';
$nav_links nav_sitemap($exclude);
}
?>


<div id="ddtopmenubar" class="tabs">
<?php echo $nav_links['top']; ?>
        <script type="text/javascript">ddlevelsmenu.setup("ddtopmenubar", "topbar")</script>
        </div>
<!-- <br class='clear' /> -->
      </div>
The $exclude array contains the page/category names that I don’t want in the navigation tabs.
The logic steps through the array to find the current page name so that id=current can be written into that link.

At the VERY bottom of my page, I put the rest of the links
Code: [Select]
<!-- Must stay at very end of page -->
<?php
if(!_ADMIN)include 'subNavLinks.txt';
else echo 
$nav_links['sub'];
?>

  </body>
</html>
Notice that is the VERY last thing on the page, outside all the rest of the page content.  This is described in the Dynamic Drive documentation.  I don’t know what would happen if it was anywhere else – I didn’t bother trying that.

I then took the ddlevels css file that formatted the top menu and replaced it with my css from my tabs, modifying it where I needed to (though it required very little modification to work.)

There you have it.  This is not a ‘mindless’ mod – you have to understand your CSS and the how the php works to create the lists but at least the ground work is done for you.

I hope that this is useful to someone.  Maybe you templaters can use it as a starting point.

« Last Edit: March 10, 2009, 03:25:17 AM by jean01 »
Logged

poppoll

  • Full Member
  • ***
  • Karma: 47
  • Posts: 199
    • Poppoll's sNews playground
Re: Multi level tabbed menu using pages/categories as top level
« Reply #1 on: March 11, 2009, 09:09:10 PM »

Hello Jean,
Did the test on localhost and it is working.
Only I had to change:
Code: [Select]
$bytes = file_put_contents(F_ROOT.'includes/topNavLinks.txt',$navitems_nocurrent,LOCK_EX);
  $bytes = file_put_contents(F_ROOT.'includes/subNavLinks.txt',$navitems['sub'],LOCK_EX); 
  $bytes = file_put_contents(F_ROOT.'includes/linktext.txt',$linktext,LOCK_EX);
to:
Code: [Select]
$bytes = file_put_contents('topNavLinks.txt',$navitems_nocurrent,LOCK_EX);
  $bytes = file_put_contents('subNavLinks.txt',$navitems['sub'],LOCK_EX); 
  $bytes = file_put_contents('linktext.txt',$linktext,LOCK_EX);
 
Is this normal?

Second: If I add a page the submenu is not working, a second page not showing.

Thanks for sharing

PP
« Last Edit: March 12, 2009, 11:09:10 PM by poppoll »
Logged

jean01

  • Newbie
  • *
  • Karma: 0
  • Posts: 46
Re: Multi level tabbed menu using pages/categories as top level
« Reply #2 on: March 13, 2009, 05:39:23 PM »

Yes, sorry the F_ROOT constant is unique to my website and set outside this code.
You can tell I am totally new to posting my code for others to use!!

I use xampp locally but not with virtual servers.  So my xampp sites do not operate from the actual web root. 
I  use this constant to set the path to the web root to the xampp path if it finds 'xampp' in $_SERVER['DOCUMENT_ROOT'] and to the website root path otherwise.  This reduces the changes i have to make when I move a site from xampp to on line.

Thanks for trying this out hope it is useful.

jean
Logged

philmoz

  • High flyer
  • ULTIMATE member
  • ******
  • Karma: 161
  • Posts: 1988
    • fiddle 'n fly
Re: Multi level tabbed menu using pages/categories as top level
« Reply #3 on: March 13, 2009, 08:53:08 PM »

@jean
doesn't snews' _SITE constant work for you in xampp
Logged
Of all the things I have lost, it is my mind that I miss the most.

jean01

  • Newbie
  • *
  • Karma: 0
  • Posts: 46
Re: Multi level tabbed menu using pages/categories as top level
« Reply #4 on: March 15, 2009, 03:38:56 PM »

Not everywhere but I tested it and it works with this mod.
So this mod should have _SITE instead of F_ROOT and it would work for everyone else.
Thanks philmoz.
Logged

Patric Ahlqvist

  • Nobodys perfect, but Im pretty effing close
  • ULTIMATE member
  • ******
  • Karma: 65
  • Posts: 4867
  • “I'm a self-made man and worships my creator.”
    • p-ahlqvist.com
Re: Multi level tabbed menu using pages/categories as top level
« Reply #5 on: March 27, 2009, 11:57:12 AM »

Mhm, VERY curious at this... Is this ok, by any chance... Will have to test it.

Actually looked at this: http://snewscms.com/forum/index.php?topic=3450.0

But there is just too much for me to handle...
« Last Edit: March 27, 2009, 12:01:49 PM by Patric Ahlqvist »
Logged
"It's only dead fish that goes with the flow... "
Updated

Patric Ahlqvist

  • Nobodys perfect, but Im pretty effing close
  • ULTIMATE member
  • ******
  • Karma: 65
  • Posts: 4867
  • “I'm a self-made man and worships my creator.”
    • p-ahlqvist.com
Re: Multi level tabbed menu using pages/categories as top level
« Reply #6 on: March 27, 2009, 12:54:44 PM »

Okidoki... I want it so bad to work, but I can't...

What I have done so far is:

DL'ed example menu, uploaded the same.
I have added head tags to call the crap.
Code: [Select]
<link rel="stylesheet" type="text/css" href="ddlevelsmenu/ddlevelsmenu-base.css" />
<link rel="stylesheet" type="text/css" href="ddlevelsmenu/ddlevelsmenu-topbar.css" />
<link rel="stylesheet" type="text/css" href="ddlevelsmenu/ddlevelsmenu-sidebar.css" />
<script type="text/javascript" src="ddlevelsmenu/ddlevelsmenu.js">

I have added a navSiteMap.php to the root of the directory (and call it "behind snews.php" ;include('navSiteMap.php') ?> which I perhaps shouldn't as it's included in the snippet, but I tried without it aswell.)

Code: [Select]
<?php
// Navigation site map
function nav_sitemap($exclude=false) {
if(!$exclude)$exclude = array();
//Functions to write lists
function makeA($url,$ltext,$rel=''){
&#160; &#160; return '<a'.mAttr('href',$url).mAttr('rel',$rel).">$ltext</a>";
}
function mAttr($name,$value){
&#160; &#160; return ($value)?" $name='$value' ":'';
}
function makeLI($ltext,$cat=false){
$reqcat=isset($_GET['category'])?substr($_GET['category'],0,stripos($_GET['category'],'/')):'';
$current " id='current' ";
$id = ( $reqcat === $cat OR ( !isset($_GET['category']) && $cat == 'home' ))?$current:'';
return "<li$id>$ltext</li>\n";
}
function makeUL($items,$id='',$class=''){
&#160; &#160; $list = is_array($items)?implode('',$items):$items;
&#160; &#160; return '<ul'.mAttr('id',$id).mAttr('class',$class).">\n$list</ul>\n";
}
function makeLinkText($href){
return makeA($href,$href)."<br /><br />\n";
}
$linktext ='';
//Fixed page nav links
&#160; if(!in_array('home',$exclude)){
$topitems['home'] = makeLI(makeA(_SITE,'Home'),'home');
$linktext .= makeLinkText('./');
}
&
#160; if(!in_array('archive',$exclude)){
$topitems['archive'] = makeLI(makeA(_SITE.'archive/','Archive'),'archive');
$linktext .= makeLinkText('archive/');
}
if(!in_array('contact',$exclude)){
$topitems['contact'] = makeLI(makeA(_SITE.'contact/','Contact'),'contact');
$linktext .= makeLinkText('contact/');
}
&
#160; if(!in_array('sitemap',$exclude)){
$topitems['sitemap'] = makeLI(makeA(_SITE.'sitemap/','Sitemap'),'sitemap');
$linktext .= makeLinkText('sitemap/');
}

$query "SELECT title,seftitle
FROM "
._PRE.'snews17_articles'."
WHERE position = 3
AND published = 1
AND visible = 'YES'
ORDER BY artorder ASC, date, id"
;
$result mysql_query($query);
while ($r mysql_fetch_array($result)) {
//Page nav links
if(!in_array($r['seftitle'],$exclude)){
$topitems[$category_title] = makeLI(makeA(_SITE.$r['seftitle'].'/',$r['title'],$r['seftitle']),$r['seftitle']);
$linktext .= makeLinkText($r['seftitle'])."<br />\n";
}
}


$art_query 'SELECT title, seftitle, date
FROM '
._PRE.'snews17_articles'.'
WHERE position = 1
AND published = 1
AND visible = \'YES\''
;

$cat_query 'SELECT id, name, seftitle, description, subcat
FROM '
._PRE.'snews17_categories'.'
WHERE published = \'YES\'
AND subcat = 0
ORDER BY catorder,id'
;
$cat_result mysql_query($cat_query);

&
#160; if (mysql_num_rows($cat_result) != 0) {
&#160;  while ($c = mysql_fetch_array($cat_result)) {
$category_title $c['seftitle'];&#160; &#160; &#160; 
&#160; &#160; &#160; if(in_array($category_title,$exclude) )continue;&#160; &#160; &#160; 
&#160; &#160; &#160; //Category link
$topitems[$category_title] = makeLI(makeA(_SITE.$category_title.'/',$c['name'],$category_title),$category_title);
$linktext .= makeLinkText($category_title.'/');
$catid $c['id'];
$query $art_query.' AND category = '.$catid.' ORDER BY artorder ASC';
$result mysql_query($query);
while ($r mysql_fetch_array($result)) {
&
#160; &#160; &#160; &#160; //Category link
$catlist[$category_title][] = makeLI(makeA(_SITE.$category_title.'/'.$r['seftitle'],$r['title']));
$linktext .= makeLinkText($category_title.'/'.$r['seftitle'].'/');
}

$subcat_result mysql_query('SELECT id, name, seftitle, description, subcat
FROM '
._PRE.'snews17_categories'.'
WHERE published = \'YES\'
AND subcat = '
.$c['id'].'
ORDER BY catorder ASC'
);

while ($s mysql_fetch_array($subcat_result)) {
$subcat_title $s['seftitle'];
$subcat_name $s['name'];
&
#160; &#160; &#160; &#160; //Subcategory link
$subcatitem makeA(_SITE.$category_title.'/'.$subcat_title.'/',$subcat_name);
$linktext .= makeLinkText($category_title.'/'.$subcat_title.'/');
&
#160; &#160; &#160; &#160; $subcatid = $s['id'];
&#160; &#160; &#160; &#160; 
$query $art_query.' AND category = '.$subcatid.' ORDER BY artorder ASC';
$artresult mysql_query($query);
while ($r mysql_fetch_array($artresult)) {
&
#160; &#160; &#160; &#160; &#160; //Subcategory article list item
$subcatlist[$category_title][$subcat_title][]
=makeLI(makeA(_SITE.$category_title.'/'.$subcat_title.'/'.$r['seftitle'].'/',$r['title']) );
$linktext .= makeLinkText($category_title.'/'.$subcat_title.'/'.$r['seftitle'].'/');
}
//Subcategory list of articles
$subcatitem .= makeUL($subcatlist[$category_title][$subcat_title]);
//Subcategory link list item
$catlist[$category_title][] makeLI($subcatitem);
//end subcategory articles
}
// List of all articles, subcategories and subcategory articles for a category
$navitems['sub'] .= makeUL($catlist[$category_title],$category_title,'ddsubmenustyle');
}
}
// Make top menu list for tabs
$navitems['top'] = makeUL($topitems,'','noprint');

// $navitems array used if (_ADMIN) while menus may be changing

 
// Menu is written to files for regular use
&#160; // Remove id='current' before writing to file - it will be determined when the page is loaded
&#160; $current = " id='current' ";
&#160; $navitems_nocurrent = str_replace($current,'',$navitems['top']);
&#160; $bytes = file_put_contents('topNavLinks.txt',$navitems_nocurrent,LOCK_EX);
&#160; $bytes = file_put_contents('subNavLinks.txt',$navitems['sub'],LOCK_EX);&#160; 
&#160; $bytes = file_put_contents('linktext.txt',$linktext,LOCK_EX);
&#160; 
//Return current values for use in page if _ADMIN
&#160; return $navitems;
}
?>


I have made them txt files (at root)
I have added this to where my menu should be located:
Code: [Select]
<?php
      $exclude 
= array('archive','sitemap','welcome','general');
if(!_ADMIN){
// Read navigation links from file
$nav_links['top']=file_get_contents('topNavLinks.txt',FILE_USE_INCLUDE_PATH);
$nav_array explode("\n",$nav_links['top']);
foreach ($nav_array as $key=>$value) {
    if(!empty($categorySEF) AND stripos($nav_array[$key],"/$categorySEF") ) {
     $nav_array[$key] = str_ireplace('<li>',"<li id='current' >",$nav_array[$key]);
          
}else if((empty($categorySEF) OR in_array($categorySEF,$exclude)) AND stripos($nav_array[$key],"home")) {
           
        $nav_array[$key] = str_ireplace('<li>',"<li id='current' >",$nav_array[$key]);
           
}
}
     $nav_links['top'] = implode("\n",$nav_array);
} else {
// Create new navigation links
// They will be saved by nav_sitemap() 
include 'navSiteMap.php';
$nav_links nav_sitemap($exclude);
}
?>


<div id="ddtopmenubar" class="mattblackmenu">
<?php echo $nav_links['top']; ?>
        <script type="text/javascript">ddlevelsmenu.setup("ddtopmenubar", "topbar")</script>
        </div>
<!-- <br class='clear' /> -->

I have added this at the very end of the document (just before body, html tag)
Code: [Select]
<!-- Must stay at very end of page -->
<?php
if(!_ADMIN)include 'subNavLinks.txt';
else echo 
$nav_links['sub'];
?>


changed this:
Code: [Select]
  $bytes = file_put_contents(F_ROOT.'includes/topNavLinks.txt',$navitems_nocurrent,LOCK_EX);
  $bytes = file_put_contents(F_ROOT.'includes/subNavLinks.txt',$navitems['sub'],LOCK_EX); 
  $bytes = file_put_contents(F_ROOT.'includes/linktext.txt',$linktext,LOCK_EX);

to this:
Code: [Select]
$bytes = file_put_contents('topNavLinks.txt',$navitems_nocurrent,LOCK_EX);
  $bytes = file_put_contents('subNavLinks.txt',$navitems['sub'],LOCK_EX); 
  $bytes = file_put_contents('linktext.txt',$linktext,LOCK_EX);

even tried this:
Code: [Select]
  $bytes = file_put_contents(_SITE.'includes/topNavLinks.txt',$navitems_nocurrent,LOCK_EX);
  $bytes = file_put_contents(_SITE.'includes/subNavLinks.txt',$navitems['sub'],LOCK_EX); 
  $bytes = file_put_contents(_SITE.'includes/linktext.txt',$linktext,LOCK_EX);

I have also changed every instance of articles and categories to snews17_articles and snews17_categories as I have a prefix in my database... Might this be the dilemma. Jean's snippets do not seem to be written for prefixes...

Now without that first snippet in index.php but the ordinary pages() function and the JS I can see them links but the snippet shows nothing. Is this cause I have nothing inside my txt files ? And if so how would I edit them ? That is how would I go about to enter links ?

My test enviroment: http://fredagsgolfen.net/testing/

Mhm... I don't quite understand the insertion of this it seems.


EDIT --> additional information on this.
I have put the testing enviroment in a sub folder. Changed all paths to ../ so structure is:

default snews.php and original project site in site root.
--
  | Folder testing containing
  --
     | test index.php
       all them txt files
       navSiteMap.php
       AND menu folder ddlevelsmenu

EDIT 2 -->
Now entered both code examples (this implementation and Dynamic drives original code).
The original code example works, and fine too. The implementation do not however, except adding a second down arrow in the preivous... I wonder where I'm wrong. I have come to the conclusion the it must be in the handling of the navSiteMap.php, index.php code AND the text files, as the original code in fact is working...

I would very much appriciate some help here... Anyone, Jean ?
« Last Edit: March 28, 2009, 02:29:20 PM by Patric Ahlqvist »
Logged
"It's only dead fish that goes with the flow... "
Updated

jean01

  • Newbie
  • *
  • Karma: 0
  • Posts: 46
Re: Multi level tabbed menu using pages/categories as top level
« Reply #7 on: March 28, 2009, 03:49:39 PM »

Hi Patrick
I responded to your PM.
jean
Logged

Patric Ahlqvist

  • Nobodys perfect, but Im pretty effing close
  • ULTIMATE member
  • ******
  • Karma: 65
  • Posts: 4867
  • “I'm a self-made man and worships my creator.”
    • p-ahlqvist.com
Re: Multi level tabbed menu using pages/categories as top level
« Reply #8 on: March 28, 2009, 05:53:37 PM »

Ok, great... Will have a looksie. Thanks so much, Jean
Logged
"It's only dead fish that goes with the flow... "
Updated

Patric Ahlqvist

  • Nobodys perfect, but Im pretty effing close
  • ULTIMATE member
  • ******
  • Karma: 65
  • Posts: 4867
  • “I'm a self-made man and worships my creator.”
    • p-ahlqvist.com
Re: Multi level tabbed menu using pages/categories as top level
« Reply #9 on: March 29, 2009, 12:20:51 PM »

Okey...

I reset the tables to have no prefix. I put everything in root except ddlevels files, they are in their own subfolder.
Got everything to work except one thing... the subbie's don't show. All writing to what it should output revealing that there is in fact a menu with sub menus... but I can't get them to show:

http://fredagsgolfen.net

mhm... first thing. My suspiscion about prefixes seemed right. Second wtf, hehe
Logged
"It's only dead fish that goes with the flow... "
Updated

Patric Ahlqvist

  • Nobodys perfect, but Im pretty effing close
  • ULTIMATE member
  • ******
  • Karma: 65
  • Posts: 4867
  • “I'm a self-made man and worships my creator.”
    • p-ahlqvist.com
Re: Multi level tabbed menu using pages/categories as top level
« Reply #10 on: March 29, 2009, 01:30:15 PM »

FRUSTRATED, hehe....

I am so close it seems. All things working out EXCEPT being visible... My output is exactly as yours, that is in view source. Writing to files works:
http://fredagsgolfen.net/linktext.txt
http://fredagsgolfen.net/subNavLinks.txt
http://fredagsgolfen.net/topNavLinks.txt

Still haveing the original DD code working, but I CAN NOT get this thing to show... Hot damn, it's getting on my nervs ;)

I have my navSiteMap and Index as txt's... you fell like having a looksie if there is something obvious that I'm missing... It's soooo little it seems to get it to work:

http://fredagsgolfen.net/index.txt
http://fredagsgolfen.net/navSiteMap.txt

It seems I have to give it up otherwise... I'm just not good enough ;)
Logged
"It's only dead fish that goes with the flow... "
Updated

poppoll

  • Full Member
  • ***
  • Karma: 47
  • Posts: 199
    • Poppoll's sNews playground
Re: Multi level tabbed menu using pages/categories as top level
« Reply #11 on: March 29, 2009, 03:08:07 PM »

Pat,
Remove at the top of index.php
<?php include('navSiteMap.php'); ?>
It is included here:
Code: [Select]
// Create new navigation links
// They will be saved by nav_sitemap()
include '/navSiteMap.php';
$nav_links = nav_sitemap($exclude);
}


Important!! You can't have pages in the navigation!!  Hide the pages and it will work.
I can send you a working example if you wish.
PP
Logged

Patric Ahlqvist

  • Nobodys perfect, but Im pretty effing close
  • ULTIMATE member
  • ******
  • Karma: 65
  • Posts: 4867
  • “I'm a self-made man and worships my creator.”
    • p-ahlqvist.com
Re: Multi level tabbed menu using pages/categories as top level
« Reply #12 on: March 29, 2009, 07:35:34 PM »

Oh I wish... So I wish ;) Pretty please ;)
Logged
"It's only dead fish that goes with the flow... "
Updated

poppoll

  • Full Member
  • ***
  • Karma: 47
  • Posts: 199
    • Poppoll's sNews playground
Re: Multi level tabbed menu using pages/categories as top level
« Reply #13 on: March 29, 2009, 08:15:19 PM »

Pat,
You can download the demo here


PP
« Last Edit: March 30, 2009, 01:34:39 AM by poppoll »
Logged

poppoll

  • Full Member
  • ***
  • Karma: 47
  • Posts: 199
    • Poppoll's sNews playground
Re: Multi level tabbed menu using pages/categories as top level
« Reply #14 on: March 30, 2009, 01:36:52 AM »

Pat,
Just posted a new topic Dropdown menu including Pages and Categories

Have a lOOk..  ;D
PP

Logged
Pages: [1] 2