Перейти к содержимому


antaNT

Регистрация: 12 Jun 2011
Offline Активность: Oct 25 2022 11:04 PM
-----

Мои сообщения

В теме: Smarty-дебаггер в ShopCMS

17 October 2018 - 07:46 PM

немного переделал :D
{* Smarty *}
{* debug.tpl, last updated version 2.1.0 *}
{assign_debug_info}
{capture assign=debug_output}
<!DOCTYPE html>
<html lang="en">
    <head>
	    <meta charset="utf-8">
	    <meta http-equiv="X-UA-Compatible" content="IE=edge">
	    <meta name="viewport" content="width=device-width, initial-scale=1">
	    <title>Smarty Debug Console</title>
	    <!-- Bootstrap CSS -->
	    {* <link rel="stylesheet" href="/lib/Bootstrap/bootstrap3.3.7_nixcolors/css/bootstrap.min.css"> *}
	    <!-- Latest compiled and minified CSS -->
	    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
    </head>
    <body>
<div class="container-fluid">
    <div class="row">
	    <div class="col-lg-12">
		    <div class="page-header text-primary">
			  <h1>ant Smarty Debug Console <small>{$_smarty_debug_output}</small> {$debug_output} </h1>
		    </div>
		    <h2>List of assigned template variables <small class=badge>{$_debug_keys|@count}</small></h2>
		    <div class="cont__ainer" style="margin-top: 20px;">
		    <div class="well" id="list_assigned_vars">
			    {section name=vars loop=$_debug_keys}
				    <span class='label label-primary'>{ldelim}${$_debug_keys[vars]|escape:'html'}{rdelim}&nbsp;<sup>{$_debug_vals[vars]|@count}</sup></span>
			    {sectionelse}
				    <h3><span class='label label-danger'>no template variables assigned</span></h3>
			    {/section}
		    </div>
		    </div>
	    </div>
	    <div class="col-lg-6">
			    <h2>included templates &amp; config files (load time in seconds) <small class=badge>{$_debug_tpls|@count}</small></h2>
			    <ul class="list-group">
			    {section name=templates loop=$_debug_tpls}
			    <li class="list-group-item">    {section name=indent loop=$_debug_tpls[templates].depth}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{/section}
				    <span class={if $_debug_tpls[templates].type eq "template"}text-primary{elseif $_debug_tpls[templates].type eq "insert"}text-info{else}text-default{/if}>
					    {$_debug_tpls[templates].filename|escape:html}</span>
				    {if isset($_debug_tpls[templates].exec_time)}
					    <span class="badge exectime">
					    {$_debug_tpls[templates].exec_time|string_format:"%.5f"}
					    {if %templates.index% eq 0}(total){/if}
					    </span>
				    {/if}
				    </li>
			    {sectionelse}
				    <p>no templates included</p>
			    {/section}
			    </ul>
	    </div>

	    <div class="col-lg-6">
		    <h2>assigned template variables <small class=badge>{$_debug_keys|@count}</small></h2>
		    <div id="table_assigned_vars">
			    {section name=vars loop=$_debug_keys}
					    <div class="text-danger bg-primary" style="border:1px solid lightsteelblue; border-bottom:0; padding:5px 15px;margin-top:10px;"><strong>{ldelim}${$_debug_keys[vars]|escape:'html'}{rdelim}</strong>&nbsp;<sup>{$_debug_vals[vars]|@count}<sup>&nbsp;
					    {if $_debug_vals[vars]|@count >1}<button class="btn btn-xs btn-primary pull-right" type="button" data-toggle="collapse" href="#coll_{$smarty.section.vars.index}"><span class="glyphicon glyphicon-align-justify" aria-hidden="true"></span></button>{/if}</div>
					    <div class="collapse {if $_debug_vals[vars]|@count <=1}in{/if}" id="coll_{$smarty.section.vars.index}" style="border:1px solid lightsteelblue; border-top:0; padding:5px 15px;">{$_debug_vals[vars]|@debug_print_var}</div>
			    {sectionelse}
				    <div>no template variables assigned</div>
			    {/section}
		    </div>
		    <h2>assigned config file variables (outer template scope)</h2>
		    <table class="table table-hover table-condensed" id="table_config_vars">
			    {section name=config_vars loop=$_debug_config_keys}
				    <tr>
					    <td>{ldelim}#{$_debug_config_keys[config_vars]|escape:'html'}#{rdelim}</td>
					    <td>{$_debug_config_vals[config_vars]|@debug_print_var}</td></tr>
			    {sectionelse}
				    <tr><td><p>no config vars assigned</p></td></tr>
			    {/section}
		    </table>
	    </div>
    </div>
</div>


{*		 <!-- jQuery -->
	    <script src="/lib/jquery/1.9.1/jquery.min.js"></script>
	    <!-- Bootstrap JavaScript -->
	    <script src="/lib/Bootstrap/bootstrap3.3.7_nixcolors/js/bootstrap.min.js"></script> *}
	    <!-- Bootstrap core JavaScript
	    ================================================== -->
	    <!-- Placed at the end of the document so the pages load faster -->
	    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
	    <!-- Latest compiled and minified JavaScript -->
	    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
    </body>
</html>
{/capture}
{if isset($_smarty_debug_output) and $_smarty_debug_output eq "html"}
    {$debug_output}
{else}
<script type="text/javascript">
// <![CDATA[
    if ( self.name == '' ) {ldelim}
	   var title = 'Console';
    {rdelim}
    else {ldelim}
	   var title = 'Console_' + self.name;
    {rdelim}
    _smarty_console = window.open("",title.value,"width=1200,height=900,resizable=yes,scrollbars=yes");
    _smarty_console.document.write('{$debug_output|escape:'javascript'}');
    _smarty_console.document.close();
// ]]>
</script>
{/if}

В теме: ShopCMS и PHP7

31 August 2018 - 11:40 AM

нет, конечно, пока только на 5.6 переделал на utf-8, выскочила такая проблема - пустая строка перед DOCTYPE - все файлы без бом - во всех шаблонах первый символ<!DOCTYPE>, до переконвертации из 1251 ничего такого не было


нет, конечно, пока только на 5.6 переделал на utf-8, выскочила такая проблема - пустая строка перед DOCTYPE - все файлы без бом - во всех шаблонах первый символ<!DOCTYPE>, до переконвертации из 1251 ничего такого не было

разобрался в классах смарти переводы строки стояли после ?>

:D

В теме: ShopCMS и PHP7

31 August 2018 - 10:01 AM

нет, конечно, пока только на 5.6 переделал на utf-8, выскочила такая проблема - пустая строка перед DOCTYPE - все файлы без бом - во всех шаблонах первый символ<!DOCTYPE>, до переконвертации из 1251 ничего такого не было


:P
разобрался, в класах смарти преводы строки стояли после ?>

В теме: [дополнение] Разная скидка для разных категорий

30 August 2018 - 07:16 AM

полагаю пункт 2.3 "2.3 в функции prdSearchProductByTemplate

перед ВТОРЫМ вхождением строки" имеется ввиду всетаки ТРЕТЬЕ условие if (isset($callBackParam["extraParametrsTemplate"])) {




if ($offset &gt;= 0 &amp;&amp; $offset &lt;= $products_count) {
while ($row = db_fetch_row($q)) {

# [ДОПОЛНЕНИЕ] РАЗНАЯ СКИДКА ДЛЯ РАЗНЫХ КАТЕГОРИЙ
$row["Price"] = CatDiscount ($row["Price"],$row["categoryID"]);
# END[ДОПОЛНЕНИЕ] РАЗНАЯ СКИДКА ДЛЯ РАЗНЫХ КАТЕГОРИЙ

if (isset($callBackParam["extraParametrsTemplate"])) {

function GetPriceProductWithOption($variants, $productID) {
# [ДОПОЛНЕНИЕ] РАЗНАЯ СКИДКА ДЛЯ РАЗНЫХ КАТЕГОРИЙ
$full_price = 0;
$base_price = 0;

# $row = db_fetch_assoc(db_query("SELECT Price FROM " . PRODUCTS_TABLE . " WHERE productID=$productID LIMIT 1"));
$row = db_fetch_assoc(db_query("SELECT Price, categoryID FROM " . PRODUCTS_TABLE . " WHERE productID=$productID LIMIT 1"));

$base_price = CatDiscount ((float)$row['Price'],$row['categoryID']);
$change = $base_price/(float)$row['Price'];

if (!$variants) {
#return $row['Price']
$full_price = $base_price;
return $full_price;
}

$row1 = db_fetch_assoc(db_query("SELECT SUM(price_surplus) AS price_surplus FROM " . PRODUCTS_OPTIONS_SET_TABLE . " WHERE productID=$productID AND variantID IN (" . implode(',', $variants) . ")"));
#return $row['Price'] + $row1['price_surplus'];
$full_price = $base_price + $row1['price_surplus']*$change;
return $full_price;
# END [ДОПОЛНЕНИЕ] РАЗНАЯ СКИДКА ДЛЯ РАЗНЫХ КАТЕГОРИЙ
}

В теме: ShopCMS и PHP7

26 August 2018 - 01:25 AM

Спасибо, я видимо через чур заморочился фразой
"3. Скачать со smarty.net последнюю версию smarty 2.6.* (сейчас это 2.6.31), исправленную под PHP7 и заменить ею старую."