[Typo3-dev] Wrapping a link in an extension
Jan Steenbuck
steenbuck at ticcon.de
Tue Sep 30 14:16:49 CEST 2003
Friends, romans, countrymen,
I need a hint. I'm stuck.
We are trying to write our first extension, and we so far failed to get a
link therein to work.
Our PHP-Knowledge is still quite basic, but improving, and we have one of
our programmers at our side (he knows PHP, but doesn't know Typo3 yet...).
We have read, we have collected, we have digested, and here's what we have
accomplished so far.
Inserting Headline, Content and Image work just fine, but now we need to
put a link on that image (just like in the general content type 'image').
The marker ###Links### is correctly filled with the content from §link, but
no other parameters are passed along (no 'http://' or 'mailto:' etc).
Does anyone have a clue that could help us along? Here's the code:
----->8 snip, snip 8<-----
<<<<<<< PHP: >>>>>>>
class tx_newsboxentest_pi1 extends tslib_pibase {
var $prefixId = "tx_newsboxentest_pi1"; // Same as class name
var $scriptRelPath = "pi1/class.tx_newsboxentest_pi1.php"; // Path to this
script relative to the extension dir.
var $extKey = "newsboxentest"; // The extension key.
var $conf;
var $templateCode;
function main($content,$conf) {
$this->conf=$conf;
$this->pi_setPiVarDefaults();
$this->pi_loadLL();
// get the template
$this->templateCode =
$this->cObj->fileResource($this->conf["templateFile"]);
// get the image
$img = $this->conf["image."];
$img["file"] = "uploads/tx_newsboxentest/" .
$this->cObj->data['tx_newsboxentest_image_tb'];
// get the link
$link = $this->cObj->data['tx_newsboxentest_link_tb'];
// template is read.
// get the specified layout out of the template
$layout = $this->cObj->data['tx_newsboxentest'];
switch ($layout) {
default:
$templateMarker = "###TEMPLATE_0###";
}
$template = $this->cObj->getSubpart($this->templateCode,
$templateMarker);
$subpartArray = array();
$subpartArray["###SUBHEADER###"] = $this->cObj->data['subheader'];
$subpartArray["###HEADLINE###"] =
$this->cObj->parseFunc($this->cObj->data['tx_newsboxentest_headline_tb'],
$this->conf["parser."]);
$subpartArray["###CONTENT###"] =
$this->cObj->parseFunc($this->cObj->data['tx_newsboxentest_content_tb'],
$this->conf["parser."]);
$subpartArray["###MORE###"] = $this->cObj->IMAGE($img);
$subpartArray["###LINKS###"] = $this->cObj->typoLink($link,$this->conf);
$content = $this->cObj->substituteMarkerArrayCached($template,
$subpartArray, array(), array());
return $this->pi_wrapInBaseClass($content);
}
}
<<<<<<< ...and in the template: >>>>>>>
<tr>
<td width="152" height="21" align="left" valign="top"
background="/fileadmin/images/box_unten.gif"><a
href="###LINKS###">###MORE###"</a></td>
----->8 snip, snip 8<-----
Thanks a million in advance!
Kind regards from the far north of Germany (almost Denmark... <g>),
Jan Steenbuck
Ticcon AG · www.ticcon.de
--------------------------
Flensburg · Kiel · Hamburg
--
Hafendamm 33a, 24937 Flensburg
Tel.: (0461) 15054-0, Fax: (0461) 15054-11
eMail: steenbuck at ticcon.de
More information about the TYPO3-dev
mailing list