[Neos] use of FLOW_CONTEXT production on managed server
Steffen Müller
typo3 at t3node.com
Thu Jan 9 17:03:48 CET 2014
Hi.
On 08.01.2014 14:37 Dominic Garms wrote:
>
> I would like to know more about the FLOW_CONTEXT. As I don't have any
> control of the vhost I guess I need to use the .htaccess file inside of
> the Web folder?
That would work.
As well as setting it as a environment variable for the CLI:
# run the TYPO3 Flow CLI commands in production context
FLOW_CONTEXT=Production ./flow help
# In your Apache configuration, you usually use:
SetEnv FLOW_CONTEXT Production
... from the official docs:
http://docs.typo3.org/flow/TYPO3FlowDocumentation/TheDefinitiveGuide/PartIII/Bootstrapping.html#the-typo3-flow-application-context
You can also use mod_rewrite rules in your htaccess file:
# Rules to set ApplicationContext based on hostname
#RewriteCond %{HTTP_HOST} ^dev\.example\.com$
#RewriteRule (.*) $1 [E=FLOW_CONTEXT:Development]
#RewriteCond %{HTTP_HOST} ^staging\.example\.com$
#RewriteRule (.*) $1 [E=FLOW_CONTEXT:Production/Staging]
#RewriteCond %{HTTP_HOST} ^www\.example\.com$
#RewriteRule (.*) $1 [E=FLOW_CONTEXT:Production]
> But first of all, what would be changed
AFAIK in development contexts, exceptions are visible in the Neos views.
> and how can I reach the context in ts2 or flow itself?
API to get current context in Flow:
\TYPO3\FLOW3\Object\ObjectManagerInterface::getContext()
For example the Package Management module controller assigns the context
to the view using:
$this->view->assignMultiple(array(
(...)
'isDevelopmentContext' =>
$this->objectManager->getContext()->isDevelopment()
));
which therefore supports the following condition in the Fluid Template
of the Package Management module:
<f:if condition="{isDevelopmentContext}">...</f:if>
But I don't know how to access the context in ts2.
--
cheers,
Steffen
Active Contributor TYPO3 CMS
TYPO3 Blog: http://www.t3node.com/
Twitter: @t3node - http://twitter.com/t3node
More information about the Neos
mailing list