What means <!-- in templates page

Help for integrating the Laravel package
Forum rules
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
User avatar
AmzoooJibal
Posts: 35
Joined: 12 Mar 2021, 20:09

What means <!-- in templates page

Post by AmzoooJibal » 18 Aug 2021, 13:02

Hello,
what is the role of <!-- in templates pages ? for example in the count collection of supplier i have this javascript code:

Code: Select all

<?php $this->block()->start( 'catalog/count/supplier' ) ?>
// <!--
var supplierCounts = <?= $this->get( 'supplierCountList', map() )->toJson( JSON_FORCE_OBJECT ) ?>;

$( ".catalog-filter-supplier .supplier-lists li.attr-item" ).each( function( index, item ) {
	$(item).append( function() {
		var itemId = $(this).data( "id" );

		if( supplierCounts[itemId] ) {
			var node = document.createElement( 'span' );
			node.appendChild( document.createTextNode( supplierCounts[itemId] ) );
			$(node).addClass( 'attr-count' );
			return node;
		}

		$(this).addClass( 'disabled' );
	});
});
// -->
<?php $this->block()->stop() ?>
where and when this code are executed ? and what is the role of <!-- in template page ?

User avatar
AmzoooJibal
Posts: 35
Joined: 12 Mar 2021, 20:09

Re: What means <!-- in templates page

Post by AmzoooJibal » 18 Aug 2021, 16:20

for the first question, the supplier count is executed by the javascript in the header of filter :

Code: Select all

<?php if( ( $url = $this->get( 'filterCountUrl' ) ) != null ) : ?>
	<script defer src="<?= $enc->attr( $url ) ?>"></script>
<?php endif ?>
this filter get all count html (in this case javascript).

I have just one more question is there any role of <!-- ? i can delete them ?

User avatar
aimeos
Administrator
Posts: 7881
Joined: 01 Jan 1970, 00:00

Re: What means <!-- in templates page

Post by aimeos » 19 Aug 2021, 05:44

Code: Select all

// <!--
...
// -->
This is a protection that the browser doesn't interpret the Javascript code as HTML. Just leave it there.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply