Welcome to WebmasterWorld Guest from 220.127.116.11
Forum Moderators: phranque
basically, whoever is viewing the post their name appears wherever the code is inserted.
eg: " I think <code> username inserted</code> is amasing ... etc..
I've seen it applied to signatures and to post topics,
what is it? where is it? and where can I check it out?
It's one of those that denotes specific meaning to the contained text, rather than just visual style. These are referred to as "phrase elements".
<code> is meant to contain examples of computer source code.
Other phrase elements include <abbr> (abbreviation), <em> (emphasis), <cite> (citation), etc.
I was trying to tell you that it is the code inside those elements that I don't know, the code that knows who the member is viewing the page and inserts their username in to the sentence to appear like it is them who is being spoken to or about, if another member views the page then their name is there instead..
Is that clearer?
the code that knows who the member is viewing the page and inserts their username in to the sentence to appear like it is them who is being spoken to or about, if another member views the page then their name is there instead..
Well, that has nothing to do with the HTML <code> element. If the user's name is surrounded by <code></code> that is a coincidence.
Inserting a user's name would be done by a script or templating system running on the server. There's no way to know the exact code used to implement this, as it could be very different on different sites - different scripting languages on different sites, etc. etc. And since it's on the server side, you can't examine it.
Why not begin at the beginning and tell us just what you want to do on your site, and what software you have installed on your server?
So, I assume you have some software on your site (message board, commerce system, social networking site, etc. etc.) where you have users that login.
And you want to be able to include the user name on some page.
Let's start with what that software is. (When your users log-in, what are they logging-in to?)
ignore <code> nothing to do with it, I was simply indicating that there is some sort of code being used to grab the usersname who is viewing the page and inserting that name in to the sentence or topic of the forum post
I am also assuming that the person has not written any specific php code to use and as this is on a standard forum that it is some sort of nifty add on funny feature, just don't know what it is, where it is or where to find it?
The script is snagging the name, either via cookie or session, pulling the username out of the DB and plugging it into the HTML when it generates the page...
You will never see the "code" in the HTML. The code is what wrote the HTML.
Clear as mud?
You're not going to find it in any of those places. In fact, unless you are the site owner, you're not going to find it at all.
just wondered if anyone knew where the snippet for the code may be and what code you would use to generate it when posting..
Nobody knows. You can't see the source code - it's a server script, and it's not possible for users to view it.
There are hundreds if not thousands of variations on how one might do this.
Depends on where the site stores the user name (A database? Which kind? MySQL? PostgreSQL? Oracle? What database? What table?), what language (PHP, Perl, etc.). Did they write their own software or use a free or commercial software package? Etc. etc. etc.
Again, if you want to implement this on your own site, you'll have to tell us something about your site, and what scripting tools you have available to you.
It's a pretty fundamental things, though, and you'll find out how to do this pretty quickly, reading just about any book on PHP, Perl, Rails, whatever. One of the first examples in any scripting book - "let's greet the user by name..."
There isn't any one way to do this. willybfriendly has shown you *a* way to do it - in PHP. If you want something more specific, you will have to tell us just what tools you are working with. He didn't show how to get a value into $username, but that is site and implementation-specific.
it is a standard phpBB2 forum and assume that the code is added to a php include file and then a certain trigger added to the post that grabs the username and implements the code..
as it is a standard well known forum I am also assuming that this little addon can be found as a download with instructions on how to implement it rather than writing the code in..
I thought maybe if someone here had used it or seen etc they may know where to find the solution
I doubt there is any "plugin" or "extension" needed to do this.
The site owner would modify the template for the page where they want the username to appear. I assume there is a variable name for the username - probably something like $username. So, they would just stick $username (or something similar - I'm not familiar with the templating system that phpBB uses) somewhere in the template.
The templates define how a particular type of page - or section of a page - is layed-out, and what content appears on it. There are probably templates for displaying a post, displaying a list of posts, editing a post, enter a new post, the home page, etc. etc. etc.
Again, this is NOT something that a user can see or alter. It isn't just something that a user can stick in a post.
Why not check on the phpBB support website? If you can't find it in the documentation, then somebody can surely answer your question in the forums there.
once the code is in place you simply type /me in to the post topic of Sig and the username appears there..
for reference it is here.. [phpbb.com...]