"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)          
By gagester - August 18, 2009
          http://www.centrasodablasting.com/index2.php
Once I figure this out (with your help) I'll be (almost) set. :)
I can't seem to get the <div id="bttn"> to be "embedded" with the list of services/buttons on the left.
I want each service to have the "bttn" style and be spaced out to appear to fit in a button, rather than the entire list seeming to "float above" them as it appears to be doing now.
Ideas??
                                        
        Once I figure this out (with your help) I'll be (almost) set. :)
I can't seem to get the <div id="bttn"> to be "embedded" with the list of services/buttons on the left.
I want each service to have the "bttn" style and be spaced out to appear to fit in a button, rather than the entire list seeming to "float above" them as it appears to be doing now.
Ideas??
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:
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.
                          
        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
                    Chris
Re: [chris] "Linking" style with list of services (which functions as buttons)
By gagester - August 19, 2009
          perfect. simple enough. :) 
thank you!!
                                        
        thank you!!