CMS Builder

6 posts by 2 authors in: Forums > CMS Builder
Last Post: November 14, 2012   (RSS)

By knight_oWL - November 12, 2012

Having some issues with CMS Builder; have used this before and had no problems, however this u/l is causing some problems.

index.php is showing the following on all php links: Notice: Undefined variable: tl_home_pageRecord in /home/twis2066/public_html/index.php on line 221

also, photo uploads are not appearing.

furniture.php is giving the following: Record not found!

I've looked over these a few times and am not sure where the problem is.

SOS [:/]

Re: [knight_oWL] CMS Builder

By gregThomas - November 12, 2012

Hi night owl,

Please could you post or attach your code for me? That way I can take a closer look at what might be causing the issues. The most common causes of the issues you have are:

You probably don't have $tl_home_pageRecord set to anything. Is the variable name correct?

Are you using the getRecords function to display the uploads? If you are have you set loadUploads to true? Your getRecords function would look something like this:

list($mainContents, $MetaData) = getRecords(array(
'tableName' => 'test_1',
'loadUploads' => true,
'allowSearch' => false,
));


So you need to check that loadUploads is set to true in your getRecords function.

funiture.php is most likely returning record not found because:
1) Something is incorrect in your getRecords function. ie, the incorrect table name, or field name in a where clause.
2) If you have allowSearch set to true in the getRecords function, check that the number value in the url has a corresponding record.
3) Finally, the line that is causing this error will look something like this:

if (!$variable) { dieWith404("Record not found!"); } // show error message if no record found

Check that the variable is being set with something further up the page.

Thanks
Greg Thomas







PHP Programmer - interactivetools.com

Re: [greg] CMS Builder

By knight_oWL - November 12, 2012 - edited: November 12, 2012

Hi Greg,

Thanks for getting back to me, just had a closer look...

'loadUploads' => true, (this was set correctly)

tl_homepage is the MySQL table given when I created the section - for some reason I have tl_home_pageRecord as variable name in php snippets - weird? These are paste directly from the code generator. I have made this change and the page now loads correct along with pictures.

also, a couple more question :) How do I specify the height and width parameters for pic uploads? I (of course) would like them to display at correct size on the Site, however when this gets over to the client I am positive that almost any size pic will be uploaded. also, how can I setup CMS so that the existing pic needs to be deleted before another pic is able to u/l in place. Hope that makes sense. Here is the code snippet for pics:

<?php if ($upload = @$tl_homepageRecord['main_1_pic'][0]):?>
<img src="<?php echo $upload['urlPath'] ?>" width="<?php echo $upload['width'] ?>" height="<?php echo $upload['height'] ?>" alt="" />
<?php endif?>

Sorry abt this, not a php guru by any means, prob. an easy fix.

Now furniture.php

I've looked this over again, and not being a php guy cannot see where things might be out. looking for variations in other records I do see one...

$rustic_furnitureRecord = @$rustic_furnitureRecords[0]; // get first record

whereas with all other table names we have @$tablenameRecords[1];

I'm certain that this is the problem, but am not clear on how to correct this within the code generator.

I appreciate your help on this!

Re: [knight_oWL] CMS Builder

By gregThomas - November 13, 2012

You can specify the height and width of a picture by going to the section editor section, then clicking modify on the section you want to edit from the section list, then clicking modify on the upload field. A dialog box should pop up that looks like the image that I've attached. Press the input validation link and you will see a list of options to resize pictures. If you tick tick the create thumbnail 2 checkbox and enter the dimesions you want to use. Then press the recreate link to create the resized images for any images you've already uploaded. You can also stop the user uploading more than one picture by changing the maximum uploads to 1.

You can display the new thumbnail 2 using this code:

<?php if ($upload = @$tl_homepageRecord['main_1_pic'][0]):?>
<img src="<?php echo $upload['thumbUrlPath2'] ?>" width="<?php echo $upload['width'] ?>" height="<?php echo $upload['height'] ?>" alt="" />
<?php endif?>


I think you are close with furniture.php, if you could upload or paste your code, I might be able to spot the problem.

Thanks!
Greg Thomas







PHP Programmer - interactivetools.com
Attachments:

uploads.png 23K

Re: [greg] CMS Builder

By knight_oWL - November 14, 2012 - edited: November 14, 2012

Hi Greg,

I re-sized the images using the thumbnail and restricted the max. u/l's to one in the section editor. Didn't see the advanced options there (thnks) however, when I resize the image using the thumbnail on existing picture, I get a very grainy/pixelated version. I u/l a larger pic with dimensions outside the restricted range, but when it resized it did so with constraints; in other words it did not resize to the specified dimension (in section editor), only to one dimension (height) and the width was constrained by the original dimension of the pic. (constrained proportions)

I'm new to the forum to, so I assume you need the entire code for furniture.php...? I'm sure you can spot the problem, and I appreciate your help in this. I need to get this Site wrapped up! :)


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

// load viewer library
$libraryPath = 'cmsAdmin/lib/viewer_functions.php';
$dirsToCheck = array('/home/twis2066/public_html/','','../','../../','../../../');
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 record from 'rustic_furniture'
list($rustic_furnitureRecords, $rustic_furnitureMetaData) = getRecords(array(
'tableName' => 'rustic_furniture',
'where' => '', // load first record
'loadUploads' => true,
'allowSearch' => false,
'limit' => '1',
));
$rustic_furnitureRecord = @$rustic_furnitureRecords[0]; // get first record
if (!$rustic_furnitureRecord) { dieWith404("Record not found!"); } // show error message if no record found

?>
<!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>Rustic Furniture</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>

<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="utf-8">

<!-- CHECKLIST: Remove if activated in .htaccess -->
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

<!-- CHECKLIST: Test on CMS
-->
<title>Twisted Log Rustic Furniture</title>

<!-- CHECKLIST: Test on CMS
SEO, need to be on every indexing page -->
<meta name="description" content="Rustic Log Furniture in Cochrane, Alberta, Canada" />
<meta name="keywords" content="affordable log furniture,discount log furniture,hand crafted log furniture,handcrafted log furniture,log furniture,log furniture benches,log furniture chairs,log furniture for sale,log furniture futon,log patio furniture,rustic log cabin furniture,rustics log furniture" />
<meta name="author" content="Eldon Preston www.twistedlog.ca" />
<meta name="copyright" content="www.twistedlog.ca, Larissa Pitton" />
<meta name="distribution" content="Global" />
<meta name="revisit-after" content="30 days" />
<meta name="robots" content="furniture, follow" />
<meta name="url" content="http://www.twistedlog.ca/" />
<meta name="language" content="English" />

<meta name="viewport" content="width=device-width">

<!-- CHECKLIST: Test on CMS
Canonical url for a page to index in search engines -->
<link rel="canonical" href="">

<link rel="stylesheet" href="publish/style.css">
<!--[if lt IE 8]><link rel="stylesheet" href="publish/style.ie.css"><![endif]-->

<script src="http://yandex.st/modernizr/2.6.1/modernizr.min.js"></script>
<script src="http://yandex.st/jquery/1.8.1/jquery.min.js"></script>
<script src="publish/script.js"></script>
</head>
<body>
<!--<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/ru_RU/all.js#xfbml=1";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>-->

<!--script language="javascript">
$(document).ready(
function (){
$("#pikame2").PikaChoose({
animationSpeed: 1000,
showCaption:false,
carousel: false
});
});
</script-->
<header class="b-header">
<a class="b-logo" href="index.php" title="Twisted Log - Log constrauctions and furnishing">Main page</a>
<nav class="b-menu">
<ul>
<li class="b-menu__item">
<a class="b-menu__item-link" href="index.php">home</a>
</li>
<li class="b-menu__item">
<a class="b-menu__item-link" href="about.php">about us</a>
</li>
<li class="b-menu__item">
<a class="b-menu__item-link" href="where2cus.php">where to see us</a>
</li>
<li class="b-menu__item">
<a class="b-menu__item-link" href="quotes.php">quotes</a>
</li>
</ul>

</nav>
<nav class="b-submenu">
<ul>
<li class="b-submenu__item b-submenu__item_active">
<a class="b-submenu__item-link" href="furniture.php">Rustic Furniture »</a>
</li>
<li class="b-submenu__item">
<a class="b-submenu__item-link" href="log_timber.php">Log & Timber Construction »</a>
</li>
<li class="b-submenu__item">
<a class="b-submenu__item-link" href="homes_cabins.php">Log Homes & Cabins »</a>
</li>
<li class="b-submenu__item">
<a class="b-submenu__item-link" href="homes_cabins.php">Railing & Stairs »</a>
</li>
</ul>

</nav>
<figure class="b-signup">
<a class="b-signup__link b-signup__link_fb" target="_blank" href="https://www.facebook.com/TwistedLog">Sign in as facebook</a>
<a class="b-signup__link b-signup__link_fl" target="_blank" href="http://www.flickr.com/photos/twistedlog/sets/">Sign in as flickr</a>
<p class="b-signup__txt">SIGN UP FOR OUR <big>newsletters</big></p>
<form class="b-signup__form" action="FormToEmail.php" method="get">
<fieldset>
<div class="b-signup__input">
<input type="text" placeholder="Enter Your Email Here..." id="usr_email" name="optin"/>
</div>
<input class="b-signup__submit" type="submit"/>
</fieldset>
</form>
</figure>
</header>
<div class="b-slider b-slider_furniture">
<div class="b-welcome__wrap">
<i class="b-welcome__decor"></i>
<div class="b-welcome b-welcome_inner"><?php echo htmlencode($rustic_furnitureRecord['rf_title']) ?></div>
</div>
<ul id="pikame2" >
<li><img src="tmp/furniture1.jpg"/></li>
</ul>
<i class="g-gray-triangle_left"></i>
<i class="g-gray-triangle_right"></i>
</div>
<div class="l-content">
<div class="l-content__inner">
<div class="b-text">
<p><span style="color: #915113"><strong><em><big>You imagine… and we create…</big></em></strong></span></p>
<p><?php echo $rustic_furnitureRecord['rf_content']; ?></p>
</div>
<section class="b-furniture">
<div class="b-furniture__item">
<p class="b-furniture__title">LIVE EDGE FURNITURE</p>
<div class="b-furniture__types">
<i class="b-furniture__link_decor" style="background-image: url(tmp/furniture2.jpg)"></i>
<a class="b-furniture__link fancy" href="rf1.html" ></a>
</div>
</div>
<div class="b-furniture__item">
<p class="b-furniture__title">LOG & TIMBER FURNITURE</p>
<div class="b-furniture__types">
<i class="b-furniture__link_decor" style="background-image: url(tmp/furniture3.jpg)"></i>
<a class="b-furniture__link fancy" href="rf2.html" ></a>
</div>
</div>
<div class="b-furniture__item">
<p class="b-furniture__title">RECLAIMED FURNITURE</p>
<div class="b-furniture__types">
<i class="b-furniture__link_decor" style="background-image: url(tmp/furniture4.jpg)"></i>
<a class="b-furniture__link fancy" href="rf3.html" ></a>
</div>
</div>
<div class="b-furniture__item">
<p class="b-furniture__title">SPECIALTY ITEMS</p>
<div class="b-furniture__types">
<i class="b-furniture__link_decor" style="background-image: url(tmp/furniture5.jpg)"></i>
<a class="b-furniture__link fancy" href="rf4.html" ></a>
</div>
</div>
</section>
<div class="b-text">
<p>Contact us to discuss your needs or to set an appointment.</p>
<p><strong>Twisted Log Ltd.</strong><br/>
<span style="color: #915113">Phone: (4030 932-1158 Fax: 1-866-283-2597<br/>
Box 1035 Cochrane, AB, T4C 1B1</span><br/>
info@twistedlog.ca </p>
</div>
</div> <!-- l-content__inner -->
</div> <!-- l-content -->
<footer class="b-footer-wrap">
<figure class="b-footer">
<div class="b-footer__arrow_left"></div>
<div class="b-footer__arrow_right"></div>

<div class="b-copyright hcard">
<strong>Powered by:</strong><br/>
<span class="b-copyright__firm fn org">TwistedLogLtd.</span><br/>
P. O. Box 1035<br/>
Cochrane, AB, T4C 1B1<br/>
Tel: <span class="tel">(403) 932 - 1158</span><br/>
<span class="email"><a href="mailto:info@twistedlog.ca">info@twistedlog.ca</a></span><br/>
Copyright © 2007-2012
</div>

<nav class="b-footer-menu">
<ul>
<li class="b-footer-menu__item b-footer-menu__item_active">
<a class="b-footer-menu__item-link" href="index.php">home</a>
</li>
<li class="b-footer-menu__item">
<a class="b-footer-menu__item-link" href="about.php">about us</a>
</li>
<li class="b-footer-menu__item">
<a class="b-footer-menu__item-link" href="where2cus.php">where to see us</a>
</li>
<li class="b-footer-menu__item">
<a class="b-footer-menu__item-link" href="quotes.php">quotes</a>
</li>
</ul>
</nav>

<nav class="b-footer-submenu">
<ul>
<li class="b-footer-submenu__item">
<a class="b-footer-submenu__item-link" href="furniture.php">Rustic Furniture »</a>
</li>
<li class="b-footer-submenu__item">
<a class="b-footer-submenu__item-link" href="log_timber.php">Log & Timber Construction »</a>
</li>
<li class="b-footer-submenu__item">
<a class="b-footer-submenu__item-link" href="homes_cabins.php">Log Homes & Cabins »</a>
</li>
<li class="b-footer-submenu__item">
<a class="b-footer-submenu__item-link" href="homes_cabins.php">Railing & Stairs »</a> </li>
</ul>
</nav>

<p class="b-epilog">
The information contained herein is proprietary of Twisted Log Ltd. and cannot be reproduced in any way without their expressed written permission.
</p>
</figure>
</footer>

<!-- CHECKLIST:
Google Analytics snippet BEGIN -->
<script type="text/javascript">

var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-36188144-1']);
_gaq.push(['_trackPageview']);

(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();

</script>
<!-- Google Analytics snippet END -->

</body>
</html>