Jump to content

AnnouncementTop template error


Recommended Posts

I keep getting different template errors that I would never get before.

Any ideas on this one.

See image:

Could contain: Text, Page

This is the error log:

{{if $announcements = \IPS\core\Announcements\Announcement::loadAllByLocation('content')}}
	<div class='cAnnouncementsContent'>
		{{foreach $announcements as $announcement}}
		<div class='cAnnouncementContentTop ipsAnnouncement ipsMessage_{$announcement->color} ipsType_center'>
            {{if $announcement->type == \IPS\core\Announcements\Announcement::TYPE_CONTENT}}
			<a href='{$announcement->url()}' data-ipsDialog data-ipsDialog-title="{$announcement->title}">{$announcement->title}</a>
            {{elseif $announcement->type == \IPS\core\Announcements\Announcement::TYPE_URL}}
            <a href='{$announcement->url}' target="_blank" rel='noopener'>{$announcement->title}</a>
            {{else}}
            <span>{$announcement->title}</span>
            {{endif}}
		</div>
		{{endforeach}}
	</div>
{{endif}}

 

Link to comment
Share on other sites

Hi,

Similar error was reported twice:

Solved:

Unsolved:

[announcementContentTop on the default theme. announcementTop + announcementContentTop on Ehren's theme.]

Edited by Luuuk
Link to comment
Share on other sites

Just now, Marc Stridgen said:

What you posted there is not an error log, it's a template. Please try disabling template caching if you have that enabled. 

Also, if you need support on a stock item, please post in the support forum 

Thank you Marc but I'm never quite sure where to post and not get into trouble 😇

FYI, I believe my caching is already disabled? Posting image here just to make sure I have it right?

Could contain: Text, Menu

Link to comment
Share on other sites

2 minutes ago, Giray said:

I'll wait and see what happens.

You can check if the error is still there by pasting in your browser a URL pointing to a non-existent attachment like:

https://YourSite/applications/core/interface/file/attachment.php?id=0

 

Link to comment
Share on other sites

1 hour ago, Luuuk said:

You can check if the error is still there by pasting in your browser a URL pointing to a non-existent attachment like:

https://YourSite/applications/core/interface/file/attachment.php?id=0

 

Unfortunately it is. Just tried what you suggested and I still get:

[[Template core/front/global/announcementContentTop is throwing an error. This theme may be out of date. Run the support tool in the AdminCP to restore the default theme.]]

Link to comment
Share on other sites

1 minute ago, Giray said:

Unfortunately it is. Just tried what you suggested and I still get:

[[Template core/front/global/announcementContentTop is throwing an error. This theme may be out of date. Run the support tool in the AdminCP to restore the default theme.]]

What shows up in the logs?

Link to comment
Share on other sites

Log

TypeError: get_class(): Argument #1 ($object) must be of type object, null given in /home/myaccount/public_html/applications/core/sources/Announcements/Announcement.php:198
Stack trace:
#0 /home/myaccount/public_html/system/Theme/Theme.php(880) : eval()'d code(104): IPS\core\Announcements\_Announcement::loadAllByLocation('content')
#1 /home/myaccount/public_html/system/Theme/SandboxedTemplate.php(61): IPS\Theme\class_core_front_global->announcementContentTop()
#2 /home/myaccount/public_html/system/Theme/Theme.php(880) : eval()'d code(18644): IPS\Theme\_SandboxedTemplate->__call('announcementCon...', Array)
#3 /home/myaccount/public_html/system/Theme/SandboxedTemplate.php(61): IPS\Theme\class_core_front_global->widgetContainer('header', 'horizontal')
#4 /home/myaccount/public_html/system/Theme/Theme.php(880) : eval()'d code(6690): IPS\Theme\_SandboxedTemplate->__call('widgetContainer', Array)
#5 /home/myaccount/public_html/system/Theme/SandboxedTemplate.php(61): IPS\Theme\class_core_front_global->globalTemplate('d09378790251aab...', '\n\n<section id='...', Array)
#6 /home/myaccount/public_html/system/Output/Output.php(748): IPS\Theme\_SandboxedTemplate->__call('globalTemplate', Array)
#7 /home/myaccount/public_html/init.php(913) : eval()'d code(26): IPS\_Output->error('We could not lo...', '2S328/1', 404, '', Array, NULL, NULL)
#8 /home/myaccount/public_html/applications/core/interface/file/attachment.php(136): IPS\cms_hook_Output->error('node_error', '2S328/1', 404, '')
#9 {main}

And backtrace

#0 /home/myaccount/public_html/system/Theme/SandboxedTemplate.php(71): IPS\_Log::log(Object(TypeError), 'template_error')
#1 /home/myaccount/public_html/system/Theme/Theme.php(880) : eval()'d code(18644): IPS\Theme\_SandboxedTemplate->__call('announcementCon...', Array)
#2 /home/myaccount/public_html/system/Theme/SandboxedTemplate.php(61): IPS\Theme\class_core_front_global->widgetContainer('header', 'horizontal')
#3 /home/myaccount/public_html/system/Theme/Theme.php(880) : eval()'d code(6690): IPS\Theme\_SandboxedTemplate->__call('widgetContainer', Array)
#4 /home/myaccount/public_html/system/Theme/SandboxedTemplate.php(61): IPS\Theme\class_core_front_global->globalTemplate('d09378790251aab...', '\n\n<section id='...', Array)
#5 /home/myaccount/public_html/system/Output/Output.php(748): IPS\Theme\_SandboxedTemplate->__call('globalTemplate', Array)
#6 /home/myaccount/public_html/init.php(913) : eval()'d code(26): IPS\_Output->error('We could not lo...', '2S328/1', 404, '', Array, NULL, NULL)
#7 /home/myaccount/public_html/applications/core/interface/file/attachment.php(136): IPS\cms_hook_Output->error('node_error', '2S328/1', 404, '')
#8 {main}

 

Just now, Daniel F said:

Since I'm already in your ACP and working on your other issue, I'll take this one too:) 

I thank you... while blushing 😉 Too kind!!

Link to comment
Share on other sites

Just found a new template error. Not sure if it's related to my previous template errors and fixed in upcoming release or not.

If I try to show an activity stream, e.g. my unread content, I get:

  1. [[Template core/front/streams/streamItems is throwing an error. This theme may be out of date. Run the support tool in the AdminCP to restore the default theme.]]

Is there some kind of temporary fix?

Could contain: Text, Page

Link to comment
Share on other sites

For quick reference, this is the template content. See anything...?

Note that I just tried with the default IPS theme and the problem persists.

Last point, this just suddenly started happening today, with no other changes made.

 

 

{{$currentSeparator = NULL;}}
{{if \count( $results )}}
    {{foreach $results as $result}}
        {{if $result !== NULL}}
            {{if $showTimeSeparators}}
                {{if $currentSeparator != 'earlier'}}
                    {{$separator = $result->streamSeparator( $sort == 'date' );}}
                    {{if $currentSeparator != $separator}}
                        <li class='ipsStreamItem_time' data-timeType='{$separator}'>{lang="$separator"}</li>
                        {{$currentSeparator = $separator;}}
                    {{endif}}
                {{endif}}
            {{endif}}
            {$result->html( $view, $sort != 'date', TRUE )|raw}
        {{endif}}
    {{endforeach}}
{{else}}
    {{if ! ( \IPS\Request::i()->isAjax() and isset( \IPS\Request::i()->before ) )}}
    <li class='ipsBox_alt ipsType_center ipsPad' data-role="streamNoResultsMessage">
        <p class='ipsType_reset ipsType_light ipsType_normal'>
            {lang="stream_no_results"}
        </p>
    </li>
    {{endif}}
{{endif}}

Edited by Giray
Link to comment
Share on other sites

Thanks. Now the question you can't answer... fix timeframe? This one is pretty bad for anyone using this function which on my board happens to be FRONT and center 😉 I've made it into a 'see everything' button.

Could contain: Text, Flyer, Advertisement, Paper, Poster, Brochure, Page, File

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...