Skip to content

Instantly share code, notes, and snippets.

@Dimox
Created January 10, 2013 11:55
Show Gist options
  • Save Dimox/4501510 to your computer and use it in GitHub Desktop.
Save Dimox/4501510 to your computer and use it in GitHub Desktop.
if ($cat == $cat1 || $parent == $cat1) $class = 'cat1';
if ($cat == $cat2 || $parent == $cat2) $class = 'cat2';
if ($cat == $cat3 || $parent == $cat3) $class = 'cat3';
if ($cat == $cat4 || $parent == $cat4) $class = 'cat4';
if ($cat == $cat5 || $parent == $cat5) $class = 'cat5';
if ($cat == $cat6 || $parent == $cat6) $class = 'cat6';
if ($cat == $cat7 || $parent == $cat7) $class = 'cat7';
@beholdr
Copy link

beholdr commented Jan 10, 2013

Блин, не к тому форку написал)

for ($i = 1; $i <= 7; $i++) {
  if ($cat == ${'cat'.$i} || $parent == ${'cat'.$i}) $class = 'cat'.$i;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment