<?php

$currentPageID = CONST_ABOUT_PAGE_ID;

$profileAboutWhatIDoHeading = get_field('profile_about_work_heading',$currentPageID);

$profileAboutWorkIcon = array();
$profileAboutWorkTitle = array();
$profileAboutWorkContent = array();

if(have_rows('profile_about_work',$currentPageID)){
    while(have_rows('profile_about_work',$currentPageID)){
        the_row();      

        $profileAboutWorkIcon[] = get_sub_field('profile_about_work_icon',$currentPageID);
        $profileAboutWorkTitle[] = get_sub_field('profile_about_work_title',$currentPageID);
        $profileAboutWorkContent[] = get_sub_field('profile_about_work_content',$currentPageID);

    }
}

?>

<?php
    if(sizeof($profileAboutWorkIcon) > 0 ){
?>
    <div class="white-space-50"></div>

    <!-- Services -->
    <div class="row">
        <div class="col-xs-12 col-sm-12">
            <div class="block-title">
                <?php 
                    $tempArray = explode(",",$profileAboutWhatIDoHeading);
                    if(sizeof($tempArray) > 1 ){
                ?>
                    <h3><?php echo($tempArray[0]); ?> <span><?php echo($tempArray[1]); ?></span></h3>
                <?php
                    }
                    else{
                ?>
                    <h3><?php echo($tempArray[0]); ?></h3>
                <?php
                    }
                ?>
            </div>
        </div>
    </div>

    <div class="row">

        <?php
            for($outter=0; $outter < sizeof($profileAboutWorkIcon); $outter+=2 )
            {
        ?>

        <div class="col-xs-12 col-sm-6">
            <div class="col-inner">
                <div class="info-list-w-icon">
                    <?php
                        $tempValue = $outter+1;
                        for($counter=$outter; $counter <= $tempValue; $counter++ ){
                    ?>
                    <div class="info-block-w-icon">
                        <div class="ci-icon">
                            <i class="lnr <?php echo($profileAboutWorkIcon[$counter]); ?>"></i>
                        </div>
                        <div class="ci-text">
                            <h4><?php echo($profileAboutWorkTitle[$counter].$counter); ?></h4>
                            <?php echo($profileAboutWorkContent[$counter]); ?>
                        </div>
                    </div>
                    <?php
                        }
                    ?>
                </div>
            </div>
        </div>
        <?php
            }
        ?>

    </div>
    <!-- End of Services -->

<?php
    }
?>