-
-
Save mattclements/8549e915ae3cae097cfb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<section class="section // section--base // section--fixed"> | |
<div class="container"> | |
<?php | |
//Array (Feature Title, Feature Description, Icon Class); | |
$adverts = array ( | |
array('No Call Out Charge','Free quotation for all jobs','no-callout'), | |
array('Qualified Plumbers','Qualified Gas Safe Engineers','tick'), | |
array('Free Quotations','No obligation free quotations','contract'), | |
array('Great Service','Knowledgeable, experienced staff','thumb'), | |
array('5 Star Reviews','We are trustworthy and reliable','star'), | |
array('No Call Center','Speak with our experienced staff','no-call-center'), | |
); | |
$selected_adverts = array_rand($adverts, 2); | |
foreach($selected_adverts as $selected_advert) | |
{ | |
echo '<div class="feature-half">'; | |
echo '<svg class="icon icon-feature" aria-labelledby="title-icon-'.$adverts[$selected_advert][2].'" aria-describedby="desc-icon-'.$adverts[$selected_advert][2].'"><use xlink:href="/assets/img/icons.svg#icon-'.$adverts[$selected_advert][2].'"></use></svg>'; | |
echo '<h2 class="feature-half__title">'.$adverts[$selected_advert][0].'</h2>'; | |
echo '<p class="feature-half__text">'.$adverts[$selected_advert][1].'…</p>'; | |
echo '</div>'; | |
} | |
?> | |
<div class="feature-half__cta"> | |
<?php include($_SERVER['DOCUMENT_ROOT'].'/includes/module.tel.php'); ?> | |
</div> | |
</div> | |
</section> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<section class="section // section--base // section--fixed"> | |
<div class="container"> | |
<?php | |
//Array (Feature Title, Feature Description, Icon Class); | |
$adverts = array ( | |
array('title' => 'No Call Out Charge', 'text' => 'Free quotation for all jobs', 'icon' => 'no-callout'), | |
array('title' => 'Qualified Plumbers', 'text' => 'Qualified Gas Safe Engineers', 'icon' => 'tick'), | |
array('title' => 'Free Quotations', 'text' => 'No obligation free quotations', 'icon' => 'contract'), | |
array('title' => 'Great Service', 'text' => 'Knowledgeable, experienced staff', 'icon' => 'thumb'), | |
array('title' => '5 Star Reviews', 'text' => 'We are trustworthy and reliable', 'icon' => 'star'), | |
array('title' => 'No Call Center', 'text' => 'Speak with our experienced staff', 'icon' => 'no-call-center'), | |
); | |
$selected_adverts = array_rand($adverts, 2); | |
foreach($selected_adverts as $selected_advert) | |
{ | |
echo '<div class="feature-half">'; | |
echo '<svg class="icon icon-feature" aria-labelledby="title-icon-'.$adverts[$selected_advert]['icon'].'" aria-describedby="desc-icon-'.$adverts[$selected_advert]['icon'].'"><use xlink:href="/assets/img/icons.svg#icon-'.$selected_advert['icon'].'"></use></svg>'; | |
echo '<h2 class="feature-half__title">'.$adverts[$selected_advert]['title'].'</h2>'; | |
echo '<p class="feature-half__text">'.$adverts[$selected_advert]['text'].'…</p>'; | |
echo '</div>'; | |
} | |
?> | |
<div class="feature-half__cta"> | |
<?php include($_SERVER['DOCUMENT_ROOT'].'/includes/module.tel.php'); ?> | |
</div> | |
</div> | |
</section> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Either will work - the 2nd example is more readable if you can change the original array to be associative.