Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Sub Menus?
Hi,
I need help on how to make sub menus in text pattern. At my site http://www.runjeeta.com, I want to make a sub menu that shows up under “web design” once the person has clicked on that link. I searched the forum but didn’t find any instructions that made sense to me. I’m new to txp and am still trying to figure it all out. Any help would be great.
thanks,
raspberryheaven
Last edited by raspberryheaven (2006-09-17 03:08:43)
“Words have no wings but they can fly a thousand miles.” (Korean Proverb)
Offline
#2 2006-09-17 23:47:05
- NyteOwl
- Member

- From: Nova Scotia, Canada
- Registered: 2005-09-24
- Posts: 539
Re: Sub Menus?
depending on how you have structureed your site, if you have made each topic a section you could use a conditional <code><txp:if_section></code> to display a submenu when you are in the specific section, ie web design etc.
Obsolescence is just a lack of imagination. / 36-bits Forever! / #include <disclaimer.h>;
Offline
Re: Sub Menus?
Can I make my articles the same section as their parent menu heading.
For example, if my Main menu says “web design,” can I put all the articles in the same section as the “web design” link, and still have them as sub sections?
“Words have no wings but they can fly a thousand miles.” (Korean Proverb)
Offline
Re: Sub Menus?
Yes. For the menu, turn off auto-append comments in the Admin tab. Put this in your sidebar, or wherever (use uls/hx/etc for markup):
<code>
<dl>
<dt>Web Design</dt>,<!—<—not req’d—>
<txp:if_section name=“web-design”>
<txp:article_custom form=“menu-item” limit=“6” section=“web-design” />
</txp:if_section>
</dl>
</code>
form:menu-item
<code>
<dd><a href=”<txp:permlink />”><txp:title /></a></dd>
</code>
<hr />
Also, for your section menu, you can hand-code it (<li><a href="/design/">Design</a></li>) or use <txp:section_list break="li" wraptag="ul" /> if you want to separate it from the links.
Last edited by jm (2006-09-21 03:21:57)
Offline
Re: Sub Menus?
OK. thanks, I’ll try that. Btw, what does <dt> and <dl> mean?
“Words have no wings but they can fly a thousand miles.” (Korean Proverb)
Offline
#6 2006-09-18 04:16:22
- nardo
- Member

- From: tuvalahiti
- Registered: 2004-04-22
- Posts: 743
Re: Sub Menus?
jm – that might not work properly on an individual article page? – article_custom might be better
Offline
Re: Sub Menus?
Offline
#8 2006-09-18 06:35:45
- Books
- New Member
- Registered: 2006-08-27
- Posts: 3
Re: Sub Menus?
Like raspberryheaven, I’m new to Textpattern and have been trying to figure this out as well. I want some tabs at the top of my site and when clicked I want the submenus to change, similiar to the way it works at www.digital-web.com .
Is there a Textpattern template that does this that I could study? I looked at Andreas02 for Textpattern and while it looks like it would do it, it is set up so the submenu is the same on all pages.
Thank you!
Books
Offline
Re: Sub Menus?
Hi, I just tried what you suggested at: http://www.runjeeta.com/webdesign
I can see it trying to work but I don’t understand txp code enough to fix it on my own. Right now, it looks like the footer is being sucked up into the side bar and my other navigation items (that belong outside of my web design catagory) are gone.
Below is the code:
<code>
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”
“http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=“http://www.w3.org/1999/xhtml” xml:lang=“en” lang=“en”>
<head>
<title> Web Design</title>
<link rel=“stylesheet” href=”<txp:css />” type=“text/css” media=“screen” />
</head>
<body>
<div id=“page”>
<div id=“top”></div>
<div id=“wrapper”>
<div id=“header”>
<h1><txp:link_to_home class=“site_name”><txp:sitename /></txp:link_to_home></h1>
</div>
<div id=“content”>
<txp:article />
<!— or use:
<txp:article id=“articleID#” />
—>
</div><!— content —>
</div><!— wrapper —>
<div id=“sidebar”>
<div id=“noindent”>
<ul>
<li>
<form action=”<txp:site_url />” method=“get”>
<h2>Search</h2>
<input type=“text” name=“q” value=”“ id=“s” size=“15” />
</form>
</li>
<li>
<!—<txp:category_list break=“br” /> —> </li> <li> <h2>Links</h2>
<dl>
<dt>Web Design</dt>,<!-<del><!—not req’d</del>->
<txp:if_section name=“web-design”>
<txp:article_custom form=“menu-item” limit=“6” section=“web-design” />
</txp:if_section>
</dl>
<txp:linklist form=“plainlinks” sort=“date desc” break=“br” />
</li>
</ul>
</div><!— noindent —>
</div><!— sidebar —>
<div id=“footer”>
<p>
Proudly powered by <a href=“http://www.textpattern.com”>Textpattern</a> | <txp:feed_link label=“RSS” section=“article” flavor=“rss” />
</p>
</div>
</div><!— page —>
</body>
</html>
</code>
I am going to keep playing around with this while i wait for feed back. Thanks!
Last edited by raspberryheaven (2006-09-21 03:13:38)
“Words have no wings but they can fly a thousand miles.” (Korean Proverb)
Offline
Re: Sub Menus?
Oh no, that was supposed to be an HTML Comment regarding the use of a <dt> tag (you can replace it with a header, list item, etc). I forgot to convert my dashes to entities for Textile. <del> is an HTML tag that strikes out text. Only the <txp:... /> tags are important, Textpattern code—the rest is plain HTML.
Here it is:
<code>
<dl>
<dt>Web Design</dt>
<txp:if_section name=“web-design”>
<txp:article_custom form=“menu-item” limit=“6” section=“web-design” />
</txp:if_section>
</dl>
</code>
Offline
Re: Sub Menus?
Ok. I cleared up the part where the code was sucking the footer up.
Code now looks like :
However, it’s still not subtabbing. At http://www.runjeeta.com/webdesign, you can see the post titled Vancouverfood.org, is in the body, not a link for the sub menu.
<code>
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”
“http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=“http://www.w3.org/1999/xhtml” xml:lang=“en” lang=“en”>
<head>
<title> Web Design</title>
<link rel=“stylesheet” href=”<txp:css />” type=“text/css” media=“screen” />
</head>
<body>
<div id=“page”>
<div id=“top”></div>
<div id=“wrapper”>
<div id=“header”>
<h1><txp:link_to_home class=“site_name”><txp:sitename /></txp:link_to_home></h1>
</div>
<div id=“content”>
<txp:article />
<!— or use:
<txp:article id=“articleID#” />
—>
</div><!— content —>
</div><!— wrapper —>
<div id=“sidebar”>
<div id=“noindent”>
<ul>
<li>
<form action=”<txp:site_url />” method=“get”>
<h2>Search</h2>
<input type=“text” name=“q” value=”“ id=“s” size=“15” />
</form>
</li>
<li>
<!—<txp:category_list break=“br” /> —> </li> <li> <h2>Links</h2>
<txp:linklist form=“plainlinks” sort=“date desc” break=“br” />
<dl>
<dt>Web Design</dt>
<txp:if_section name=“webdesign”>
<txp:article_custom form=“menu-item” limit=“6” section=“web-design” />
</txp:if_section>
</dl>
</li>
</ul>
</div><!— noindent —>
</div><!— sidebar —>
<div id=“footer”>
<p>
Proudly powered by <a href=“http://www.textpattern.com”>Textpattern</a> | <txp:feed_link label=“RSS” section=“article” flavor=“rss” />
</p>
</div>
</div><!— page —>
</body>
</html>
</code>
Last edited by raspberryheaven (2006-09-21 03:26:55)
“Words have no wings but they can fly a thousand miles.” (Korean Proverb)
Offline
Re: Sub Menus?
It’s also adding an extra “web design “ piece of text to the nav bar. :( maybe I should hand code this for now?
“Words have no wings but they can fly a thousand miles.” (Korean Proverb)
Offline