Noob question about Site Set Attributes (5.8)

Permalink
Hi all, I'm fairly new to the C5 arena so please go easy on me if this seems stupid.

I'm wanting to set a global attribute for a site (a url for an external booking link). I'd like the client to be able to edit this value if they see fit and it propagate throughout the theme so I thought I'd at a new Set with a custom attribute within the Site category (presuming thats the category for sitewide attributes?). Trying it this way rather than hardcoding it into the theme pages.

Question is how do I retrieve the values inside the Site Set within my theme? My custom attribute has a handle of 'booking_url' inside a set 'booking_details'.

 
jakobfuchs replied on at Permalink Reply
jakobfuchs
PineCreativeLabs replied on at Permalink Reply
PineCreativeLabs
You could simply use a sitewide (global) area and use either the content or html block within it. If your theme doesn't have a global area where you want it to be editable, you'll need to add one.
<?php $a = new GlobalArea('Booking Link'); $a->display($c); ?>


And just drop a content (or HTML) block in there with the link.
drcodswallop replied on at Permalink Best Answer Reply
Thanks for the suggestions. Found a solution in the 8.0 release notes which says:

Custom attributes can now be globally applied to your site, and easily accessed by calling
\Site::getSite()->getAttribute(‘attribute_handle’);

I created my custom attribute in System & Settings > Basics, targeted the handle with the above code and all is well :)
okapi replied on at Permalink Reply
okapi
Thanks for sharing!
I'm using that in a page template:

<?php echo Site::getSite()->getAttribute('attribute_handle'); ?>

Works in C5 version 8.5.2