View Full Version : I am new to php still...need help to further expand my knowledge.
DrkFusion
07-24-2002, 02:02 AM
I am farely new to php, in the short time, I have coded 2 scripts from ground up, 1 using databases, and the other using get functions.
They were pretty simple. I am trying to work on some stuff to integrate into vb, can someone help me with how I go about assiging templates to each action like ?action=create will use the table create_blah, and ?action=done will use done_blah, also
How to go about verifying user information, with this all cleared up, I am able to present to you some more hacks :) The 2 mods for vb which I have released in my life, are not really template integrated, due to my lack of knowledge of how it works. If someone can help me out here, I will be very glad, and appreciative.
Thank you
Drk
Xenon
07-24-2002, 10:11 AM
you can name your templates as you want to, there are no restrictions, i mean you can call template done_blah also if your $action=create.
normally you have to use this line of code for template including:
eval("\$varname = \"".gettemplate("templatename")."\";");
you must have required global.php to use this functions ;)
after that line, you can use $varname in your output template. All variables are parsed in template templatename.
at the end of your code section you want to use an outputtemplate:
eval("dooutput(\"".gettemplate('outputtemplatename')."\");");
DrkFusion
07-24-2002, 01:46 PM
how about for mysql db information, would I use
require("./glopal.php");
or
include ("config.pjp");
I am guessing the db info is being included in global.php, but I was making a hack,and only included global.php, and it said db not found, or cannot connect etc.
Thanks again for helping me.
Drk
DrkFusion
07-24-2002, 01:48 PM
...
So the Varname can be used to assign tempaltes to each different break? and dooutput is used if/for...(kinda not clear on that part)
Xenon
07-24-2002, 01:50 PM
you just must have this line in your file:
require("./global.php");
as you can see in globa.php:// ###################### Start init #######################
unset($dbservertype);
unset($debug);
//load config
require('./admin/config.php');
if ($debug != 1) {
unset($showqueries);
unset($explain);
}
// init db **********************
// load db class
$dbservertype = strtolower($dbservertype);
$dbclassname="./admin/db_$dbservertype.php";
all other needed files are included in global.php
Xenon
07-24-2002, 01:54 PM
the dooutput part is just needed at the end of your code to make the final output.
you can have files which just use the dooutput section and no other template functions, but if you want to templatize your code more and more, you have to use the varname code too.
the varname code is neededd for let's say template in templates. The dooutput is needed to make the final output
DrkFusion
07-24-2002, 01:55 PM
Ah thanks, :)
Ok, I think almost understand it, i still can't ge what dooutput is used for...:-/ srry
Drk
Xenon
07-24-2002, 02:02 PM
hmm, explainig is really hard ;)
just have a look at some of the vb-files and see how dooutput is used ;)
DrkFusion
07-24-2002, 04:45 PM
Ah, I am seeing the light at the end of the tunnel now, thanks :)
*hopes its not a train*
Drk
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.