Homepage
Main navigation
Main content
Additional information
October Tricks
Login / Sign up
Quality Guidelines
About
GitHub
Propose new content
October CMS resources and help articles
Simple and to the point. Optimized by the community.
×
Login / Sign up
Quality Guidelines
About
GitHub
Propose new content
Edit trick
Changes will be published after manual review
Title
Give your trick a describing title. Do
not
start with «How to...».
Your trick
Keep it short and concise! Markdown is supported.
There are multiple ways to access a component's properties. Given this is our component: ```php class Example extends Component { // Note the property is public! public $foo = 'bar'; public function onRun() { // This creates a varaible `foo` in twig. $this->page['foo'] = $this->foo; } } ``` You can acceess it's properties like this: ```twig [example] == function onStart() { // Access it in the code section via the components // array on the page property. $valueOfFoo = $this->page->components['example']->foo; } == Since the property's visibility is public you can access it using {{ example.foo }}. Private properties won't be accessible this way. Because we also set the property on the `page` variable in `onRun` it is also accessible directly via {{ foo }}. ```
References
Add additional online resources to your trick
+ Add reference
Topics
If your trick fits more than one topic select multiple. Select at least one.
Backend
Plugin Development
CMS
Twig
Themes
Deployment
Tags
You can use existing tags or create new ones. Add at least one.
Submit for review
Cancel
We use cookies to measure the performance of this website. Do you want to accept these cookies?
Accept
Decline