modx evolution get template value from resource object - modx

I am using modx evo 1.0.2.
I have resource id. Now i wanted to get a template var of this resource.
I have array of resource ids. I am getting resource by its id like this:
$objResource = $modx->getDocumentObject('id',$arrPage['id']);
Now i want to get a template variable of this resource. I have tried like this:
$objResource->getTemplateVarOutput('TempVarName');
it was not working. What will be the proper way to get tvValue from a specific resource?
Any suggestion will be helpful .
Thanks

$modx->getTemplateVarOutput(array('TempVarName'), $arrPage['id']);
http://wiki.modxcms.com/index.php/API:getTemplateVarOutput

Related

Where does "aws_eip" resource in terraform file (.tf) gets the value referring "id" attribute in "aws_instance" resource?

In this page https://www.terraform.io/intro/getting-started/dependencies.html
What is the value of aws_instance.example.id as I don't see an attribute called id for an instance resource (https://www.terraform.io/docs/providers/aws/d/instance.html)
The second link points to documentation about a data source.
In the page https://www.terraform.io/intro/getting-started/dependencies.html, "${aws_instance.example.id}" is referring a resource, not a data source (data sources are preceded by data.)
Here is the documentation about aws_instance you're looking for:
https://www.terraform.io/docs/providers/aws/r/instance.html#id
It is very important to differentiate between resources and data sources in Terraform ;)
From the page you linked:
id is set to the ID of the found Instance.
In addition to the attributes listed

Get Google Blockly Block by Id?

I would like to query the DOM to get a block by ID. Currently I have to find all elements by class name, and manually extract the correct index, which is not sustainable.
How can give a block a unique ID?
Thanks
All blocks already have an id (api docs). However, a Block object isn't a DOM object so you won't find it by using document.getElementById(..). Instead you'll use Workspace.getBlockById(..). Your workspace is usually Blockly.mainWorkspace

E-Commerce Product Custom Field Kentico 10

I am using E-commerce module of Kentico portal and it has two fields for Products pricing : SKUPrice and SKURetailPrice.
I needed one more field to show sell price and I added a new field in Modules application of the portal.(Modules->E-Commerce->Classes->SKU->Fields->New Field)
Now, I need to access this field in my code,but SKUInfo class doesn't show me the newly added field.What I need to do so that the newly added field reflects in my project code ?
I have already build the entire solution multiple times.Any other solutions please.
You can use GetValue and SetValue methods for such fields like this:
SKUInfo sku = ...;
string a = sku.GetValue("field").ToString();
sku.SetValue("field", "value");
JanH has the answer for custom fields you set, also keep in mind though that there is a "SKUCustomData" for other information that you want to store. It takes a Name-Value pair dictionary if memory serves me correctly, and useful if you need to store configuration information or other things that won't be located on the normal SKU table.

Access to a join entity in twig

I'm a beginner in symfony/twig and i need help to understand how to access variable from a join entity in twig
I've 2 entities : Avdert with a one-to-one relationship with the entity Image
I created an index.html.twig where all my Advert are listed using the variable $listAdverts it's OK I've the list of all my adverts
I want to display a small image near each of my Advert, if I look using dump what's in advert.image I've id and url of image it's OK.
So I thought that as I just needed to use advert.image.url to access the url of the image, but instead I'm getting this error:
"Impossible to access an attribute ("url") on a null variable"
I'm missing something but what ?

Sitecore how to check does sitecore content tree item available for extranet/anomouse user

Hello is is possible to define grammatically does extranet/anonym user has access to content tree item ?
I need it like additional case in my IHttpModule.
Thanks.
You can use AuthorizationManager class to get any access right information like this:
Sitecore.Security.AccessControl.AuthorizationManager.IsAllowed(
item,
Sitecore.Security.AccessControl.AccessRight.ItemRead,
User.FromName("domain\\name", AccountType.User)
);

Resources