Skip to content

Instantly share code, notes, and snippets.

@beelbrecht
Last active December 12, 2015 01:38
Show Gist options
  • Save beelbrecht/4692685 to your computer and use it in GitHub Desktop.
Save beelbrecht/4692685 to your computer and use it in GitHub Desktop.
<f:render section="Main" />
{namespace v=Tx_Vhs_ViewHelpers}
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="utf-8"/>
<title>TYPO3 Template</title>
</head>
<body>
<f:layout name="Default" />
<f:section name="Main">
<v:page.content.render />
</f:section>
</body>
</html>
page.10 = FLUIDTEMPLATE
page.10 {
file = EXT:website_template/Resources/Private/Templates/Site/Index.html
layoutRootPath = EXT:website_template/Resources/Private/Templates/Site/Layouts/
partialRootPath = EXT:website_template/Resources/Private/Templates/Site/Partials/
}
@NamelessCoder
Copy link

Hi Benjamin,

Bit more space to express one self here. Q: have you confirmed that your Layout does in fact render the Main section?

@NamelessCoder
Copy link

...and is your content in colPos zero?

@beelbrecht
Copy link
Author

Hi,
my colPos is zero, the standard TYPO3 column, not left, not right, not border...

I've added the Default.html Layout ;-) Just a section rendering.

If I use this, instead of the vhs viewhelper, the output is correct generated:
<f:cObject typoscriptObjectPath="lib.field_main_content_before" />
lib.field_main_content = COA
lib.field_main_content.100 < styles.content.get

BTW: I'm using TYPO3 4.5

@NamelessCoder
Copy link

4.5 should be fine, at least regarding this particular VH.

Are you seeing any SQL-related errors in your log?

The pid should be coming from $GLOBALS['TSFE']->id or $GLOBALS['TSFE']->page['content_from_pid'] if you selected "content from other pid" in the page. The pid is sensitive to mountpoint (_GET[MP]) but I assume that's not the case here.

Another possibility: Are workspaces in use (and previewing in another than the live workspace)? If I recall, this VH doesn't play well with workspaces yet.

@NamelessCoder
Copy link

Hmm, something just reminded me that there could be some detail in the default values of VH arguments on 4.5 - could you try this instead:

<v:page.content.render column="0" />

That way should make perfectly sure the query is correct even if the default value is misunderstood.

@beelbrecht
Copy link
Author

Ok, after a bit debugging I've found this problem:
$pid = $GLOBALS['TSFE']->id;
if (isset($this->arguments['pageUid']) === TRUE) {
$pid = $this->arguments['pageUid'];
} elseif ($GLOBALS['TSFE']->page['content_from_pid']) {
$pid = $GLOBALS['TSFE']->page['content_from_pid'];
}
var_dump($pid);
exit;

this results in "null";
the $pid is empty.

the pid in the where condition looks like this: pid = ''

It's a plain 4.5 installation, no mountpoints, no "use content from other page..."

@NamelessCoder
Copy link

Okay, that leads me to suspect that using isset() on the ArrayAccess implementation that is $this->arguments on 4.5 will always return TRUE or at the very least, return TRUE incorrectly in this specific case. On 4.6+ this is an array.

If you change this to:

if (isset($this->arguments['pageUid']) === TRUE && $this->arguments['pageUid'] > 0) {

Does it then work as it should? This fix would allow the existing behaviour on all versions of TYPO3 so I hope it also solves this particular issue on 4.5 :)

@beelbrecht
Copy link
Author

Output of var_dump($this->arguments)
object(Tx_Fluid_Core_ViewHelper_Arguments)[137]
protected 'arguments' =>
array (size=11)
'column' => int 0
'limit' => null
'order' => string 'sorting' (length=7)
'sortDirection' => string 'ASC' (length=3)
'pageUid' => null
'contentUids' => null
'slide' => int 0
'slideCollect' => int 0
'slideCollectReverse' => int 0
'loadRegister' => null
'as' => null

BUT output of "isset($this->arguments['pageUid'])" gives me a TRUE

I think, that this is the problem...

@NamelessCoder
Copy link

  • great minds think alike ;)

@beelbrecht
Copy link
Author

yeah! It works!
Big thanks for your support :-)

@NamelessCoder
Copy link

You're very welcome. Anytime :)

Hope you enjoy your weekend. And VHS!

/C

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment