Simple Machines Community Forum

SMF Support => Language Specific Support => Italiano (Italian) => Topic started by: laudia on July 22, 2013, 09:10:12 AM

Title: modifiche template
Post by: laudia on July 22, 2013, 09:10:12 AM
ciao, sto cercando di ottimizzare il template personalizzato, devo spostare file css esterni prima dei javascript, volevo sapere se facendo così è il modo giusto
Questa è la parte iniziale del template, devo spostare i due file css style.css e print.css prima del javascript senza modificare quello che fà
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"', $context['right_to_left'] ? ' dir="rtl"' : '', '><head>
<meta http-equiv="Content-Type" content="text/html; charset=', $context['character_set'], '" />
<meta name="description" content="', !empty($context['meta_description']) ? $context['meta_description'] : $modSettings['meta_description'], ''. ' - ' .$context['page_title'] .'" />', empty($context['robot_no_index']) ? '' : '
<meta name="robots" content="noindex" />', '
<meta name="keywords" content="', !empty($context['meta_keywords']) ? $context['meta_keywords'] . ', ' : '', $modSettings['meta_keywords'], '" />
<script language="JavaScript" type="text/javascript" src="', $settings['default_theme_url'], '/script.js?fin11"></script>
<script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
var smf_theme_url = "', $settings['theme_url'], '";
var smf_images_url = "', $settings['images_url'], '";
var smf_scripturl = "', $scripturl, '";
var smf_iso_case_folding = ', $context['server']['iso_case_folding'] ? 'true' : 'false', ';
var smf_charset = "', $context['character_set'], '";
// ]]></script>
<title>', $context['page_title'], '</title>';

// The ?fin11 part of this link is just here to make sure browsers don't cache it wrongly.
echo '
<link rel="stylesheet" type="text/css" href="', $settings['theme_url'], '/style.css?fin11" />
<link rel="stylesheet" type="text/css" href="', $settings['default_theme_url'], '/print.css?fin11" media="print" />';


io l' ho modificato così
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"', $context['right_to_left'] ? ' dir="rtl"' : '', '><head>
<meta http-equiv="Content-Type" content="text/html; charset=', $context['character_set'], '" />
<meta name="description" content="', !empty($context['meta_description']) ? $context['meta_description'] : $modSettings['meta_description'], ''. ' - ' .$context['page_title'] .'" />', empty($context['robot_no_index']) ? '' : '
<meta name="robots" content="noindex" />', '
<meta name="keywords" content="', !empty($context['meta_keywords']) ? $context['meta_keywords'] . ', ' : '', $modSettings['meta_keywords'], '" />
   // The ?fin11 part of this link is just here to make sure browsers don't cache it wrongly.
<link rel="stylesheet" type="text/css" href="', $settings['theme_url'], '/style.css?fin11" />
<link rel="stylesheet" type="text/css" href="', $settings['default_theme_url'], '/print.css?fin11" media="print" />';
echo '
<script language="JavaScript" type="text/javascript" src="', $settings['default_theme_url'], '/script.js?fin11"></script>
<script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
var smf_theme_url = "', $settings['theme_url'], '";
var smf_images_url = "', $settings['images_url'], '";
var smf_scripturl = "', $scripturl, '";
var smf_iso_case_folding = ', $context['server']['iso_case_folding'] ? 'true' : 'false', ';
var smf_charset = "', $context['character_set'], '";
// ]]></script>
<title>', $context['page_title'], '</title>';


mi dite se è giusto o devo modificarlo in altro modo
Title: Re: modifiche template
Post by: emanuele on July 23, 2013, 03:14:17 PM
Scusa per il ritardo nella risposta...

Non son sicuro del perché vuoi spostarli prima, comunque questo è il codice:
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"', $context['right_to_left'] ? ' dir="rtl"' : '', '><head>
<meta http-equiv="Content-Type" content="text/html; charset=', $context['character_set'], '" />
<meta name="description" content="', !empty($context['meta_description']) ? $context['meta_description'] : $modSettings['meta_description'], ''. ' - ' .$context['page_title'] .'" />', empty($context['robot_no_index']) ? '' : '
<meta name="robots" content="noindex" />', '
<meta name="keywords" content="', !empty($context['meta_keywords']) ? $context['meta_keywords'] . ', ' : '', $modSettings['meta_keywords'], '" />
<link rel="stylesheet" type="text/css" href="', $settings['theme_url'], '/style.css?fin11" />
<link rel="stylesheet" type="text/css" href="', $settings['default_theme_url'], '/print.css?fin11" media="print" />
<script language="JavaScript" type="text/javascript" src="', $settings['default_theme_url'], '/script.js?fin11"></script>
<script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
var smf_theme_url = "', $settings['theme_url'], '";
var smf_images_url = "', $settings['images_url'], '";
var smf_scripturl = "', $scripturl, '";
var smf_iso_case_folding = ', $context['server']['iso_case_folding'] ? 'true' : 'false', ';
var smf_charset = "', $context['character_set'], '";
// ]]></script>
<title>', $context['page_title'], '</title>';


quello che hai postato ti darebbe un errore di sintassi. ;)
Title: Re: modifiche template
Post by: laudia on July 23, 2013, 04:55:08 PM
grazie emanuele sei sempre molto gentile e disponibile non c'è bisogno che ti scusi per il ritardo nella risposta.

sto cercando di ottimizzare il template per velocizzare il caricamento delle pagine e vari tool online consigliano di mettere i css prima dei javascript.

Sai per caso cos'è ?fin11

   // The ?fin11 part of this link is just here to make sure browsers don't cache it wrongly.
   <link rel="stylesheet" type="text/css" href="', $settings['theme_url'], '/style.css?fin11" />
   <link rel="stylesheet" type="text/css" href="', $settings['default_theme_url'], '/print.css?fin11" media="print" />

ho provato a toglierlo e sembra funzioni comunque secondo te è necessario?
Title: Re: modifiche template
Post by: emanuele on July 23, 2013, 06:18:35 PM
// The ?fin11 part of this link is just here to make sure browsers don't cache it wrongly.
Serve solitamente nei passaggi di versione tra SMF (per esempio tra beta e finale o tra 1.0 e 1.1) per far evitare che i browser usino la version none non aggiornata mantenuta in cache.

IMPORTANTE!!
Leggi qui:
http://www.simplemachines.org/community/index.php?topic=508248.0
o magari qui per più dettagli:
http://www.italiansmf.net/index.php?topic=578.0
Title: Re: modifiche template
Post by: laudia on July 24, 2013, 07:08:41 AM
quindi mi consigli di farlo rimanere com'è.
ma... ???  Da qualche giorno sto cercando di ottimizzare il forum ma mi sembra che il forum non si sia velocizzato un gran che, anzi. Potresti, con un click, vedere se ti sembra abbastanza veloce il caricamento delle pagine del forum e darmi un tuo parere, o è la mia connessione che in questi giorni è peggiorata.
Title: Re: modifiche template
Post by: emanuele on July 24, 2013, 02:52:06 PM
http://tools.pingdom.com/fpt/#!/eoYq4K/http://www.webguadagno.com/
https://developers.google.com/speed/pagespeed/insights#url=http_3A_2F_2Fwww.webguadagno.com_2F&mobile=false
http://www.webpagetest.org/result/130724_PP_1APM/

http://tools.pingdom.com/fpt/#!/ejVlYS/http://www.webguadagno.com/forum/index.php
https://developers.google.com/speed/pagespeed/insights#url=http_3A_2F_2Fwww.webguadagno.com_2Fforum_2Findex.php&mobile=false
http://gtmetrix.com/reports/www.webguadagno.com/ItFnAwcG

Non vedo niente di particolare a parte che spesso il server stesso impiega tempo a rispondere (guardando il whois, ecc. sembrerebbe sia un server americano, se il tuo pubblico è italiano forse ti converrebbe trovare qualcosa di europeo per evitare lag...).
Title: Re: modifiche template
Post by: laudia on July 25, 2013, 05:17:02 AM
si avevo pensato anch' io che potessere essere questo l' unico inconveniente, credo che il mio hosting abbia anche una sezione europea ma sicuramente dovrò pagare per poter spostarlo da quello americano a quello europeo, magari in seguito lo farò.
ti ringrazio come sempre dell' aiuto