image attribute in header?

Permalink 1 user found helpful
so i have an image attribute i want pulled into my header element.

i tried this:
<img src="<?php 
if(!$c->getCollectionAttributeValue('background')) {
   echo '';
} else {
   $bgphoto = $c->getCollectionAttributeValue('background'); 
   echo $bgphoto->getFileRelativePath();
}
?>"


this is the error i'm receiving:
<b>Warning</b>:  call_user_func_array() [<a href='function.call-user-func-array'>function.call-user-func-array</a>]: First argument is expected to be a valid callback, 'FileVersion::getFileRelativePath' was given in <b>/xxxx/xxxx/xxxx/concrete/models/file.php</b> on line <b>31</b><br />
" /></a>


and also added the loader model:
<?php
Loader::element('header_required'); 
Loader::model('collection_attributes');
?>

 
DavidMIRV replied on at Permalink Reply
DavidMIRV
have you tried $c->getAttributeValue('background');
jhart replied on at Permalink Reply
<b>Fatal error</b>: Call to undefined method Page::getAttributeValue()
hereNT replied on at Permalink Reply
hereNT
<img src="<?php 
if(!$c->getCollectionAttributeValue('background')) {
    echo '';
} else {
    $bgphoto = File::getByID($c->getCollectionAttributeValue('background')); 
    echo $bgphoto->getFileRelativePath();
}
?>"
jhart replied on at Permalink Reply
<b>Catchable fatal error</b>: Object of class File could not be converted to string in <b>concrete/libraries/3rdparty/adodb/adodb.inc.php</b> on line <b>983</b><br />
kino replied on at Permalink Reply
kino
Add first.
$c = Page::getCurrentPage();


or

What C5 Version?

This function was added I think it was 5.3.3 or later.
jhart replied on at Permalink Reply
5.3.3

unfortunately,

$c = Page::getCurrentPage();

didn't do anything...
kino replied on at Permalink Reply
kino
first.

add
echo $c->getCollectionAttributeValue('meta_description');

Is this no error?

second.
echo $c->getCollectionAttributeValue('background');

no error?

and more
kino replied on at Permalink Reply
kino
<img src="<?php
if(!$c->getCollectionAttributeValue('background')) {
    echo '';
} else {
    echo File::getRelativePathFromID($c->getCollectionAttributeValue('background')->fID);}
    ?>" />
jhart replied on at Permalink Reply
i love you!