Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Tabelle erstellen

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Language: German
View previous topic :: View next topic  
Author Message
Twilo
Smarty Regular


Joined: 13 Jan 2005
Posts: 88
Location: Berlin

PostPosted: Tue Feb 08, 2005 1:18 am    Post subject: Tabelle erstellen Reply with quote

Hallo,

ich möchte eine Tabelle erstellen

das Problem ist aber, dass ich nicht nur Zahlen oder Wörter in den Spalten einfügen möchte, sondern soetwas

[php:1:31993a148e]<a href="javascript:var f = window.open('/bilder/{#$bild._id#}.{#$bild._extension#}','bildAusgabe','width=600,height=480');"><img src="/thumbnail/{#$bild._id#}.{#$bild._extension#}" width="{#$bild._thumbnail_width#}" height="{#$bild._thumbnail_height#}" alt="" /></a>[/php:1:31993a148e]

wie muss ich die Tabelle mit den Daten füttern?

oder muss ich sogar einen anderen Weg gehen
die Tabelle soll 4 Spalten haben

die Daten (mehrere Datensätze) kommen aus einer Datenbank

mfg
Twilo
Back to top
View user's profile Send private message Visit poster's website
rok°!
Smarty Rookie


Joined: 10 Jan 2005
Posts: 12

PostPosted: Thu Feb 10, 2005 4:03 pm    Post subject: Reply with quote

ich glaub du hast dein problem zu unkonkret geschildert. ich hab nicht verstanden, was du willst...
Back to top
View user's profile Send private message
Twilo
Smarty Regular


Joined: 13 Jan 2005
Posts: 88
Location: Berlin

PostPosted: Fri Feb 11, 2005 2:07 pm    Post subject: Reply with quote

Hallo,

bei Smarty muss man ja der Tabelle die Datensätze mit geben.

meien Datensätze enthalten aber nicht die Daten, die Smarty erwartet, sondern müssen erst aufbereitet werden

Smarty soll mir nachher z.B. so eine Tabelle ausgeben

Code:
<table >
<tr>
<td><a href="javascript:var f = window.open('/bilder/1.jpg','bildAusgabe','width=600,height=480');"><img src="/thumbnail/1.jpg" width="100" height="56" alt="" /></a></td>
<td><a href="javascript:var f = window.open('/bilder/2.gif','bildAusgabe','width=600,height=480');"><img src="/thumbnail/2.gif" width="100" height="58" alt="" /></a></td>
<td><a href="javascript:var f = window.open('/bilder/3.gif','bildAusgabe','width=600,height=480');"><img src="/thumbnail/3.gif" width="100" height="35" alt="" /></a></td>
<td><a href="javascript:var f = window.open('/bilder/4.gif','bildAusgabe','width=600,height=480');"><img src="/thumbnail/4.gif" width="100" height="58" alt="" /></a></td>
</tr>
[...]


wenn ich Smarty z.B. ein Array schon mit den fertigen HTML-Code gebe, dann bekomm ich das als Ausgabe, was ich haben möchte, nur ist das nicht das, was ich mir erhoffe Smile

ich möchte ja nachher vielleicht irgendwann mal was ändern, nur geht das schlcht, wenn der Teil dann so in der Datenbank steht

kann man sich vielelicht selber irgendwie eien Tabelle zusammenschustern lassen
vielleicht über foreach schleifen, oder ähnlich?

Twilo
Back to top
View user's profile Send private message Visit poster's website
CaptainE
Smarty Rookie


Joined: 23 Dec 2004
Posts: 22

PostPosted: Fri Feb 11, 2005 3:13 pm    Post subject: Reply with quote

es gibt da wohl zwei möglichkeiten für dich

1. natürlich solltest du nicht die html daten in die DB schreiben. Aber wenn du die aus der DB ausließt, dann wäre hier im phpscript eine möglichkeit die in dein gewünschtes Format zu bringen.

2. natürlich kannst dir auch mit einem Foreach eine tabelle Bauen, das ist weiter nichts großes und ich mach das öfter so. das sieht dann ungefähr so aus (ist nur eine hilfe in die richtung, nicht dass ich weider kitik zu einzelheiten bekomm)

Ich geh hier von einem Mehrdimensionalen Arra in dieser form aus:
Code:
$rows
 0 -> $cols
           0 -> INHALT1
           1 -> INHALT2
           2 -> INHALT3
 1 -> $cols
           0 -> INHALT1
           1 -> INHALT2
           2 -> INHALT3
 1 -> $cols
           0 -> INHALT1
           1 -> INHALT2
           2 -> INHALT3

Das Template sieht dann so aus:
Code:

<table>
 {foreach from=$rows item=col}
  <tr>
   {foreach from=$col item=content}
    <td>{$content}</td>
   {/foreach}
  </tr>
 {/foreach}
</table>


Hoffe das hilft dir weiter
Back to top
View user's profile Send private message
Twilo
Smarty Regular


Joined: 13 Jan 2005
Posts: 88
Location: Berlin

PostPosted: Fri Feb 11, 2005 8:30 pm    Post subject: Reply with quote

Hwallo

hm...
helfen tut es etwas Smile

mein Array sieht folgendermaßen aus

[php:1:9c19caf147]Array
(
[0] => Array
(
[_id] => 4
[_extension] => gif
[_thumbnail_width] => 100
[_thumbnail_height] => 58
)

[1] => Array
(
[_id] => 6
[_extension] => jpg
[_thumbnail_width] => 100
[_thumbnail_height] => 33
)

[...]

)[/php:1:9c19caf147]

ich möchte im Template angeben können, wieviele Spalten ausgegeben werden sollen

das passt dann nicht mehr wirklich zu dein Beispiel :-/

ich müsste irgendwie eine Tabelle, oder <viv> Konstrukt hinbekommen, wo ich im Template
[php:1:9c19caf147]<a href="javascript:var f = window.open('/bilder/{#$bild._id#}.{#$bild._extension#}','bildAusgabe','width=600,height=480');"><img src="/thumbnail/{#$bild._id#}.{#$bild._extension#}" width="{#$bild._thumbnail_width#}" height="{#$bild._thumbnail_height#}" alt="" /></a>[/php:1:9c19caf147]
soetwas auch angeben kann

Twilo
Back to top
View user's profile Send private message Visit poster's website
rok°!
Smarty Rookie


Joined: 10 Jan 2005
Posts: 12

PostPosted: Fri Feb 11, 2005 11:14 pm    Post subject: Reply with quote

kannst du doch. mit ner if-abfrage, wie weit der index ist.
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Language: German All times are GMT
Page 1 of 1

 
Jump to:  
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
Protected by Anti-Spam ACP