[TYPO3] Replace page content when single view displayed
Jeppe Vesterbæk
jhve02 at control.aau.dk
Fri Feb 24 13:46:57 CET 2006
Hi Mike
>Jeppe, how do I make the links in the listview point to the subpage?
>
>
Well, what you basically want to do is to give the listview page the PID
of the subpage -- if you have the PID, you have the url to the page,
right?. You could hard code it like "index.php?id=PID", but even better
use one of the available functions $this->cObj->getTypoLink_URL(...) or
$this->cObj->pi_linkToPage(...) (see them described here:
http://www.kroeckertskothen.de/typo3conf/ext/extdeveval/apidocs/tslib_pibase_api.html#6741a664b20441a5fe03e675e1f814ad)
Ok, so how to you get the PID of you "details"-page? You have a number
of possible ways to do this. Some of them could be:
1) The nicest solution is to configure your plugin using flexforms. You
can read about that here:
http://wiki.typo3.org/index.php/Extension_Development%2C_using_Flexforms.
But if you are new to typo3 extension development, this may be a bit too
much (though will have/should look at this at some point :p).
2) When you insert a plugin, you have the possibility of selecting a
"starting point". You could use this field when you insert your list
view plugin to select the single view page. In your plugin, get the page
value like this: $pid = $this->cObj->data['pages']. A small notice: if
you select more than one page, $this->cObj->data['pages'] will contain a
comma-separated list if PIDs. So, to be sure use $PIDs= explode(",",
$this->cObj->data['pages']), and you can read the first pid in $PIDs[0].
3) You could use page typoscript to do it: Put the following in your
template typoscript field:
"plugin.tx_mikejones_listview_pi1.singleviewPID = 43" (substitute
'tx_mikejones_listview_pi1' with the name of your plugin and '43' with
the PID of your single view page). Then in your listview plugin, you can
get the value like this: $pid = $conf['singleviewPID']
4) And the very simple: Just hard code the PID of the single view page
in your list view plugin.
Quick summary (in reverse order): Number 3 and 4 are quick but not nice
and they only allow you to have one list view /single view per site
since they are defined globally -- I included them in the list just to
show you a broader list of options. Number 2 is ok -- it allows you to
define the PID locally and you can thus have as many list view/single
view sets as you'd like. Furthermore, it's very easy and quick to
implement. Number 1 is the nicest solution IMHO, but it's gonna take
you some time if you don't know flexforms.
Hope you figure it out. Otherwise do not hesitate to ask again. Have a
nice weekend.
/Jeppe
More information about the TYPO3-english
mailing list