![]() |
Startseite
Forum
Affilinator kostenlos
Impressum
alte Dokumentation
|
|
|||||||
| PHP Programmierung Tipps und Fragen zum PHP Programmierung. |
![]() |
|
|
Themen-Optionen | Ansicht |
|
#1
|
|||
|
|||
|
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 == "ITEM" || ($tagName == "IMAGE" ) {$insideitem = true; weiterer code $rssfeedurl = str_replace("-", "%20", "$rssfeedurl" ;parse_feed ("$rssfeedurl",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 |
|
#2
|
||||
|
||||
|
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
|
|
#3
|
|||
|
|||
|
Ich habe die Klammer und das Fragezeichen entfernt nur leider keine veränderung Seite ist weiß
und welche Variable ist fur die Suche
__________________
<->Autoblog Jokiba |
|
#4
|
|||
|
|||
|
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 |
|
#5
|
|||
|
|||
|
Code:
{if $where_to_search}
{include file="searchDetails.html"}
{/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> 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="pagination.html"}
<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="mirago.html"}
{include file="amazon.html"}
{include file="ebay.html"}
</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 == "ITEM") || ($tagName == "IMAGE")) {
$insideitem = true;
}
}
function endElement($parser, $tagName) {
global $insideitem, $tag, $title, $description, $link, $iurl, $i, $n;
if ($i >= $n) {
return;
}
if ($tagName == "ITEM") {
printf("<div align=\"left\">");
printf("<div class=\"rss_title\"><a href=\"$link\">");
printf("<strong>");
printf(htmlspecialchars(trim($title)));
printf("</strong>");
printf("</a></div>\n");
printf("<div class=\"rss_desc\">");
if (strlen ($description) > 0) {
printf(trim($description));
}
printf("</div>\n");
printf("<br />\n");
printf("</div>");
$title = "";
$description = "";
$link = "";
$iurl = "";
$insideitem = false;
$i += 1;
}
}
function characterData($parser, $data) {
global $insideitem, $tag, $title, $description, $link, $iurl;
if ($insideitem) {
switch ($tag) {
case "TITLE":
$title .= $data;
break;
case "DESCRIPTION":
$description .= $data;
break;
case "LINK":
$link .= $data;
break;
case "URL":
$iurl .= $data;
break;
}
}
}
function parse_feed ($url, $num) {
global $insideitem, $tag, $title, $description, $link, $iurl, $i, $n;
$insideitem = false;
$tag = "";
$title = "";
$description = "";
$link = "";
$iurl = "";
$i = 0;
$n = $num;
$xml_parser = xml_parser_create();
xml_set_element_handler($xml_parser, "startElement", "endElement");
xml_set_character_data_handler($xml_parser, "characterData");
$fp = fopen($url,"r")
or die("Error reading RSS data.");
while ($data = fread($fp, 4096)) {
xml_parse($xml_parser, $data, feof($fp))
or die(sprintf("XML error: %s at line %d",
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&ei=UTF-8';
$rssfeedurl = str_replace("-", "%20", "$rssfeedurl");
parse_feed ("$rssfeedurl",4);
{/php}
</div>
<br>
{/if}
</td></tr>
</table>
</td></tr>
{/foreach}
<tr><td class="font12 pad3">
{if $searchProducts_data.items}
<hr>
{include file="pagination.html"}
{/if}
<br>
</td></tr>
</table>
__________________
<->Autoblog Jokiba |
|
#6
|
|||
|
|||
|
Ähm
Beim Einfügen sind massig """ 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 |
|
#7
|
|||
|
|||
|
oh ja es lag an den """ da sollte eigentlich "" stehen.
wie bekomme ich den jetzt das suchwort übergeben vom affilinator $suchwort
__________________
<->Autoblog Jokiba |
![]() |
| Lesezeichen |
| Aktive Benutzer in diesem Thema: 1 (Registrierte Benutzer: 0, Gäste: 1) | |
| Themen-Optionen | |
| Ansicht | |
|
|
Ä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 |