I currently have this array in layout.php
<?php
$arrLayout = array(
"section1" => array(
"wControl" => array(
"title" => "Control",
"display" => ""
),
"wRecentTV" => array(
"title" => "Recent TV",
"display" => ""
)
),
"section2" => array(
"wXBMCLibrary" => array(
"title" => "XBMC Library",
"display" => ""
)
),
"section3" => array(
"wSearch" => array(
"title" => "Search",
"display" => ""
),
"wRSS" => array(
"title" => "RSS Feed",
"display" => ""
)
),
);
?>
What I want to so is say. If ( $wControl == “true” ) and ‘wControl’ is not in any section then write
,
"wControl" => array(
"title" => "Control",
"display" => ""
)
to the end of section x between the ) and ), and rewrite the file.
Basically wControl may or may not exist in any one of the sections. So if it doesn’t exist it must be added to the array and layout.php must be rewritten to show it. Hope that all makes sense.
From what I can gather I can check if its in the array and then push it with
if (!in_array( wControl, $arrLayout ))
array_push(..)
How would I code this correctly?
Thanks
1 Answer