Ergebnis 1 bis 8 von 8

Thema: mod_newslist - [hasText] bleibt = 1, wenn Details gelöscht werden

  1. #1
    Contao-Nutzer
    Registriert seit
    06.10.2009.
    Beiträge
    161

    Standard mod_newslist - [hasText] bleibt = 1, wenn Details gelöscht werden

    Hallo.
    Über folgendes bin ich gerade gestolpert:
    Ich möchte in meiner Nachrichtenliste den "Weiterlesen" Button nur anzeigen, wenn es keine Nachrichten-Details gibt. Bei einer neuen Nachricht funktioniert das prächtig. Wenn es aber erst Details gibt, diese dann aber gelöscht werden, werden die Template-Variablen anscheinend nicht geändert!? [hasText] = 1 und [text] = 1
    Der Button wird angezeigt und verweist auf eine leere newsreader Seite.

  2. #2
    Contao-Nutzer
    Registriert seit
    06.10.2009.
    Beiträge
    161

    Standard

    Contao Open Source CMS 3.5.25

  3. #3
    Community-Moderator
    Wandelndes Contao-Lexikon
    Avatar von Spooky
    Registriert seit
    12.04.2012.
    Ort
    Scotland
    Beiträge
    34.109
    Partner-ID
    10107

    Standard

    Poste die Ausgabe von $this->showTemplateVars() einer solchen Nachricht.

  4. #4
    Contao-Fan
    Registriert seit
    01.11.2013.
    Beiträge
    644

    Standard

    Habe auch das Problem dass kein Detailinhalt vorhanden ist, die Weiterlesen-Buttons jedoch trotzdem angezeigt werden.

    Code:
    Array
    (
        [id] => 80
        [pid] => 2
        [tstamp] => 1514387225
        [headline] => Headline
        [alias] => alias
        [author] => 
        [date] => 
        [time] => 1504774980
        [subheadline] => 
        [teaser] => 
    Teaser lorem ipsum...
    
    
        [addImage] => 
        [singleSRC] => P?	|???\@??.l/
        [alt] => A-Chem Group
        [size] => a:3:{i:0;s:3:"300";i:1;s:3:"300";i:2;s:4:"crop";}
        [imagemargin] => a:5:{s:6:"bottom";s:0:"";s:4:"left";s:0:"";s:5:"right";s:0:"";s:3:"top";s:0:"";s:4:"unit";s:0:"";}
        [imageUrl] => 
        [fullsize] => 
        [caption] => 
        [floating] => above
        [addEnclosure] => 
        [enclosure] => Array
            (
            )
    
        [source] => internal
        [jumpTo] => 32
        [articleId] => 0
        [url] => 
        [target] => 
        [cssClass] => 
        [noComments] => 
        [featured] => 
        [published] => 1
        [start] => 
        [stop] => 
        [meta_title] => 
        [lazyDisable] => 
        [sharebuttons_networks] => 
        [sharebuttons_theme] => 
        [sharebuttons_template] => sharebuttons_default
        [addYouTube] => 
        [youtube] => 
        [autoplay] => 
        [addPreviewImage] => 
        [posterSRC] => 
        [youtubeFullsize] => 
        [youtubeLinkText] => 
        [videoDuration] => 
        [addPlayButton] => 
        [languageMain] => 0
        [tags] => Array
            (
                [0] => Americas
            )
    
        [class] =>  odd
        [newsHeadline] => Headline
        [subHeadline] => 
        [hasSubHeadline] => 
        [linkHeadline] => Headline
        [more] => Weiterlesen … Titel
        [link] => de/link
        [archive] => Contao\NewsArchiveModel Object
            (
                [arrData:protected] => Array
                    (
                        [id] => 2
                        [tstamp] => 1501841969
                        [title] => Standorte DE
                        [jumpTo] => 29
                        [protected] => 
                        [groups] => 
                        [allowComments] => 
                        [notify] => notify_admin
                        [sortOrder] => ascending
                        [perPage] => 0
                        [moderate] => 
                        [bbcode] => 
                        [requireLogin] => 
                        [disableCaptcha] => 
                        [sharebuttons_networks] => 
                        [sharebuttons_theme] => 
                        [sharebuttons_template] => sharebuttons_default
                        [master] => 0
                    )
    
                [arrModified:protected] => Array
                    (
                    )
    
                [arrRelations:protected] => Array
                    (
                        [jumpTo] => Array
                            (
                                [table] => tl_page
                                [field] => id
                                [type] => hasOne
                                [load] => eager
                            )
    
                        [groups] => Array
                            (
                                [table] => tl_member_group
                                [field] => id
                                [type] => hasMany
                                [load] => lazy
                            )
    
                        [master] => Array
                            (
                                [table] => tl_news_archive
                                [field] => id
                                [type] => hasOne
                            )
    
                    )
    
                [arrRelated:protected] => Array
                    (
                        [jumpTo] => Contao\PageModel Object
                            (
                                [blnDetailsLoaded:protected] => 1
                                [arrData:protected] => Array
                                    (
                                        [id] => 29
                                        [pid] => 41
                                        [sorting] => 640
                                        [tstamp] => 1513783194
                                        [title] => Standorte
                                        [alias] => standorte
                                        [type] => regular
                                        [pageTitle] => 
                                        [language] => de
                                        [robots] => noindex,nofollow
                                        [description] => 
                                        [redirect] => permanent
                                        [jumpTo] => 0
                                        [url] => 
                                        [target] => 
                                        [dns] => 
                                        [staticFiles] => 
                                        [staticPlugins] => 
                                        [fallback] => 
                                        [adminEmail] => 
                                        [dateFormat] => d.m.Y
                                        [timeFormat] => H:i
                                        [datimFormat] => Y-m-d H:i
                                        [createSitemap] => 
                                        [sitemapName] => 
                                        [useSSL] => 
                                        [autoforward] => 
                                        [protected] => 
                                        [groups] => 
                                        [includeLayout] => 
                                        [layout] => 1
                                        [mobileLayout] => 0
                                        [includeCache] => 
                                        [cache] => 
                                        [includeChmod] => 
                                        [cuser] => 0
                                        [cgroup] => 0
                                        [chmod] => a:9:{i:0;s:2:"u1";i:1;s:2:"u2";i:2;s:2:"u3";i:3;s:2:"u4";i:4;s:2:"u5";i:5;s:2:"u6";i:6;s:2:"g4";i:7;s:2:"g5";i:8;s:2:"g6";}
                                        [noSearch] => 
                                        [cssClass] => 
                                        [sitemap] => map_never
                                        [hide] => 
                                        [guests] => 
                                        [tabindex] => 0
                                        [accesskey] => 
                                        [published] => 1
                                        [start] => 
                                        [stop] => 
                                        [cookiebar_enable] => 
                                        [cookiebar_message] => 
                                        [cookiebar_jumpTo] => 0
                                        [cookiebar_position] => top
                                        [cookiebar_placement] => body_end
                                        [cookiebar_button] => 
                                        [cookiebar_combineAssets] => 
                                        [ga_analyticsid] => 
                                        [ga_anonymizeip] => 
                                        [ga_ignoreadmins] => 
                                        [ga_ignoremembers] => 
                                        [ga_externaltracking] => 
                                        [ga_addlinktracking] => 
                                        [ga_setdomainname] => 
                                        [ga_titlelinktracking] => 
                                        [ga_bounceseconds] => 0
                                        [ga_eventtracking] => 
                                        [ogTagsEnable] => 
                                        [ogTags] => 
                                        [ogType] => website
                                        [ogImage] => 
                                        [ogAudio] => 
                                        [ogVideo] => 
                                        [dlh_googlemaps_apikey] => 
                                        [youtube_template] => youtube_default
                                        [youtubePrivacy] => 
                                        [youtubePrivacyTemplate] => youtubeprivacy_default
                                        [languageMain] => 0
                                        [languageRoot] => 0
                                        [languageQuery] => 
                                        [addFontIcon] => 
                                        [fontIcon] => 
                                        [cssStyleSelector] => 
                                        [geo_single_page] => 
                                        [geo_child_page] => 
                                        [geo_single_choose] => a:1:{i:0;s:2:"ip";}
                                        [geo_child_choose] => 
                                        [mainAlias] => unternehmen
                                        [mainTitle] => Unternehmen
                                        [mainPageTitle] => Unternehmen
                                        [parentAlias] => unternehmen
                                        [parentTitle] => Unternehmen
                                        [parentPageTitle] => Unternehmen
                                        [folderUrl] => unternehmen/
                                        [rootId] => 1
                                        [rootAlias] => alias
                                        [rootTitle] => Titel
                                        [rootPageTitle] => Titel
                                        [domain] => 
                                        [rootLanguage] => de
                                        [rootIsPublic] => 1
                                        [rootIsFallback] => 1
                                        [rootUseSSL] => 
                                        [rootFallbackLanguage] => de
                                        [trail] => Array
                                            (
                                                [0] => 1
                                                [1] => 41
                                                [2] => 29
                                            )
    
                                        [subpages] => 0
                                    )
    
                                [arrModified:protected] => Array
                                    (
                                        [protected] => 
                                        [groups] => 
                                        [layout] => 0
                                        [mobileLayout] => 0
                                        [cache] => 0
                                        [language] => 
                                        [dateFormat] => 
                                        [timeFormat] => 
                                        [datimFormat] => 
                                    )
    
                                [arrRelations:protected] => Array
                                    (
                                        [jumpTo] => Array
                                            (
                                                [table] => tl_page
                                                [field] => id
                                                [type] => hasOne
                                                [load] => lazy
                                            )
    
                                        [groups] => Array
                                            (
                                                [table] => tl_member_group
                                                [field] => id
                                                [type] => hasMany
                                                [load] => lazy
                                            )
    
                                        [layout] => Array
                                            (
                                                [table] => tl_layout
                                                [field] => id
                                                [type] => hasOne
                                                [load] => lazy
                                            )
    
                                        [mobileLayout] => Array
                                            (
                                                [table] => tl_layout
                                                [field] => id
                                                [type] => hasOne
                                                [load] => lazy
                                            )
    
                                        [cuser] => Array
                                            (
                                                [table] => tl_user
                                                [field] => id
                                                [type] => hasOne
                                                [load] => lazy
                                            )
    
                                        [cgroup] => Array
                                            (
                                                [table] => tl_user_group
                                                [field] => id
                                                [type] => hasOne
                                                [load] => lazy
                                            )
    
                                    )
    
                                [arrRelated:protected] => Array
                                    (
                                    )
    
                                [blnPreventSaving:protected] => 1
                            )
    
                    )
    
                [blnPreventSaving:protected] => 
            )
    
        [count] => 2
        [text] => 1
        [hasText] => 1
        [hasTeaser] => 1
        [hasMetaFields] => 
        [numberOfComments] => 
        [commentCount] => 
        [timestamp] => 1504774980
        [datetime] => 2017-09-07T09:03:00+00:00
        [sharebuttons] => 
        [showTags] => 1
        [showTagClass] => 1
        [taglist] => Array
            (
                [0] => Array
                    (
                        [url] => Americas
                        [tag] => Americas
                        [class] => Americas
                    )
    
            )
    
    )
    Ich möchte den Weiterlesen-Button nur einblenden, wenn Detailinhalt vorhanden ist.
    Dazu sollte ja folgender Code zuständig sein:
    Code:
    <?php if ($this->hasText || $this->hasTeaser): ?>
        <p class="more"><?= $this->more ?></p>
      <?php endif; ?>
    Wenn jedoch stets "1" rückgegeben wird, wird eben auch der Link ausgegeben.

  5. #5
    Community-Moderator
    Wandelndes Contao-Lexikon
    Avatar von Spooky
    Registriert seit
    12.04.2012.
    Ort
    Scotland
    Beiträge
    34.109
    Partner-ID
    10107

    Standard

    Das ist auch korrekt so, denn wenn die Nachricht eine Weiterleitung angegeben hat, soll man ja einen Link haben, der dort hin führt.

  6. #6
    Contao-Nutzer
    Registriert seit
    06.10.2009.
    Beiträge
    161

    Standard

    Schon etwas her, bin aber gerade wieder darüber gestolpert. Inzwischen ist Contao 3.5.34 installiert, Problem bleibt bestehen.
    Stört das sonst niemanden?? ;-)
    Wie oben beschrieben, funktioniert die Template Variable $this->hasText bei einer neuen Nachricht einwandfrei. Wenn ich aber eine Nachricht mit Details habe, diese dann aber weg lösche, dann bleibt $this->hasText auf 1 und es wird der "Weiterlesen" Button angezeigt, obwohl es keine Details gibt.

  7. #7
    Contao-Nutzer
    Registriert seit
    06.10.2009.
    Beiträge
    161

    Standard

    Code:
    Array
    (
        [id] => 11
        [pid] => 2
        [tstamp] => 1522148589
        [headline] => Wir haben geschlossen: Mai-Ferien
        [alias] => Mai-Ferien
        [author] => 
        [date] => 07.05.2018 12:23
        [time] => 1525688580
        [subheadline] => 
        [teaser] => <p>Vom 7. - 9. Mai sind Mai-Ferien und wir haben geschlossen!</p>
        [addImage] => 
        [singleSRC] => ?
    ?i???%??
        [alt] => 
        [size] => a:3:{i:0;s:0:"";i:1;s:0:"";i:2;s:0:"";}
        [imagemargin] => a:5:{s:6:"bottom";s:0:"";s:4:"left";s:0:"";s:5:"right";s:0:"";s:3:"top";s:0:"";s:4:"unit";s:0:"";}
        [imageUrl] => 
        [fullsize] => 
        [caption] => 
        [floating] => above
        [addEnclosure] => 
        [enclosure] => Array
            (
            )
    
        [source] => external
        [jumpTo] => 0
        [articleId] => 0
        [url] => blog-reader/gorilla-congolium-nauseum.html
        [target] => 
        [cssClass] => 
        [noComments] => 
        [featured] => 1
        [published] => 1
        [start] => 
        [stop] => 
        [class] =>  first even
        [newsHeadline] => Wir haben geschlossen: Mai-Ferien
        [subHeadline] => 
        [hasSubHeadline] => 
        [linkHeadline] => <a href="blog-reader/gorilla-congolium-nauseum.html" title="Weiterlesen auf blog-reader/gorilla-congolium-nauseum.html">Wir haben geschlossen: Mai-Ferien</a>
        [more] => <a href="blog-reader/gorilla-congolium-nauseum.html" title="Weiterlesen auf blog-reader/gorilla-congolium-nauseum.html">Weiterlesen …</a>
        [link] => blog-reader/gorilla-congolium-nauseum.html
        [archive] => Contao\NewsArchiveModel Object
            (
                [arrData:protected] => Array
                    (
                        [id] => 2
                        [tstamp] => 1502875008
                        [title] => Aktuelles / Blog
                        [jumpTo] => 76
                        [protected] => 
                        [groups] => 
                        [allowComments] => 1
                        [notify] => notify_admin
                        [sortOrder] => ascending
                        [perPage] => 0
                        [moderate] => 1
                        [bbcode] => 
                        [requireLogin] => 1
                        [disableCaptcha] => 
                    )
    
                [arrModified:protected] => Array
                    (
                    )
    
                [arrRelations:protected] => Array
                    (
                        [jumpTo] => Array
                            (
                                [table] => tl_page
                                [field] => id
                                [type] => hasOne
                                [load] => eager
                            )
    
                        [groups] => Array
                            (
                                [table] => tl_member_group
                                [field] => id
                                [type] => hasMany
                                [load] => lazy
                            )
    
                    )
    
                [arrRelated:protected] => Array
                    (
                        [jumpTo] => Contao\PageModel Object
                            (
                                [blnDetailsLoaded:protected] => 
                                [arrData:protected] => Array
                                    (
                                        [id] => 76
                                        [pid] => 47
                                        [sorting] => 128
                                        [tstamp] => 1502813308
                                        [title] => Blog
                                        [alias] => blog-reader
                                        [type] => regular
                                        [pageTitle] => 
                                        [language] => 
                                        [robots] => index,follow
                                        [description] => 
                                        [redirect] => permanent
                                        [jumpTo] => 0
                                        [url] => 
                                        [target] => 
                                        [dns] => 
                                        [staticFiles] => 
                                        [staticPlugins] => 
                                        [fallback] => 
                                        [adminEmail] => 
                                        [dateFormat] => 
                                        [timeFormat] => 
                                        [datimFormat] => 
                                        [createSitemap] => 
                                        [sitemapName] => 
                                        [useSSL] => 
                                        [autoforward] => 
                                        [protected] => 
                                        [groups] => 
                                        [includeLayout] => 
                                        [layout] => 0
                                        [mobileLayout] => 0
                                        [includeCache] => 
                                        [cache] => 0
                                        [includeChmod] => 
                                        [cuser] => 0
                                        [cgroup] => 0
                                        [chmod] => a:9:{i:0;s:2:"u1";i:1;s:2:"u2";i:2;s:2:"u3";i:3;s:2:"u4";i:4;s:2:"u5";i:5;s:2:"u6";i:6;s:2:"g4";i:7;s:2:"g5";i:8;s:2:"g6";}
                                        [noSearch] => 
                                        [cssClass] => 
                                        [sitemap] => map_default
                                        [hide] => 1
                                        [guests] => 
                                        [tabindex] => 0
                                        [accesskey] => 
                                        [published] => 1
                                        [start] => 
                                        [stop] => 
                                        [languageMain] => 0
                                        [languageRoot] => 0
                                        [dlh_googlemaps_apikey] => 
                                        [pageImage] => 
                                        [pageImageOrder] => a:1:{i:0;s:0:"";}
                                        [pageImageJumpTo] => 0
                                        [pageImageAlt] => 
                                        [pageImageTitle] => 
                                        [t4c_megamenu_show] => 
                                        [t4c_megamenu_selected_module] => 0
                                        [pro_page_icon] => 
                                    )
    
                                [arrModified:protected] => Array
                                    (
                                    )
    
                                [arrRelations:protected] => Array
                                    (
                                        [jumpTo] => Array
                                            (
                                                [table] => tl_page
                                                [field] => id
                                                [type] => hasOne
                                                [load] => lazy
                                            )
    
                                        [groups] => Array
                                            (
                                                [table] => tl_member_group
                                                [field] => id
                                                [type] => hasMany
                                                [load] => lazy
                                            )
    
                                        [layout] => Array
                                            (
                                                [table] => tl_layout
                                                [field] => id
                                                [type] => hasOne
                                                [load] => lazy
                                            )
    
                                        [mobileLayout] => Array
                                            (
                                                [table] => tl_layout
                                                [field] => id
                                                [type] => hasOne
                                                [load] => lazy
                                            )
    
                                        [cuser] => Array
                                            (
                                                [table] => tl_user
                                                [field] => id
                                                [type] => hasOne
                                                [load] => lazy
                                            )
    
                                        [cgroup] => Array
                                            (
                                                [table] => tl_user_group
                                                [field] => id
                                                [type] => hasOne
                                                [load] => lazy
                                            )
    
                                        [pageImageJumpTo] => Array
                                            (
                                                [table] => tl_page
                                                [field] => id
                                                [type] => hasOne
                                                [load] => lazy
                                            )
    
                                    )
    
                                [arrRelated:protected] => Array
                                    (
                                    )
    
                                [blnPreventSaving:protected] => 
                            )
    
                    )
    
                [blnPreventSaving:protected] => 
            )
    
        [count] => 1
        [text] => 1
        [hasText] => 1
        [hasTeaser] => 1
        [hasMetaFields] => 1
        [numberOfComments] => 
        [commentCount] => 
        [timestamp] => 1525688580
        [datetime] => 2018-05-07T12:23:00+02:00
    )

  8. #8
    Community-Moderator
    Wandelndes Contao-Lexikon
    Avatar von Spooky
    Registriert seit
    12.04.2012.
    Ort
    Scotland
    Beiträge
    34.109
    Partner-ID
    10107

    Standard

    Das ist normal, denn dein Newsartikel hat
    Code:
    [source] => external
    (Externe Weiterleitung).

Aktive Benutzer

Aktive Benutzer

Aktive Benutzer in diesem Thema: 1 (Registrierte Benutzer: 0, Gäste: 1)

Lesezeichen

Lesezeichen

Berechtigungen

  • Neue Themen erstellen: Nein
  • Themen beantworten: Nein
  • Anhänge hochladen: Nein
  • Beiträge bearbeiten: Nein
  •