1

On a Drupal 7 site with pathauto installed I'm using a view to show all taxonomy terms of a given node. The terms are linked to the term's page. The problem is, that the path of those terms does not use the url alias' that are set for the terms. Is there a way (without programmatically rewrite the view) to use alias in a view?

I know about the globalredirect module, but a redirect is not a clean solution here, in my opinion. And I do not understand why the pathes aren't replaced by there aliases in a view, can someone explain please?

3
  • Need help please.
    – user26985
    Commented Jan 22, 2015 at 13:05
  • When listing terms, Views uses the aliases by default. How does your view know which node to show terms for? Contextual filters? Commented Jan 23, 2015 at 21:29
  • Thank you. I managed to make it work. I just create a template in which I made a loop on view The display to manual.
    – user26985
    Commented Jan 26, 2015 at 11:22

1 Answer 1

0
<div id="nos_produits" class="grids_of_3 grids_of_3_accueil">

<?php 


$field = $view->result;
?>

<?php 

    foreach($field as $obj){


     $url = drupal_lookup_path('alias', 'taxonomy/term/'. $obj->tid);

?>
<div id="nos_produits" class="grids_of_3 grids_of_3_accueil">
<div class="grid1_of_3 div_cat_accueil">

    <a href="<?php echo $url;?>">
        <div>
            <p><span><?php echo $obj->taxonomy_term_data_name;?></span></p>
        </div>
        <img src="http://faliam.com/demo/sites/default/files/styles/catalogueimage/public/catalogue/<?php echo $obj->_field_data['tid']['entity']->field_illustration['und'][0]['filename'];  ?>" alt="" height="300" width="368">

    </a>


    </div>
    </div>

<?php

}

?>
</div>
1
  • 1
    Well I'm interested for a better solution. Thanks: o)
    – user26985
    Commented Jan 26, 2015 at 11:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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