Main
Index
Search
Posts
Who's
Online
Log
In

Home: Products: CMS Builder:
Help with some code

 

 


kcmedia
User

Nov 15, 2011, 1:07 AM

Post #1 of 6 (1221 views)
Shortcut
Help with some code Can't Post

Hi all

i have this page attached called gallery and the layout works ok but i am having problems getting it to work with cmsb i have uploaded gallery page and below if the code out of cmsb.

<?php header('Content-type: text/html; charset=utf-8'); ?>
<?php
/* STEP 1: LOAD RECORDS - Copy this PHP code block near the TOP of your page */

// load viewer library
$libraryPath = 'cmsAdmin/lib/viewer_functions.php';
$dirsToCheck = array('','../','../../','../../../');
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($galleryRecords, $galleryMetaData) = getRecords(array(
'tableName' => 'gallery',
'perPage' => '8',
));

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
<style type="text/css">
body { font-family: arial; }
.instructions { border: 3px solid #000; background-color: #EEE; padding: 10px; text-align: left; margin: 25px}
</style>
</head>
<body>

<!-- INSTRUCTIONS -->
<div class="instructions">
<b>Sample List Viewer - Instructions:</b>
<ol>
<?php /*><li style="color: red; font-weight: bold">Rename this file to have a .php extension!</li><x */ ?>
<li><b>Remove any fields you don't want displayed.</b> (Most list pages only have title and link fields.)</li>
<li>Rearrange remaining fields to suit your needs.</li>
<li>Copy and paste code into previously designed page (or add design to this page).</li>
</ol>
</div>
<!-- /INSTRUCTIONS -->

<!-- STEP2: Display Records (Paste this where you want your records to be listed) -->
<h1>Gallery - List Page Viewer</h1>
<?php foreach ($galleryRecords as $record): ?>
Record Number: <?php echo $record['num'] ?><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 ($galleryMetaData['invalidPageNum']): ?>
Results page '<?php echo $galleryMetaData['page']?>' not found, <a href="<?php echo $galleryMetaData['firstPageLink'] ?>">start over &gt;&gt;</a>.<br/><br/>
<?php elseif (!$galleryRecords): ?>
No records were found!<br/><br/>
<?php endif ?>
<!-- /STEP2: Display Records -->


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

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

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


</body>
</html>
Thanks

Craig
KC Media Solutions
www.kcmedia.biz
Attachments: gallery.php (8.24 KB)


Jason
Staff / Moderator


Nov 15, 2011, 9:37 AM

Post #2 of 6 (1212 views)
Shortcut
Re: [kcmedia] Help with some code [In reply to] Can't Post

Hi Craig,

Could you give some more details about the types of problems you're having?

Thanks
---------------------------------------------------
Jason Sauchuk - Programmer 
interactivetools.com

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


kcmedia
User

Nov 19, 2011, 4:24 PM

Post #3 of 6 (1161 views)
Shortcut
Re: [Jason] Help with some code [In reply to] Can't Post

Hi Jason

i got most of it working but need some help with this part of the code with the page links

here is the cmsb code

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

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

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

and this is the code from the site i cant get it to work like this

<div class="pagination">
<ul>
<li><a class="previous-1" href="#"><span class="circle-arrow-left"></span>Previous</a></li>
<li><a class="current" href="#">1</a></li>
<li><a href="#">2</a></li>
<li><a href="#">3</a></li>
<li><a href="#">4</a></li>
<li><a href="#">5</a></li>
<li><a class="next-1" href="#">Next<span class="circle-arrow"></span></a></li>
</ul>
</div>
Thanks

Craig
KC Media Solutions
www.kcmedia.biz


Jason
Staff / Moderator


Nov 21, 2011, 9:34 AM

Post #4 of 6 (1115 views)
Shortcut
Re: [kcmedia] Help with some code [In reply to] Can't Post

Hi Craig,

Take a look at this post:

http://www.interactivetools.com/forum/gforum.cgi?post=77535#77535

Is this what you're looking for?

Hope this helps
---------------------------------------------------
Jason Sauchuk - Programmer 
interactivetools.com

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


kcmedia
User

Nov 21, 2011, 11:51 AM

Post #5 of 6 (1112 views)
Shortcut
Re: [Jason] Help with some code [In reply to] Can't Post

Hi Jason

sort of i am trying to get the cmsb code into the same style but i put all the styling there ut still shows up the standard way.
Thanks

Craig
KC Media Solutions
www.kcmedia.biz


Jason
Staff / Moderator


Nov 21, 2011, 11:54 AM

Post #6 of 6 (1111 views)
Shortcut
Re: [kcmedia] Help with some code [In reply to] Can't Post

Hi Craig,

The CMSB code generator doesn't create code to show pages in the same way as in the previous post. To do that does require some custom programming.

Can you use that example to create your pagination list without the styling, and then add the styling in later?
---------------------------------------------------
Jason Sauchuk - Programmer 
interactivetools.com

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