• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

RESOLVED How to replace the [insert_php] with variables

Status
Not open for further replies.

luhas

New member
Messages
3
Likes
0
Points
1
#1
Dear friends,
I am using this construction on my page and now I cannot make it work with the new snippet update. It seems that various snippets do not transfer variables. Can you, please, help me?

[insert_php]
$pozrok = date(Y);
$pozmesic = date(m);
if ($_GET['rok']){$pozrok=$_GET['rok'];}
if ($_GET['mesic']){$pozmesic=$_GET['mesic'];}
[/insert_php]

<center>
<strong>Docházka za měsíc [insert_php] echo $pozmesic; echo "/"; echo $pozrok; [/insert_php]</strong>

This code constructs the required link with parameters, calls another application and display that in the page. If I create the snipets and replace the [insert_php] with the [wbcr_php_snippet id="xxx"] or [wbcr_snippet id="xxx"] with the php code, the variables do not show in the link.
 
Last edited:

luhas

New member
Messages
3
Likes
0
Points
1
#2
I have found the solution, rewitten everything to php. :)
Thank you.
 
Last edited:

Kirill

Support team
Messages
82
Likes
4
Points
8
#3
Hi Luhas

Snippets are designed as isolated units. This avoids potential name conflicts. But this prevents the direct exchange of data between snippets.

Can you create a snippet that constructs the link and immediately displays it? Or do you have a reason to divide it?

Best regards, Kirill
Webcraftic team
 

luhas

New member
Messages
3
Likes
0
Points
1
#4
Thank you very much Kirill, I have put everything in one snippet and it works now.
Best Regards, Luhas
 
Status
Not open for further replies.