Wayne B Posted November 2, 2015 Posted November 2, 2015 Hi In pages I had a plugin created which I used in the sidebar - code as follows <style> .myButton { -moz-box-shadow: 0px 1px 0px 0px #f0f7fa; -webkit-box-shadow: 0px 1px 0px 0px #f0f7fa; box-shadow: 0px 1px 0px 0px #f0f7fa; background-color:#00376c; -moz-border-radius:6px; -webkit-border-radius:6px; border-radius:6px; border:1px solid #057fd0; display:inline-block; cursor:pointer; color:#ffffff; font-family:Arial; font-size:10px; font-weight:bold; padding:3px 12px; text-decoration:none; text-shadow:0px -1px 0px #5b6178; } .myButton:hover { } .myButton:active { position:relative; top:1px; } </style> {{if !empty( $records ) }} <h3 class='ipsWidget_title ipsType_reset'>{lang="Current Member of the Month" sprintf="$database->recordWord( 2, TRUE )"}</h3> {{if $orientation == 'vertical'}} <div class='ipsPad_half ipsWidget_inner'> <ul class='ipsDataList ipsDataList_reducedSpacing'> {{foreach $records as $record}} <li class='ipsDataItem'> <div class='ipsDataItem_main'> <div class="ipsCommentCount ipsPos_right {{if ( $record->record_comments ) === 0}}ipsFaded{{endif}}" data-ipsTooltip title='{lang="replies_number" pluralize="$record->record_comments"}'>{expression="$record->record_comments"}</div> <a href="{$record->url()->setQueryString( 'do', 'getLastComment' )}" title='{lang="view_this_topic" sprintf="$record->title"}' class='ipsDataItem_title ipsType_break'>{wordbreak="$record->_title"}</a>{$record->customFieldDisplayByKey('member', 'listing')|raw}<br> <span class='ipsType_light ipsType_small'>{$record->_content|raw}</span> <div align="center"><a href="{$record->url()->setQueryString( 'do', 'getLastComment' )}" class="myButton">Leave A Comment</a></div> </div> </li> {{endforeach}} </ul> </div> {{else}} <div class='ipsWidget_inner'> <ul class='ipsDataList'> {template="recordRow" group="listing" location="database" app="cms" themeClass="IPS\cms\Theme" params="null, null, $records"} </ul> </div> {{endif}} {{endif}} Worked perfectly fine on 4.0.X Upgraded to 4.1 and now 4.1.2 and if I try to use the plugin in the sidebar it delivers a fatal error to the page Fatal error: Call to a member function recordWord() on a non-object in /home/xxx/xxx/xxx/system/Theme/Theme.php(3948) : eval()'d code on line 45 Anyone able to advise what has gone wrong please?
Netherlord Posted November 2, 2015 Posted November 2, 2015 Im going to take a guess and say this bit has changed in the system. <h3 class='ipsWidget_title ipsType_reset'>{lang="Current Member of the Month" sprintf="$database->recordWord( 2, TRUE )"}</h3>
Wayne B Posted November 2, 2015 Author Posted November 2, 2015 Is anyone able to advise how to correct it?
Netherlord Posted November 2, 2015 Posted November 2, 2015 2 minutes ago, Police Community said: Is anyone able to advise how to correct it? At first glance i dont notice anything out of the ordinary. Im not sure how to correct it but i could advise you to save it how it is now, and start removing sections of the code until the error goes away, pinpoint the cause and then see if the problem area variables are the same in 4.1 as they had been in the original plugin.
Wayne B Posted November 2, 2015 Author Posted November 2, 2015 11 minutes ago, Police Community said: sprintf="$database->recordWord( 2, TRUE )" Removing this element resolved the Fatal Error just not sure what the benefit of having that was really.
Netherlord Posted November 2, 2015 Posted November 2, 2015 2 minutes ago, Police Community said: Removing this element resolved the Fatal Error just not sure what the benefit of having that was really. I think the sprintf function writes a formatted string to a variable. But at least it fixed the issue.
Wayne B Posted November 2, 2015 Author Posted November 2, 2015 Yeah - not sure its needed in this example to be honest. Thanks for your help
opentype Posted November 8, 2015 Posted November 8, 2015 I also got this problem with block templates created in 4.0.x, where the title was outputted this way. Took me a while to pin that down. To fix it I had to replace the {lang="something" sprintf="$database->recordWord( 2, TRUE )"} with simply {$title}
Recommended Posts
Archived
This topic is now archived and is closed to further replies.