The SitePoint Forums have moved.

You can now find them here.
This forum is now closed to new posts, but you can browse existing content.
You can find out more information about the move and how to open a new account (if necessary) here.
If you get stuck you can get support by emailing forums@sitepoint.com

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

gettemplate

hehe me again. i'm still trying to study vB so I can make my own addons and everything but i'm really stuck on this one. i'm not sure how this works exactly. i read php.net and understand how and what eval(); does but this one is a lot different.

eval("\$pminfo = \"".gettemplate('forumhome_pmloggedin')."\";");

a normal one that i'd probably use is
eval("\$something = \"$anotherone\";");

A few of my questions:

1. Where is the ".gettemplate('forumhome_pmloggedin')." function in vB. (which file)?
2. How does this .gettemplate thing work?
3. If I were to make one from scratch what would i need in order to accomplish this?

Thank You for your time and your help is greatly appriciated to this newb trying to learn PHP.

In vBulletin, gettemplate is located in functions.php in the admin directory.
Basically what it does is check the template cache for the template called, and if it doesn't find it, it pulls the template directly from the database.

Not quite sure what you mean make it from scratch, but if you are talking about how to call a template like that, you just substitute your variable and what template you want it to call. Then put the variable somewhere in the code or the templates.

function gettemplate($templatename,$escape=1,$gethtmlcomments=1) {
// gets a template from the db or from the local cache
global $templatecache,$DB_site,$templatesetid,$addtemplatename;

$gettemp=$DB_site->query_first("SELECT template FROM template WHERE title='".addslashes($templatename)."' AND (templatesetid=-1 OR templatesetid='$templatesetid') ORDER BY templatesetid DESC LIMIT 1");
$template=$gettemp[template];
$templatecache[$templatename]=$template;