hschottm / tags

Contao tags extension
11 stars 16 forks source link

Contao 4.10 fixes #61

Closed Sioweb closed 3 years ago

Sioweb commented 3 years ago

This will fix the no root page found https://github.com/hschottm/tags/issues/60

Im not sure which contao version is required for $objPage->getFrontendUrl or PageModel::getFrontendUrl. Maybe 4.8?

jankout commented 3 years ago

Thank you very much.

@hschottm Can you implement it, please?

jankout commented 3 years ago

@Sioweb Es gibt noch ein Problem mit der URL in _mod_tagcloud.html5_, sobald die Rootseite ein Sprachensuffix und eine eingetragene Domain hat. Weißt du zufällig, was man ändern muss. Siehe https://www.allesbrille-berlin.com/de/kontakt (ganz unten ist die Tagcloud).

Ich habe es temporär hinbekommen, indem ich die URL manuell hard eingetragen haben

<ul class="cloud"<?php echo (($this->topten && !$this->expandedAll) ? ' style="display: none;"' : ''); ?>>
<?php foreach ($this->tags as $tag): ?>
    <li class="<?php echo $tag['tag_class']; ?>">
<?php if (strlen($this->jumpTo)): ?><a href="tags/tag/<?php echo $tag['tag_name']; ?>" 
title="<?php echo $tag['tag_name'] . ' (' . $tag['tag_count'] . ')'; ?>">
<?php endif; ?><?php echo $tag['tag_name']; ?><?php if (strlen($this->jumpTo)): ?></a><?php endif; ?></li>
<?php endforeach; ?>
</ul>

Es geht um tags/tag/<?php echo $tag['tag_name']; ?>. Ursprünglich ist es mit <?php echo $tag['tag_url']; ?>

Sioweb commented 3 years ago

@jankout Bei mir hat das zunächst auch nicht funktioniert, ich glaube nach dem ich das Verzeichnis /var/cache gelöscht habe, hat es funktioniert.

In der Datei /Hschottm/Tags/modules/ModuleTagCloud.php Zeile 114 wird die URL zusammengesetzt, im Template muss nichts angepasst werden.

Zum Debuggen habe ich bei mir lokal mal folgendes in Zeile 112 - 128 eingetragen:

            if (count($pageArr))
            {
                echo '<pre>' . __METHOD__ . ":\n" . print_r($objPage->getFrontendUrl(), true) . "\n#################################\n\n" . '</pre>';
                die('<pre>' . __METHOD__ . ":\n" . print_r($objPage->getFrontendUrl('/tag/' . \TagHelper::encode($tag['tag_name'])), true) . "\n#################################\n\n" . '</pre>');
                $strUrl = StringUtil::ampersand($objPage->getFrontendUrl('/tag/' . \TagHelper::encode($tag['tag_name'])));
                if (strlen($strParams))
                {
                    if (strpos($strUrl, '?') !== false)
                    {
                        $strUrl .= '&amp;' . $strParams;
                    }
                    else
                    {
                        $strUrl .= '?' . $strParams;
                    }
                }
            }

Das sollte dann eine weiße Seite erzeugen mit dem Inhalt:

Contao\ModuleTagCloud::showTags:
de/newsarchiv.html
#################################

Contao\ModuleTagCloud::showTags:
de/newsarchiv/tag/TAGNAME.html
#################################