Zum Inhalt springen

Probleme bei HMENU Erstellung

Erstellt am 11. September 2004 · 7 Antworten · letzte Antwort am 16. September 2004

Tags: Templates & Layouts, Frage

Lietzi ·

Hallo Leute!

Ich bin seit knapp ner Woche dabei mich mit Typo 3 zu beschäftigen, hab erstmal die Tuts durchgelesen und die refs auch mal überflogen..

Schon schön zu sehen das OpenSource sowas tiefdurchdachtes wie Typo3 herausbringen kann..

Ich hab jetzt angefangen ein Homepageprojekt auf Typo3 umzubauen, scheitere aber schon an der Erstellung des dynamischen Menus (der Rest hat auch so noch recht gut geklappt). Das alles hab ich nach dem MTB/1 versucht umzusetzen..

Mein Ziel ist es ein MainMenu und ein SubMenu zu realisieren, wobei die Menus jeweils einzeilig sind und untereinander stehen. Das Template passt, die Tags werden vom autoparser erstellt und von den Subparts erkannt, aber leider nur gelöscht..

hier das Template:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>

	<head>
		<link href="gcu_class.css" rel="stylesheet" type="text/css" media="all">
	</head>

	<body background="fond.jpg" bgcolor="#ffffff" leftmargin="0" marginheight="0" marginwidth="0" topmargin="0">
		<table width="643" border="0" cellspacing="2" cellpadding="0" height="580">
			<tr height="515">
				<td align="center" valign="bottom" width="80" height="515" id="mlocation"><img src="mlocations/mlocation-willkommen.jpg" alt="" height="360" width="80" border="0"></td>
				<td id="content" colspan="2" valign="top" align="center" width="557" height="515">
					<div class="Headline" class="Headline" align="center">
						Hier steht eine Headline</div>
					<div class="copy">
						<p>Hier steht etwas Copytext..</p>
					</div>
				</td>
			</tr>
			<tr height="34">
				<td width="80" height="34"></td>
				<td width="40" height="34"></td>
				<td valign="bottom" width="515" height="34">
						<table width="490" border="0" cellspacing="2" cellpadding="0" height="25" id="Main_Menu">
							<tr>
								<td class="Main_Menu_act">Der Club</td>
								<td class="Main_Menu_no" align="center">Der Platz</td>
								<td class="Main_Menu_no" align="center">Der Pro</td>
								<td class="Main_Menu_no" align="center">Die Turniere</td>
								<td class="Main_Menu_no" align="right">Der Service</td>
							</tr>
						</table>
				</td>
			</tr>
			<tr valign="top" height="23">
				<td width="80" height="23"></td>
				<td width="40" height="23"></td>
				<td width="515" height="23">
						<table width="490" border="0" cellspacing="2" cellpadding="0" height="20" id="Sub_Menu">
							<tr>
								<td class="Sub_Menu_act">Jugend</td>
								<td class="Sub_Menu_no" align="center">Ladies</td>
								<td class="Sub_Menu_no" align="center">Senioren</td>
								<td class="Sub_Menu_no" align="center">Senioren-Liga</td>
								<td class="Sub_Menu_no" align="center">Jungsenioren-Liga</td>
								<td class="Sub_Menu_no" align="right">Internes</td>
							</tr>
						</table>
				</td>
			</tr>
		</table>
		<p></p>
	</body>

</html>

Hier das Template Setup:

# Configuring the Auto-Parser:
plugin.tx_automaketemplate_pi1 {
# Read the template file:
content = FILE
content.file = fileadmin/templates/main_tpl/template_std.html
# Here we define which elements in the HTML that
# should be wrapped in subpart-comments:
elements {

BODY.all = 1
BODY.all.subpartMarker = DOCUMENT_BODY
HEAD.all = 1
HEAD.all.subpartMarker = DOCUMENT_HEADER
HEAD.rmTagSections = title
TD.all =1
TABLE.all = 1
}
# Prefix all relative paths with this value:
relPathPrefix = fileadmin/templates/main_tpl/
}

temp.m_menu = HMENU
temp.m_menu.1 = TMENU
temp.m_menu.1 {
   NO.allWrap = <td class="Main_Menu_no" align="center"> | </td>
   ACT = 1
   ACT.allWrap = <td class="Main_Menu_act" align="center"> | </td>
}

temp.s_menu = HMENU
temp.s_menu.2 = TMENU
temp.s_menu.2 {
   NO.allWrap = <td class="Sub_Menu_no" align="center"> | </td>
   ACT = 1
   ACT.allWrap = <td class="Sub_Menu_act" align="center"> | </td>
}

# Main TEMPLATE cObject for the BODY
temp.mainTemplate = TEMPLATE
temp.mainTemplate {
# Feeding the content from the Auto-parser to the TEMPLATE cObject:
template =< plugin.tx_automaketemplate_pi1
# Select only the content between the <body>-tags
workOnSubpart = DOCUMENT_BODY
# Substitute the ###menu_1### subpart with some example content:
subparts.Main_Menu = temp.m_menu
# Substitute the ###menu_1### subpart with some example content:
subparts.Sub_Menu < temp.s_menu
# Substitute the ###content### subpart with some example content:
subparts.content < styles.content.get
# Substitute the ###mlocation## subpart with an example image:
subparts.mlocation = IMAGE
subparts.mlocation {
   file = fileadmin/bilder/mlocation/mlocation-willkommen.jpg
   file.width = 80   
  }
}

# Main TEMPLATE cObject for the HEAD
temp.headTemplate = TEMPLATE
temp.headTemplate {
# Feeding the content from the Auto-parser to the TEMPLATE cObject:
template =< plugin.tx_automaketemplate_pi1
# Select only the content between the <head>-tags
workOnSubpart = DOCUMENT_HEADER
}

# Default PAGE object:
page = PAGE
page.typeNum = 0
# Copying the content from TEMPLATE for <body>-section:
page.10 < temp.mainTemplate
# Copying the content from TEMPLATE for <head>-section:
page.headerData.10 < temp.headTemplate
page.bodyTag = <body background="fileadmin/templates/main_tpl/fond.jpg" bgcolor="#ffffff" leftmargin="0" marginheight="0" marginwidth="0" topmargin="10">

Mag alles ein wenig unübersichtlich sein, tut mir leid, ich mach noch meine ersten Schritte und die recht wackelig..

Die passenden Stellen sind an sich analog dem MTB, funktioniert aber trotzdem nicht: Es kommt diese Homepage dabei raus:

<!DOCTYPE html
	PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<!-- 
	This website is brought to you by TYPO3 - get.content.right
	TYPO3 is a free open source Content Management Framework created by Kasper Skaarhoj and licensed under GNU/GPL.
	TYPO3 is copyright 1998-2004 of Kasper Skaarhoj. Extensions are copyright of their respective owners.
	Information and contribution at http://www.typo3.com
-->

	<style type="text/css">
		/*<![CDATA[*/
	<!--
	/* default styles for extension "tx_mininews_pi1" */
	.tx-mininews-pi1 .tx-mininews-pi1-listrow P.tx-mininews-pi1-listrowField-title { font-weight:bold; }
	.tx-mininews-pi1 .tx-mininews-pi1-listrow P.tx-mininews-pi1-listrowField-teaser { margin-bottom:15px; }
	.tx-mininews-pi1 .tx-mininews-pi1-fp_listrow P.tx-mininews-pi1-fp_listrowField-title { font-weight:bold; }
	.tx-mininews-pi1 .tx-mininews-pi1-fp_listrow P.tx-mininews-pi1-fp_listrowField-teaser { margin-top:0px; margin-bottom:10px; }
	.tx-mininews-pi1 .tx-mininews-pi1-singleView P.tx-mininews-pi1-singleViewField-teaser { font-style:italic; margin-top:5px; margin-bottom:10px; }
	.tx-mininews-pi1 .tx-mininews-pi1-browsebox P SPAN.tx-mininews-pi1-browsebox-strong { font-weight:bold; }
	.tx-mininews-pi1 .tx-mininews-pi1-listrow P.tx-mininews-pi1-listrowField-teaser A { color:black; text-decoration:none; }
	.tx-mininews-pi1 .tx-mininews-pi1-listrow P.tx-mininews-pi1-listrowField-teaser A:hover { color:black; text-decoration:none; }
	-->
		/*]]>*/
	</style>

		<link href="fileadmin/templates/main_tpl/gcu_class.css" rel="stylesheet" type="text/css" media="all">
	
	<title>Willkommen</title>
	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
	<meta name="generator" content="TYPO3 3.6 CMS" />

	<script type="text/javascript">
		/*<![CDATA[*/
	<!--
		browserName = navigator.appName;
		browserVer = parseInt(navigator.appVersion);
		var msie4 = (browserName == "Microsoft Internet Explorer" && browserVer >= 4);
		if ((browserName == "Netscape" && browserVer >= 3) || msie4 || browserName=="Konqueror") {version = "n3";} else {version = "n2";}
			// Blurring links:
		function blurLink(theObject)	{	//
			if (msie4)	{theObject.blur();}
		}
		
	// -->
		/*]]>*/
	</script>


</head>
<body background="fileadmin/templates/main_tpl/fond.jpg" bgcolor="#ffffff" leftmargin="0" marginheight="0" marginwidth="0" topmargin="10">

		<table width="643" border="0" cellspacing="2" cellpadding="0" height="580">
			<tr height="515">
				<td align="center" valign="bottom" width="80" height="515" id="mlocation"><img src="fileadmin/bilder/mlocation/mlocation-willkommen.jpg" width="80" height="360"  border="0" alt="" title="" /></td>
				<td id="content" colspan="2" valign="top" align="center" width="557" height="515">
	<!--  CONTENT ELEMENT, uid:3/image [begin] -->

		<a name="3"></a>
		<!--  Image block: [begin] -->
			<div align="center"><table width="470" border="0" cellspacing="0" cellpadding="0"  class="imgtext-table"><tr><td colspan="1"><img src="clear.gif" width="470" height="1" alt="" /></td></tr><tr><td valign="top"><img src="uploads/pics/clubhaus.jpg" width="470" height="369"  border="0" align="top" alt="" title="" /><br /></td></tr></table></div><img src="clear.gif" width="1" height="6" border="0" class="spacer-gif" alt="" title="" /><br />
		<!--  Image block: [end] -->
			
	<!--  CONTENT ELEMENT, uid:3/image [end] -->
		
	<!--  CONTENT ELEMENT, uid:2/text [begin] -->
		<a name="2"></a>
		<!--  Header: [begin] -->
			<div class="csc-header csc-header-n2"><h1>Willkommen auf der Site</h1></div>

		<!--  Header: [end] -->
			
		<!--  Text: [begin] -->
			<p class="bodytext">Schön das sie reinschauen!</p>
		<!--  Text: [end] -->
			
	<!--  CONTENT ELEMENT, uid:2/text [end] -->
		</td>
			</tr>
			<tr height="34">

				<td width="80" height="34"></td>
				<td width="40" height="34"></td>
				<td valign="bottom" width="515" height="34">
						<table width="490" border="0" cellspacing="2" cellpadding="0" height="25" id="Main_Menu"></table>
				</td>
			</tr>
			<tr valign="top" height="23">
				<td width="80" height="23"></td>
				<td width="40" height="23"></td>

				<td width="515" height="23">
						<table width="490" border="0" cellspacing="2" cellpadding="0" height="20" id="Sub_Menu"></table>
				</td>
			</tr>
		</table>
		<p></p>
	
</body>
</html>

Ich hoffe Ihr könnt mir helfen.. wird so wie ich mich kenne irgendwas kleines sein..

Danke schonmal im vorraus!

jenses ·

Hallo Lietzi !

1. statt

temp.s_menu = HMENU 
temp.s_menu.2 = TMENU 
temp.s_menu.2 { 
   NO.allWrap = <td class="Sub_Menu_no" align="center"> | </td> 
   ACT = 1 
   ACT.allWrap = <td class="Sub_Menu_act" align="center"> | </td> 
}

nimmst du das

temp.s_menu = HMENU 
temp.s_menu.entryLevel = 1
temp.s_menu.1 = TMENU 
temp.s_menu.1 { 
   NO.allWrap = <td class="Sub_Menu_no" align="center"> | </td> 
   ACT = 1 
   ACT.allWrap = <td class="Sub_Menu_act" align="center"> | </td> 
}

2.
subparts.Main_Menu = temp.m_menu
ersetzen mit
subparts.Main_Menu < temp.m_menu

Dann funzt es.

viele Grüße
jenses

Lietzi ·

Hallo Jenses!

War echt voller Hoffnung, aber das mit dem = scheint irgendwie erst später dazwischen gerutscht zu sein.. ich hab deine Änderungen durchgeführt es funzt aber leider immer noch nicht (ich find es schade das es keine Fehlermeldungen gibt, bzw. ich nicht weiß wo man die mal sehen kann)..

Auf jeden fall sieht mein Setup nun so aus:

# Configuring the Auto-Parser:
plugin.tx_automaketemplate_pi1 {
# Read the template file:
content = FILE
content.file = fileadmin/templates/main_tpl/template_std.html
# Here we define which elements in the HTML that
# should be wrapped in subpart-comments:
elements {

BODY.all = 1
BODY.all.subpartMarker = DOCUMENT_BODY
HEAD.all = 1
HEAD.all.subpartMarker = DOCUMENT_HEADER
HEAD.rmTagSections = title
TD.all =1
TABLE.all = 1
}
# Prefix all relative paths with this value:
relPathPrefix = fileadmin/templates/main_tpl/
}

temp.m_menu = HMENU
temp.m_menu.1 = TMENU
temp.m_menu.1 {
   NO.allWrap = <td class="Main_Menu_no" align="center"> | </td>
   ACT = 1
   ACT.allWrap = <td class="Main_Menu_act" align="center"> | </td>
}

temp.s_menu = HMENU
temp.s_menu.entryLevel = 1
temp.s_menu.1 = TMENU
temp.s_menu.1 {
   NO.allWrap = <td class="Sub_Menu_no" align="center"> | </td>
   ACT = 1
   ACT.allWrap = <td class="Sub_Menu_act" align="center"> | </td>
}

# Main TEMPLATE cObject for the BODY
temp.mainTemplate = TEMPLATE
temp.mainTemplate {
# Feeding the content from the Auto-parser to the TEMPLATE cObject:
template =< plugin.tx_automaketemplate_pi1
# Select only the content between the <body>-tags
workOnSubpart = DOCUMENT_BODY
# Substitute the ###menu_1### subpart with some example content:
subparts.Main_Menu < temp.m_menu
# Substitute the ###menu_1### subpart with some example content:
subparts.Sub_Menu < temp.s_menu
# Substitute the ###content### subpart with some example content:
subparts.content < styles.content.get
# Substitute the ###mlocation## subpart with an example image:
subparts.mlocation = IMAGE
subparts.mlocation {
   file = fileadmin/bilder/mlocation/mlocation-willkommen.jpg
   file.width = 80   
  }
}

# Main TEMPLATE cObject for the HEAD
temp.headTemplate = TEMPLATE
temp.headTemplate {
# Feeding the content from the Auto-parser to the TEMPLATE cObject:
template =< plugin.tx_automaketemplate_pi1
# Select only the content between the <head>-tags
workOnSubpart = DOCUMENT_HEADER
}

# Default PAGE object:
page = PAGE
page.typeNum = 0
# Copying the content from TEMPLATE for <body>-section:
page.10 < temp.mainTemplate
# Copying the content from TEMPLATE for <head>-section:
page.headerData.10 < temp.headTemplate
page.bodyTag = <body background="fileadmin/templates/main_tpl/fond.jpg" bgcolor="#ffffff" leftmargin="0" marginheight="0" marginwidth="0" topmargin="10">
Lietzi ·

Ich hab mal noch ein wenig rumgebastelt..
So hab ich das template auf eine andere seite kopiert
(bisher hatte ich es auf der willkommensseite, die keine subpages hat ausprobiert), die auch supages hat.

hier wird dann mit entrylevel = 0 und dem level1-anhang (also mit den oben als main_menu engetragenen einstellungen) erziehlt dass die subpages angezeigt werden.

Für mich logisch wäre gewesen das wenn ich da nun -1 angebe die Liste der Mainpages angezeigt wird: leider fehlanzeige!

auch die einstellungen die eigentlich für die supages gedacht waren, zeigen nichts an.

Ich brauch da unbedingt hilfe, hier im Forum hab ich nichts ähnliches gefunden, die tuts laufen auch alle anders.. HILFE!

jenses ·

Hallo Lietzi !
Ich hab so das Gefühl,
das es dir an elementarem Grundverständnis von Typo3 mangelt. #paralyzed#
Du solltest wirklich mal die neue deutsche Doku durcharbeiten. 😉

Eine ganz normale Seitenstruktur in Typo3 sieht so aus :

Root
--seite 1
----seite 1.1
-----seite 1.2
--seite 2
-----seite 2.1
-----seite 2.2

usw.
Dabei ist Root vom Typ Shortcut, verweist auf seite 1 in der ersten Menüebene.
Bei Root --> Seitentitel bearbeiten muß der Haken bei "Ist Anfang der Web-Seite" gesetzt sein, und zwar nur dort !
Auf der Seite Root legst du dein Template an, welches die Konfiguration der Seite beinhaltet ( also den Autoparser, die Menüs, Inhaltselemente usw. ).
Im Template müssen die Haken bei Constants, Setup und Rootlevel gesetzt werden.
Dein Setup mit meinen Änderungen arbeitet genau mit oben beschriebener Seitenstruktur zusammen,
legts du weitere Ebenen an, mußt du das Setup erweitern.
Und du brauchst nicht für jede Seite ein eigenes Template anzulegen.
Das ist wirklich nur notwendig, wenn dort z.B. das Menü anders aufgebaut sein soll.

Wie gesagt, mit einem typischen Seitenbaum mit 2 Ebenen funktioniert das Setup einwandfrei.

viele Grüße
jenses

Lietzi ·

Hallo Jenses!

Den Part in der Doku hab ich wohl überlesen #paralyzed# :o

Jetzt klappt alles soweit..

Nur ich hab da dann noch ein Problem das sich durch das Umstellen ergibt..

Ich will nicht ein RTFM riskieren und versuche es erstmal selbst..

Also bis bald (wird sicher nicht lange dauern)

Lietzi

jenses ·

Was ist denn RTFM ? :o

jenses

edit: schon selbst gefunden!
Ne, wir sind hier doch eigentlich alle ganz nett zueinander.