0

On my homepage, I have a zentools module that creates a grid of images. Right now, the images link to the articles they are from, but I would prefer that they link to another page on the site. There doesn't seem to be an option to change the link within the actual module interface, so is there a way to do so by modifying some code, perhaps?

Edit:

defined('_JEXEC') or die('Restricted access'); 

$last = "";

$class = ' zt-'.$options->theme;

if($options->margin) {

    $class .= ' zt-no-margin';
}


// Count number of items in layout

$count = count((array)$layout);


// Load Matchheights

$match_height = "";

if($options->matchheight) { 

    $doc->addScript($media_path .'js/jquery.matchHeight-min.js');
    $match_height = 'data-match-height="zt-match-height"';
}

 ?>

 <div id="zentools-<?php echo $module->id;?>" class="zentools zt-grid zt-responsive-grid <?php echo $class;?>">
    <ul>
        <?php foreach ($list as $key => $item) { 

        $item_class = '';
        if($item->featured) {
            $item_class .= ' zt-featured';
        }
        ?>
            <li grid-col="1/<?php echo $options->maxcols;?>" class="zt-item<?php echo $item_class;?>" <?php echo $match_height;?>>
                <?php foreach ($columns as $column => $colwidth) { ?>
                    <div class="zt-col zt-col-<?php echo $colwidth;?>"> 
                        <?php $elements = $layout->$column;
                            $count = 0;
                            $total_elements = count((array)$elements);

                            foreach ($elements as $type => $element) {

                                $settings->count = $count;

                                if($count == 1) { ?>
                                    <div class="zt-item-container" <?php echo $match_height;?>>
                                <?php }

                                $zen->loadElement($element->type, $element, $item, $settings, $zen);

                                if($count == $total_elements) { ?>
                                    </div>
                                <?php } 
                                $count ++;
                            } ?>
                        </div>
                <?php } ?>      
            </li>
        <?php } ?>
    </ul>
</div>

<?php if($lightbox->enable) { $zen->loadBlock('lightbox', $module, $settings); } ?>
  • Yes, but without seeing the code, we can;t really help. Could you please share the code snipets from the necessary files – Lodder Jul 8 '15 at 16:04
  • Sorry, I'm a little new to this... how can I access the code? – Chris Jul 8 '15 at 16:05
  • The module you installed came as a zip file, open the zip file and the files are in there. We'll preferable need the code snippets from the default.php file – Lodder Jul 8 '15 at 16:11
  • Ok, I think I found the default.php file.. lemme learn how to format the code haha – Chris Jul 8 '15 at 16:21
  • Alright, I think that should be the right file. – Chris Jul 8 '15 at 16:42
1

My advice? Go back to the extension creator and ask them if they have a solution.If not, are they willing to do the mods for you?

If not, then you have two options:

  1. Find another extension that will provide you with the capability to individually set the URL destination.
  2. Modify the code yourself, or pay someone to do it.

Because the links are being dynamically generated, you will have to ascertain where it is going to get the new link information from, and set it accordingly.

This will entail setting a meta item for these links and referencing that meta item, and also creating a way to update that information in the database. You are not going to be able to just add a link to the code - unless you want the same link for every image that is displayed.

The code you are looking for is related to $zen->loadElement($element->type, $element, $item, $settings, $zen); You are going to have to work backwards and find the code where the elements for $item_class .= ' zt-featured'; are determined. This will then have the format for how it is creating the links.

As I said, you may find that it will be easier for you to research another plugin for this job, one that already includes what you need.

0

Try setting an alternative link for the article itself, under the links and images tab:

article link settings

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.