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,
    ));
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 求差集那个函数有问题,有无佬可以解决
  • ¥15 【提问】基于Invest的水源涵养
  • ¥20 微信网友居然可以通过vx号找到我绑的手机号
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥65 汇编语言除法溢出问题