"Linking" style with list of services (which functions as buttons)

3 posts by 2 authors in: Forums > CMS Builder
Last Post: August 19, 2009   (RSS)

Re: [gagester] "Linking" style with list of services (which functions as buttons)

By Chris - August 19, 2009

Hi gagester,

I'm not sure what you mean by embedding, but I did take a look at your code and I think I figured out what you're trying to accomplish.

All the HTML (and PHP) between the foreach and endforeach will be repeated, so if you want each service to appear in a <div id="bttn">, you'll want to put that <div> inside the foreach block. For example:

<?php foreach ($servicesRecords as $record): ?>

<div id="bttn">
<p>
<span class="bigger"><?php echo $record['name'] ?> </span><br>
<p><?php echo $record['button_text'] ?></p>
<a href="<?php echo $record['_link'] ?>"><img src="images/find-out-more.gif"></a><br/>
</p>
</div>

<?php endforeach; ?>


Then you get one <div> per service.

I've attached a modified version of your index2.php file with the above change.

P.S. You should probably be using class="bttn" instead of id="bttn". IDs are meant to be unique. Whether or not this will cause any real problems with browsers is anyone's guess though.
All the best,
Chris
Attachments:

index2_new.php 8K

Re: [chris] "Linking" style with list of services (which functions as buttons)

By gagester - August 19, 2009

perfect. simple enough. :)

thank you!!