|
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 |
iclone Smarty n00b
Joined: 04 Dec 2012 Posts: 2 Location: Germany
|
Posted: Tue Dec 04, 2012 9:51 pm Post subject: Global Assign Wert |
|
|
Hi,
und zwar hab ich da mal eine Frage. Ist es möglich in einer HTML erstellten Variable, in einer anderen HTML aufzurufen?
also in einer HTML Datei habe ich z.B: Code: | {assign var="counter" scope="global" value=$smarty.foreach.aussen.iteration} |
und in einer anderen HTML Datei wollte ich dann die Variable mit
anzeigen lassen.
Lg
iclone |
|
Back to top |
|
Grizzly Smarty Pro
Joined: 15 Apr 2011 Posts: 172 Location: Germany
|
Posted: Wed Dec 05, 2012 7:01 am Post subject: |
|
|
Hi,
so lange die "zweite" HTML datei in der ersten oder in einer Art Container für alle HTML-Dateien aufgerufen wird (also sprich da wo die 1. Datei geladen wird, wird auch die zweite geladen), funktioniert es. Aber auch nur wenn du als scope "global" nimmst. Ich weiß zwar nicht warem, aber bei mir gab es aus irgendeinem Grund mal das verhalten, dass es bei einer Situation, wenn ich ein Template zusätzlich dazulade, nicht funktioniert hat! |
|
Back to top |
|
iclone Smarty n00b
Joined: 04 Dec 2012 Posts: 2 Location: Germany
|
Posted: Wed Dec 05, 2012 11:22 am Post subject: |
|
|
Hi Grizzly
hmm, glaube das wird bei einem Shop System nicht so einfach funktionieren oder doch? Müsste doch eigentlich nur eine Datei in die andere Datei laden
Vg |
|
Back to top |
|
Grizzly Smarty Pro
Joined: 15 Apr 2011 Posts: 172 Location: Germany
|
Posted: Wed Dec 05, 2012 11:52 am Post subject: |
|
|
Verstehe nicht genau was du meinst.
wenn du zum Beispiel eine index.html hast und in dieser SMARTY verwendest, dann würde es ja z. B. so aussehen
Code: |
<html>
<head>
</head>
<body>
{include file="test.html"} {*in dieser test.html initialisierst du die Variable test über {assign var="test" scope="global" value='test'}*}
{include file="test2.html"} {* in dieser test2.html greifst du auf die globale Variable test über {$test} zu *}
</body>
</html>
|
|
|
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
|