dongliyan7318 2014-08-22 09:39
浏览 39
已采纳

错字3 - 由id实现

I'm using typo3 and realurl.

In my extension I generate some ID's (next and previous page) and everything works fine up to this point. An example link looks like:

/index.php?id=12

The link takes the visitor to the specific page, but this link is in the url as well. Of course I generate this linke exactly like this:

$GLOBALS['TSFE']->baseURL . "index.php?id=" . $banner->getPrevious();

So, it is exactly what i expected. But how can i turn this url into a seo-friendly URL? Is there something like $realUrl->createUrlFromId()? :P

I checked the manual, looked in some forums, but 99% of the time it is something related to TypoScript, which I don't need (from my point of view) in this case.

Edit:

Here is the .htaccess: http://pastebin.com/DBXjLYjp

Thank you in advance

  • 写回答

1条回答 默认 最新

  • doqau82086 2014-08-22 11:43
    关注

    RealURL hooks into several core methods to generate links, and manipulates the result to be a speaking URL. So, no, it does not offer an own method, but extends existing ones. You don't use a link generation, but build it by yourself. RealURL therefore can not access your link.

    The htaccess only converts speaking urls back into GET-params.

    Use a method like pi_linkToPage, a link viewhelper, or a TypoScript typolink to generate a link.

    $myLink1 = $this->pi_linkToPage('example', 42);
    $myLink2 = $this->cObj->typolink('example', array(
        'parameter' => 42,
    ));
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?