Hi,
I have the following structure in the content directory :
projects
-----projects A
template-projectA.txt
-----projects B
template-projectB.txt
-----projects C
template-projectC.txt
The template-projectX is the following :
<div class="grid-4">
<?php $articles = $site->index()->visible()->filterBy('tags', 'projectX', ',')->paginate(8) ?>
<?php foreach($articles as $article): ?>
<div class="tile txtleft">
<a href="<?php echo $article->url() ?>">
<?php if($image = $article->images()->sortBy('sort', 'asc')->first()): ?>
<img class="fl" src="<?php echo thumb($image, array('width' => 100, 'height' => 100))->url() ?>" alt="<?php echo $article->title()->html() ?>">
<?php endif ?>
<h3><?php echo $article->title()->html() ?></h3>
<p><?php echo $article->text()->excerpt(100) ?></p></a>
</div>
<?php endforeach ?>
</div>
The only difference between the templates for projectA, ProjectB or ProjectC is the filterBy(‘tags’, ‘ProjecX’).
I started to duplicate the template with this only change (1 word) in order to get the relevant display for the respective template.
Is there a simpliest way to do so, meaning having only one single template with the line and the filter tag referring to the directory which it belongs to ?
I don’t know if it is clear enough, but it would help me a lot.
Thank you for your support
Gerard