Click to See Complete Forum and Search --> : Database-linked curly braces?
Funny Guy
11-30-2005, 08:13 PM
When I download and use PHP apps that use databases(like phpBB), I look into the HTML code and find a bunch of text enclosed within curly braces. I'll see things like {AVATAR} and {POST}. I looked into my database and found that there are tables with columns named the same as them.
What is this? What do I have to do to use it?
NogDog
11-30-2005, 10:18 PM
If there's a '$' just before or after the opening curly brace, then they're being used to specify a PHP variable name. (This is done to prevent the parser from getting confused as to which characters are part of the variable name and which are not.)
Funny Guy
12-01-2005, 01:42 PM
No, I see them used where their name applies to the content of the page, like it's a placeholder or something. It's used only in HTML code as well, either in the layout or, for one example, I've seen it used inside the HTML tags. I think the server inserts code according to what's stored in the database while it's server-side.
NogDog
12-01-2005, 08:52 PM
Can you post some code for us to look at?
Funny Guy
12-01-2005, 09:12 PM
In phpBB,
Here in the head:
<html dir="{S_CONTENT_DIRECTION}">
<head>
<meta http-equiv="Content-Type" content="text/html; charset={S_CONTENT_ENCODING}">
<meta http-equiv="Content-Style-Type" content="text/css">
{META}
{NAV_LINKS}
<title>FGComics.com :: Forums :: {PAGE_TITLE}</title>
And in the body:
<!-- BEGIN privmsg_extensions -->
<table border="0" cellspacing="0" cellpadding="0" align="center" width="100%">
<tr>
<td valign="top" align="center" width="100%">
<table height="40" cellspacing="2" cellpadding="2" border="0">
<tr valign="middle">
<td>{INBOX_IMG}</td>
<td><span class="cattitle">{INBOX_LINK} </span></td>
<td>{SENTBOX_IMG}</td>
<td><span class="cattitle">{SENTBOX_LINK} </span></td>
<td>{OUTBOX_IMG}</td>
<td><span class="cattitle">{OUTBOX_LINK} </span></td>
<td>{SAVEBOX_IMG}</td>
<td><span class="cattitle">{SAVEBOX_LINK} </span></td>
</tr>
</table>
</td>
</tr>
</table>
There are many more occurrences; these aren't the only ones.
NogDog
12-02-2005, 02:04 AM
The braces used like that are not part of the PHP language. My best guess is that some other code reads in those files and does some sort of search and replace on those expressions before executing it. But it's only a guess without seeing the whole application source and analyzing it -- and I'm not asking you to post it! :eek: