このデータを として保存された配列に持っています$eventTitles
。アルファベット順に並べてみました。
Array (
[Customer Challenge - Sustainability] => Customer Challenge - Sustainability
[Manifesto Stores] => Manifesto Stores
[Helpful Heroes] => Helpful Heroes
[Ben 5 places left test] => Ben 5 places left test
[Ben sold out test] => Ben sold out test
[Ben 1 space left test] => Ben 1 space left test
[Follow the Product] => Follow the Product
[Living the Operating Model] => Living the Operating Model
[Leaders Unplugged] => Leaders Unplugged
[Market Trends] => Market Trends
[FINAL MASTER EVENT CONFIG - DO NOT AMEND] => FINAL MASTER EVENT CONFIG - DO NOT AMEND
[You Can Do It] => You Can Do It
[Customer Challenge - Communicating EDLP] => Customer Challenge - Communicating EDLP
)
使用:
$eventTitles = ksort($eventTitles);
foreach($eventTitles as $title) {
$t = urlencode($title);
//if statement to check if the title is in the url param
//and if it is we can put selected in the left hand nav as a class
if($_GET["title"] == $title ) {
$selected = ' class="selected"';
} else {
$selected = ' ';
}
$rtnStr .= '<li><a'.$selected.'href="list.php?title='.urlencode($title).
'" data-value="'.$title.'">'.$title.'</a></li>';
}
タイトルをループしてそれぞれをレンダリングしようとすると、次のエラーが発生します。
警告: 281 行目の model.php の foreach() に無効な引数が指定されました
何がうまくいかないかについての手がかりがあれば、私は大歓迎です。