Jump to content

Problem when moving site to hosted server


NoDice
 Share

Recommended Posts

Yesterday I moved my work in progress site to the hosted server for the first time (I had only had the standard pw-installation there before). 

I immediately ran into problems and I got this error message: 

Fatal error: Call to a member function render() on a non-object in /www/webvol13/cy/4js5jujp5ytfkq5/tendfor.com/public_html/test/site/templates/topnav_01.inc on line 4

The lines in question are where markup simple navigation is called:

<?php
 
$treeMenu = $modules->get("MarkupSimpleNavigation"); // load the module
echo $treeMenu->render($options = array(
    'parent_class' => 'parent',
    'current_class' => 'current',
    'has_children_class' => 'has_children',
    'levels' => true,
    'levels_prefix' => 'level',
    'max_levels' => null,
    'firstlast' => true,
    'collapsed' => false,
    'show_root' => true,
    'selector' => '',
    'outer_tpl' => '<ul>||</ul>',
    'inner_tpl' => '<ul>||</ul>',
    'list_tpl' => '<li%s>||</li>',
    'list_field_class' => '',
    'item_tpl' => '<a href="{url}">{title}</a>',
    'item_current_tpl' => '<a href="{url}">{title}</a>',
    'xtemplates' => '',
    'xitem_tpl' => '<span>{title}</span>',
    'xitem_current_tpl' => '<span>{title}</span>'
));

?>

The strange thing is that after putting some test line in, I think it was echo $treeMenu; between line 3 and 4, it started working!

After removing the line, it kept working just fine and without any glitch all day (all pages and functions on the site). Not sure if it was the change or if it just started working after something had been cached or so on the server in the external host environment. 

Anyway, I uploaded again late last night, and I got the same error message, and this time, I can't get it going. Very strange. 

Anyone seen anything like it, or have any suggestions as to what might be going wrong? 

Link to comment
Share on other sites

I now tried removing these lines from my header while on the externally hosted server: 

<div id="navbar_full">
        <div id="navbar_field">
            <div id="logo"><a href="./"><img src="<?php echo $pages->get("/site-settings/")->top_menu_logo_01->url; ?>"></a>
            </div>                 
            <div id="lang"> 
                <ul>
                    <li class="current"><a href="./">Sv</a></li>
                    <li><a href="./">Eng</a></li>
                </ul>
            </div>
            <nav>
            <?php
               include("./topnav_01.inc");
            ?>
            </nav>
            <div class="clear"></div>
        </div>
</div>
 

And then everything works fine (sans top navigation of course). So clearly something is going on with my code in relation to the server environment. Strangest thing is that it started working yesterday and then did so without glitch.

I should perhaps also mention that it renders the logo and the lang-parts so it seems to be in the markupsimplenavigation call things fall apart. I think it is all standard there though and, once again, never had this problem (or anything like it) in my own dev environments.  

Link to comment
Share on other sites

I'm still not having any luck with this. I would be really grateful for any hints on weather it might be some setting on the service provider's end or if I could have done something strange or dumb on my end (that I just can't see at the moment since it is working great in dev and since I actually got it started on the remote once by just adding and then removing some code).  

Link to comment
Share on other sites

It seems like ProcessWire can not load the module, so calling the render() method causes this error.

Try this:

  • Uninstall and install the MarkupSimpleNavigation module

Also make sure that you uploaded all files + migrated the complete database to your live server.

Btw, no need to call the module with all those options. These are the default options that the module will use. Just specify the ones you need to differ from the default ones.

  • Like 2
Link to comment
Share on other sites

Thanks, will try the uninstall - install. I upload the whole site using ftp (and remove everything before I do) AND I drop and reimport current mysql-database. After that I change the rewrite base and the site config.php-settings to reflect the hosted settings.

That's it. Note that if I remove the html above - everything rocks and rolls (but the navigation menu), and also that I once got it up and running by just adding and removing a line. 

Will let you know how I fare after the reinstall. 

Link to comment
Share on other sites

I used to run into strange issues too - also with other systems when transferring files one-by-one. Nowadays I zip locally and transfer the zip and unzip it on the server. This way I can be sure all the rights, files, et cetera will be transferred.

  • Like 1
Link to comment
Share on other sites

Well, I don't think it is a file transfer problem as I take the entire site including all hidden files (and the hidden files are on the server). Once again, it also got going, and it runs without the navigation section. Will try your suggestion if all else fails though and let you know if it does the trick!

Link to comment
Share on other sites

OK friends, I tried to install and uninstall the markupsimplenavigation (I am using modules manager). I tried to remove all but the non-standard options (certainly a good idea although it seems to protest before the options). I tried to zip all the files and then extract on server. 

All of this produced the exact same error and error message as before. 

Could it be a server side problem? If so, what? 

Link to comment
Share on other sites

I used to run into strange issues too - also with other systems when transferring files one-by-one. Nowadays I zip locally and transfer the zip and unzip it on the server. This way I can be sure all the rights, files, et cetera will be transferred.

Yep, I do it like that too. It's also a lot faster than transferring files one-by-one. On the server, it unzips in 2-3 seconds. Most hosting control panels have such a feature in a file-manager tool.

  • Like 1
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

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