<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<atom:link href="http://fbb.just4test.de/extern.php?action=feed&amp;tid=4998&amp;type=rss" rel="self" type="application/rss+xml" />
		<title><![CDATA[Informationen für CMS/made simple / [GELÖST] Smarty Variable in php-Dokument aus Template verwenden]]></title>
		<link>http://www.cmsmadesimple.de/forum/viewtopic.php?id=4998</link>
		<description><![CDATA[Die aktuellsten Beiträge in [GELÖST] Smarty Variable in php-Dokument aus Template verwenden.]]></description>
		<lastBuildDate>Sun, 26 Feb 2017 11:53:35 +0000</lastBuildDate>
		<generator>FluxBB</generator>
		<item>
			<title><![CDATA[Re: [GELÖST] Smarty Variable in php-Dokument aus Template verwenden]]></title>
			<link>http://www.cmsmadesimple.de/forum/viewtopic.php?pid=40114#p40114</link>
			<description><![CDATA[<div class="quotebox"><cite>pWorker schrieb:</cite><blockquote><div><p>den als $_POST[&quot;savepath&quot;] verwendet.</p></div></blockquote></div><p>... was du nicht tun solltest, da auch die $_POST Variablen manipulierbar sind. Immer filtern <img src="http://www.cmsmadesimple.de/forum/plugins/ezbbc/style/smilies/wink.png" alt="wink" />.</p><div class="quotebox"><cite>pWorker schrieb:</cite><blockquote><div><p>Eines verstehe ich nicht, kann ich in jedem php Dokument auf ALLE Variablen aller Templates zugreifen? Unabhängig ob die lokal oder global</p></div></blockquote></div><p>Du musst Variablen als global deklarieren, dann kannst du es</p><p><a href="http://www.smarty.net/docs/en/language.variable.scopes.tpl" rel="nofollow">http://www.smarty.net/docs/en/language. … scopes.tpl</a></p><p>Also z.Bsp</p><div class="codebox"><pre><code>{assign var=foo value=&quot;bar&quot; scope=&quot;global&quot;}</code></pre></div><p><a href="http://www.smarty.net/docs/en/language.function.assign.tpl" rel="nofollow">http://www.smarty.net/docs/en/language. … assign.tpl</a></p><div class="quotebox"><cite>pWorker schrieb:</cite><blockquote><div><p>Zur Session Variable, was ist das genau?</p></div></blockquote></div><p><a href="https://secure.php.net/manual/de/reserved.variables.session.php" rel="nofollow">https://secure.php.net/manual/de/reserv … ession.php</a></p><p>Smarty kennt einen Großteil der Server-Variablen und kann dadurch auch relativ einfach darauf zugreifen via</p><div class="codebox"><pre><code>{$smarty.server.post.savepath}</code></pre></div><p>oder</p><div class="codebox"><pre><code>{$smarty.server.session.savepath}</code></pre></div>]]></description>
			<author><![CDATA[dummy@example.com (cyberman)]]></author>
			<pubDate>Sun, 26 Feb 2017 11:53:35 +0000</pubDate>
			<guid>http://www.cmsmadesimple.de/forum/viewtopic.php?pid=40114#p40114</guid>
		</item>
		<item>
			<title><![CDATA[Re: [GELÖST] Smarty Variable in php-Dokument aus Template verwenden]]></title>
			<link>http://www.cmsmadesimple.de/forum/viewtopic.php?pid=40113#p40113</link>
			<description><![CDATA[<p>Hey moin ihr Beiden und danke für Eure Hilfe. <br />Ich hatte jetzt einfach den savepath mitgepostet und den als $_POST[&quot;savepath&quot;] verwendet. Eines verstehe ich nicht, kann ich in jedem php Dokument auf ALLE Variablen aller Templates zugreifen? Unabhängig ob die lokal oder global, in foreach-Schleifen ind voneinenader verschiedenen Dokumenten oder sonstwo generiert werden? </p><p>Zur Session Variable, was ist das genau? </p><p>Schönen Sonntag noch</p>]]></description>
			<author><![CDATA[dummy@example.com (pWorker)]]></author>
			<pubDate>Sun, 26 Feb 2017 09:47:55 +0000</pubDate>
			<guid>http://www.cmsmadesimple.de/forum/viewtopic.php?pid=40113#p40113</guid>
		</item>
		<item>
			<title><![CDATA[Re: [GELÖST] Smarty Variable in php-Dokument aus Template verwenden]]></title>
			<link>http://www.cmsmadesimple.de/forum/viewtopic.php?pid=40103#p40103</link>
			<description><![CDATA[<div class="quotebox"><cite>pWorker schrieb:</cite><blockquote><div><p>wie kann ich eine Smarty Variable in einem .php Dokument verwenden?</p><div class="codebox"><pre><code>line 3 : $savpth = $smarty-&gt;get_template_vars(&#039;savenewspath&#039;);</code></pre></div></div></blockquote></div><p>Punkt 1 - wenn möglich solltest du die native API von Smarty 3 verwenden, und da heisst die Methode getTemplateVars()</p><p><a href="http://www.smarty.net/docs/en/api.get.template.vars.tpl" rel="nofollow">http://www.smarty.net/docs/en/api.get.template.vars.tpl</a></p><p>anstatt der Funktion get_template_vars() aus der BC-Klasse.</p><p>Punkt 2 - Du musst dir erst Zugriff auf Smarty verschaffen, ist bei CMSMS etwas ungewöhnlich eingebunden.</p><div class="codebox"><pre><code>  $smarty = $template-&gt;smarty;</code></pre></div><p>oder </p><div class="codebox"><pre><code>  $savpth = $template-&gt;smarty-&gt;getTemplateVars(&#039;savenewspath&#039;);</code></pre></div>]]></description>
			<author><![CDATA[dummy@example.com (cyberman)]]></author>
			<pubDate>Sat, 25 Feb 2017 22:31:52 +0000</pubDate>
			<guid>http://www.cmsmadesimple.de/forum/viewtopic.php?pid=40103#p40103</guid>
		</item>
		<item>
			<title><![CDATA[Re: [GELÖST] Smarty Variable in php-Dokument aus Template verwenden]]></title>
			<link>http://www.cmsmadesimple.de/forum/viewtopic.php?pid=40095#p40095</link>
			<description><![CDATA[<p>Hm, warum nimmst du keine Session-Variable? Beim btAdminer übernehme ich die Variabeln per Session:</p><div class="codebox"><pre class="vscroll"><code>// Adminer Session
// Need to have cookie visible from parent directory
session_set_cookie_params(0, &#039;/&#039;, &#039;&#039;, 0);
// Create signon session
$session_name = &#039;btAdminer&#039;;
session_name($session_name);
//session_start();

$host = $config[&#039;db_hostname&#039;];
if (isset($config[&quot;db_port&quot;]) and $config[&#039;db_port&#039;] != &#039;&#039;) $host.=&#039;:&#039;.$config[&#039;db_port&#039;];

// Store there credentials in the session
$_SESSION[&#039;ADM_driver&#039;] = &#039;server&#039;;
$_SESSION[&#039;ADM_user&#039;] = $config[&#039;db_username&#039;];
$_SESSION[&#039;pwds&#039;][$_SESSION[&#039;ADM_driver&#039;]][$host][$config[&#039;db_username&#039;]] = $config[&#039;db_password&#039;];
$_SESSION[&#039;ADM_password&#039;] = $config[&#039;db_password&#039;];
$_SESSION[&#039;ADM_server&#039;] = $host;
$_SESSION[&#039;ADM_db&#039;] = $config[&#039;db_name&#039;];
$_SESSION[&#039;ADM_hideOtherDBs&#039;] = &#039;&#039;;
// Get signon uri for redirect
$_SESSION[&#039;ADM_SignonURL&#039;] = $config[&#039;root_url&#039;].&#039;/modules/btAdminer/btAdminer.php&#039;;
$_SESSION[&#039;ADM_LogoutURL&#039;] = $config[&#039;root_url&#039;].&#039;/&#039;.$config[&#039;admin_dir&#039;].&#039;/logout.php&#039;;
$_SESSION[&#039;ADM_uploadDir&#039;] = $config[&#039;uploads_path&#039;];
// Plugins
$_SESSION[&#039;ADM_plugin_zipexport&#039;] = $this-&gt;GetPreference(&#039;zipexport&#039;);
$_SESSION[&#039;ADM_plugin_xmlexport&#039;] = $this-&gt;GetPreference(&#039;xmlexport&#039;);
$_SESSION[&#039;ADM_plugin_foreign&#039;] = $this-&gt;GetPreference(&#039;foreign&#039;);
$_SESSION[&#039;ADM_plugin_textarea&#039;] = $this-&gt;GetPreference(&#039;textarea&#039;);
$_SESSION[&#039;ADM_plugin_enum&#039;] = $this-&gt;GetPreference(&#039;enum&#039;);
// root_url
$_SESSION[&#039;ADM_root_url&#039;] = $config[&#039;root_url&#039;];

$sid = session_id();
// Force to set the cookie
setcookie($session_name, $sid, 0, &#039;/&#039;, &#039;&#039;);
// Close that session
session_write_close();</code></pre></div><p>Für das schreiben der Session-Variable</p>]]></description>
			<author><![CDATA[dummy@example.com (nockenfell)]]></author>
			<pubDate>Sat, 25 Feb 2017 20:04:07 +0000</pubDate>
			<guid>http://www.cmsmadesimple.de/forum/viewtopic.php?pid=40095#p40095</guid>
		</item>
		<item>
			<title><![CDATA[[GELÖST] Smarty Variable in php-Dokument aus Template verwenden]]></title>
			<link>http://www.cmsmadesimple.de/forum/viewtopic.php?pid=40055#p40055</link>
			<description><![CDATA[<p><strong>Moin,</strong></p><p>sicher eine einfach zu lösende Frage, aber wie kann ich eine Smarty Variable in einem .php Dokument verwenden?</p><div class="codebox"><pre><code>line 3 : $savpth = $smarty-&gt;get_template_vars(&#039;savenewspath&#039;);</code></pre></div><p>gibt mir </p><p>Call to a member function get_template_vars() on null in line 3. Muss ich irgendwo den Pfad zum Template angeben? <br />Das Script wird via Ajax ausgeführt.</p><p>Ajax.php:</p><div class="codebox"><pre><code>&lt;?php

   $savpth = $smarty-&gt;get_template_vars(&#039;savenewspath&#039;);

  $encodedData=explode(&#039;,&#039;, $_POST[&quot;img&quot;]);
    $data = base64_decode($encodedData[1]);
    $urlUploadImages = $_SERVER[&#039;DOCUMENT_ROOT&#039;].&#039;/uploads/&#039;.$savpth;
    $nameImage = &quot;testcrop.png&quot;;
    $img = imagecreatefromstring($data);
     if($img) {
        imagepng($img, $urlUploadImages.$nameImage, 0);
        imagedestroy($img); 
        echo &quot;OK&quot;;		
    }
    else {
        echo &#039;ERROR&#039;;
    }

?&gt;</code></pre></div><p>Den $savenewspath hab ich im Template via {capture assign=&quot;savenewspath&quot;}news/id{$articleid}/{/capture} festgelegt.</p>]]></description>
			<author><![CDATA[dummy@example.com (pWorker)]]></author>
			<pubDate>Sun, 19 Feb 2017 11:39:13 +0000</pubDate>
			<guid>http://www.cmsmadesimple.de/forum/viewtopic.php?pid=40055#p40055</guid>
		</item>
	</channel>
</rss>
