<?php
$context = $modx->context->key;
$resource = $modx->getObject('modResource', array(
'context_key'=>$context,
'pagetitle'=>'Geo Page - Austin, Texas'
));
$rawValue = $resource->getTVValue('geoImage');
return $rawValue;
return $rawValue;return $modx->resource->getTVValue('geoImage');return $modx->resource->getTVValue(12);
TemplateA loads a style sheet (master.css) that is a modX resource itself using an ext file include.having trouble parsing that - maybe a bit of your code might help...
<link rel="stylesheet" type="text/css" href= "/master.css" />
[[!inc? &file=`[[++assets_path]]css/css_general.css`]]
#geoBox {
background: url([[getGeoImageTv]]) no-repeat 17px 13px;
position: relative;
}<link rel="stylesheet" type="text/css" href= "/master.css?id=[[*id]]" /> ... or send the tv value (but that might be messy) ... <link rel="stylesheet" type="text/css" href= "/master.css?tv=[[*geoImage]]" />

<?php
$modx->regClientCss($modx->getChunk('ChunkName'));
return "";<style type="text/css">
#geoBox {
background: url([[*geoImage]]) no-repeat 17px 13px;
position: relative;
}
</style>I think I would put the CSS content in a chunkAre you talking about just this one style rule or the whole style sheet?
Put a tag for the snippet at the top of the <body> section of the templateYou want to inject CSS rules into the <body> ? Wouldn't they need to be in the <head>? I'm confused.
Lucas and Bob, Thanks for help.
It seems like the easy fix here is to just add the single style rule to the head of the template itself:
<style type="text/css"> #geoBox { background: url([[*geoImage]]) no-repeat 17px 13px; position: relative; } </style>
This gets the image tv I have set individually on each resource and seems to be working. I don't love having CSS in the page, but it works. If I had a bunch of rules to define like this I'd like it less.
Bob, I'm not sure I follow your suggestion...
First, what is the concern regarding extra processing? Is loading the style sheet as a modx resource really going to make a significant impact? I haven't noticed any loading time problems yet. It sure is convenient for skinning a site. I've added tvs to the style sheet resource that define font and bg colors and I reference these in many places inside the style sheet to generate the desired look. That works easily since the style sheet is the current resource being parsed. Once I need a tv from another resource it's more challenging.
Either one. Whichever is more convenient.
I think I would put the CSS content in a chunkAre you talking about just this one style rule or the whole style sheet?
Put a tag for the snippet at the top of the <body> section of the templateYou want to inject CSS rules into the <body> ? Wouldn't they need to be in the <head>? I'm confused.