Gena Posted April 13, 2011 Share Posted April 13, 2011 Hey I want to start by saying thank you for the work that has gone into Processwire... I have come to appreciate it some much as I have been working with it the last couple of weeks! I would like to ask for some help... the site I have been working on was working well on my localhost, but I have been having a lot of problems with setting things up on our live server... Somewhere things are not initialising correctly in the setup, and again and again I am finding the message "Call to a member function xxxxxxx() on a non-object" popping up, for code that worked great on local host. Please, is there any advice or guidelines for things to possibly look for, or what I should possibly change to fix it? Please, all help would be appreciated, as I need to get this site up ASAP! Gena Link to comment Share on other sites More sharing options...
Adam Kiss Posted April 13, 2011 Share Posted April 13, 2011 Hi Gena, one of the first things I would check, be on your place, is some control panel or administration for your live server and check what PHP you use on it. I remember something like this happening before to me, because I had wrong PHP to run .php files (even though PHP 5.3 was installed on it) Next thing I'll check is whether all files have been copied to server – it's not unusual for me to try to run some application, that isn't on server (and/or screwing that transfer up in the process). Once I tried to check one application 12 times... But that one had 2.5GB in size (and additional 4GB in database) Also, I would check if all permissions are okay, whether you have updated your database along with the files (this could happen while changing your templates, uploading new files, but not new database). If none of this helps, please post full error code along with the code where the error is located. Hope it helps P.S.: Welcome to forums Link to comment Share on other sites More sharing options...
ryan Posted April 13, 2011 Share Posted April 13, 2011 Gena, thanks for your feedback and glad you like ProcessWire so far. I think Adam had great suggestions. Of those he mentioned, my first thought is something about your php version or configuration. If you want, pm me a link to your phpinfo. Or, if you prefer, try installing a blank copy of processwire to your server. The installer should notify you of any potential issues and workarounds. Link to comment Share on other sites More sharing options...
Adam Kiss Posted April 13, 2011 Share Posted April 13, 2011 Ah yes! The installer! I forgot that one Link to comment Share on other sites More sharing options...
Gena Posted April 13, 2011 Author Share Posted April 13, 2011 Thank you for the advice When I had problems with moving my pw site from local host to liver server along the guidelines given in the forum, I did set it up manually with the installer for both the sub domains. Its still giving problems however... Ryan, I will send the phpinfo to you in a pm after this And if needed, I will post examples of the errors coming up and the source code later Thank you for the help - I really appreciate it! Link to comment Share on other sites More sharing options...
Gena Posted April 13, 2011 Author Share Posted April 13, 2011 Hey Wanted to add an example of the kind of problem I'm having. When I try loading my frontpage that has a featured contant slider, it uses a Slider module to generate the markup I need to use with the slider. The code works great on my localhost, but when I try it on my live server, I get this error: "Call to a member function width() on a non-object (line 53 of /var/www/clients/client220/web338/web/site/modules/Slider.module)" <?php class Slider extends ModuleJS { public static function getModuleInfo() { return array( 'title' => 'Slider', 'version' => 100, 'summary' => 'Generates Markup for Slider', 'autoload' => true, ); } function addPaginationLinks($slide_count) { $slide_links = ""; $count = 1; while($count <= $slide_count) { $slide_links .= "<li><a>$count</a></li>"; $count++; } return $slide_links; } function renderSlide($slide_page) { if($slide_page->summary) { $summary = strip_tags($slide_page->summary); if(strlen($summary) > 400) { $summary = substr($summary, 0, 320); // display no more than specified length $summary = substr($summary, 0, strrpos($summary, ". ")+1); // and truncate to last sentence } $summary = trim($summary); } if ($slide_page->template == "video") { $img= $slide_page->video_poster->width(300); $width = $img->width; $height = $img->height; $slide ="<div class = 'media slide'> <a href = '$page_address' ><img src = '".$img->url."' class = 'rounded-img img' width = '$width' height = '$height'> </a> <div class = 'bd'> <h1><a href = '$page_address' >".$slide_page->title."</a></h1> <p>".$summary." <a href = '$page_address' >... <span class = 'strong secondary'> Watch video </span> </a></p> </div></div>"; } else { $img= $slide_page->images->first()->width(300); $width = $img->width; $height = $img->height; $slide ="<div class = 'media slide'> <a href = '$page_address' ><img src = '".$img->url."' class = 'rounded-img img' width = '$width' height = '$height'></a> <div class = 'bd'> <h1><a href = '$page_address' >".$slide_page->title."</a></h1> <p>".$summary." <a href = '$page_address' >... <span class = 'strong secondary'> Read More </span> </a></p> </div></div>";} return $slide; } function render($slide_pages, $p_class) { $slides_mu = '<div id="slides" class = "unit size1of1 man"> <div class="slides_container">'; $num_slides = count($slide_pages); foreach($slide_pages as $slide) { $slides_mu .= $this->renderSlide($slide); } $slides_mu .= '</div> <div class = "slider_nav"> <a href="#" class="prev">Prev</a> <ul class = "pagination">'; $slides_mu .= $this->addPaginationLinks($num_slides); $slides_mu .= '</ul> <a href="#" class="next">Next</a> </div>'; $slides_mu .= '</div>'; return $slides_mu; } } Link to comment Share on other sites More sharing options...
Adam Kiss Posted April 13, 2011 Share Posted April 13, 2011 I think that the problem might be here: $img= $slide_page->video_poster->width(300); I'm not sure what type that field is, but unless it's a single image, it won't work (it shouldn't). The question is though, how come it works on your local and doesn't on your server. Edit: Although, PW gives error for this line: $img= $slide_page->images->first()->width(300); Are you absolutely positive that there are no changes between localhost and your server (either in code or in database)? Link to comment Share on other sites More sharing options...
Gena Posted April 13, 2011 Author Share Posted April 13, 2011 Video_poster is an image field that only receives/ stores a single image, yes... Is far as any changes between localhost and live between code and database, as far as I know they are the same (except for a couple of lines I commented out in some files to disable Tera-Wurfl, but that shouldn't affect the Slider for instance in any way.) So if there is still a difference between the two environments in code or database, I'm still trying to find it... Link to comment Share on other sites More sharing options...
apeisa Posted April 13, 2011 Share Posted April 13, 2011 Hi Gena How did you deployed this live in the first place? DB-import & (s)ftp all the files? Link to comment Share on other sites More sharing options...
Gena Posted April 13, 2011 Author Share Posted April 13, 2011 I checked again, and with the slider, I found there was a bug that seemed to happen with not having any images loaded in the images field... I just need to write a default picture for the slider to default if there is none available or connected to the news piece/ video / article With some of the other problems, I *did* find some files that were changed between my local host and uploading it onto the live server, that was causing that one file wasn't being including, and that was the cause of the problems there But this has allready been a big help, with where I can get some 'temporary' sites live that people will be able to access Now I just need to try to get the Tera-Wurfl code working correctly so both the full and mobile site can be handled and redirected correctly Thank you so much! Hopefully I will be able to post a link to the completed site here soon, that you can see the finished project Link to comment Share on other sites More sharing options...
ryan Posted April 13, 2011 Share Posted April 13, 2011 Gena, Glad that you got it working! With the line that generated the error, you can add a check like this to make sure the field is populated: if($slide_page->video_poster) { $img = $slide_page->video_poster->width(300); } With fields that have multiple images, you can perform a check like this: if(count($slide_page->images)) { $img = $slide_page->images->first()->width(300); } I am thinking about adding a 'default image' option to the image fieldtype so that you can optionally have it use a default image when not populated. That way, you wouldn't ever need to perform the if() statements in your code. Link to comment Share on other sites More sharing options...
Gena Posted April 13, 2011 Author Share Posted April 13, 2011 Thank you With the default image option, I think that would be very useful, especially with something like thumbnails or profile pictures 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