简体   繁体   English

typo3-通过id的realurl

[英]typo3 - realurl by id

I'm using typo3 and realurl . 我正在使用typo3realurl

In my extension I generate some ID's (next and previous page) and everything works fine up to this point. 在我的扩展程序中,我生成了一些ID(下一页和上一页),到目前为止一切正常。 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. 该链接将访问者带到特定页面,但是该链接也位于URL中。 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? 但是,如何将该URL转换为seo友好的URL? Is there something like $realUrl->createUrlFromId()? 是否有类似$ realUrl-> createUrlFromId()的东西? :P :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. 我查看了手册,浏览了一些论坛,但有99%的时间与TypoScript有关,在这种情况下,我不需要(从我的角度来看)。

Edit: 编辑:

Here is the .htaccess: http://pastebin.com/DBXjLYjp 这是.htaccess文件: http : //pastebin.com/DBXjLYjp

Thank you in advance 先感谢您

RealURL hooks into several core methods to generate links, and manipulates the result to be a speaking URL. RealURL挂钩于几种核心方法来生成链接,并将结果操纵为口语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. 因此,RealURL无法访问您的链接。

The htaccess only converts speaking urls back into GET-params. htaccess仅将口语URL转换回GET-params。

Use a method like pi_linkToPage, a link viewhelper, or a TypoScript typolink to generate a link. 使用pi_linkToPage,链接viewhelper或TypoScript typolink之类的方法来生成链接。

$myLink1 = $this->pi_linkToPage('example', 42);
$myLink2 = $this->cObj->typolink('example', array(
    'parameter' => 42,
));

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM