PHP Joomla! 6 Joomla! 5 Joomla! 3 (Legacy) Template Override Basic

Read and Render Article Extra Links (urla, urlb, urlc)

Decodes the article urls JSON column to render structured CTA buttons such as Demo, Docs or Download inside overrides.

Updated on 24 November 2026 22 copies 98 views
templates/seu_template/html/com_content/article/default.php
<?php

declare(strict_types=1);

$urls = json_decode((string) ($this->item->urls ?? '{}'));

foreach (['a', 'b', 'c'] as $slot) {
    $href  = trim((string) ($urls->{'url' . $slot} ?? ''));
    $label = trim((string) ($urls->{'url' . $slot . 'text'} ?? ''));
    if ($href !== '') : ?>
        <a href="<?php echo htmlspecialchars($href, ENT_QUOTES, 'UTF-8'); ?>"
           target="_blank" rel="noopener noreferrer" class="btn btn-outline-dark">
            <?php echo htmlspecialchars($label !== '' ? $label : $href, ENT_QUOTES, 'UTF-8'); ?>
        </a>
    <?php endif;
}
Properly escapes URLs and labels with rel="noopener noreferrer" for external targets.
templates/seu_template/html/com_content/article/default.php
<?php
$urls = json_decode($this->item->urls);
if (!empty($urls->urla)) {
    echo '<a href="' . $urls->urla . '" target="_blank">' . ($urls->urlatext ?: $urls->urla) . '</a>';
}
Classic Joomla 3 decoding of $this->item->urls.

Technical explanation and best practices

The native Link A, Link B and Link C fields in com_content are ideal for portfolio live URLs, repositories or download links without adding extra extensions.

Direct Engineering

Have a Joomla project or technical challenge in mind?

From architectural diagnosis to production deployment, directly with the engineer.