Answers.Body: <p>You can use reference tags:
  <a href="https://craftcms.com/docs/4.x/reference-tags.html#examples" rel="nofollow noreferrer">https://craftcms.com/docs/4.x/reference-tags.html#examples</a>
  E.g:</p>
  <ol>
  <li>Create a Global Set with handle <code>customers</code></li>
  <li>Create a <code>totalCustomers</code> field and assign to said Global Set</li>
  <li>Save value to <code>totalCustomers</code> field.</li>
  <li>Then use the following ref:
  <code>{globalset:customers:totalCustomers}</code> as a placeholder on any text field.</li>
  <li>When you render the field you'll need to call the <code>parseRefs</code> filter:</li>
  </ol>
  <pre><code>entry.myField | parseRefs
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-06-16T06:35:53.967Z
Answers.LastActivityDate: 2022-06-16T06:35:53.967Z
Answers.UserDisplayName: Matanya
Answers.Body: <p>You can't directly use like this. but there is way with twig replace.
  you can use same keyword as above <code>[global.totalCustomers]</code> in your heading or any field. then in twig template query the global and replace this with original count in frontend.</p>
  <pre><code>{% set globalCount = globalhandle.totalCustomers %}
  {{ entry.heading|replace({'[global.totalCustomers]': globalCount}) }}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-06-16T04:57:56.027Z
Answers.LastActivityDate: 2022-06-16T04:57:56.027Z
Answers.UserDisplayName: Taher Kathiriya
Body: <p>I'd like to set a variable like &quot;totalCustomers&quot; and then use this throughout our content in different pages and content blocks so that there is one source of truth. Is that possible?</p>
  <p>e.g. I define a global variable &quot;totalCustomers&quot; = &quot;10,000&quot;</p>
  <p>Then within a new entry I can use this in the heading, something like &quot;We serve [global.totalCustomers] customers daily&quot;</p>
  <p>And then in another entry I can use this in some other content &quot;Our [global.totalCustomers] love us&quot;</p>
  
Tags: <variable><globals><content>
Title: Can I define and use global variables within content fields?
ThreadText: # Can I define and use global variables within content fields?
  
  (Asked by: username_0 on 2022-06-16)
  
  I'd like to set a variable like "totalCustomers" and then use this throughout our content in different pages and content blocks so that there is one source of truth. Is that possible?
  
  e.g. I define a global variable "totalCustomers" = "10,000"
  
  Then within a new entry I can use this in the heading, something like "We serve [global.totalCustomers] customers daily"
  
  And then in another entry I can use this in some other content "Our [global.totalCustomers] love us"
  
  **Tags:** variable, globals, content
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2022-06-16. Score: 1
  
  You can use reference tags:
  <https://craftcms.com/docs/4.x/reference-tags.html#examples>
  E.g:
  
  1. Create a Global Set with handle `customers`
  2. Create a `totalCustomers` field and assign to said Global Set
  3. Save value to `totalCustomers` field.
  4. Then use the following ref:
     `{globalset:customers:totalCustomers}` as a placeholder on any text field.
  5. When you render the field you'll need to call the `parseRefs` filter:
  
  ```
  entry.myField | parseRefs
  
  ```
  
  
  ---
  
  ### Answer by username_2 on 2022-06-16. Score: 0
  
  You can't directly use like this. but there is way with twig replace.
  you can use same keyword as above `[global.totalCustomers]` in your heading or any field. then in twig template query the global and replace this with original count in frontend.
  
  ```
  {% set globalCount = globalhandle.totalCustomers %}
  {{ entry.heading|replace({'[global.totalCustomers]': globalCount}) }}
  
  ```
  
  
  ---
  
  