Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.

Array indizes dynamisch ansprechen

 
Post new topic   Reply to topic    Smarty Forum Index -> Language: German
View previous topic :: View next topic  
Author Message
kills
Smarty Elite


Joined: 28 May 2004
Posts: 493

PostPosted: Mon Aug 30, 2004 2:25 pm    Post subject: Array indizes dynamisch ansprechen Reply with quote

Hallo zusammen,

könnte solch ein Templategeflecht funktionieren?
Hab grad keine Smarty umgebung hier um die Idee zu testen.

form.tpl:
Code:

{ include file="news_header.tpl"}
 
{ if isset( $smarty.get.id_news)) }
   { foreach from=$aNewsParagraphs item="aParagraph" key="index"}
      { include file="news_body.tpl" index="{$index}"}
   { /foreach }
{ /if }


news_header.tpl:
Code:

<form action="{ $smarty.server.php_self }" method="post">
   <select name="id_newscat">
      { html_options options=$aNewsCats }
   </select>
   
   { validate field="title" criteria="notEmpty" append="aErrors" message="Der Titel des Artikels fehlt!" }
   <input type="text" name="title" value="{ $title }"/>
   
   { validate field="intro" criteria="notEmpty" append="aErrors" message="Das Intro des Artikels fehlt!" }
   <textarea name="intro">{ $intro }</textarea>
</form>


news_body.tpl:
Code:

<form action="{ $smarty.server.php_self }" method="post">
   { validate field="title" criteria="notEmpty" append="aErrors" message="Der Titel des { $index }. Absatzes fehlt!" }
   <input type="text" name="title" value="{ $aNewsParagraphs[$index].title }"/>
   
   { validate field="intro" criteria="notEmpty" append="aErrors" message="Der Text des { $index }. Absatzes fehlt!" }
   <textarea name="intro">{ $aNewsParagraphs[$index].intro }</textarea>
</form>
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    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