Page 1 of 2
[Gelöst] News Summary Custom Field
Posted: Wed Feb 03, 2010 12:54 pm
by antiheld2000
Hi,
ich möchte in einem summarytemplate mein custom field anzeigen. Aber leider funktioniert es nicht, mache ich was falsch? Geht es generell nicht? Habe ich ein Brett vorm Kopf?
Mein Versuch:
Code: Select all
{if $entry->Teaser_Image}
<img src="{$entry->file_location}/{$field->value}" />
<img src="{$entry->file_location}/{$field->Teaser_Image}" />
{/if}
Aber die If-Abfrage feuert nicht einmal. Was denn da los?!
Gruß
anti
Re: News Summary Custom Field
Posted: Thu Feb 04, 2010 12:05 am
by NaN
antiheld2000 wrote:
{if $entry->Teaser_Image}
file_location}/{$field->value}" />
file_location}/{$field->Teaser_Image}" />
{/if}
Ohne jetzt groß auszuprobieren... schau Dir mal die fett markeirten Teile an.
Fällt Dir was auf?
Re: News Summary Custom Field
Posted: Thu Feb 04, 2010 7:19 am
by antiheld2000
da hst du recht. das ist schon mal ein guter hinweis ;o) aaaaaaaaaaber dann müsste doch eigentlich das hier klappen, oder nicht?!
Code: Select all
{if isset($entry->fields)}
{foreach from=$entry->fields item='field'}
<div class="NewsSummaryField">
{if $field->type == 'file'}
<img src="{$entry->file_location}/{$field->value}"/>
{else}
{$field->name}: {eval var=$field->value}
{/if}
</div>
{/foreach}
{/if}
Das ist übrigens der Code aus dem Sample Summary template. Warum funktioniert das denn bloss nicht!?!?
Re: News Summary Custom Field
Posted: Thu Feb 04, 2010 7:49 am
by cyberman
{$entry->Teaser_Image} ist aber vorhanden und wird angezeigt?
Re: News Summary Custom Field
Posted: Thu Feb 04, 2010 7:53 am
by antiheld2000
Im Admin ist es vorhanden, wird dort auch wieder befüllt angezeigt. Im Frontend komme ich da aber irgendwie nicht ran… Dies passiert mit jedem Custom Field. Auch in der Detailansicht, fällt mir just gerade jetzt auf. Hm, sehr seltsam…
Re: News Summary Custom Field
Posted: Thu Feb 04, 2010 7:56 am
by cyberman
{get_template_vars} ins template packen und du bekommst angezeigt, was da vorhanden ist ...
Re: News Summary Custom Field
Posted: Thu Feb 04, 2010 8:06 am
by antiheld2000
dann brauch ich jetzt nochmal hilfe… ich kann da nichts aufschlussreiches erkennen. was sollte ich hier erkennen können? bitte klär mich auf
Code: Select all
SCRIPT_NAME = /index.php
app_name = CMS
sitename = Localhost
lang = de_DE
encoding = utf-8
gCms = Object
cgsimple = Object
content_obj = Object
content_id = 15
page = 15
page_id = 15
page_name = startseite
page_alias = startseite
position = 00001
friendly_position = 1
gcb_params = Array (1)
menuparams = Array (4)
count = 34
nodelist = Array (34)
node = Object
count_value = 6
actionid = m235eb
actionparams = Array (5)
returnid = 15
mod = Object
CompanyDirectory = Object
items = Array (4)
itemcount = 4
pagetext = Seite
oftext = von
pagecount = 1
curpage = 1
firstlink = <<
prevlink = <
lastlink = >>
nextlink = >
entry = Object
firstletter = W
aktletter = W
prevpage = ‹
firstpage = «
nextpage = ›
lastpage = »
pagenumber = 1
category_label = Kategorie:
author_label = Erstellt von:
param_category = Aktuelles
param_summarytemplate = Full-Size-Accordion
param_module = News
Re: News Summary Custom Field
Posted: Thu Feb 04, 2010 8:10 am
by cyberman
Wie gesagt, jetzt siehst du erst mal alle Variablen, die Smarty-seitig vorhanden sind, und kannst ins Detail gehen mit
{$entry|print_r}
Re: News Summary Custom Field
Posted: Thu Feb 04, 2010 8:26 am
by antiheld2000
Nochmal daaanke, nun ist das Ergebnis wie folgt:
Code: Select all
stdClass Object
(
[author_id] => 1
[author] => admin
[authorname] =>
[id] => 12
[title] => News de luxe
[content] => Lorem Ipsum
[summary] => Lorem Ipsum
[postdate] => 2010-02-03 13:14:23
[startdate] => 2010-02-03 13:14:23
[enddate] =>
[create_date] => 2010-02-03 13:15:56
[modified_date] => 2010-02-03 13:50:17
[category] => Aktuelles
[fieldsbyname] => Array
(
)
[fields] => Array
(
)
[file_location] => http://localhost:8888/uploads/news/id12
[link] => http://localhost:8888/index.php?mact=News,cntnt01,detail,0&cntnt01articleid=12&cntnt01returnid=15
[titlelink] => Newsde luxe
[morelink] => Weiterlesen …
[moreurl] => http://localhost:8888/index.php?mact=News,cntnt01,detail,0&cntnt01articleid=12&cntnt01returnid=15
[printlink] => Drucken
[printurl] => http://localhost:8888/index.php?mact=News,cntnt01,print,0&cntnt01articleid=12&cntnt01showtemplate=false&cntnt01returnid=15
)
1
Um es jetzt wirklich zu überprüfen, müsste ich doch die Arrays
fieldsbyname und
fields augegeben haben. Komm ich so an die ran?!
Re: News Summary Custom Field
Posted: Thu Feb 04, 2010 8:39 am
by cyberman
Was mir gerade noch einfällt, CMSms bringt für diesen Check einen eigenen Tag mit
{dump item=$entry}
Re: News Summary Custom Field
Posted: Thu Feb 04, 2010 9:26 am
by antiheld2000
Mit {dump wird das nichts...
{dump item=$entry} -> Rendern der Seite bricht ab
{dump item='$entry'} -> $entry = NULL
Re: News Summary Custom Field
Posted: Thu Feb 04, 2010 9:27 am
by antiheld2000
Ähem, ich sehe gerade meine letzten beiden Posts hier nicht mehr?! Ich glaub ich werd verrückt?!?
Re: News Summary Custom Field
Posted: Thu Feb 04, 2010 9:28 am
by antiheld2000
Sorry, wenn das hier jetzt ein doppelpost wird, aber ich kann meine eigenen posts nicht mehr sehen?!
Nochmal daaanke, nun ist das Ergebnis wie folgt:
Code: Select all
stdClass Object
(
[author_id] => 1
[author] => admin
[authorname] =>
[id] => 12
[title] => News de luxe
[content] => Lorem Ipsum
[summary] => Lorem Ipsum
[postdate] => 2010-02-03 13:14:23
[startdate] => 2010-02-03 13:14:23
[enddate] =>
[create_date] => 2010-02-03 13:15:56
[modified_date] => 2010-02-03 13:50:17
[category] => Aktuelles
[fieldsbyname] => Array
(
)
[fields] => Array
(
)
[file_location] => http://localhost:8888/uploads/news/id12
[link] => http://localhost:8888/index.php?mact=News,cntnt01,detail,0&cntnt01articleid=12&cntnt01returnid=15
[titlelink] => Newsde luxe
[morelink] => Weiterlesen …
[moreurl] => http://localhost:8888/index.php?mact=News,cntnt01,detail,0&cntnt01articleid=12&cntnt01returnid=15
[printlink] => Drucken
[printurl] => http://localhost:8888/index.php?mact=News,cntnt01,print,0&cntnt01articleid=12&cntnt01showtemplate=false&cntnt01returnid=15
)
1
Um es jetzt wirklich zu überprüfen, müsste ich doch die Arrays fieldsbyname und fields augegeben haben. Komm ich so an die ran?!
Re: News Summary Custom Field
Posted: Thu Feb 04, 2010 11:22 am
by cyberman
Ja, der SMF-Spamfilter ist nicht gerade der Hit

... seltsamerweise hab ich deine Postings über die Thread-Benachrichtigung lesen können.
Hast du schon mal dies gecheckt?
Code: Select all
{if $entry->fields->Teaser_Image}
<img src="{$entry->file_location}/{$field->value}" />
<img src="{$entry->file_location}/{$field->Teaser_Image}" />
{/if}
($entry ist ein Objekt)
Re: News Summary Custom Field
Posted: Thu Feb 04, 2010 1:52 pm
by antiheld2000
Ebenfalls kein positives Ergebnis… Sehr seltsam…