wdrożenia PrestaShop Powiększenie zdjęć moduł

Brak polskich znaków

  • 1 Odpowiedzi
  • 6847 Wyświetleń

0 użytkowników i 1 Gość przegląda ten wątek.

*

Offline owcash

  • Nowy
  • *
  • 8
  • 0
Brak polskich znaków
« dnia: Listopad 14, 2012, 10:24:23 am »
Witam,
mam taki problem, odziedziczyłem sklep po poprzednim pracowniku. Niestety okazało się, że strona główna w całości została edytowana w kodzie zamiast w panelu admina.
Poniżej wkleję index.html z /modules/editorial.

Po wpisaniu tam polskich znaków wyświetlają się one na stronie jako znaki zapytania, dopiero wpisanie np: Proszę zauwaĹźyÄ zostają one wyświetlane poprawnie, jednak jest to męczące, głupie i nielogiczne.

Niby wszędzie jest utf-8 (ale sprawdzałem tylko index na podstronach), niestety nie wiem sam jak to naprawić.

Bardzo prosżę o pomoc.

W razie pytań chętnie wkleję potrzebne kody.

Kod index.php /modules/editorial/index.html

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="pl">
<head>
<title>Photos de l'AlgĂŠrie</title>
<link rel="stylesheet" type="text/css" media="screen" href="slides/style.css" />
<style type="text/css" media="screen">
@import "slides/jj_rasper/style.css";
</style>
<script type="text/javascript" src="script/slides.js"></script>
<script type="text/javascript" src="slides/includes.php"></script>
<script type="text/javascript" src="slides/boot.js"></script>
</head>
<body>
  <div id="main">
    <div id="centre">
     <div id="bandeau">&nbsp;</div>
      <div id="fpss-container">
  <div id="fpss-slider">
    <div id="slide-loading"></div>
    <div id="slide-wrapper">
      <div id="slide-outer">
        <!-- slide 01 -->
        <div class="slide">
          <div class="slide-inner"> <a href="photos-algerie/photos-alger-algerie.php" title="photos des villes de l'AlgĂŠrie" class="fpss_img"> <span><span style="background:url(photos-villes-algerie.jpg) no-repeat;"><span> <img src="photos-villes-algerie.jpg" alt="Photos des villes d'AlgĂŠrie" title="Photos de villes d'AlgĂŠrie" /> </span></span></span> [/url]
            <div class="fpss_introtext">
              <div class="slidetext">
               <h1><a href="#" title="photos des villes de l'AlgĂŠrie">Photos des villes d'AlgĂŠrie[/url]</h1>
                <h3>Albums photos</h3>
                <p>De villes ancestrales aux villes modernes, l'AlgĂŠrie porte l'empreinte des civilisations Berbère, Romaine, Turque, Arabe...</p>
                <a class="readon" href="#changeURLhere">Voir l'album...[/url] </div>
            </div>
          </div>
        </div>
        <!-- slide 02 -->
        <div class="slide">
          <div class="slide-inner"> <a href="photos-algerie/photos-algerie-vue-du-ciel.php" title="Photos de la nature de l'AlgĂŠrie" class="fpss_img"> <span><span style="background:url(photos-nature-algerie.jpg) no-repeat;"><span> <img src="photos-nature-algerie.jpg" alt="photos de la nature d'algĂŠrie" title="Photos de la nature de l'AlgĂŠrie" /> </span></span></span> [/url]

            <div class="fpss_introtext">
             <div class="slidetext">
               <h1><a href="#" title="Photos de la nature de l'AlgĂŠrie">Photos de la nature d'AlgĂŠrie[/url]</h1>
                <h3>Albums photos</h3>
                <p>Du Sahara Ă  la cĂ´te mĂŠditerranĂŠenne, en passant par les chaines montagneuses enneigĂŠes ou dĂŠsertiques, les pleines...</p>
                <a class="readon" href="#changeURLhere">Voir l'album...[/url] </div>
            </div>
          </div>
        </div>
        <!-- slide 03 -->
        <div class="slide">
          <div class="slide-inner"> <a href="photos-algerie/photos-portraits-algeriens.php" title="Photos portraits d'AlgĂŠriens" class="fpss_img"> <span><span style="background:url(images/2007_transformers_007_1.jpg) no-repeat;"><span> <img src="photos-portraits-algeriens.jpg" alt="photos portraits d'algĂŠriens" title="photos portraits d'AlgĂŠriens" /> </span></span></span> [/url]
            <div class="fpss_introtext">
              <div class="slidetext">
               <h1><a href="#" title="Photos portraits d'AlgĂŠriens">Photos portraits d'AlgĂŠrie[/url]</h1>
                <h3>Albums photos</h3>
                <p> &Aacute; travers les visages multiples des AlgĂŠriens, ce cache une richesse indĂŠniable, qui forment l'âme de l'AlgĂŠrie </p>
                <a class="readon" href="photos-algerie/photos-portraits-algeriens.php" title="Photos portraits d'AlgĂŠriens">Voir l'album...[/url] </div>
            </div>
          </div>
        </div>
        <!-- fin slides -->
      </div>
    </div>
  </div>
<div id="navi-outer">
 <div class="ul_container">
   <ul>
    <li class="noimages"><a id="fpss-container_prev" href="javascript:void(0);" class="button2" title="PrĂŠcedent">&laquo;[/url]</li>
    <li><a class="button off" href="javascript:void(0);"><span class="fpss_key">02</span><span class="fpss_keytitle"></span><img src="img02.jpg" alt="photos algerie" />[/url]</li>
    <li><a class="button off" href="javascript:void(0);"><span class="fpss_key">03</span><span class="fpss_keytitle"></span><img src="images/img03.jpg" alt="photos algerie" />[/url]</li>
    <li><a class="button off" href="javascript:void(0);"><span class="fpss_key">04</span><span class="fpss_keytitle"></span><img src="images/img04.jpg" alt="photos algerie" />[/url]</li>
    <li class="noimages"><a id="fpss-container_playButton" href="javascript:void(0);" class="button2">Pause[/url]</li>
    <li class="noimages"><a id="fpss-container_next" href="javascript:void(0);" class="button2" title="Suivant">&raquo;[/url]</li>
   </ul>
  </div>
 </div>
 </div>
    </div>
    <div id="footer">
<span class="w3c">[
<img src="w3c.gif" alt="W3C" />
<a href="http://jigsaw.w3.org/css-validator/check/referer" class="valid">CCS[/url] ] . [
<img src="w3c.gif" alt="W3C" />
<a href="http://validator.w3.org/check?uri=referer" class="valid">XHTML[/url] ]
</span>

<span id="droit"><img src="footer-logo.png" alt="photos algerie" /></span> &copy;2009 Digicraft - Tous droits rĂŠservĂŠs . <a href="index.html"><img src="accueil.gif" alt="'accueil photos algĂŠrie" />[/url] .
<!-- AddThis Button BEGIN -->
<script type="text/javascript">var addthis_pub="digikraft";</script>
<a href="script/addthis_widget.js" onmouseover="return addthis_open(this, '', '[URL]', '[TITLE]')" onmouseout="addthis_close()" onclick="return addthis_sendto()"><img src="favoris.gif" alt="marques-pages" style="border:0"/>[/url]<script type="text/javascript" src="http://s7.addthis.com/js/200/addthis_widget.js"></script>
<!-- AddThis Button END -->
. <a href="photos-algerie/contact.php"><img src="contact-footer.gif" alt="contact photos algĂŠrie" />[/url]
</div>
</div>
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-2760391-2");
pageTracker._trackPageview();
} catch(err) {}</script>
</body>
</html>


(jakieś bzdury)

a tu editorial.php

<?php

class Editorial extends Module
{
   /** @var max image size */
   protected $maxImageSize = 307200;

   function __construct()
   {
      $this->name = 'editorial';
      $this->tab = 'Tools';
      $this->version = '1.4';
      
      /* The parent construct is required for translations */
      parent::__construct();
      
      $this->page = basename(__FILE__, '.php');
      $this->displayName = $this->l('Home text editor');
      $this->description = $this->l('A text editor module for your homepage');
   }

   function install()
   {
      if (!parent::install())
         return false;
      // Trunk file if already exists with contents
      /*
      if (!$fd = @fopen(dirname(__FILE__).'/editorial.xml', 'w'))
         return false;
      @fclose($fd);
      */
      return $this->registerHook('home');
   }

   function putContent($xml_data, $key, $field, $forbidden, $section)
   {
      foreach ($forbidden AS $line)
         if ($key == $line)
            return 0;
      if (!eregi('^'.$section.'_', $key))
         return 0;
      $key = eregi_replace('^'.$section.'_', '', $key);
      //$field = pSQL($field);
      $field = htmlspecialchars($field);
      if (!$field)
         return 0;
      return ("\n".'      <'.$key.'>'.$field.'</'.$key.'>');
   }

   function getContent()
   {
      /* display the module name */
      $this->_html = '<h2>'.$this->displayName.'</h2>';

      /* update the editorial xml */
      if (isset($_POST['submitUpdate']))
      {
         // Forbidden key
         $forbidden = array('submitUpdate');
         
         foreach ($_POST AS $key => $value)
            if (!Validate::isCleanHtml($_POST[$key]))
            {
               $this->_html .= $this->displayError($this->l('Invalid html field, javascript is forbidden'));
               $this->_displayForm();
               return $this->_html;
            }

         // Generate new XML data
         $newXml = '<?xml version=\'1.0\' encoding=\'utf-8\' ?>'."\n";
         $newXml .= '<editorial>'."\n";
         $newXml .= '   <header>';
         // Making header data
         foreach ($_POST AS $key => $field)
            if ($line = $this->putContent($newXml, $key, $field, $forbidden, 'header'))
               $newXml .= $line;
         $newXml .= "\n".'   </header>'."\n";
         $newXml .= '   <body>';
         // Making body data
         foreach ($_POST AS $key => $field)
            if ($line = $this->putContent($newXml, $key, $field, $forbidden, 'body'))
               $newXml .= $line;
         $newXml .= "\n".'   </body>'."\n";
         $newXml .= '</editorial>'."\n";

         /* write it into the editorial xml file */
         if ($fd = @fopen(dirname(__FILE__).'/editorial.xml', 'w'))
         {
            if (!@fwrite($fd, $newXml))
               $this->_html .= $this->displayError($this->l('Unable to write to the editor file.'));
            if (!@fclose($fd))
               $this->_html .= $this->displayError($this->l('Can\'t close the editor file.'));
         }
         else
            $this->_html .= $this->displayError($this->l('Unable to update the editor file.
Please check the editor file\'s writing permissions.'));

         /* upload the image */
         if (isset($_FILES['body_homepage_logo']) AND isset($_FILES['body_homepage_logo']['tmp_name']) AND !empty($_FILES['body_homepage_logo']['tmp_name']))
         {
            Configuration::set('PS_IMAGE_GENERATION_METHOD', 1);
            if ($error = checkImage($_FILES['body_homepage_logo'], $this->maxImageSize))
               $this->_html .= $error;
            elseif (!imageResize($_FILES['body_homepage_logo'], dirname(__FILE__).'/homepage_logo.jpg'))
               $this->_html .= $this->displayError($this->l('An error occurred during the image upload.'));
         }
      }

      /* display the editorial's form */
      $this->_displayForm();

      return $this->_html;
   }

   private function _displayForm()
   {
      global $cookie;
      
      /* Languages preliminaries */
      $defaultLanguage = intval(Configuration::get('PS_LANG_DEFAULT'));
      $languages = Language::getLanguages();
      $iso = Language::getIsoById($defaultLanguage);
      $divLangName = 'title¤subheading¤cpara¤logo_subheading';

      /* xml loading */
      $xml = false;
      if (file_exists(dirname(__FILE__).'/editorial.xml'))
            if (!$xml = @simplexml_load_file(dirname(__FILE__).'/editorial.xml'))
               $this->_html .= $this->displayError($this->l('Your editor file is empty.'));

      $this->_html .= '

         <script type="text/javascript" src="../js/tinymce/jscripts/tiny_mce/tiny_mce.js"></script>
         <script language="javascript" type="text/javascript">
            tinyMCE.init({
               language : "';
      $iso = Language::getIsoById(intval($cookie->id_lang));
      $this->_html .= ((!file_exists(PS_ADMIN_DIR.'/../js/tinymce/jscripts/tiny_mce/langs/'.$iso.'.js')) ? 'en' : $iso).'",
               mode : "textareas",
               elements : "nourlconvert",
               convert_urls : false,
               theme : "advanced",
               theme_advanced_buttons1 : "bold, italic, underline, fontselect, fontsizeselect",
               theme_advanced_buttons2 : "forecolor, backcolor, separator, justifyleft, justifycenter, justifyright, justifyfull, separator, bullist, numlist, separator, undo, redo, separator, link, unlink, separator, code",
               theme_advanced_buttons3 : "",
               theme_advanced_toolbar_location : "top",
               theme_advanced_toolbar_align : "left",
               plugins : "contextmenu, directionality, media, paste, preview, safari",
               theme_advanced_buttons3_add : "ltr,rtl,pastetext,pasteword,selectall",
               theme_advanced_buttons1_add : "media,preview",
               paste_create_paragraphs : false,
               paste_create_linebreaks : false,
               paste_use_dialog : true,
               paste_auto_cleanup_on_paste : true,
               paste_convert_middot_lists : false,
               paste_unindented_list_class : "unindentedList",
               paste_convert_headers_to_strong : true,
               paste_insert_word_content_callback : "convertWord",
               plugin_preview_width : "500",
               plugin_preview_height : "600",
               extended_valid_elements : "a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]"
            });
            function convertWord(type, content)
            {
               switch (type)
               {
                  case "before":
                     break;
                  case "after":
                     break;
               }
               return content;
            }
      </script>
      <script language="javascript">id_language = Number('.$defaultLanguage.');</script>
      <form method="post" action="'.$_SERVER['REQUEST_URI'].'" enctype="multipart/form-data">
         <fieldset style="width: 900px;">
            <legend><img src="'.$this->_path.'logo.gif" alt="" title="" /> '.$this->displayName.'</legend>
            <label>'.$this->l('Main title').'</label>
            <div class="margin-form">';
            
            foreach ($languages as $language)
            {
               $this->_html .= '
               <div id="title_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $defaultLanguage ? 'block' : 'none').';float: left;">
                  <input type="text" name="body_title_'.$language['id_lang'].'" id="body_title_'.$language['id_lang'].'" size="64" value="'.($xml ? stripslashes(htmlspecialchars($xml->body->{'title_'.$language['id_lang']})) : '').'" />
               </div>';
             }
            $this->_html .= $this->displayFlags($languages, $defaultLanguage, $divLangName, 'title', true);
            
            
      $this->_html .= '
               <p class="clear">'.$this->l('Appears along top of homepage').'</p>
            </div>
            <label>'.$this->l('Subheading').'</label>
            <div class="margin-form">';
            
            foreach ($languages as $language)
            {
               $this->_html .= '
               <div id="subheading_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $defaultLanguage ? 'block' : 'none').';float: left;">
                  <input type="text" name="body_subheading_'.$language['id_lang'].'" id="body_subheading_'.$language['id_lang'].'" size="64" value="'.($xml ? stripslashes(htmlspecialchars($xml->body->{'subheading_'.$language['id_lang']})) : '').'" />
               </div>';
             }
            $this->_html .= $this->displayFlags($languages, $defaultLanguage, $divLangName, 'subheading', true);
            
      $this->_html .= '
               <div class="clear"></div>
            </div>
            <label>'.$this->l('Introductory text').'</label>
            <div class="margin-form">';

            foreach ($languages as $language)
            {
               $this->_html .= '
               <div id="cpara_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $defaultLanguage ? 'block' : 'none').';float: left;">
                  <textarea cols="100" rows="30" id="body_paragraph_'.$language['id_lang'].'" name="body_paragraph_'.$language['id_lang'].'">'.($xml ? stripslashes(htmlspecialchars($xml->body->{'paragraph_'.$language['id_lang']})) : '').'</textarea>
               </div>';
             }
            
            $this->_html .= $this->displayFlags($languages, $defaultLanguage, $divLangName, 'cpara', true);
            
            $this->_html .= '
               <p class="clear">'.$this->l('Text of your choice; for example, explain your mission, highlight a new product, or describe a recent event').'</p>
            </div>
            <label>'.$this->l('Homepage\'s logo').' </label>
            <div class="margin-form">
               <img src="'.$this->_path.'homepage_logo.jpg" alt="" title="" style="" />

               <input type="file" name="body_homepage_logo" />
               <p style="clear: both">'.$this->l('Will appear next to the Introductory Text above').'</p>
            </div>
            <label>'.$this->l('Homepage logo link').'</label>
            <div class="margin-form">
               <input type="text" name="body_home_logo_link" size="64" value="'.($xml ? stripslashes(htmlspecialchars($xml->body->home_logo_link)) : '').'" />
               <p style="clear: both">'.$this->l('Link used on the 2nd logo').'</p>
            </div>
            <label>'.$this->l('Homepage logo subheading').'</label>
            <div class="margin-form">';
            
            foreach ($languages as $language)
            {
               $this->_html .= '
               <div id="logo_subheading_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $defaultLanguage ? 'block' : 'none').';float: left;">
                  <input type="text" name="body_logo_subheading_'.$language['id_lang'].'" id="logo_subheading_'.$language['id_lang'].'" size="64" value="'.($xml ? stripslashes(htmlspecialchars($xml->body->{'logo_subheading_'.$language['id_lang']})) : '').'" />
               </div>';
             }
            
            $this->_html .= $this->displayFlags($languages, $defaultLanguage, $divLangName, 'logo_subheading', true);
            
            $this->_html .= '
               <div class="clear"></div>
            </div>
            <div class="clear pspace"></div>
            <div class="margin-form clear"><input type="submit" name="submitUpdate" value="'.$this->l('Update the editor').'" class="button" /></div>
         </fieldset>
      </form>';
   }

   function hookHome($params)
   {
      if (file_exists('modules/editorial/editorial.xml'))
      {
         if ($xml = simplexml_load_file('modules/editorial/editorial.xml'))
         {
            global $cookie, $smarty;
            $smarty->assign(array(
               'xml' => $xml,
               'homepage_logo' => file_exists('modules/editorial/homepage_logo.jpg'),
               'logo_subheading' => 'logo_subheading_'.$cookie->id_lang,
               'title' => 'title_'.$cookie->id_lang,
               'subheading' => 'subheading_'.$cookie->id_lang,
               'paragraph' => 'paragraph_'.$cookie->id_lang,
               'this_path' => $this->_path
            ));
            return $this->display(__FILE__, 'editorial.tpl');
         }
      }
      return false;
   }

}

*

Offline deviant

  • Mieszkaniec
  • *****
  • 776
  • 1
  • Płeć: Mężczyzna
  • prestamod
  • PrestaShop: PS
  • Status: forum
Odp: Brak polskich znaków
« Odpowiedź #1 dnia: Listopad 14, 2012, 10:50:24 am »
Pobierz sobie stąd http://notepad-plus-plus.org/download/v6.2.1.html Notepad++, zainstaluj, odpal sobie żądany plik w tym notatniku i zapisz go ponowanie w UTF-8 (bez BOM). Możesz tego dokonać konwertując go w tym programie, zakładka "Format"
Prestamod -> [sklepy][hosting][modyfikacje][szablony][pomoc]