getCollectionAttributeValue problem

Permalink
Hello,

i am using
$paginaType = $c->getCollectionAttributeValue('paginaType');
in my block controller to determine the css class to use in that page. this displays the result of a select dropdown menu.

$content.="<div class=\"".$paginaType."\">\n";

in my test site on my localhost this works fine html result =
<div class="pageStyle1">
but when i put everything online the result is

<div class="Object id #167">

i'm pretty shure i did everything the same, did i mis something?

already cleared and updated cache

using Concrete 5.4.1.1 (and loving it)

thanx

Marco

stmarco
 
Mnkras replied on at Permalink Reply
Mnkras
umm, it returns an object,

try something like

$ak = CollectionAttributeKey::getByHandle('paginaType');
$selectedOptions = $c->getAttribute($ak->getAttributeKeyHandle());
foreach($selectedOptions as $opt) {
    echo $opt->getSelectAttributeOptionID();
}

are you trying to get the collection type?
(aka pagetype)

$c-> getCollectionTypeHandle();

Mike
stmarco replied on at Permalink Reply
stmarco
Hey Mike,

thanks for the reply, i am making a small webshop and created a block that uses custom page attributes for product properties, this worked fine until now.
i wanted to use the same system to change the css class depending on a select value of a custom page attribute. All my other custom attributes are text fields and a check box, no problem with those.

function getContentAndGenerate($align = false, $style = false, $id = null) {
         $content="";
         $c = Page::getCurrentPage();
         $paginaType = $c->getCollectionAttributeValue('paginaType'); 
         $content.="<div class=\"".$paginaType."\">\n";
... other content is added also extracted from page attributes.
         $content.="</div>\n";
         return $content;
      }


this code is only a part of the controller.php file.

paginaType is Dutch for pageType, but here it is misleading, paginaType is de handle of the custom page attribute i use to control the css of my div with, the other content has no problems, i only have problems with the attribute of the select type.

I downloaded my online version to an empty folder on my localhost and exported my online database and imported it to my localhost.
offline it works (it returns the value i need and changes the css)
online it doesn't work (it returns an object)

could it be a php issue?
my local php version is 5.3.4
my online php version is 5.1.6 (i can not change this :)

thanks

Marco
stmarco replied on at Permalink Reply
stmarco
The php version of my online server is most likely to cause the problem.