Layout and display issue

5 posts by 2 authors in: Forums > CMS Builder
Last Post: September 26, 2011   (RSS)

By KCMedia - September 22, 2011

Hi

I have this page that has 2 divs on it one down one side and one down another side and inside these divs i want 4 products per div.

How can i make so that 4 showup in each div but they all come from the same muilt section.


I have included the file that has all the design and also below the code out of cmsb

<?php header('Content-type: text/html; charset=utf-8'); ?>
<?php


// load viewer library
$libraryPath = 'cmsAdmin/lib/viewer_functions.php';
$dirsToCheck = array('/var/www/vhosts/gasolinecustomgarage.com.au/httpdocs/','','../','../../','../../../');
foreach ($dirsToCheck as $dir) { if (@include_once("$dir$libraryPath")) { break; }}
if (!function_exists('getRecords')) { die("Couldn't load viewer library, check filepath in sourcecode."); }

// load records
list($used_motorcyclesRecords, $used_motorcyclesMetaData) = getRecords(array(
'tableName' => 'used_motorcycles',
'perPage' => '8',
));

?> <!-- STEP2: Display Records (Paste this where you want your records to be listed) -->
<h1>Used Motorcycles - List Page Viewer</h1>
<?php foreach ($used_motorcyclesRecords as $record): ?>
Record Number: <?php echo $record['num'] ?><br/>
Title: <?php echo $record['title'] ?><br/>
Content: <?php echo $record['content'] ?><br/>
_link : <a href="<?php echo $record['_link'] ?>"><?php echo $record['_link'] ?></a><br/>


<!-- STEP 2a: Display Uploads for field 'images' (Paste this anywhere inside STEP2 to display uploads) -->
<!-- Upload Fields: num, createdTime, tableName, fieldName, recordNum, preSaveTempId, filePath, filename, extension, thumbFilePath, isImage, hasThumbnail, urlPath, width, height, thumbUrlPath, thumbWidth, thumbHeight, info1, info2, info3, info4, info5 -->
<?php foreach ($record['images'] as $upload): ?>
<?php if ($upload['hasThumbnail']): ?>
<img src="<?php echo $upload['thumbUrlPath'] ?>" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>" alt="" /><br/>

<?php elseif ($upload['isImage']): ?>
<img src="<?php echo $upload['urlPath'] ?>" width="<?php echo $upload['width'] ?>" height="<?php echo $upload['height'] ?>" alt="" /><br/>

<?php else: ?>
<a href="<?php echo $upload['urlPath'] ?>">Download <?php echo $upload['filename'] ?></a><br/>

<?php endif ?>
<?php endforeach ?>
<!-- STEP2a: /Display Uploads -->


<hr/>
<?php endforeach ?>

<?php if ($used_motorcyclesMetaData['invalidPageNum']): ?>
Results page '<?php echo $used_motorcyclesMetaData['page']?>' not found, <a href="<?php echo $used_motorcyclesMetaData['firstPageLink'] ?>">start over &gt;&gt;</a>.<br/><br/>
<?php elseif (!$used_motorcyclesRecords): ?>
No records were found!<br/><br/>
<?php endif ?>
<!-- /STEP2: Display Records -->


<!-- STEP3: Display Page Links (Paste anywhere below "Load Record List") -->
<?php if ($used_motorcyclesMetaData['prevPage']): ?>
<a href="<?php echo $used_motorcyclesMetaData['prevPageLink'] ?>">&lt;&lt; prev</a>
<?php else: ?>
&lt;&lt; prev
<?php endif ?>

- page <?php echo $used_motorcyclesMetaData['page'] ?> of <?php echo $used_motorcyclesMetaData['totalPages'] ?> -

<?php if ($used_motorcyclesMetaData['nextPage']): ?>
<a href="<?php echo $used_motorcyclesMetaData['nextPageLink'] ?>">next &gt;&gt;</a>
<?php else: ?>
next &gt;&gt;
<?php endif ?>
<!-- /STEP3: Display Page Links -->
Thanks



Craig

KC Media Solutions

www.kcmedia.biz
Attachments:

used-motorcycles_006.php 11K

Re: [kcmedia] Layout and display issue

By Jason - September 23, 2011

Hi Craig,

I think this is what you're looking for:

<div id="page_left">
<div class="grid_4">
<h2 class="comm_title">used motorcycles</h2>
<ul class="shop_list">
<?php
$maxRecordsPerDiv = 4;
$recordCount = 0;
?>
<?php foreach ($used_motorcyclesRecords as $record): ?>
<?php if ((++$recordCount % $maxRecordsPerDiv) == 0): ?>
</ul>
</div>

<div class="grid_4 push_1">
<h2 class="comm_title">&nbsp;</h2>
<ul class="shop_list">
<?php endif ?>

<li>
<div class="left">
<h3 class="title"><?php echo $record['title'];?></h3>
<p class="desc"><?php echo $record['content'];?></p>
</div>
<div class="img">
<?php if ($image = @$record['images'][0]): ?>
<a href="<?php echo $record['_link'];?>"><img src="<?php echo $image['thumbUrlPath'];?>" alt="" /></a>
<?php endif ?>
</div>
</li>

<?php endforeach ?>
</ul>
</div>


It will output the first 4 records into 1 div, then create a second div to output the last 4.

Hope this helps get you started.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Layout and display issue

By KCMedia - September 23, 2011

Hi Jason

that didnt work i get this error

Notice: Undefined variable: used_motorcyclesRecords in /var/www/vhosts/gasolinecustomgarage.com.au/httpdocs/newsite/used-motorcycles.php on line 103 Warning: Invalid argument supplied for foreach() in /var/www/vhosts/gasolinecustomgarage.com.au/httpdocs/newsite/used-motorcycles.php on line 103


also now there is only 1 div on the left where does the one on the right showup there are 2 divs one called grid_4 and grid_4 push_1 that pushes the 2nd div to the right float on the page does this all matter.
Thanks



Craig

KC Media Solutions

www.kcmedia.biz
Attachments:

used-motorcycles_007.php 7K

Re: [kcmedia] Layout and display issue

By Jason - September 26, 2011

Hi Craig,

I took a look at your file and the getRecords call that you had posted in your original post is missing from your file:

// load records
list($used_motorcyclesRecords, $used_motorcyclesMetaData) = getRecords(array(
'tableName' => 'used_motorcycles',
'perPage' => '8',
));


This is the call that gets the records out of the database to display in your divs.

Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/