Zum Inhalt springen

wieso funktioniert der link nicht

Erstellt am 18. Juni 2007 · 3 Antworten · letzte Antwort am 18. Juni 2007

Tags: Links, Frage

nugget ·

ich bin dabei ein fe_plugin zu schreiben. ich habe zu meiner extension ein html template eingebunden welches die marke ersetzt. funktioniert auch alles wunderbar bis auf die erstellung des links. dieser wird nicht als link markiert warum??

	function listView($content,$conf)	{
		$this->conf=$conf;		// Setting the TypoScript passed to this function in $this->conf
		$this->pi_setPiVarDefaults();
		$this->pi_loadLL();		// Loading the LOCAL_LANG values
		
	#Preconfigure the typolink
	$this->local_cObj = t3lib_div::makeInstance('tslib_cObj');
	$this->local_cObj->setCurrentVal($GLOBALS['TSFE']->id);
	$this->typolink_conf = $this->conf['typolink.'];
	$this->typolink_conf['parameter.']['current'] = 1;
		
	# Get the template
	$this->templateCode = $this->cObj->fileResource($conf['templateFile']);
 
	# Get the parts out of the template
	$template['total'] = $this->cObj->getSubpart($this->templateCode,'###TEMPLATE###');
	$template['list'] = $this->cObj->getSubpart($template['total'],'###LIST###');

    $query = "SELECT * FROM tx_bafiremissions_missions";
	$query .= " WHERE deleted = 0 AND hidden = 0 ";
    $res = mysql(TYPO3_db,$query);
	
	while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
		# Build content from template
		$markerArray['###MISSION_NR###'] = $row['mission_number'];             
		$markerArray['###MISSION_ART###'] = $row['mission_art'];
		$markerArray['###MISSION_DATE###'] = $row['mission_date'] = date("d.m.Y",$row['mission_date']);
		$markerArray['###MISSION_STREET###'] = $row['mission_street'];
		$markerArray['###MISSION_MSG###'] = $row['mission_msg'];
		$markerArray['###MISSION_DETAILS###'] = $row['mission_street'];
		
		$content_list .= $this->cObj->substituteMarkerArrayCached($template['list'], $markerArray);
		}   
	
	$subpartArray['###CONTENT###'] = $content_list; 
 
	# Typolink
	$temp_conf = $this->typolink_conf;
	$temp_conf['additionalParams'].= '&tx_bafiremissions_pi1[mode]=list&tx_bafiremissions_pi1[cat]='.$row['uid'];
	$temp_conf['useCacheHash']=$this->allowCaching;                            
	$temp_conf['no_cache']=!$this->allowCaching;
	$temp_conf['parameter.']['wrap'] = "|,".$GLOBALS['TSFE']->type;
	$wrappedSubpartContentArray['###LINK###'] = $this->local_cObj->typolinkWrap($temp_conf); 

	$content = $this->cObj->substituteMarkerArrayCached($template['total'], $markerArray, $subpartArray, $wrappedSubpartContentArray);
	return $content;  
    	}
<!-- ###TEMPLATE### begin -->
 <table class="mission_list_table" cellpadding="2" cellspacing2="">
  <!-- ###CONTENT### -->
   <!-- ###LIST### -->
    <tr>
		<td class="mission_month" colspan="6">###MISSION_MONTH###</td>
	</tr>
	<tr>
     <td class="mission_nr">###MISSION_NR###</td>
	 <td class="mission_art">###MISSION_ART###</td>
	 <td class="mission_date">###MISSION_DATE###</td>
	 <td class="mission_street">###MISSION_STREET###</td>
	 <td class="mission_msg">###MISSION_MSG###</td>
	 <td class="mission_details"><!--###LINK###-->Mission Details<!--###LINK###--></td>
    </tr>
   <!-- ###LIST### -->
  <!-- ###CONTENT### -->
 </table>
<!-- ###TEMPLATE### end -->
eisstern ·

Das geliche hatte ich auch for 2 Tagen. Die Funktion

<?php
$this->local_cObj->typolinkWrap($temp_conf)
?>

gibt ein Array mit den Linktags zurück und nicht den Link selbst. Der erste Teil des Arrays ist der <a href...> und der zweite das </a>. Also musste du es so lösen:

<?php
$temp = $this->local_cObj->typolinkWrap($temp_conf);
$wrappedSubpartContentArray['###LINK###'] = $temp[0]."Linktext".$temp[1];
?>

Hoffe das hilft.

eisstern ·

Ich habe aus 1 Zeile 2 gemacht (Zeile 44). Mehr wars net. Du musst dir allerdings noch selber überlegen wie du den Linktext setzt.
Wie man zB den Seitentitel automatisch ausliest weiß ich selbst noch nicht. Muss da selber noch forschen. Bin für Infos offen ^^

Edit Begin
Hab grad erst gesehen dass ich da noch überall local_cObj geschrieben hab. Sollte der Code so nicht funktionieren mache überall mal nur cObj draus (also zb $this->cObj->typolinkWrap($temp_conf) )
Edit Ende

<?php
function listView($content,$conf)       {
                $this->conf=$conf;            // Setting the TypoScript passed to this function in $this->conf
                $this->pi_setPiVarDefaults();
                $this->pi_loadLL();          // Loading the LOCAL_LANG values
               
        #Preconfigure the typolink
        $this->local_cObj = t3lib_div::makeInstance('tslib_cObj');
        $this->local_cObj->setCurrentVal($GLOBALS['TSFE']->id);
        $this->typolink_conf = $this->conf['typolink.'];
        $this->typolink_conf['parameter.']['current'] = 1;
               
        # Get the template
        $this->templateCode = $this->cObj->fileResource($conf['templateFile']);
 
        # Get the parts out of the template
        $template['total'] = $this->cObj->getSubpart($this->templateCode,'###TEMPLATE###');
        $template['list'] = $this->cObj->getSubpart($template['total'],'###LIST###');

    $query = "SELECT * FROM tx_bafiremissions_missions";
        $query .= " WHERE deleted = 0 AND hidden = 0 ";
    $res = mysql(TYPO3_db,$query);
       
        while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
                # Build content from template
                $markerArray['###MISSION_NR###'] = $row['mission_number'];             
                $markerArray['###MISSION_ART###'] = $row['mission_art'];
                $markerArray['###MISSION_DATE###'] = $row['mission_date'] = date("d.m.Y",$row['mission_date']);
                $markerArray['###MISSION_STREET###'] = $row['mission_street'];
                $markerArray['###MISSION_MSG###'] = $row['mission_msg'];
                $markerArray['###MISSION_DETAILS###'] = $row['mission_street'];
               
                $content_list .= $this->cObj->substituteMarkerArrayCached($template['list'], $markerArray);
                }   
       
        $subpartArray['###CONTENT###'] = $content_list;
 
        # Typolink
        $temp_conf = $this->typolink_conf;
        $temp_conf['additionalParams'].= '&tx_bafiremissions_pi1[mode]=list&tx_bafiremissions_pi1[cat]='.$row['uid'];
        $temp_conf['useCacheHash']=$this->allowCaching;                           
        $temp_conf['no_cache']=!$this->allowCaching;
        $temp_conf['parameter.']['wrap'] = "|,".$GLOBALS['TSFE']->type;
        $temp = $this->local_cObj->typolinkWrap($temp_conf);
        $wrappedSubpartContentArray['###LINK###'] = $temp[0]."Linktext".$temp[1];
        //$wrappedSubpartContentArray['###LINK###'] = $this->local_cObj->typolinkWrap($temp_conf);

        $content = $this->cObj->substituteMarkerArrayCached($template['total'], $markerArray, $subpartArray, $wrappedSubpartContentArray);
        return $content; 
        }
?>