Limit line display in Joomla

0

I work in a company that is in the business of covenants, but I have verified that on their website, when I put them on the page of seeing agreements, it loads all at once, which makes the site very heavy. It's done on the Joomla platform, but I do not have much knowledge on the platform.

Code:

<?php
if(!defined('_VALID_MOS')){
    define('_VALID_MOS', 1);
}
if(!defined('CURRENT_DIRECTORY')){
// JPATH_BASE should point to Joomla!'s root directory
    define('CURRENT_DIRECTORY', realpath(dirname(__FILE__)) . '/');
}
if(!defined('DS')){
    define('DS', DIRECTORY_SEPARATOR);
}
require_once ( JPATH_BASE . DS . 'includes' . DS . 'defines.php' );
require_once ( JPATH_BASE . DS . 'includes' . DS . 'framework.php' );
require_once ( CURRENT_DIRECTORY . 'custom.fields.php' );
$mainframe = & JFactory::getApplication('site');
$mainframe->initialise();
$user = & JFactory::getUser();
$session = & JFactory::getSession();
$db = & JFactory::getDBO();

$query = " SELECT * FROM #__content WHERE alias='conveniados' ";
$db->setQuery($query);
$result = $db->loadAssoc();

$customFields = json_decode(CustomFields::getFields($result["id"]));
?>
<div class="columns pad-3">
    <?php
    $conveniados = array();
    $destaques = array();
    $servicos = array();
    $locais = array();
    $especialidades = array();
    $convs = json_decode(file_get_contents($customFields->webservice));
    foreach($convs as $conv){
        $info = array();
        $info["nome"] = $conv->nmConveniado;
        $info["categoria"] = $conv->listaEspecialidade[0]->nmEspecialidade;
        $especialidades[] = $conv->listaEspecialidade[0]->nmEspecialidade;
        $info["endereco"] = $conv->listaEndereco[0]->nmLogradouro;
        $info["bairro"] = $conv->listaEndereco[0]->nmBairro;
        $info["cidade"] = $conv->listaEndereco[0]->nmCidade;
        $info["telefone"] = $conv->dsTelefone1;
        $locais[] = $conv->listaEndereco[0]->nmCidade;
        $info["estado"] = $conv->listaEndereco[0]->sgEstado;
        $servicos_str = '';
        $k=0;
        foreach($conv->listaServico as $serv_str){
            $k++;
            $servicos[] = $serv_str->nmServico;
            if($k==count($conv->listaServico)){
                $servicos_str .= $serv_str->nmServico;
            } else {
                $servicos_str .= $serv_str->nmServico.', ';
            }
        }
        $info["servicos"] = $servicos_str;
        $info["imagem"] = $conv->listaImagem[0]->nmArquivo;
        $conveniados[] = $info;
        if($conv->flDestaqueSite){
            $destaques[] = $info;
        }
    }
    $_especialidades = array_unique($especialidades);
    $_servicos = array_unique($servicos);
    $_locais = array_unique($locais);
    asort($_especialidades);
    asort($_servicos);
    asort($_locais);
    ?>
    <div class="search-bar">
        <div class="links">
            <?php if($customFields->link_android){ ?>
            <a href="<?php echo $customFields->link_android; ?>" target="_blank" class="android">
                <p>BAIXE AGORA NOSSO APLICATIVO</p>
                <span class="image"></span>
            </a>
            <?php } ?>
            <?php if($customFields->link_ios){ ?>
            <a href="<?php echo $customFields->link_ios; ?>" target="_blank" class="ios">
                <p>BAIXE AGORA NOSSO APLICATIVO</p>
                <span class="image"></span>
            </a>
            <?php } ?>
        </div>
        <div class="input-box">
            <i class="fa fa-search"></i>
            <input type="text" id="searchQuery" />
        </div>
        <div class="select-box">
            <select name="locais-select" class="locais-s">
                <option value>Local do conveniado</option>
                <?php foreach($_locais as $local){ ?>
                    <?php if(trim($local)!=''){ ?>
                    <option value="<?php echo $local; ?>"><?php echo $local; ?></option>
                    <?php } ?>
                <?php } ?>
            </select>
            <select name="especialidades-select" class="especialidades-s">
                <option value>Especialidades</option>
                <?php foreach($_especialidades as $especialidade){ ?>
                    <?php if(trim($especialidade)!=''){ ?>
                    <option value="<?php echo $especialidade; ?>"><?php echo $especialidade; ?></option>
                    <?php } ?>
                <?php } ?>
            </select>
            <select name="servicos-select" class="servicos-s">
                <option value>Serviços</option>
                <?php foreach($_servicos as $servico){ ?>
                    <?php if(trim(servico)!=''){ ?>
                    <option value="<?php echo $servico; ?>"><?php echo $servico; ?></option>
                    <?php } ?>
                <?php } ?>
            </select>
        </div>
    </div>

    <div class="conv-destaque">
        <div class="conv-destaque-inner">
            <?php $d=0; ?>
            <?php shuffle($destaques); ?>
            <?php foreach($destaques as $destaque){ ?>
                <?php 
                $d++; 
                if($d<=2){ 
                ?>
                    <div 
                    class="conv-destaque-item" 
                    especialidade="<?php echo $destaque["categoria"]; ?>"
                    local="<?php echo $destaque["cidade"]; ?>"
                    nome="<?php echo $destaque["nome"]; ?>"
                    servicos="<?php echo $destaque["servicos"]; ?>"
                    >
                        <div class="destaque-item-imagem">
                            <?php if($destaque["imagem"] != ''){ ?>
                            <img border="0" src="<?php echo $destaque["imagem"]; ?>" alt="<?php echo $destaque["nome"]; ?>" />
                            <?php } else { ?>
                            <img border="0" src="<?php echo JURI::base(); ?>images/blank-conv.jpg" alt="<?php echo $destaque["nome"]; ?>" />
                            <?php } ?>
                        </div>
                        <div class="destaque-item-info">
                            <p class="info-t" title="<?php echo $destaque["nome"]; ?>"><?php echo $destaque["nome"]; ?></p>
                            <p>Categoria: <?php echo $destaque["categoria"]; ?></p>
                            <p><?php echo $destaque["endereco"]; ?>, <?php echo $destaque["bairro"]; ?>, <?php echo $destaque["cidade"]; ?> - <?php echo $destaque["estado"]; ?></p>
                            <p><?php echo $destaque["telefone"]; ?></p>
                        </div>
                    </div>
                <?php } ?>
            <?php } ?>
        </div>
    </div>

    <div class="conv-lista">

        <div class="conv-lista-header">
            <span>Conveniados</span>
        </div>

        <div class="conv-lista-inner">
            <div class="conv-lista-overflow">
                <?php foreach($conveniados as $conveniado){ ?>
                <div 
                class="conv-lista-item" 
                especialidade="<?php echo $conveniado["categoria"]; ?>"
                local="<?php echo $conveniado["cidade"]; ?>"
                nome="<?php echo $conveniado["nome"]; ?>"
                servicos="<?php echo $conveniado["servicos"]; ?>"
                >
                    <div class="lista-item-imagem">
                        <?php if($conveniado["imagem"] != ''){ ?>
                        <img border="0" src="<?php echo $conveniado["imagem"]; ?>" alt="<?php echo $conveniado["nome"]; ?>" />
                        <?php } else { ?>
                        <img border="0" src="<?php echo JURI::base(); ?>images/blank-conv.jpg" alt="<?php echo $conveniado["nome"]; ?>" />
                        <?php } ?>
                    </div>
                    <div class="lista-item-info">
                        <p class="info-t" title="<?php echo $conveniado["nome"]; ?>"><?php echo $conveniado["nome"]; ?></p>
                        <p>Categoria: <?php echo $conveniado["categoria"]; ?></p>
                        <p><?php echo $conveniado["endereco"]; ?>, <?php echo $conveniado["bairro"]; ?>, <?php echo $conveniado["cidade"]; ?> - <?php echo $conveniado["estado"]; ?></p>
                        <p><?php echo $conveniado["telefone"]; ?></p>
                    </div>
                </div>
                <?php } ?>
            </div>
        </div>

    </div>

</div>
<?php
?>

The list appears in div conv-lista-inner

    
asked by anonymous 16.03.2018 / 13:31

0 answers