We are transitioning over to a new forum platform. Please post new issues there. Existing threads will be dealt with here unless you choose to move them over. Visit the new forum

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

  • 4 years ago
Drew McLellan

Drew McLellan 2637 points
Perch Support

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

:) Thanks Drew