Hello, I'm building a one page site that is put together by pulling in other pages in the site on the home page. These other pages have custom styles that are managed through the CMS and I'm targeting them by placing a 'data-path="$Link"' attribute on each page's section in the home page template (example output: <section data-path="/portfolio/first-entry/">)
I need to output a style block in my template that targets the data-path attribute to give that section custom styles. Here's the starter code I have for the function I'm calling into my template file:
function CustomStyles() {
$pages = Page::get();
echo '<style type="text/css">';
foreach($pages as $page) {
echo '[data-path="' . $page->Link . '"]{}';
}
echo '</style>';
}
However, $page->Link doesn't output anything because there isn't a Link property in the $page array. How can I access the same $Link property in my custom function that is used in the templating engine?