[TYPO3-mvc] Setting a default pageUid for different controllers from typoscript.

Nathan Lenz typo3 at k9tfk.com
Thu Jan 21 16:55:41 CET 2010


I meant for this thread to be different from my RealURL thread. Oh well,
they are both meant for solving the same problem.


I have a working example!

First, put this in the Typoscript settings:

plugin.tx_myext.settings.overridePageUid {
    Blog.show.pageUid = 2266
    Blog.show.argumentsToRemove = controller,action	
}

This tells the link builder to default to pageUid 2266 if a different
pageUid is not provided to the viewHelper.

IF the pageUid ends up being set through this method, then the
controller and action parameters are not added into the final link.



Second, use the plugin's flexform to set the default controller/action
to whatever you want, my proof of concept looks like this:

<switchableControllerActions>
 <TCEforms>
  <label>Pick the default Controller->action</label>
   <config>
     <type>input</type>
     <size>35</size>
   </config>
 </TCEforms>
</switchableControllerActions>

So on page 2266, I place a copy of tx_myext_pi1 and set the default
controller and action to: "Blog->show"


Third, and final step:

Create a RealURL fixedPostVar on page 2266 that does a lookup on the
appropriate blog table, mapping the name to the id.


Final result:

Any <f:link.action controller="Blog" action="show" arguments="{blog:
blog}">View a blog</f:link.action> in any template will automatically
link to:

/somepage/show/blog-name-here

Without the special fixed post var rule in RealURL, it would look like:

/somepage/show/?tx_myext_pi1[Blog]=3


This only required two changes to extBase/Fluid. They are non-blocking
changes that should not change default behavior...  I would be happy to
provide a patch if people find this helpful.

--Nathan



More information about the TYPO3-project-typo3v4mvc mailing list