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

[gelöst] aus & wird & im javascript

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


Joined: 08 Jan 2013
Posts: 6

PostPosted: Thu Feb 28, 2013 1:04 pm    Post subject: [gelöst] aus & wird & im javascript Reply with quote

folgenden Code baue ich in meine HTML Seite ein

Code:

<script type="text/javascript">
//<![CDATA[
  (function() {ldelim}
    var shr = document.createElement('script');
    shr.src = '//dtym7iokkjlif.cloudfront.net/assets/pub/shareaholic.js';
    shr.type = 'text/javascript';
    shr.async = 'true';
    shr.onload = shr.onreadystatechange = function() {ldelim}
      var rs = this.readyState;
      if (rs && rs != 'complete' && rs != 'loaded') return;
      var apikey = '[KEY]'
      try {ldelim} Shareaholic.init(apikey); {rdelim} catch (e) {ldelim}{rdelim}
    {rdelim};
    var s = document.getElementsByTagName('script')[0];
    s.parentNode.insertBefore(shr, s);
  {rdelim})();
//]]>
</script>


und folgenden bekomme ich auf der Seite

Code:

<script type="text/javascript">
//<![CDATA[
  (function() {
    var shr = document.createElement('script');
    shr.src = '//dtym7iokkjlif.cloudfront.net/assets/pub/shareaholic.js';
    shr.type = 'text/javascript';
    shr.async = 'true';
    shr.onload = shr.onreadystatechange = function() {
      var rs = this.readyState;
      if (rs &amp;&amp; rs != 'complete' &amp;&amp; rs != 'loaded') return;
      var apikey = '[KEY]'
      try { Shareaholic.init(apikey); } catch (e) {}
    };
    var s = document.getElementsByTagName('script')[0];
    s.parentNode.insertBefore(shr, s);
  })();
//]]>
</script>


Durch den Fehler in der if Zeile && -> &amp;&amp; ist es natürlich falsch und wird nicht ausgeführt. Liegt es am smarty bzw. wie kann ich das ändern?

Danke ![/code]


Last edited by blondie0708 on Thu Feb 28, 2013 9:06 pm; edited 1 time in total
Back to top
View user's profile Send private message
Grizzly
Smarty Pro


Joined: 15 Apr 2011
Posts: 172
Location: Germany

PostPosted: Thu Feb 28, 2013 1:24 pm    Post subject: Reply with quote

Wenn du dein JS in dem Template hast, dann mach mal statt

Code:

//<![CDATA[

//DEIN CODE

//]]> 


folgendes:

Code:

{literal}

//DEINE CODE

{/literal}
Back to top
View user's profile Send private message Visit poster's website
blondie0708
Smarty Rookie


Joined: 08 Jan 2013
Posts: 6

PostPosted: Thu Feb 28, 2013 1:34 pm    Post subject: Reply with quote

Sad

nö. da ändert sich nix.

---

ich habe das jetzt mal als .js Datei gespeichert und eingebunden.

dann bleibt der Fehler auch.


Last edited by blondie0708 on Thu Feb 28, 2013 1:56 pm; edited 1 time in total
Back to top
View user's profile Send private message
Grizzly
Smarty Pro


Joined: 15 Apr 2011
Posts: 172
Location: Germany

PostPosted: Thu Feb 28, 2013 1:48 pm    Post subject: Reply with quote

Führst du den Code auf dem Server aus? Wenn ja, schau mal in die Datei auf deinem Server (in der der Code ausgeführt ist). Wenn es dort auch so ist, liegts evtl. an deinem FTP-Programm bzw. Editor.

Ansonsten überprüfe mal ob evtl. magic_quotes_runtime auf ON steht in der php.ini, wenn ja, dann setz es mal auf OFF
Back to top
View user's profile Send private message Visit poster's website
blondie0708
Smarty Rookie


Joined: 08 Jan 2013
Posts: 6

PostPosted: Thu Feb 28, 2013 4:35 pm    Post subject: Reply with quote

magic_quotes_runtime = Off

und FTP Programm überträgt im BIN-Modus
Back to top
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Thu Feb 28, 2013 6:28 pm    Post subject: Reply with quote

Benutzt Du eventuell einen "output" Filter?
Back to top
View user's profile Send private message
blondie0708
Smarty Rookie


Joined: 08 Jan 2013
Posts: 6

PostPosted: Thu Feb 28, 2013 9:05 pm    Post subject: Lösung ohne lösen Reply with quote

nachdem auch das Ersetzen des && mit and nicht funktioniert hat, habe ich jetzt den Holzhammer herausgeholt.

Die fehlerhafte Zeile habe ich mit

Code:

      if (rs) {
         if ( rs != 'complete' ) {
             if ( rs != 'loaded') return;
            }
         }   


ersetzt.


und läuft !
Back to top
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Fri Mar 01, 2013 11:19 am    Post subject: Reply with quote

Sag mal wird dein Template Kode über eine Variable in einem Template ausgegeben?

Wenn dann noch $smarty->html_escape = true gesetzt ist, haben wir endlich die Erklärung warum Ersetzt wurde.
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