Hi,
I have done a few SS sites now and found migrating to the live server from my localhost a breeze.. apart from this one!
Everything works fine except none of the images uploaded through the CMS are showing in the front or backend. When I try to view the images directly in the browser, ie. www.mysite.com/assets/Uploads/images/lessons.jpg I get this error:
[User Error] Couldn't run query: SELECT "File"."ClassName", "File"."Created", "File"."LastEdited", "File"."Name", "File"."Title", "File"."Filename", "File"."Content", "File"."Sort", "File"."SortOrder", "File"."ParentID", "File"."OwnerID", "File"."ID", CASE WHEN "File"."ClassName" IS NOT NULL THEN "File"."ClassName" ELSE 'File' END AS "RecordClassName" FROM "File" WHERE ("File"."ClassName" IN ('Image','ImageGalleryImage','Image_Cached')) AND (ID = ) ORDER BY SortOrder ASC LIMIT 1 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') ORDER BY SortOrder ASC LIMIT 1' at line 1
GET /assets/Uploads/images/lessons.jpg
Line 526 in /home/loveviol/public_html/newtest/sapphire/core/model/MySQLDatabase.php
This is my page.php:;
<?php
class Page extends SiteTree {
public static $db = array(
'HeaderID' => 'Varchar(20)',
'BGImageTopSpace' => 'Int',
);
public static $has_one = array(
'BGImage' => 'Image',
"Footer" => "WidgetArea",
);
public function getCMSFields(){
Requirements::css( project() . "/css/admin.css");
$fields = parent::getCMSFields();
$fields->addFieldsToTab('Root.Content.Main', new TextField('HeaderID', 'HeaderID'));
$fields->addFieldsToTab('Root.Content.BackgroundImage', new ImageUploadField('BGImage', 'Background Image'));
$fields->addFieldsToTab('Root.Content.BackgroundImage', new NumericField('BGImageTopSpace', 'Space above background image'));
return $fields;
}
public function MyBGImage(){
if($image = $this->obj('BGImage')){
$image->PageHeight = $image->getHeight() - 120 + $this->BGImageTopSpace;
return $image;
}
}
public function LatestNews(){
if($object = DataObject::get('NewsEntry', $filter='', $sort='', $join='', $limit=5))
return $object;
}
public function Testimonials(){
if($object = DataObject::get('Testimony', $filter='published = 1', $sort='SortOrder ASC', $join='', $limit=''))
return $object;
}
}
class Page_Controller extends ContentController
{
public function init() {
Requirements::block('sapphire/thirdparty/prototype/prototype.js');
Requirements::block('sapphire/thirdparty/behaviour/behaviour.js');
Requirements::block('sapphire/thirdparty/scriptaculous/effects.js');
Requirements::block('cms/javascript/PageCommentInterface.js');
Validator::set_javascript_validation_handler('none');
Requirements::javascript('http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js');
Requirements::javascript('mysite/javascript/script.js');
parent::init();
}
}
The images definitely exist as I can access them via FTP fine. Interestingly, if I comment out the function MyBGImage() function and attempt to view an image in the browser, I just get a 404 not found page instead of the error...
Thanks for any help here, bit stumped and really want to get this one wrapped up!
if it helps the page is currently available here [url=http://newtest.loveviolin.co.nz/]http://newtest.loveviolin.co.nz/
I have edited this to update the code and change the link..