Skip to main content
cleaning up
Source Link

You can wrap parameters of your channel:entries tag in simple conditionals. This will provide you with one way to prevent repeating your template code.

So instead of duplicating your channel loop (which as you said is not very DRY), just use one loop and put the category parameter inside a conditional:

{exp:channel:entries 
    {if segment_1 == ""}category="1"{/if}
}
    {!-- channel entries template stuff --}
{/exp:channel:entries}

Or if you diddid want to use a snippet (which would prevent you from having to repeatfor the repeated template code as you said) andyet still havereap the usabilitybenefits of working with templates as files you can use Snippet Sync. I use it on all my installs and it works great. There is a developer license available.

You can wrap parameters of your channel:entries tag in simple conditionals. This will provide you with one way to prevent repeating your template code.

So instead of duplicating your channel loop (which as you said is not very DRY), just use one loop and put the category parameter inside a conditional:

{exp:channel:entries 
    {if segment_1 == ""}category="1"{/if}
}
    {!-- channel entries template stuff --}
{/exp:channel:entries}

Or if you did want to use a snippet (which would prevent you from having to repeat template code as you said) and still have the usability of working with files you can use Snippet Sync. I use it on all my installs and it works great. There is a developer license available.

You can wrap parameters of your channel:entries tag in simple conditionals.

So instead of duplicating your channel loop (which is not very DRY), just use one loop and put the category parameter inside a conditional:

{exp:channel:entries 
    {if segment_1 == ""}category="1"{/if}
}
    {!-- channel entries template stuff --}
{/exp:channel:entries}

Or if you did want to use a snippet for the repeated template code yet still reap the benefits of working with templates as files you can use Snippet Sync. I use it on all my installs and it works great. There is a developer license available.

Source Link

You can wrap parameters of your channel:entries tag in simple conditionals. This will provide you with one way to prevent repeating your template code.

So instead of duplicating your channel loop (which as you said is not very DRY), just use one loop and put the category parameter inside a conditional:

{exp:channel:entries 
    {if segment_1 == ""}category="1"{/if}
}
    {!-- channel entries template stuff --}
{/exp:channel:entries}

Or if you did want to use a snippet (which would prevent you from having to repeat template code as you said) and still have the usability of working with files you can use Snippet Sync. I use it on all my installs and it works great. There is a developer license available.