PDA

View Full Version : How to use replacement variables?


Peter Ostry
04-05-2010, 01:52 PM
I posted this on vbulletin.com but maybe here is a better place.
--------------

In the registration "welcome" mail I need the URL of the server as a clickable link. Not the URL of the forum, which is $vboptions[bburl] but the servername alone. I made a replacement variable called 'serverurl' that contains the PHP code for the server name:
http://<? echo $_Server['SERVER_NAME']; ?>The vBulletin manual talks about advantages and dangers of replacement variables but I cannot find an example how to actually use them. I tried my replacement variable in the phrase of the welcome mail in various flavours:
[serverurl]
$vboptions[serverurl]
<serverurl>
etc, nothing worked.

How do I call a replacement variable?
Can I have PHP code in a replacement variable?
Is there another method to get just the URL of the server?

Peter Ostry
04-07-2010, 11:39 AM
Mmh ... nobody knows that?
Impossible :)

I make it easier:

1) How do I display my own phrases in templates?
2) How do I insert PHP variables/constants into a template?

Thanks in advance,
Peter

Lynne
04-07-2010, 02:03 PM
Replacement Variables are used to replace words on the pages of your site - not for emails sent out.

1) Your own phrase in a template? Create a global phrase and then call it like you do other phrases.

2) You can't put php into a template. You put php into a plugin and then put the output into a variable which you may then use in a template (assuming you register it for use in the template also).

Peter Ostry
04-08-2010, 01:11 AM
Replacement Variables are used to replace words on the pages of your site - not for emails sent out.
But there is such a $vboptions[bburl] thing in the email. How do I make my own $peteroptions[serverurl] thing?

1) Your own phrase in a template? Create a global phrase and then call it like you do other phrases.
I assume "global phrase" means a normal phrase which is generated via "add new phrase". Please tell me if this is not true, the manual is not very clear on this subject.

And I have never called phrases myself.
What is a phrase call:
This ? [myValue]
or this ? {vb:rawphrase myValue}
or this ? $something[myValue]
(number 2 is my favorite ...)

2) You can't put php into a template. You put php into a plugin and then put the output into a variable which you may then use in a template (assuming you register it for use in the template also).
How do I register a variable for a template, is this in the manual?
And something like {vb:raw $_SERVER['SERVER_NAME']} is not supposed to work?

Sorry for being slow. Since MODx and vBulletin I am confused with plugins, snippets, chunks, phrases, products, and so on. All of them include something from somewhere.

Peter Ostry
04-22-2010, 05:09 PM
Again too much text and too many questions?

Ok, a shorter version:
What exactly do I have to do if I want the server name as a link in the text of an automated email, except of hardcoding it?