CMS Builder

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

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

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

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: [knight_oWL] CMS Builder

Hi Knight_owl,

I've looked through the code for furniture.php, and I it looks as if all of your variables have the correct names, so I'm still not sure why it's failing. The only thing it might be is if you haven't added any data to the rustic_furniture section yet. If it isn't that could you create a second level support request:


https://www.interactivetools.com/support/email_support_form.php


On the image resizing issue; you shouldn't find images are heavily pixelated unless your trying to upload an image that is much smaller than the size your converting it to. I think the issue might be with the img tag code I suggested, try removing the width and height, as these might be different from the ones set for thumbnail 2:

<img src="<?php echo $upload['thumbUrlPath2'] ?>" alt="" />
Images are resized keeping the original dimension as opposed to being stretched or cropped as generally this will give the best looking result.
You can force an image to be stretched to the correct dimensions in the img tag like this:

<!-- change to the dimensions you require -->
<img src="<?php echo $upload['thumbUrlPath2'] ?>" width="400" height="300" alt="" />


Thanks!
Greg Thomas







PHP Programmer - interactivetools.com