Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2011-03-23 18:03:42

AndrijaM
Member
From: Belgrade, Serbia
Registered: 2007-12-22
Posts: 190
Website

Using global variables

In trying to find solution for this a possible solution came out to use php to declare a variable in article which would have article title in it, so then I can use it in another section not related with article itself.

Is this possible? How to do this?

Offline

#2 2011-03-23 19:22:23

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 5,001
Website GitHub

Re: Using global variables

I really don’t think you need this. You could save this to a cookie using chs_cookie (the link to the plugin is missing there but you can find it here) and then retrieve it again in your form, but I think if you persevere with what you were trying in the other thread, you should be able to get it working without this roundabout method.


TXP Builders – finely-crafted code, design and txp

Offline

#3 2011-03-23 19:55:26

AndrijaM
Member
From: Belgrade, Serbia
Registered: 2007-12-22
Posts: 190
Website

Re: Using global variables

Ok, so the main problem is solved, but in the meantime I found the answer to this question also, maybe someone found it useful in some situation:

Inside articles I placed

<txp:php> $GLOBALS[“subject”] = “value 1”; </txp:php>

and then in zem contact form

<li><txp:zem_contact_text label=“Subject:” default=”<txp:php> echo $GLOBALS[“subject”] ; </txp:php>” name=“tema” break=”“ required=“0” /></li>

Now, I’m not a programmer, so this is maybe not good, I don’t know, but it works.

Last edited by AndrijaM (2011-03-23 19:56:01)

Offline

Board footer

Powered by FluxBB