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

Wieder mal ein schleifen Problem

 
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
Bjoern3003
Smarty Rookie


Joined: 22 Nov 2004
Posts: 7

PostPosted: Mon Nov 22, 2004 3:31 pm    Post subject: Wieder mal ein schleifen Problem Reply with quote

Hi,

ich möchte aus meiner SQL Datei mehrere Werte auslesen und dann untereinander und nebeneinander in einer Tabelle ausgeben.

Allerdings komme ich im moment null weiter Sad

Hier mal der Code für Smarty:

Code:
$id = 0;
$query = "select contentid,date from favorites WHERE userid LIKE '".$_SESSION['userid']."'";
$result = mysql_query($query, $conn);
while(list($contentid,$date) = mysql_fetch_array($result)) {

$smarty->assign("favos", array("id" => $id+1, "titel" => $contentid, "datum" => $date));


Und hier der Code in der tpl:

Code:
{foreach name=aussen1 item=favo1 from=$favos}
                              <tr>
                                <td class="content">{$id}</td>
                                <td class="content">{$titel}</td>
                                <td class="content">{$datum}</td>
                                <td class="content">Löschen</td>
                              </tr>
{/foreach}


Ich weiß, das der hundert pro nicht richtig ist, aber leider kann ich aus dem Handbuch nichts entnehmen, was mich weiterbringt Sad

Hoffentlich kann mir hier schnell geholfen werden. Smile
Back to top
View user's profile Send private message
ZakMc
Smarty Pro


Joined: 04 Oct 2004
Posts: 182

PostPosted: Tue Nov 23, 2004 11:16 am    Post subject: Reply with quote

das funzt so nicht

warum willst du smarty-assign in eienr while schleife aufrufen???

du übergibst an smarty das fertige array und assign nur einmal
Back to top
View user's profile Send private message
Bjoern3003
Smarty Rookie


Joined: 22 Nov 2004
Posts: 7

PostPosted: Tue Nov 23, 2004 9:21 pm    Post subject: Reply with quote

Habe es inzwischen hinbekommen Smile

Ne andere Frage. Kann man das caching komplett deaktivieren??

Mit $smarty->caching = false; tut er trotzdem weiterhin fleißig die Files cachen.

Problem ist, das man im laufenden Betrieb das Template schnell wechseln können soll.

Und das unter mehreren Leuten (jeder nen anderes Template).

Danke
Back to top
View user's profile Send private message
messju
Administrator


Joined: 16 Apr 2003
Posts: 3336
Location: Oldenburg, Germany

PostPosted: Wed Nov 24, 2004 9:14 am    Post subject: Reply with quote

Bjoern3003 wrote:
Habe es inzwischen hinbekommen Smile

Ne andere Frage. Kann man das caching komplett deaktivieren??

Mit $smarty->caching = false; tut er trotzdem weiterhin fleißig die Files cachen.


nein, das compilieren von templates kann man nicht deaktivieren.

Quote:
Problem ist, das man im laufenden Betrieb das Template schnell wechseln können soll.

Und das unter mehreren Leuten (jeder nen anderes Template).

Danke


eine möglichkeit ist, verschiedene compile_ids zu verwenden:

$smarty->template_dir = 'dir_a';
$smarty->display('index.tpl', null, 'a');
...
$smarty->template_dir = 'dir_b';
$smarty->display('index.tpl', null, 'b');
Back to top
View user's profile Send private message Send e-mail Visit poster's website
ZakMc
Smarty Pro


Joined: 04 Oct 2004
Posts: 182

PostPosted: Wed Nov 24, 2004 10:32 am    Post subject: Reply with quote

war das nicht so das mit compile_force=true das Template immer neu generiert wird. Er erzeugt zwar ne Datei in Cacahe benutzt diese aber nie
Back to top
View user's profile Send private message
messju
Administrator


Joined: 16 Apr 2003
Posts: 3336
Location: Oldenburg, Germany

PostPosted: Wed Nov 24, 2004 10:53 am    Post subject: Reply with quote

caching!=compiling.

ja, force_compile compiliert jedes mal die datei in templates_c (das "c" steht für "compiled" und *NICHT* für "cached", btw).

caching ist optional.
compilieren nicht.

cache/ is optional.
templates_c/ nicht.

aber du willst ganz sicher deine software nicht so designen, dass sie nur mit force_compile funktioniert.
force_compile sollte nur für debug-zwecke verwendet werden.
eine software die nur funktioniert wenn force_compile an ist, ist broken by design.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Bjoern3003
Smarty Rookie


Joined: 22 Nov 2004
Posts: 7

PostPosted: Wed Nov 24, 2004 5:53 pm    Post subject: Reply with quote

Ich möchte einfach nur, das ich in echtzeit zwischen verschiedenen Designs hinund her wechseln kann.

Und die User sollen das auch können.

Und das ganze ohne vorher den cache zu leeren, da dieser ja für alle User gleich ist.
Back to top
View user's profile Send private message
the-styler
Smarty Rookie


Joined: 12 Jul 2004
Posts: 25

PostPosted: Wed Nov 24, 2004 9:42 pm    Post subject: Reply with quote

was ist denn dieses force_compile
Back to top
View user's profile Send private message
messju
Administrator


Joined: 16 Apr 2003
Posts: 3336
Location: Oldenburg, Germany

PostPosted: Sat Nov 27, 2004 10:27 am    Post subject: Reply with quote

the-styler wrote:
was ist denn dieses force_compile


guckst du http://smarty.php.net/manual/de/variable.force.compile.php

gruss
messju
Back to top
View user's profile Send private message Send e-mail Visit poster's website
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