I am creating a PHP menu system (for an education program) that has a whole lot of module numbers, if statements, etc.
What I would love to do is go:
'module_number' = 'NUMBER'
'module_name' = 'NAME'
'module_url' = 'URL',
'module_number' = 'NUMBER'
'module_name' = 'NAME'
'module_url' = 'URL',
'module_number' = 'NUMBER'
'module_name' = 'NAME'
'module_url' = 'URL', etc, etc
and that then creates a li element for each module above in the format:
<li>
NUMBER
<?php if (( NUMBER * 3 - 1 ) < $GlobalVariable ) { ?>
<a href="URL">NAME</a>
<?php } else { ?>
NAME
</li>
Is there some way I can do that?
I assume it would be with arrays, etc but I am still learning.
EDIT:
Ok, I've got a multidimensional array happening (thanks for telling me what they are called so I could learn).
$daysregistered = 2;
$modules = array (
array(0,'Thought Engineering Introduction','thought-engineering/'),
array(1,'Leadership','thought-engineering/leadership'),
array(2,'The Key to Velocity','thought-engineering/the-key-to-velocity'),
array(3,'Master Level Communication','thought-engineering/master-level-communication'),
array(4,'Priming for Opportunity','thought-engineering/'),
array(5,'Quality','thought-engineering/'),
array(6,'Your Most Critical Role as a Leader','thought-engineering/'),
array(7,'Comprehensive Single System Perspective','thought-engineering/'),
array(8,'Nexus Points & Income Time/Busy Time','thought-engineering/'),
array(9,'Goals, Precession & Motion','thought-engineering/'),
array(10,'Risk','thought-engineering/'),
array(11,'Measurement','thought-engineering/'),
array(12,'Bringing it All Together','thought-engineering/')
);
for ($row = 0; $row < 12; $row++) {
$unlocked = ( $modules[$row][0] * 3 - 1 ) < $daysregistered;
echo "<li>";
if ( $unlocked ) { echo "<a href='".$modules[$row][2]."'>"; };
echo "<span class='module_no'>".$modules[$row][0]."</span>";
echo "<span class='module_descript'>".$modules[$row][1];
echo "<span class='module_access";
if ( $unlocked ) { echo " lock"; };
echo"'><i class='fa fa-2x fa-";
if ( ! $unlocked ) { echo "un"; };
echo "lock";
if ( ! $unlocked ) { echo "-alt"; };
echo "' aria-hidden='true'></i></span></span>";
if ( $unlocked ) { echo "</a>"; };
echo "</li>";
}