I'm using 3.1.13 SilverStripe CMS and Framework. I have ran into troubles after creating a function inside my Page.php (class Page) and initializing it in my views (page.ss).
I want to create a pagination for my project.
Here is my error with source and trace:
[User Error] Uncaught Exception: The request must be readable as an array.
GET /?flushtoken=88455a3cc5497ee38dd7a61d75370221&flush=all
Line 28 in /var/www/project-name/framework/core/PaginatedList.php
Source
19 * Constructs a new paginated list instance around a list.
20 *
21 * #param SS_List $list The list to paginate. The getRange method will
22 * be used to get the subset of objects to show.
23 * #param array|ArrayAccess Either a map of request parameters or
24 * request object that the pagination offset is read from.
25 */
26 public function __construct(SS_List $list, $request = array()) {
27 if (!is_array($request) && !$request instanceof ArrayAccess) {
28 throw new Exception('The request must be readable as an array.');
29 }
30
31 $this->request = $request;
32 parent::__construct($list);
33 }
34
Trace
PaginatedList->__construct(DataList,)
HomePage.php:182
HomePage->PaginatedPages()
call_user_func_array(Array,Array)
Object.php:731
Object->__call(PaginatedPages,Array)
ViewableData.php:361
HomePage_Controller->PaginatedPages()
ViewableData.php:361
ViewableData->obj(PaginatedPages,,1,,)
SSViewer.php:91
SSViewer_Scope->getObj(PaginatedPages,,1,,)
SSViewer.php:504
SSViewer_DataPresenter->getObj(PaginatedPages,,1,,)
SSViewer.php:111
SSViewer_Scope->obj(PaginatedPages,,1)
.cache.themes.project-name.templates.Layout.HomePage.ss:400
include(/tmp/silverstripe-cache-php5.5.9-1ubuntu4.11-var-www-project-name/www-data/.cache.themes.project-name.templates.Layout.HomePage.ss)
SSViewer.php:1031
SSViewer->includeGeneratedTemplate(/tmp/silverstripe-cache-php5.5.9-1ubuntu4.11-var-www-project-name/www-data/.cache.themes.project-name.templates.Layout.HomePage.ss,HomePage_Controller,,Array,)
SSViewer.php:1098
SSViewer->process(HomePage_Controller,)
SSViewer.php:1094
SSViewer->process(HomePage_Controller)
Controller.php:203
Controller->handleAction(SS_HTTPRequest,index)
RequestHandler.php:200
RequestHandler->handleRequest(SS_HTTPRequest,DataModel)
Controller.php:153
Controller->handleRequest(SS_HTTPRequest,DataModel)
ContentController.php:198
ContentController->handleRequest(SS_HTTPRequest,DataModel)
ModelAsController.php:78
ModelAsController->handleRequest(SS_HTTPRequest,DataModel)
RootURLController.php:130
RootURLController->handleRequest(SS_HTTPRequest,DataModel)
Director.php:370
Director::handleRequest(SS_HTTPRequest,Session,DataModel)
Director.php:153
Director::direct(/,DataModel)
main.php:177
Where is the problem? I'm following this instructions and it fails when I'm calling my function in the view.
Nevermind! I just realized that if I want to get $this->request work, I need to place that function into class Page controller.
Related
After upgrading to PHP 7.4, elemntor started giving error
url: www.aldon.ltd/
Cloud Service: GCP
Server: Openlitespeed Wordpress
Linux: Ubuntu 20.04 LTS
Notice: Trying to access array offset on value of type null in /var/www/html/wp-content/plugins/elementor/includes/base/controls-stack.php on line 1449
Notice: Trying to access array offset on value of type null in /var/www/html/wp-content/plugins/elementor/includes/base/controls-stack.php on line 1451
Except this notice shown at the top of webpage, all other functions are working as expected.
Code causing error
/**
* End controls section.
*
* Used to close an existing open controls section. When you use this method
* it stops adding new controls to this section.
*
* This method should be used inside _register_controls().
*
* #since 1.4.0
* #access public
*/
Public function end_controls_section() {
$stack_name = $this->get_name();
// Save the current section for the action.
$current_section = $this->current_section;
$section_id = $current_section['section'];
$args = [
'tab' => $current_section['tab'],
];
Error Log at /usr/local/lsws/logs/error.log
PHP Notice: wp_deregister_script was called incorrectorrectly. Do not deregister the jquery-core script in the administration area. To target the front-end theme, use the wp_enqueue_scrip>
PHP Notice: /var/www/html/wp-content/plugins/elementor/includes/base/controls-stack.php on line 1449
PHP Notice: /var/www/html/wp-content/plugins/elementor/includes/base/controls-stack.php on line 1451
I resolved it for a temporary solution. Changing line no. 1204 from
if ( $dynamic_property ) ) {
to
if ( $dynamic_property && isset($settings[ $control_name ][ $dynamic_property ]) ) {
Hey and good morning :).
I'll start with the error message and explain afterwards what I've tried and did:
Catchable fatal error: Object of class __TwigTemplate_[64chars] could not be converted to string in /someFolder/lib/Twig/Loader/Filesystem.php on line 139
The full error message as Image:
The PHP Error Message
The call stack as Text:
Call Stack
# Time Memory Function Location
1 0.0001 123400 {main}( ) ../handleOOP.php:0
2 0.0107 1269656 OOPHandler::runPage( ) ../handleOOP.php:7
3 0.0107 1269768 AnweisungEingeben->stepkontrolle( ) ../OOPHandler.php:62
4 0.0108 1271536 AnweisungEingeben->ausgabe( ) ../AnweisungEingeben.php:77
5 0.0383 1669484 Twig_Environment->render( ) ../AnweisungEingeben.php:442
6 0.0383 1669484 Twig_Environment->loadTemplate( ) ../Environment.php:347
7 0.0383 1669512 Twig_Environment->getTemplateClass( ) ../Environment.php:378
8 0.0384 1669512 Twig_Loader_Filesystem->getCacheKey( ) ../Environment.php:312
In the AnweisungEingeben.php I have the following code fragment:
include_once "../lib/Twig/Autoloader.php";
Twig_Autoloader::register();
$template_dirs = array(
$root.'templates/web/anweisungen',
[...]
);
$twig_loader = new Twig_Loader_Filesystem($template_dirs);
$twig = new Twig_Environment($twig_loader, array("debug" => true));
$template = $twig->loadTemplate('Anweisung_Base.phtml');
$wech = $twig->render($template); // line 442 from AnweisungEingeben.php
I already tried:
If the paths are correct (via scandir("path"))
If Twig gets loaded
Minimal Code like
$loader = new Twig_Loader_Array(array('index.html' => 'Hello World!'));
$twig = new Twig_Environment($loader);
echo $twig->render('index.html');
Unfortunately everything results in the same.
The strange thing is, that the exact same code is working flawlessly in a minimal project.
I know it's very chaotic, but the project is existing and growing now for about ~20 years and this twig approach is my try to start(!) separating the logic from the html code.
You're mixing methods up, you are trying to pass a Twig_Template to the Twig_Environment's render method, while this method actually expect the path to the template as it's first parameter
So either do :
$template = $twig->loadTemplate('Anweisung_Base.phtml');
echo $template->render();
Or
echo $twig->render('Anweisung_Base.phtml');
I just uninstalled 2 extension from magento connect and end up with a 3rd extension fatal error.
http://nutrija.com
Front end of magento is throwing just a white page.
backend - is working normally.
i have already tried disabling "Webinse_DailyDeals" extension, removing that 16th line of code. But no luck.
ERROR LOG: [Sun Mar 27 08:11:38 2016] [error] [client 59.96.113.41]
PHP Fatal error: Uncaught Error: Call to a member function addLink()
on null in
/home/nutrija/public_html/includes/src/Webinse_DailyDeals_Block_Links.php:16
Stack trace:
0 /home/nutrija/public_html/includes/src/__default.php(27948): Webinse_DailyDeals_Block_Links->addDealLink('dailydeals_link...')
1 /home/nutrija/public_html/includes/src/__default.php(27814): Mage_Core_Model_Layout->_generateAction(Object(Mage_Core_Model_Layout_Element), Object(Mage_Core_Model_Layout_Element))
2 /home/nutrija/public_html/includes/src/__default.php(27806): Mage_Core_Model_Layout->generateBlocks(Object(Mage_Core_Model_Layout_Element))
3 /home/nutrija/public_html/includes/src/__default.php(27810): Mage_Core_Model_Layout->generateBlocks(Object(Mage_Core_Model_Layout_Element))
4 /home/nutrija/public_html/includes/src/__default.php(27810): Mage_Core_Model_Layout->generateBlocks(Object(Mage_Core_Model_Layout_Element))
5 /home/nutrija/public_html/includes/src/__default.php(13941): Mage_Core_Model_Layout->generateBlocks()
6 /home/nutrija/public in /home/nutrija/public_html/includes/src/Webinse_DailyDeals_Block_Links.php
on line 16
<?php
/**
* AddDealsLink Block
*
* #category Webinse
* #package Webinse_DailyDeals
* #author Webinse Team <info#webinse.com.com>
*/
class Webinse_DailyDeals_Block_Links extends Mage_Core_Block_Template
{
public function addDealLink()
{
$parentBlock = $this->getParentBlock();
$text = $this->helper('dailydeals')->getDealsConfig('dailydeals_group/label_deals_link');
$parentBlock->addLink($text, 'dailydeals/', $text, true, array(), 1, null, 'class="top-link-deals"');
return $this;
}
}
First, try to turn off compilation. Next, check why the $parentBlock not exists in your layout.
Posted this on http://magento.stackexchange.com but I haven't gotten an answer.
I am getting this error for a while and I am clueless to what is wrong with it. Whenever I click the view order page, I get a blank page. Now I installed some code on my index.php that displays the errors.
This is the error that I get:
Array ( [type] => 1 [message] => Class
'Mage_Sales_Block_Order_Info' not found [file] =>
/app/code/core/Mage/Core/Model/Layout.php [line] => 491 )
This is line 491 (and context)
/**
* Create block object instance based on block type
*
* #param string $block
* #param array $attributes
* #return Mage_Core_Block_Abstract
*/
protected function _getBlockInstance($block, array $attributes=array())
{
if (is_string($block)) {
if (strpos($block, '/')!==false) {
if (!$block = Mage::getConfig()->getBlockClassName($block)) {
Mage::throwException(Mage::helper('core')->__('Invalid block type: %s', $block));
}
}
if (class_exists($block, false) || mageFindClassFile($block)) {
$block = new $block($attributes);
}
}
if (!$block instanceof Mage_Core_Block_Abstract) {
Mage::throwException(Mage::helper('core')->__('Invalid block type: %s', $block));
}
return $block;
}
Seems nothing is wrong there (and why should it, its magento default code)
Now the next part is somewhat strange. I expected the class to live in app/code/core/Mage/Sales/Block/Order/Info I looked it up. The folders Order/Info didnt exist in my folder. Nor in the fresh install zip.
What is going on and more importantly, how can I fix this?
I hope you are using latest version of magento never mind even if it is old looks like you are missing some order block files try copying all the files properly. some times you may miss some files while you download the files from magento website check your magento zip file size that you downloaded.
I have downloaded the Kohana Pagination module from Git and have been having some issues trying to use it.
I moved it into the modules folder and have updated my bootstrap to include the module...
'pagination' => MODPATH.'kohana-pagination',
I have the following code that loads some messages from a simple table with pagination...
public function action_index()
{
$content = View::factory('welcome')
->bind('messages', $messages)
->bind('pager_links', $pager_links);
$message = new Model_Message;
$message_count = $message->count_all();
$pagination = Pagination::factory(array(
'total_items' => $message_count,
'items_per_page' => 3,
));
$pager_links = $pagination->render();
$messages = $message->get_all($pagination->items_per_page, $pagination->offset);
$this->template->content = $content;
}
When I run load this in my browser, I get the following error message...
ErrorException [ Fatal Error ]: 1Call to undefined method Kohana::config()
MODPATH\kohana-pagination\classes\kohana\pagination.php [ 87 ]
82 * #return array config settings
83 */
84 public function config_group($group = 'default')
85 {
86 // Load the pagination config file
87 $config_file = Kohana::config('pagination');
88
89 // Initialize the $config array
90 $config['group'] = (string) $group;
91
92 // Recursively load requested config groups
{PHP internal call} ยป Kohana_Core::shutdown_handler()
If I remove the code relating to the pagination, the page loads the data fine from the database. Any pointers here would be great.
Update
Found this link: https://github.com/kloopko/kohana-pagination, on the back of Ikke, so cheers for the help folks.
Appears that the previously bundled pagination module has been removed, found the kohana-pagination module which has been updated to cater for 3.2.
Hope that helps someone else just starting out. :)
The issue is just the config system has changed for version 3.2. Most modules can be fixed by simply updating
$config_file = Kohana::config('pagination');
to
$config_file = Kohana::$config->load('pagination');
Let me update you the steps to resolve with Kohana paging.
Go to modules/pagination/classes/kohana/pagination.php
Change the
$config_file = Kohana::config('pagination');
to
$config_file = Kohana::$config->load('pagination');
in the same page at the line 199
change this line to
return URL::site(Request::current()->uri).URL::query(array($this->config['current_page']['key'] => $page));
to
return URL::site(Request::current()->uri()).URL::query(array($this->config['current_page']['key'] => $page));
Add uri braces.
This resolved my issue. thank you.