discuss.answer
You can either pass the value to PHP temporary by url request (get/post) or
store it in session, cookies or write to text file
etc.
Best way is to store it in the database and make use of a MODX Placeholder!
https://docs.modx.com/revolution/2.x/developing-in-modx/other-development-resources/class-reference/modx/modx.setplaceholder
Resource 12: [[!mySnippet? &type=`X-Type`]]
mySnippet Code:
<?php
$modx->setPlaceholder('type', $type);
Resource 25: [[+type]]
[ed. note: mrhaw last edited this post 6 years, 11 months ago.]
Thank you for answer,
i hoped to find an easier way but i try to do tat with the placeholder and text file.
Thanks!
Check out setPlacholders
https://modx.com/extras/package/setplaceholders
https://github.com/oo12/setPlaceholders
website.com/page.html?
myparameter=myvalue
[[!setPlaceholders? &ph=`myparameter == request.myparameter`]]
Use placeholder [[+myparameter]] in resource
or in code:
$value = $modx->getPlaceholder('myparameter');
[ed. note: mrhaw last edited this post 6 years, 7 months ago.]
I'm not clear on what you're trying to do, but you might be looking for a session variable.
In snippet 1:
$_SESSION['type'] = 'something';
In snippet 2:
$type = $_SESSION['type'];
This assumes that snippet 1 will always execute before snippet 2, and that no snippets on other pages will use the value of the session variable.
I want to use php variable on my site to get user information. How can i get it using php variable?
[ed. note: markh last edited this post 6 years, 4 months ago.]
Hi showbox, could you make a new thread and tell us more about what you want to do? You will get better answers than here
In a language such as C, C++, and Java the programmer must declare the name and type of the variable before use it. In PHP the type of the variable does not need to be declared before using it because types are associated with values rather than variables. As a result, a variable can change the type of its value as much as we want.
You don't need to declare variables or their type before using them in PHP.
As a result, you have Variable Variables, so you may assign a variable to another variable.
for example,
<?php
$v='var1';
echo $v; // prints var1
$$v = 'var2';
echo $$v; // prints var2
echo $var1; // prints var2
?>
[ed. note: markh last edited this post 6 years, 4 months ago.]
Is SEO forum
spam still a thing?