Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-05-28 19:53:01

sebatorresi
Member
From: Spain
Registered: 2009-05-27
Posts: 105
Website

Special drop down menu, help!

Hello!

I´m starting with txp, i search in the forum and google but i can´t get what i want.

This is the menu that i have, i don´t understand how can i do to connect the txp to this menu. In the title y put special because if you see on the bottom of each sub-menu i have a class (bottom) this class do a round corner. Is possible do this?

<div id="navigation">

			<ul id="menu">

	<li class="current"><a href="#">Inicio</a></li>

	<li>
		<a href="#">Nosotros</a>
		<div class="menudown">
			<ul>
				<li><a href="#">Historia</a></li>
				<li><a href="#">Visi&oacute;n</a></li>
				<li class="bottom"><a href="#">Familia Pastoral</a></li>
			</ul>
		</div>
	</li>

	<li>
		<a href="#">Ministerios</a>
		<div class="menudown">
			<ul>
				<li><a href="#">Mujeres de Conquista</a></li>
				<li><a href="#">Hombres Protagonistas</a></li>
				<li><a href="#">Adolescentes</a></li>
				<li class="bottom"><a href="#">Ni&ntilde;os</a></li>

			</ul>
		</div>
	</li>

	<li><a href="#">Barcas</a></li>

	<li><a href="#">Blog</a></li>

	<li>
		<a href="#">Cont&aacute;ctanos</a>
		<div class="menudown">
			<ul>
				<li><a href="#">Motivos de Oraci&oacute;n</a></li>
				<li><a href="#">Consejer&iacute;a</a></li>
				<li class="bottom"><a href="#">Autoayuda</a></li>
			</ul>
		</div>
	</li>
</ul>
			</div><!-- #navigation -->

Thanks,
Seba

(edit: added bc.. for better code display. -Els)

Last edited by els (2009-05-28 21:59:43)


Sonríe | Smile . <txp:lover />

Offline

#2 2009-05-28 22:00:49

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: Special drop down menu, help!

Yes, that should be possible. Are the first level items sections and the second level articles?

Offline

#3 2009-05-28 22:14:36

sebatorresi
Member
From: Spain
Registered: 2009-05-27
Posts: 105
Website

Re: Special drop down menu, help!

O thanks for the edit!

Could be both sections with articles? or, What is the best way to do that?
If is like you say, first level section and second level articles, the second one is a link into the “sub-menu”, do you understand me?

An example, when you click on “Ministerios” you go to the article of “Ministerios” and when you click on “Mujeres de Conquista” (second level of “Ministerios”) you go the article of “Mujeres de Conquista” or when i click on “Mujeres de Conquista” i go directly to the article with out create a section.
Oh, now i´m a bit confused hehehe

Thanks!,
Seba


Sonríe | Smile . <txp:lover />

Offline

#4 2009-05-28 23:13:43

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: Special drop down menu, help!

I think the code below should work, if nosotros, ministerios, barcas, blog and contactanos are sections, and Historia, Visión, etcetera are articles in those sections.
It’s just a start, you’d need to modify it if you want no second level for some sections, or to add the ‘current’ class to the second level as well, but you can first try if this works, and if it does it can be fine-tuned later.

<ul id="menu">
	<li<txp:if_section name=""> class="current"</txp:if_section>><txp:link_to_home>Inicio</txp:link_to_home></li>
	<txp:section_list sections="nosotros,ministerios,barcas,blog,contactanos" break="">
		<li<txp:if_section name='<txp:section />'> class="current"</txp:if_section>><txp:section title="1" link="1" />
		<txp:article_custom section='<txp:section />' limit="999" sort="title asc">
			<txp:if_first_article>
				<div class="menudown">
				<ul>
			</txp:if_first_article>
			<txp:if_last_article>
					<li class="bottom"><a href="<txp:permlink />" title="<txp:title />"><txp:title /></a></li>
				</ul>
				</div>	
			<txp:else />
					<li><a href="<txp:permlink />" title="<txp:title />"><txp:title /></a></li>
			</txp:if_last_article>
		</txp:article_custom>
		</li>
	</txp:section_list>
</ul>

Offline

#5 2009-05-29 01:06:02

sebatorresi
Member
From: Spain
Registered: 2009-05-27
Posts: 105
Website

Re: Special drop down menu, help!

Thanks so much!

Ok, now this is working, the menu and drop down. Great!

I have this error

Tag error: -> Textpattern Notice: Page template gfd does not contain a txp:article tag on line 504”

If i use articles for the second level i have to use a page for each section, so when i use this page, this page is the same for each article in the section, my question, how can i do for put diferents articles (text) into the same page?

Thanks,
Seba

Last edited by sebatorresi (2009-05-29 01:07:24)


Sonríe | Smile . <txp:lover />

Offline

#6 2009-05-29 15:49:17

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: Special drop down menu, help!

sebatorresi wrote:

I have this error

Tag error: -> Textpattern Notice: Page template gfd does not contain a txp:article tag on line 504”

It’s just a notice, just what it says: you don’t have an article tag on your page, but you don’t have to have one. If you set production status to ‘live’ (Admin > preferences) it will go away. You can also add <txp:article limit="1" pgonly="1" /> somewhere on your page, it won’t display anything but it will remove the notice.

If i use articles for the second level i have to use a page for each section, so when i use this page, this page is the same for each article in the section, my question, how can i do for put diferents articles (text) into the same page?

You don’t have to use a different page for each section, in Presentation > sections you can assign the same page to all sections if you want. Then if you need different content for sections you can use the <txp:if_section> tags on your page.

Offline

#7 2009-06-01 19:52:02

sebatorresi
Member
From: Spain
Registered: 2009-05-27
Posts: 105
Website

Re: Special drop down menu, help!

Hello Again

I don´t understand the second point.
I put into a new page this:
<txp:if_section name="historia"> <p>example here</p> </txp:if_section>

I did a new section with the name “historia” and in ‘use page’ i call the new page but i don´t have anything in the menu of “nosotros” i´m confused.
If i want to put more than one section into the menu i have to separate with comas, no?
<txp:if_section name="nosotros, historia, familia, etc"> <p>example here</p> </txp:if_section>

I´m reading a lot about that but is taking me hard it, sorry.

Seba


Sonríe | Smile . <txp:lover />

Offline

#8 2009-06-01 20:46:37

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: Special drop down menu, help!

My code for the menu was based on your two level menu example, assuming that the first level items are sections and the second level items are articles.
So you’d have

  • sections: nosotros, ministerios, barcas, blog, contactanos
  • and articles
    • in section nosotros: Historia, Visión, Familia Pastoral
    • in section ministerios: Mujeres de Conquista, Hombres Protagonistas, Adolescentes, Niños
    • etcetera

If you do it this way, you only have to create one page for all sections; so when you’ve created the sections, enter that same page under ‘Use page’ for all those sections. You don’t even need <txp:if_section> tags to display the right articles: the <txp:article /> tag is context sensitive, so it will only display articles from the section that you are viewing. So after you’ve created your articles, and put them in the right section, all you need is the menu code and a <txp:article /> tag on your page :)

Offline

#9 2009-06-01 21:09:39

sebatorresi
Member
From: Spain
Registered: 2009-05-27
Posts: 105
Website

Re: Special drop down menu, help!

Thanks, i still with out understand :(.

I create my article “history”: In Category i have to put the category that i create, in section the same, no?
Now in the page that i create what i have to put? this part i don´t understand very well.

i´m still thinking if is better have a page for each one because may be some pages change a bit… (the client)

Thanks a lot for your help!

Seba


Sonríe | Smile . <txp:lover />

Offline

#10 2009-06-01 21:38:16

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: Special drop down menu, help!

sebatorresi wrote:

I create my article “history”: In Category i have to put the category that i create,

Yes, if you want to use categories. But you don’t have to, you can also leave it empty.

in section the same, no?

Looking at your first post the section for article ‘Historia’ would be ‘Nosotros’.

Now in the page that i create what i have to put? (…) i´m still thinking if is better have a page for each one because may be some pages change a bit… (the client)

OK, you can also create a separate page for each section, no problem. In that case, it’s easier to put the code for your menu in a form (type: misc). On your page, where you want the menu, place this:

<txp:output_form form="name-of-your-menu-form" />

And where you want the article(s) to be displayed: <txp:article />. You can customize it later with attributes like limit, form etcetera, but this will get you started.

Offline

#11 2009-06-01 22:52:40

sebatorresi
Member
From: Spain
Registered: 2009-05-27
Posts: 105
Website

Re: Special drop down menu, help!

Thanks!
I have this done, now how call the pages in the menu?
For example i have created the “nosotros” page and historia “page”, i have to connect this to the menu.
Sorry for all the questions, but in this area i´m a “bit” lose

Seba!

Last edited by sebatorresi (2009-06-01 22:54:10)


Sonríe | Smile . <txp:lover />

Offline

#12 2009-06-02 18:25:22

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: Special drop down menu, help!

Sorry, now I’m not sure I understand you ;) If you followed my examples, and if you have the menu and the article tag on your page, clicking a menu item should display the articles you want. Do you have a link to the site you are building?

Edit:

sebatorresi wrote:

the “nosotros” page and historia “page”,

Are we talking about the same ‘page’? When I say page I mean (plantilla de) página. ‘Historia’ should be an article in my opinion.

Last edited by els (2009-06-02 18:35:10)

Offline

Board footer

Powered by FluxBB