Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typo3/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Typo3 键入脚本中从SQL到Userfunc的结果_Typo3_Typoscript - Fatal编程技术网

Typo3 键入脚本中从SQL到Userfunc的结果

Typo3 键入脚本中从SQL到Userfunc的结果,typo3,typoscript,Typo3,Typoscript,我对Typo3/TypoScript非常陌生,我想知道是否以及如何能够将TypoScript中的sql语句的结果提供给php函数 到目前为止,我已经管理了userFunc,但是我对其余的部分感到困惑。 以下是我的尝试: temp.pidList = CONTENT temp.pidList { table = tx_eepcollect_sessions #table = tt_content select { pidInList < plugin.tx_eepcoll

我对Typo3/TypoScript非常陌生,我想知道是否以及如何能够将TypoScript中的sql语句的结果提供给php函数

到目前为止,我已经管理了userFunc,但是我对其余的部分感到困惑。 以下是我的尝试:

temp.pidList = CONTENT
temp.pidList {
  table = tx_eepcollect_sessions
  #table = tt_content
  select {
    pidInList < plugin.tx_eepcollect_pi1.pid_list
   where {
      stdWrap.cObject = TEXT
      stdWrap.cObject {
        data = global : _COOKIE | tx_eepcollect_pi1
        wrap = ses_id='|'
      }
    }
  }
  renderObj = COA
  renderObj {
    10 = TEXT
    10.field = ses_data
    #30 = TEXT
    #30.data = debug:data
  }
}


includeLibs.user_idList = fileadmin/services/user_IdList.php
temp.ListOfIds = USER
temp.ListOfIds.userFunc = user_IdList->get_IdList
#temp.pidList = TEXT
#temp.pidList = {"1275":{"id":"1275","tx_eepcollect_pi1":{"prozess":"add","pid":"1275","ctrl":"1360858765"},"cHash":"e90b62584f3f0e4f71bf1100faf39d83"}}
temp.ListOfIds.userFunc.jsonList < temp.pidList


temp.mainContent = COA_INT
temp.mainContent.10 = TEXT
temp.mainContent.10.stdWrap.cObject < temp.ListOfIds

输出是一个包含大量内容的数组,但不是数据库查询的结果。

打字脚本不是一种编程语言,因此它不会以任何意义执行。您应该将TS视为核心的一组指令。 所以,下面这句话:

temp.ListOfIds.userFunc.jsonList < temp.pidList
由于jsonList是您的自定义属性,您需要通过以下方法将其带到其中:

打字稿

我假设您从类user_IdList的方法get_IdList调用它,该方法有两个参数:$content和$conf

作为一种额外的手段,您可以使用or将其作为扩展,这样您就更容易使用配置

另一件事是,您的代码可能存在SQL注入漏洞:

   where {
      stdWrap.cObject = TEXT
      stdWrap.cObject {
        data = global : _COOKIE | tx_eepcollect_pi1
        wrap = ses_id='|'
      }
    }

<>所以,你可以考虑阅读

到底需要什么?temp.pidList或temp.ListOfIds的输出?如果你问的是userfunc,那么请复制粘贴php代码?我这样问是因为我认为stdWrap期望当前内容作为第一个参数。当您传递cObject名称时,我觉得应该调用cObjGetSingle方法:$this->cObj->cObjGetSingle$conf['jsonList'],$conf['jsonList'.]@cascaval,您是对的-stdWrap希望内容作为第一个参数,在我们的例子中,它将为NULL,这就是我使用jsonList.cObject的原因——这将指示stdWrap从给定的cObject加载内容,在我们的例子中就是内容。您的方法当然也是正确的,没有将.cObject添加到jsonList,但它将jsonList属性限制为只包含cObject,所以它不再可以包含带有stdWrap的普通字符串。但就目前的问题而言,这也很好:我明白了。那就行了。但是,不能将NULL作为第一个参数传递给stdWrap。您正在传递字符串内容。我想说,temp.ListOfIds.userFunc.jsonList=CONTENT和temp.ListOfIds.userFunc.jsonList.table=tx_eepcollect_会话不需要在那里,调用可以是$jsonList=$this->cObj->stdWrap,$conf['jsonList.];嗯。。。不-我们谈论的是不同的东西,我猜在我的例子中它是空的,因为我有以下结构:temp.ListOfIds=USER temp.ListOfIds.userFunc=USER_IdList->get_IdList temp.ListOfIds.userFunc.jsonList.cObjectcObj->stdWrap,$conf['jsonList.];现在我明白了困惑的来源:我认为您答案中的第二段代码也是解决方案的一部分,因为毕竟您仍然需要定义temp.ListOfIds=USER和USER函数,并且您在stdWrap中使用$conf['jsonList'],而它实际上并不存在。
temp.ListOfIds.userFunc.jsonList.cObject < temp.pidList
$jsonList = $this->cObj->stdWrap($conf['jsonList'], $conf['jsonList.']);
   where {
      stdWrap.cObject = TEXT
      stdWrap.cObject {
        data = global : _COOKIE | tx_eepcollect_pi1
        wrap = ses_id='|'
      }
    }