Krlos Posted August 11, 2016 Share Posted August 11, 2016 Hi there, I'm having this error when moving the site from localhost (Mamp pro) to Hosting: Error: Uncaught Error: Call to a member function render() on null in /home/cuadrilatero/webapps/monica/site/templates/inc/menu-inc.php:16 Stack trace: #0 /home/cuadrilatero/webapps/monica/site/templates/inc/header-inc.php(74): include() #1 /home/cuadrilatero/webapps/monica/site/templates/home.php(1): include('/home/cuadrilat...') #2 /home/cuadrilatero/webapps/monica/wire/core/TemplateFile.php(219): require('/home/cuadrilat...') #3 /home/cuadrilatero/webapps/monica/wire/core/Wire.php(347): TemplateFile->___render() #4 /home/cuadrilatero/webapps/monica/wire/core/WireHooks.php(548): Wire->_callMethod('___render', Array) #5 /home/cuadrilatero/webapps/monica/wire/core/Wire.php(370): WireHooks->runHooks(Object(TemplateFile), 'render', Array) #6 /home/cuadrilatero/webapps/monica/wire/modules/PageRender.module(503): Wire->__call('render', Array) #7 /home/cuadrilatero/webapps/monica/wire/core/Wire.php(347): PageRender->___renderPage(Object(HookEvent)) #8 /home/cuadrilatero/webapps/monica/wire/core/WireHooks.php(548): Wire->_ (line 16 of /home/cuadrilatero/webapps/monica/site/templates/inc/menu-inc.php) This error message was shown because: site is in debug mode. ($config->debug = true; => /site/config.php). Error has been logged. I'm developing on Mamp Pro with php 7.0, si working fine on my laptop. (Processwire 2.8) My hosting also have php 7.0 Thanks in advance... Link to comment Share on other sites More sharing options...
LostKobrakai Posted August 11, 2016 Share Posted August 11, 2016 Can you post the relevant code lines in your menu-inc file? The callstack looks quite normal besides maybe the last line, which I'm not sure about. Link to comment Share on other sites More sharing options...
Krlos Posted August 11, 2016 Author Share Posted August 11, 2016 I'm using markup simple navigarion module: <?php $treeMenu = $modules->get("MarkupSimpleNavigation"); // load the module //Setting options for menu $options = array( 'selector_field' => 'nav', 'outer_tpl' => '<ul class="nav navbar-nav">||</ul>', 'show_root' => true, 'max_levels' => 1, ); // Render Menu echo $treeMenu->render($options); and including the file using: <? include('inc/menu-inc.php'); ?> Locally is working fine. Link to comment Share on other sites More sharing options...
LostKobrakai Posted August 11, 2016 Share Posted August 11, 2016 Could you check if $treeMenu actually is an instance of the module? Also you probably should avoid using <? instead of <?php, because short_tags are often disabled. Link to comment Share on other sites More sharing options...
Krlos Posted August 11, 2016 Author Share Posted August 11, 2016 48 minutes ago, LostKobrakai said: Could you check if $treeMenu actually is an instance of the module? Also you probably should avoid using <? instead of <?php, because short_tags are often disabled. I'm sorry I'm no php expert, don't know how to do what you asked me. I've trying things... if I remove the render($options); part, the error is gone, but the menu is not showing. I've changed all short tags to <?php but that didn't fix the error. Link to comment Share on other sites More sharing options...
LostKobrakai Posted August 11, 2016 Share Posted August 11, 2016 var_dump(get_class($treeMenu)); Link to comment Share on other sites More sharing options...
Krlos Posted August 11, 2016 Author Share Posted August 11, 2016 I get this: string(12) "TemplateFile" Link to comment Share on other sites More sharing options...
Robin S Posted August 11, 2016 Share Posted August 11, 2016 Are you sure you're using the "selector_field" option correctly? What is the contents of this field on pages where you are using it - is it a valid selector? I would consider "selector_field" to be an advanced option that isn't needed for most menus. For most situations the "selector" option is sufficient. Link to comment Share on other sites More sharing options...
Krlos Posted August 11, 2016 Author Share Posted August 11, 2016 14 minutes ago, Robin S said: Are you sure you're using the "selector_field" option correctly? What is the contents of this field on pages where you are using it - is it a valid selector? I would consider "selector_field" to be an advanced option that isn't needed for most menus. For most situations the "selector" option is sufficient. I remove the selector_field and is not working either. Link to comment Share on other sites More sharing options...
Robin S Posted August 11, 2016 Share Posted August 11, 2016 3 minutes ago, Krlos said: I remove the selector_field and is not working either. Not working as in fatal error or as in no menu? I take it that there are some pages in your top level that you don't want to include in the menu - can you describe what you're trying to achieve? Link to comment Share on other sites More sharing options...
Krlos Posted August 12, 2016 Author Share Posted August 12, 2016 13 hours ago, Robin S said: Not working as in fatal error or as in no menu? I take it that there are some pages in your top level that you don't want to include in the menu - can you describe what you're trying to achieve? Not working and no menu. As I said earlier, this code is working on localhost. Besides I have a nother website with the same menu code running on this hosting but using PW 2.7. I'm not trying to achive nothing fancy, just need top level pages on my menu, about 4 pages. Link to comment Share on other sites More sharing options...
Robin S Posted August 12, 2016 Share Posted August 12, 2016 17 hours ago, Krlos said: I get this: string(12) "TemplateFile" Check that the MarkupSimpleNavigation module is actually installed. The class returned for $treeMenu should be "MarkupSimpleNavigation". Link to comment Share on other sites More sharing options...
Krlos Posted August 13, 2016 Author Share Posted August 13, 2016 On 12-08-2016 at 9:48 AM, Robin S said: Check that the MarkupSimpleNavigation module is actually installed. The class returned for $treeMenu should be "MarkupSimpleNavigation". Yes is installed. I'm going to rebuild this site in PW 2.7 because I can't find how to fix this. Link to comment Share on other sites More sharing options...
deltavik Posted August 19, 2016 Share Posted August 19, 2016 On 8/13/2016 at 6:48 PM, Krlos said: Yes is installed. I'm going to rebuild this site in PW 2.7 because I can't find how to fix this. Just dropped by to say that I have the same setup on my laptop (MAMP + php7 + PW3), and I was able to migrate the site to live (lamp + php7) without any hassles. In my view, PW version is not the reason. One suggestion I have to troubleshoot this situation: -- Load the default, out of the box PW3 on your hosting. -- If that works, then gradually add modules and import templates + fields one at a time until you hit the error. 1 Link to comment Share on other sites More sharing options...
Krlos Posted August 20, 2016 Author Share Posted August 20, 2016 (edited) On 18-08-2016 at 10:12 PM, deltavik said: Just dropped by to say that I have the same setup on my laptop (MAMP + php7 + PW3), and I was able to migrate the site to live (lamp + php7) without any hassles. In my view, PW version is not the reason. One suggestion I have to troubleshoot this situation: -- Load the default, out of the box PW3 on your hosting. -- If that works, then gradually add modules and import templates + fields one at a time until you hit the error. Hi, I took your advice , and you were right . Apparently when transferring data from my computer to the server permissions are wrong. I don't know why this is happening, I uploaded another PW project and everything worked well, using almost the same code. Edited August 21, 2016 by Krlos Typos 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now