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;
}
}