duplicate id-warning with if
I've got a div with "content", this div is inside a if-stat as follows:
if (isset ($_GET['s'])) {
echo '<div id="content">';
}
further down on the smae page I have:
if (!isset ($_GET['s'])) {
echo '<div id="content">';
}
this gives me a alert telling me I have duplicate ids on the same page (same goes for inside different functions)
is there anyway to tell phpstorm that they are not duplicates?
请先登录再写评论。
Hi Kristofer,
Unfortunately not -- unless you want to disable this particular inspection (via Alt+Tab or by clicking on "light bulb" icon).
In meantime -- watch/vote/etc this ticket: http://youtrack.jetbrains.com/issue/WI-5020 (and http://youtrack.jetbrains.com/issue/WI-1098 -- the same but for Smarty).
P.S.
The only other alternative is to re-think your code <--> design interaction, e.g. instead of (very basic general example, which may not be applicable to your case)
do something like this (the general idea)
if ($a) {$text = "bla bla..."
}
else {
$text = "Mega Bla Bla..."
}
echo '<div id="abc">' . $text;
ok thanks
that doesn't really help though since the only reason I "post the same id twice" like that is cause I want it in different places depending on the get
thanks though I'll follow those issues