Affilinator Forum
Partnerprogramm Skript kostenlos testen


Zurück   Affilinator Forum > Kundenforum > PHP Programmierung

PHP Programmierung Tipps und Fragen zum PHP Programmierung.

Antwort
 
Themen-Optionen Ansicht
  #1  
Alt 22.12.2007, 12:35
JoachimW JoachimW ist offline
Neuer Benutzer
 
Registriert seit: 17.11.2006
Beiträge: 49
Standard php code in diverse seiten einbinden

Hallo

habe da ein Problem den php code einzubinden
die seite bleibt dann weiß.

beispiel

{php}
<?
error_reporting(0);
function startElement($parser, $tagName, $attrs) {
global $insideitem, $tag;
if ($insideitem) {
$tag = $tagName;
} elseif (($tagName == &quot;ITEM&quot || ($tagName == &quot;IMAGE&quot) {
$insideitem = true;

weiterer code

$rssfeedurl = str_replace(&quot;-&quot;, &quot;%20&quot;, &quot;$rssfeedurl&quot;


parse_feed (&quot;$rssfeedurl&quot;,4);
?>
{/php}

dieser code funktioniert auf normalen php seiten
die smarty einleitung für php stimmt doch oder ?

wie kann ich z.B. die variabel für das suchwort
oder die variabel der categorie übergeben ?


MfG und Frohes Fest

Joachim Warnke
__________________
<->Autoblog Jokiba
Mit Zitat antworten
  #2  
Alt 22.12.2007, 14:06
Benutzerbild von AxelK
AxelK AxelK ist offline
Administrator-Technik
 
Registriert seit: 07.11.2005
Ort: Niefern
Beiträge: 992
Standard

Hi Joachim,

die spitze Klammer und das Fragezeich muss raus, den die Kennzeichnung für den PHP-Code geschieht bei Smarty mit {php}{/php}.

Variablen kannst du so in PHP übergeben:
$suchwort = $this->get_template_vars('CategoryID');

Gruß Axel
Mit Zitat antworten
  #3  
Alt 22.12.2007, 15:02
JoachimW JoachimW ist offline
Neuer Benutzer
 
Registriert seit: 17.11.2006
Beiträge: 49
Standard

Ich habe die Klammer und das Fragezeichen entfernt nur leider keine veränderung Seite ist weiß

und welche Variable ist fur die Suche


Zitat:
Zitat von AxelK Beitrag anzeigen
Hi Joachim,

die spitze Klammer und das Fragezeich muss raus, den die Kennzeichnung für den PHP-Code geschieht bei Smarty mit {php}{/php}.

Variablen kannst du so in PHP übergeben:
$suchwort = $this->get_template_vars('CategoryID');

Gruß Axel
__________________
<->Autoblog Jokiba
Mit Zitat antworten
  #4  
Alt 22.12.2007, 22:30
FrankW FrankW ist offline
Administrator
 
Registriert seit: 07.11.2005
Ort: Aschaffenburg
Beiträge: 4.935
Blog-Einträge: 1
Standard Schleifen und php

Ich denke der ganze Templatecode wäresinvoller, wobei du erst mal mit dem Original vergleichen sollst, ob alle schleifen geschlossen sind.

/templates_c und Browsercache löschen kann auch schon helfen.

Gruß
Frank
Mit Zitat antworten
  #5  
Alt 23.12.2007, 08:24
JoachimW JoachimW ist offline
Neuer Benutzer
 
Registriert seit: 17.11.2006
Beiträge: 49
Standard der ganze Templatecode

Code:
{if $where_to_search}
{include file=&quot;searchDetails.html&quot;}
{/if}

<table width="100%" border="0" cellspacing="0" cellpadding="0" class="font12 pad3">

{if $searchProducts_data.items }
<tr><td align="right">
{literal}
<script language=javascript>
function gotoUrl(url) {
  if (url == "")
    return;
  location.href = url;
}
</script>
{/literal}
<select name="menu" size="1" onchange="this.blur();gotoUrl(this.options[this.selectedIndex].value)" class="srtpulldown">
<option>&nbsp;Sortieren nach</option>
<option value="{$smarty.const.BASE_URL}suche/{$where_to_search}/{$pricemin|default:'0'}/{$pricemax|default:'-'}/{if $ShopID}{$ShopID}{else}0{/if}/{if $CategoryID}{$CategoryID}{else}-{/if}/{$searchProducts_data.currentpage}/{$urlencoded_keywords}/Price/1.html"{if $srt eq 'Price' and $dir eq '1'} selected{/if}>Preis aufsteigend</option>
<option value="{$smarty.const.BASE_URL}suche/{$where_to_search}/{$pricemin|default:'0'}/{$pricemax|default:'-'}/{if $ShopID}{$ShopID}{else}0{/if}/{if $CategoryID}{$CategoryID}{else}-{/if}/{$searchProducts_data.currentpage}/{$urlencoded_keywords}/Price/2.html"{if $srt eq 'Price' and $dir eq '2'} selected{/if}>Preis absteigend</option>
<option value="{$smarty.const.BASE_URL}suche/{$where_to_search}/{$pricemin|default:'0'}/{$pricemax|default:'-'}/{if $ShopID}{$ShopID}{else}0{/if}/{if $CategoryID}{$CategoryID}{else}-{/if}/{$searchProducts_data.currentpage}/{$urlencoded_keywords}/Rank/1.html"{if $srt eq 'Rank' and $dir eq '1'} selected{/if}>Rank aufsteigend</option>
<option value="{$smarty.const.BASE_URL}suche/{$where_to_search}/{$pricemin|default:'0'}/{$pricemax|default:'-'}/{if $ShopID}{$ShopID}{else}0{/if}/{if $CategoryID}{$CategoryID}{else}-{/if}/{$searchProducts_data.currentpage}/{$urlencoded_keywords}/Rank/2.html"{if $srt eq 'Rank' and $dir eq '2'} selected{/if}>Rank absteigend</option>
<option value="{$smarty.const.BASE_URL}suche/{$where_to_search}/{$pricemin|default:'0'}/{$pricemax|default:'-'}/{if $ShopID}{$ShopID}{else}0{/if}/{if $CategoryID}{$CategoryID}{else}-{/if}/{$searchProducts_data.currentpage}/{$urlencoded_keywords}/Title/1.html"{if $srt eq 'Title' and $dir eq '1'} selected{/if}>Titel aufsteigend</option>
<option value="{$smarty.const.BASE_URL}suche/{$where_to_search}/{$pricemin|default:'0'}/{$pricemax|default:'-'}/{if $ShopID}{$ShopID}{else}0{/if}/{if $CategoryID}{$CategoryID}{else}-{/if}/{$searchProducts_data.currentpage}/{$urlencoded_keywords}/Title/2.html"{if $srt eq 'Title' and $dir eq '2'} selected{/if}>Titel absteigend</option>
</select>
</td></tr>
<tr><td class="font12 pad3">
{include file=&quot;pagination.html&quot;}

<br><br>
<div id="headinfo">
<ul>
<li id="akt"><a href="#">Angebote</a></li>
{if $ebay_data.data.SEARCHRESULTITEM}<li><a href="{$smarty.const.BASE_URL}auktion/{if $keywords}{$keywords|smarty_urlencode}{else}{$catname|smarty_urlencode}{/if}.html">ebay</a></li>{/if}
{if $amazon_data.data.ITEM}<li><a href="{$smarty.const.BASE_URL}marktplatz/{if $keywords}{$keywords|smarty_urlencode}{else}{$catname|smarty_urlencode}{/if}.html">Amazon</a></li>{/if}
</ul>
</div>
<div style="clear:left;"></div>

</td></tr>
{/if}

{if !$searchProducts_data.items }
<tr><td>
Ihre Suche nach <b>{$keywords}</b> brachte leider keine Ergebnisse in unseren Daten.<br>
<br>
{include file=&quot;mirago.html&quot;}
{include file=&quot;amazon.html&quot;}
{include file=&quot;ebay.html&quot;}
</td></tr>

{/if}


{foreach from=$searchProducts_data.items item=it name='result'}
<tr><td style="padding: 5px;" {if $smarty.foreach.result.iteration is odd}class="resultrow"{/if}>
<table width="99%" border="0" cellspacing="0" cellpadding="0" class="font12 pad3">
<tr><td valign="top" colspan="2">
<b>{$it.TITLE.0.VALUE}</b>
{if $it.BRAND.0.VALUE}<br><span class="font10">{$it.BRAND.0.VALUE}</span>{/if}
</td></tr>
<tr><td width="85%" style="text-align:justify;">
{assign var=tmp value=$it.ID.0.VALUE}
<a href="{$smarty.const.BASE_URL}angebot/{$tmp}/{$it.TITLE.WITHOUT_CHARS}.html">
<img src="{getimage str=$it.IMAGE60.0.IMAGEURL.0.VALUE}" align="left" hspace=3 vspace=3 border="0" alt="{$it.TITLE.0.VALUE}"></a>
{$it.DESCRIPTION_SHORT.0.VALUE|default:'Weitere Informationen finden Sie auf der Produktseite.'}
</td>
<td width="15%" style="padding-left: 2px;" valign="top" align="right" nowrap class="price">
<b>{$it.DISPLAYPRICE.0.VALUE}*</b>
</td>
</tr>
<tr><td colspan="2">
{assign var=href value=$it.DEEPLINK1.0.VALUE}
<a class="shoplink" href="{$smarty.const.BASE_URL}no-index/forward.php?link={encode str=$href}" title="zum Shop" target="_blank">Im Shop {$it.SHOPINFORMATION.0.SHOPNAME.0.VALUE} ansehen oder bestellen</a><br>
<br>
<span class="10">
<a href="{$smarty.const.BASE_URL}angebot/{$tmp}/{$it.TITLE.WITHOUT_CHARS}.html" title="{$it.TITLE.0.VALUE}">Details zu {$it.TITLE.0.VALUE}</a><br>
<br>
{if $ShopID neq 0 and $it.AFFILINETCATEGORYID.0.VALUE neq 0}
<a href="{$smarty.const.BASE_URL}shop_abteilung/0/{$it.AFFILINETCATEGORYID.0.VALUE}/Seite1.html">Zur Hauptkategorie des Angebotes</a>
{/if}
{if $ShopID eq 0 and $it.CATEGORYPATH.0.VALUE}
<a href="{$smarty.const.BASE_URL}shop_abteilung/{$it.SHOPINFORMATION.0.SHOPID.0.VALUE}/{$it.MERCHANTCATEGORYID.0.VALUE}/Seite1.html">Zur Shop Kategorie {$it.CATEGORYPATH.0.VALUE}</a>
</span>
<br>
<br>
{assign var=href value=$it.SHOPINFORMATION.0.SHOPURL.0.VALUE}
	<a href="{$smarty.const.BASE_URL}no-index/forward.php?link={encode str=$href}" target="_blank">
	{if $it.SHOPINFORMATION.0.LOGO90.0.IMAGEURL.0.VALUE}
	<img src="{getimage str=$it.SHOPINFORMATION.0.LOGO90.0.IMAGEURL.0.VALUE}" align="middle" border="0" alt="Logo {$it.SHOPINFORMATION.0.SHOPNAME.0.VALUE}">
	{/if}
	{$it.SHOPINFORMATION.0.SHOPNAME.0.VALUE}
	</a>
{/if}

<!-- Anzeigen usw. in die Ergebnisse -->
{if $smarty.foreach.result.iteration eq 5}
                        <div align="center">
{php}
error_reporting(0);
function startElement($parser, $tagName, $attrs) {
        global $insideitem, $tag;
	if ($insideitem) {
		$tag = $tagName;
	} elseif (($tagName == &quot;ITEM&quot;) || ($tagName == &quot;IMAGE&quot;)) {
		$insideitem = true;
	}
}
function endElement($parser, $tagName) {
        global $insideitem, $tag, $title, $description, $link, $iurl, $i, $n;
        if ($i &gt;= $n) {
                return;
        } 
	if ($tagName == &quot;ITEM&quot;) {
		printf(&quot;<div align=\"left\">&quot;);
		printf(&quot;<div class=\"rss_title\"><a href=\"$link\">&quot;);
		printf(&quot;<strong>&quot;);
		printf(htmlspecialchars(trim($title)));
		printf(&quot;</strong>&quot;);
		printf(&quot;</a></div>\n&quot;);
		printf(&quot;<div class=\"rss_desc\">&quot;);
		if (strlen ($description) &gt; 0) {
		    printf(trim($description));
             }
		printf(&quot;</div>\n&quot;);
		printf(&quot;<br />\n&quot;);
		printf(&quot;</div>&quot;);
		$title = &quot;&quot;;
		$description = &quot;&quot;;
		$link = &quot;&quot;;
		$iurl = &quot;&quot;;
		$insideitem = false;
		$i += 1;
	}
}
function characterData($parser, $data) {
        global $insideitem, $tag, $title, $description, $link, $iurl;
	if ($insideitem) {
	switch ($tag) {
		case &quot;TITLE&quot;:
		$title .= $data;
		break;
		case &quot;DESCRIPTION&quot;:
		$description .= $data;
		break;
		case &quot;LINK&quot;:
		$link .= $data;
		break;
		case &quot;URL&quot;:
		$iurl .= $data;
		break;
	}
	}
}
function parse_feed ($url, $num) {
        global $insideitem, $tag, $title, $description, $link, $iurl, $i, $n;

$insideitem = false;
$tag = &quot;&quot;;
$title = &quot;&quot;;
$description = &quot;&quot;;
$link = &quot;&quot;;
$iurl = &quot;&quot;;
$i = 0;
$n = $num;

$xml_parser = xml_parser_create();
xml_set_element_handler($xml_parser, &quot;startElement&quot;, &quot;endElement&quot;);
xml_set_character_data_handler($xml_parser, &quot;characterData&quot;);
$fp = fopen($url,&quot;r&quot;)
        or die(&quot;Error reading RSS data.&quot;);
while ($data = fread($fp, 4096)) {
    xml_parse($xml_parser, $data, feof($fp))
        or die(sprintf(&quot;XML error: %s at line %d&quot;,
            xml_error_string(xml_get_error_code($xml_parser)),
            xml_get_current_line_number($xml_parser)));
}
fclose($fp);
xml_parser_free($xml_parser);
$i = 0;
}
$rssfeedurl = 'http://de.answers.yahoo.com/rss/searchq?p=shop&amp;ei=UTF-8';


$rssfeedurl = str_replace(&quot;-&quot;, &quot;%20&quot;, &quot;$rssfeedurl&quot;);


parse_feed (&quot;$rssfeedurl&quot;,4);
{/php}

             
                        </div>
<br>
{/if}
</td></tr>
</table>
</td></tr>
{/foreach}

<tr><td class="font12 pad3">
{if $searchProducts_data.items}
<hr>
{include file=&quot;pagination.html&quot;}
{/if}
<br>
</td></tr>
</table>
__________________
<->Autoblog Jokiba
Mit Zitat antworten
  #6  
Alt 23.12.2007, 11:55
FrankW FrankW ist offline
Administrator
 
Registriert seit: 07.11.2005
Ort: Aschaffenburg
Beiträge: 4.935
Blog-Einträge: 1
Standard php im Template

Ähm

Beim Einfügen sind massig "&quot;" reingerutscht, evtl. schon das Problem ?

Geht das Template ohne den php Code noch ?
Wenn ja erscheint es mir (ungelesen) doch eher ein Problem der php Anweisungen.

Gruß
Frank
Mit Zitat antworten
  #7  
Alt 23.12.2007, 12:31
JoachimW JoachimW ist offline
Neuer Benutzer
 
Registriert seit: 17.11.2006
Beiträge: 49
Standard

oh ja es lag an den "&quot;" da sollte eigentlich "" stehen.


wie bekomme ich den jetzt das suchwort übergeben vom affilinator

$suchwort
__________________
<->Autoblog Jokiba
Mit Zitat antworten
Antwort

Lesezeichen


Aktive Benutzer in diesem Thema: 1 (Registrierte Benutzer: 0, Gäste: 1)
 
Themen-Optionen
Ansicht

Forumregeln
Es ist Ihnen nicht erlaubt, neue Themen zu verfassen.
Es ist Ihnen nicht erlaubt, auf Beiträge zu antworten.
Es ist Ihnen nicht erlaubt, Anhänge hochzuladen.
Es ist Ihnen nicht erlaubt, Ihre Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.

Gehe zu

Ähnliche Themen
Thema Autor Forum Antworten Letzter Beitrag
Sedo Code einbinden HolgerK Affilinator - Wie geht das ? 2 16.04.2007 12:49
PHP Code per Smarty einbinden Toddy Affilinator - Wie geht das ? 0 17.12.2005 10:26



Alle Zeitangaben in WEZ +2. Es ist jetzt 15:32 Uhr.


Powered by vBulletin® Version 3.8.0 (Deutsch)
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
SEO by vBSEO 2.3.2
Affilinator GmbH