简体   繁体   English

具有GET参数的RealURL

[英]RealURL with GET parameters

We have developed a typo3 plug in that searches for trucks. 我们开发了一个typo3插件来搜索卡车。 For SEO reasons, we are trying to use the realURL plug in to make the URLs friendlier to use. 出于SEO的原因,我们正在尝试使用realURL插件使URL更加易于使用。

On the front page we have several call to actions that link to the search page with certain search parameters. 在首页上,我们有多个调用操作,这些操作链接到具有某些搜索参数的搜索页面。 An example is bellow: 下面是一个例子:

/search-results/?tx_fds_searchresults[type_name]=Trailer

This link works as expected. 此链接按预期方式工作。 On the results page is a link to the listings page with more details. 结果页面上是指向列表页面的链接,其中包含更多详细信息。 An example is bellow: 下面是一个例子:

/listing/?tx_fds_listing[id]=119870

This link is not working. 此链接不起作用。 tx_fds_listing[id] is not being populated in the arguments passed to the plug in controller. 不会在传递给插件控制器的参数中填充tx_fds_listing[id]

At first we thought it might be a config issue but again, it isn't present on other pages. 最初,我们认为这可能是配置问题,但在其他页面上却没有出现。 The ID is not a database object and may be a text string instead. 该ID不是数据库对象,而可以是文本字符串。

Edit: 编辑:

I should add that it works fine with RealURL turned off. 我应该补充一点,在关闭RealURL的情况下可以正常工作。

We get the id as $id = $this->request->getArgument('id'); 我们得到的id为$id = $this->request->getArgument('id');

Edit 2: Here is the error message from the logs. 编辑2:这是日志中的错误消息。 [ALERT] request="28233e225150a" component="TYPO3.CMS.Frontend.ContentObject.Exception.ProductionExceptionHandler": Oops, an error occurred! Code: 201512141630381db91bba - {"exception":"exception 'TYPO3\\\\CMS\\\\Extbase\\\\Mvc\\\\Exception\\\\NoSuchArgumentException' with message 'An argument \\"id\\" does not exist for this request.'

I also tried renaming the variable to name, but that didn't work either. 我也尝试将变量重命名为name,但是那也不起作用。

I have a solution that solves the root cause of the problem, if not the specific issue. 我有一个解决问题的根本原因的解决方案,即使不是特定问题。

So I had to add additional mapping to the realurl_conf.php file. 因此,我不得不向realurl_conf.php文件添加其他映射。 For example to get the listing id: 例如,获取商品编号:

$config['domain.com']['postVarSets'][3]['stock'] = array(array('GETvar' => 'tx_fds_listing[id]'));

This makes the effective URL: 这样就形成了有效的URL:

/listing/stock/119870

This was the intended usage for the plugin, so this is a good result. 这是该插件的预期用法,所以这是一个很好的结果。 I also added configuration for ajax and pdfs. 我还添加了ajax和pdf的配置。 This required modification to the typoscript that was not obvious. 这需要对打字稿进行不明显的修改。

PDF TS: PDF TS:

pdf = PAGE
pdf {
    typeNum = 300
    10 = USER_INT
    10 {
        userFunc      = TYPO3\CMS\Extbase\Core\Bootstrap->run
        #vendorName    = TYPO3
        extensionName = Fds
        pluginName = Listing

        #controller = FDS
        controller = Tx_Fds_Controller_FDSController
        #action = listingPdf
        switchableControllerActions.FDS.1 = listingPdf


    }
    config {
        disableAllHeaderCode = 1
        additionalHeaders = Content-type:application/pdf
        xhtml_cleaning = 0
        admPanel = 0
    }
}

PDF RealURL Config: PDF RealURL配置:

$config['domain.com']['postVarSets'][3]['pdf'] = array('type' => 'single', 'keyValues' => array ('type' => 300));

PDF effective URL: PDF有效网址:

/listing/pdf/stock/119870

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

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