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 |
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.
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
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
Cvid or cid? This add-on only deals with cid, not cvid...
On Mon, Aug 17, 2015, 9:25 AM concrete5 Community <
discussions@concretecms.com> wrote:
On Mon, Aug 17, 2015, 9:25 AM concrete5 Community <
discussions@concretecms.com> wrote:
Sorry. Was mistaken. aVID not cvid. Here's the function from the controller that I was talking about. . avID present in database but no 'value'. Thanks again.
- Ife
public function getValue() { $db = Loader::db(); $value = $db->GetOne("select value from atPageSelector where avID = ?", array($this->getAttributeValueID())); return $value; }
- Ife
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
instead?
Besides that, everything seems to be working for me,
can you try using
$page->getAttribute('trial');
instead?
On Mon, Aug 17, 2015, 8:53 AM concrete5 Community <
discussions@concretecms.com> wrote: