Zum Inhalt springen

Google Navigator mit Kickstarter und Flexform

Erstellt am 24. Mai 2008 · 2 Antworten · letzte Antwort am 26. Mai 2008

Tags: Frage

X_Burner ·

Guden !

Ich mache gerade meine 1. Schritte mit typoscript, und würde nun gerne meine 1. eigene Extension schreiben.

Ich würde gerne folgende Seite dynamisieren, und die Werte im Constant Editor (Template) eingeben,
wie z.B. mit der meta Content Ext.

http://test.nardino.org/routenplaner

    <meta name="gmapkey" content="ABQIAAAAzwWQu4rYkgs2UBRaibsTWBSzWSlJJMezrlFqb8VEdnYfuYbhXBQOpdrcPOcJqqqh0DLs6YCzcICk8A" />
    <script src="gmapez-2.js" type="text/javascript"></script>

	<script language="JavaScript" type="text/javascript"><!--
	function trip_planner() {
		var start_addr = encodeURIComponent( document.getElementById('start_addr').value );
		var url = "http://www.google.com/maps?f=d&hl=de&saddr=" + start_addr + ",+germany&daddr=50.103309,8.401859&sll=50.103309,8.401859&sspn=0.005209,0.014355&ie=UTF8&oi=geospell&ct=clnk&cd=1&t=h&om=1";
		window.open(url,"toolbar=0,location=0,directories=0,status=0,menubar=0,sc rollbars=0,resizable=0");
	}
	function settext(text,field) {
		if (field.value == '') {
			field.value = text;
		}
	}
	function cleartext(text,field) {
		if (field.value == text) {
			field.value=''
		}
	}
	
	//--></script>
	
  </head>
  <body>

	<div class="GMapEZ GLargeMapControl GMapTypeControl GScaleControl G_HYBRID_TYPE" style="width: 700px; height: 400px;">
	  <a href="http://maps.google.com/maps?ll=50.103309,8.401859&spn=0.005209,0.014355&t=h&om=1">
	    OPEN
	  </a>
	  <div title="Addresse">
	    TGS Langenhain<br />
	    Wilhelm-Busch Halle<br />
	    Langenhain<br /><br />
		<form name="route" onsubmit="trip_planner();return false;">
		<input type="text" value="Startort eingeben" id="start_addr" onblur="settext('Startort eingeben',this);" onfocus="cleartext('Startort eingeben',this);" /> 
		<input type="submit" value="Route berechnen" />
		</form>
	  </div>
	  <div title="Details">
		<img src="foto.gif" alt="" />
	  </div>
	</div>

Ich habe mit dem kickstarter 10 Felder angelegt:

key, latidude_a, latidude_b, longitude_a, longitude_b, width, height, name, street, PLZ, city und pic

Nach Erstellung der Ext habe ich in der Liste die Möglichkeit, einen Datensatz anzulegen,
was ich dann auch getan habe.

http://eboom.biz

Ich habe mehrere Tutorials gelesen, aber nach dem Punkt komme ich irgendwie nicht weiter.

Es wird flexform benötigt, um die Eingabe der Werte im Constant Editor.

Würde mir ein debug an der Stelle weiterhelfen ?

Aber in welcher Reihenfolge sollte ich vorgehen, nach dem ich die Grundeinstellungen über den kcikstarter erstellte habe ?

Bin für jeden Tipp dankbar 😉

Gruss

X_Burner

X_Burner ·

Hmmm...

ich habe jetzt die Datei ext_typoscript_setup.txt mit folgendem Inhalt erstellt:

plugin.tx_googlenavigator_pi1.templateFile = EXT:googlenavigator/template.html

,

die template.html liegt im / der Extension,

und die Datei class.tx_googlenavigator_pi1.php abgeändert:

function main($content,$conf)    { 

class tx_googlenavigator_pi1 extends tslib_pibase {
	var $prefixId      = 'tx_googlenavigator_pi1';		// Same as class name
	var $scriptRelPath = 'pi1/class.tx_googlenavigator_pi1.php';	// Path to this script relative to the extension dir.
	var $extKey        = 'google_navigator';	// The extension key.
	var $pi_checkCHash = true;
	
	/**
	 * Main method of your PlugIn
	 *
	 * @param	string		$content: The content of the PlugIn
	 * @param	array		$conf: The PlugIn Configuration
	 * @return	The content that should be displayed on the website
	 */
# 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###');
  
# create the content by replacing the marker in the template
$markerArray['###MARKER1###'] = 'content for marker 1';
$markerArray['###MARKER2###'] = 'content for marker 2';

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

}

Jetzt knallts aber 🙁

http://eboom.biz

Kann mir einer sagen, was in der Zeile 51 (bzw. hier in dem Schnippsel Zeile 17) falsch ist ?

HILFE !

X_Burner

X_Burner ·

Update !

Ich habe den Code wie folgt abgeändert:

class tx_googlenavigator_pi2 extends tslib_pibase {
	var $prefixId      = 'tx_googlenavigator_pi2';		// Same as class name
	var $scriptRelPath = 'pi2/class.tx_googlenavigator_pi2.php';	// Path to this script relative to the extension dir.
	var $extKey        = 'google_navigator';	// The extension key.
	var $pi_checkCHash = true;
	
	/**
	 * The main method of the PlugIn
	 *
	 * @param	string		$content: The PlugIn content
	 * @param	array		$conf: The PlugIn configuration
	 * @return	The content that is displayed on the website
	 */
	function main($content,$conf)	{
		$this->conf=$conf;
		$this->pi_setPiVarDefaults();
		$this->pi_loadLL();
		$this->template=$this->cObj->fileResource('EXT:google_navigator/template.html');
		$record=$this->pi_getRecord('tx_googlenavigator_data',$this->piVars['data']);
		
		$markerArray['###TITLE###']=$record['name'];
		
	
		$content='
			<strong>This is a few paragraphs:</strong><br />
			<p>This is line 1</p>
			<p>###TITLE###</p>
	
			<h3>" . $name . "</h3>	
	
			<h3>This is a form:</h3>
			<form action="'.$this->pi_getPageLink($GLOBALS['TSFE']->id).'" method="POST">
				<input type="hidden" name="no_cache" value="1">
				<input type="text" name="'.$this->prefixId.'[input_field]" value="'.htmlspecialchars($this->piVars['input_field']).'">
				<input type="submit" name="'.$this->prefixId.'[submit_button]" value="'.htmlspecialchars($this->pi_getLL('submit_button_label')).'">
			</form>
			<br />
			<p>You can click here to '.$this->pi_linkToPage('get to this page again',$GLOBALS['TSFE']->id).'</p>
		';
	
		return $this->pi_wrapInBaseClass($content);
		t3lib_div::debug($this->piVars,'unser debug');
	}
}



if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/google_navigator/pi2/class.tx_googlenavigator_pi2.php'])	{
	include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/google_navigator/pi2/class.tx_googlenavigator_pi2.php']);
}

Aber wie bekomme ich jetzt die Inhalte im FE angezeigt ?
Wie komme ich an die Werte in der DB die vom kickstarter angelegt wurde ?

X_Burner