Forum

Thread tagged as: Question, Blog

Php's if + blog custom not working...

I would like to choose template but for some reason it only loads the if sentence. Else is not working... Anyone masters php? — Thanks!

<?php

    if ($lang = 'en') {

        perch_blog_custom(array(
        'template' => 'post-en.html',
        'filter' => 'postSlug',
        'match' => 'eq',
        'value' => perch_get('s'),
        ));
    }

    else {

        perch_blog_custom(array(
        'template' => 'post.html',
        'filter' => 'postSlug',
        'match' => 'eq',
        'value' => perch_get('s'),
        ));
    }

?>
Raul Serrano

Raul Serrano 0 points

  • 6 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

You need to use == for comparison. A single = is an assignment.

:) Thanks Drew