-4

I don't understand, where the mistake is in this line of code.

$Header .= "<a href='#' onclick='ToggleView(\"Thumbnail\");return false;' title='Grid'><div class='" . if ($Starting_Layout = 'Thumbnail'){ echo 'active';} . " thumb-toggle-icon'></div></a>"; 

Can someone help me fix it?

4
  • 2
    What is your error message? I could see 2-3 possible errors. 1. if in assignment. 2. $Starting_Layout is being set, not compared. 3. $Header not initialized. Commented Sep 21, 2015 at 2:50
  • See also: Parse/Syntax errors: Unexpected T_IF. Commented Sep 21, 2015 at 3:01
  • It's the if ($Starting_Layout = 'Thumbnail'){ echo 'active';} . Replace this with using short-if: echo ($Starting_Layout = 'Thumbnail' ? "active" : "") Commented Sep 21, 2015 at 3:32
  • Thank you! Learn and learn. Commented Sep 21, 2015 at 19:00

1 Answer 1

1

An if statement halfway through your output string? That doesn't look suspicious to you?

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.