|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
be_fisch Smarty n00b
Joined: 10 Mar 2005 Posts: 4
|
Posted: Thu Mar 10, 2005 12:26 pm Post subject: Daten aus aus versch. mysql Tabellen nacheinander ausgeben. |
|
|
Hallo,
folgendes Problem.
Ich habe 2 mySQL Tabellen:
submenus:
id,
subname,
subid.
submenus_daten:
id,
abt_id,
name,
link
So jetzt wirds komliziert. Es soll jetzt der erste Eintrag aus submenus angezeigt werden. Un dann alle Einträge aus submenus_Daten bei denen die abt_id == der subid.
Un dann so weiter.
home
link1
link2
hom2
link3
link4
Ich habe jetzt eine mysql abfrage, die mir Beide Tabellen getrennt, an Smarty übergibt.
Also ein Array für submenus und ein Array für submenus_daten.
Wie kann ich die jetzt so ausgeben wie oben beschrieben. Sicherlich geht das mit Sections oder foreach. Aber ich hab jetzt schon sämtliche Möglichkeiten durch und komme einfach nicht weiter.
Danke für euere hilfe.
Gruß Fisch |
|
Back to top |
|
ZakMc Smarty Pro
Joined: 04 Oct 2004 Posts: 182
|
Posted: Fri Mar 11, 2005 11:17 am Post subject: |
|
|
Ich würde das mit 2 sections lösen.
ich schreib den code mal frei von der hand musst den dann noch richtig anpassen
Code: | {section name=i loop=$array1}
$array1[i].name
{section name=k loop=$array2}
{if $array1[i].id eq $array2[k].id}
$array2[k].name
{/if}
{/section
{/section} |
|
|
Back to top |
|
be_fisch Smarty n00b
Joined: 10 Mar 2005 Posts: 4
|
Posted: Mon Mar 14, 2005 11:14 am Post subject: |
|
|
Danke für deine Antwort.
Hab das ganze jetzt anders gelöst, indem ich meine SQL Abfrage angepasst habe.
Jetzt bekomm ich ein Array, wo die Werte schon in der richtigen Reihenfolge drinne stehn.
Trozdem Danke.
Gruß Fisch |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|