PHP code example of toist-net / smarty_skeleton

1. Go to this page and download the library: Download toist-net/smarty_skeleton library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

toist-net / smarty_skeleton example snippets

`smarty
{* mostrar los ultimos (usando la lista lates: section.contents.latest) 20 articulos publicados en la seccion actual *}
{foreach $section.contents.latest->get(1, 20) as $content}
	<article class="post">
		<figure>
    		<img src="{$url->image_url($content.image_square_id, 200, 100)}" alt="{$content.title}">
    		<figcaption>{$content.title}</figcaption>
    	</figure>
    	<header>
    		<time datetime="{$content.publication_date}">{$date->format('%d/%m/%Y', $content.publication_date_int)}</time>
    		<h1><a href="{$content.permanent_url}">{$content.title}</a></h1>
    	</header>
    	<section>
    		<p>{$content.description}</p>
    	</section>
    	<footer>
    		<small>{$content.comments_count}</small>
    	</footer>
	</article>
{/foreach}
smarty
<article>
	<header>
		<h1>{$content.title}</h1>
	</header>
	<section>
		{foreach $content.blocks as $block}
        	{if $block.type == 'text'}
        		<div class="text-block">
        			{$block.text}
        		</div>
        	{elseif $block.type == 'gallery'}
        		<div class="gallery{foreach $block.display_options as $display_option} {$display_option}{/foreach}">
        			{foreach $block.images as $image}
        				{if $image.link}
        					<a href="{$image.link}">
        				{/if}
        				<figure>
        					<img src="{$url->image_url($image.id, 600,  400)}" alt="{if $image.title}{$image.title}{else}{$content.title}{/if}">
        					{if $image.description}
        						<figcaption>
        							{$image.description}
        						</figcaption>
        					{/if}
        				</figure>
        				{if $image.link}
        					</a>
        				{/if}
        			{/foreach}
        		</div>
        	{elseif $block.type == 'title'}
        		<h1>{$block.text}</h1>
        	{/if}
        {/foreach}
	</section>
</article>