Can't find value associated with cvid

Permalink Browser Info Environment
Tried to use but I keep getting an empty value on any database queries. Then tried to look for value attached to cvid in phpadmin but the column is blank. Any help would be appreciated. Let me know if you need more details.

Type: Pre-Sale
Status: In Progress
View Replies:
Mnkras replied on at Permalink Reply
Mnkras
Could you provide a code example of what you are trying to do?

On Mon, Aug 17, 2015, 8:53 AM concrete5 Community <
[email protected]> wrote:
somesayinice replied on at Permalink Reply
Thanks for the quick reply. Process kinda went something like this. I created an attribute that was a page selector called 'trial'. Then I attached the attribute to a couple of pages on my site.

I tried to call the attribute from the page template php using the following:
I'm new to php so bare with me.

$page = Page::getCurrentPage();
$trial = $page->getCollectionAttributeValue('trial');
if ($trial > 0) {echo 'yes'}

It never echos. I presumed trial was an $array so I tried again with print_r but nothing.
Looking through getValue(), it seems like the controller should be returning a value based on the cvid. But when I look in the database, the 'value' is 0 and even though the 'cvid' is a regular number. I checked the db.xml and everything looks okay. I think I'm misunderstanding something fundamental but I'd love to say concrete isn't assigning a value. Is there something I need to do to make the value non-zero. Thanks again for the quick reply.

- Ife
Mnkras replied on at Permalink Reply
Mnkras
Cvid or cid? This add-on only deals with cid, not cvid...

On Mon, Aug 17, 2015, 9:25 AM concrete5 Community <
[email protected]> wrote:
somesayinice replied on at Permalink Reply
Sorry. Was mistaken. aVID not cvid. Here's the function from the controller that I was talking about.
public function getValue() {
      $db = Loader::db();
      $value = $db->GetOne("select value from atPageSelector where avID = ?", array($this->getAttributeValueID()));
      return $value;   
   }
. avID present in database but no 'value'. Thanks again.

- Ife
Mnkras replied on at Permalink Reply
Mnkras
Sorry this threw me for a loop, you are using this on 5.7+ and this page is for 5.6 so I was a bit confused, (5.7 one is here:https://www.concrete5.org/marketplace/addons/page-selector-attribute...

Besides that, everything seems to be working for me,

can you try using
$page->getAttribute('trial');

instead?

concrete5 Environment Information

Concrete 5.7.5

Browser User-Agent String

Mozilla/5.0 (Linux; Android 5.1.1; SM-N910P Build/LMY47V) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.133 Mobile Safari/537.36

Hide Post Content

This will replace the post content with the message: "Content has been removed by an Administrator"

Hide Content

Request Refund

You have not specified a license for this support ticket. You must have a valid license assigned to a support ticket to request a refund.