Slider Creatives Codeigniter

0

I'm trying to create a slider with random ads on a site's home page.

I already have a role that shows related ads on the ad details page. But by using this same code on the home page of the site, nothing is displayed.

As I do not understand much of Codeigniter, I do not know if something is missing.

 if ($related) {
                        echo '
                            <div class="row">
                                <div class="medium-12 columns">
                                    <div class="ap-ads-related">
                                        <h2>Anúncios Relacionados</h2>
                                        <div class="row">
                            ';

                        foreach ($related as $key => $rel) {
                            $related_images = $this->ads_model->images($rel->ad_id);
                            $related_image = thumbnail(@$related_images[0]->ads_img_file, "ads", 260, 180, 2);

                            $textoCorte = substr($rel->ad_name, 0, 25);
                            $textoLimitado = substr($textoCorte, 0, strrpos($textoCorte, ' '));

                            echo '
                                    <div class="small-6 medium-3 end columns">
                                        <a href="' . base_url('anuncio/' . $rel->ad_slug) . '" title="' . $rel->ad_name . '" class="item">
                                            <div class="image"><img alt="' . $rel->ad_name . '" src="' . $related_image . '"></div>

                                            <h4>' . $textoLimitado . '<br> Ver mais</h4>

                                            <div class="price">' . (($rel->ad_service) ? 'Doação' : string_money($rel->ad_price)) . '</div>

                                        </a>
                                    </div>
                                ';
                        }
                        echo '
                                        </div>
                                    </div>  
                                </div>
                            </div>
                            ';
                    }
    
asked by anonymous 24.05.2018 / 16:54

0 answers