Page 1 of 1
Not another Newb!
Posted: Wed Mar 08, 2006 11:07 am
by mrPibb
I am totally new to php, I would like to teach myself the language by jumping in head first and doing a project; but of course as a newb I dont know where to begin.
I would like to use templates and a language file much like phpBB does; that way I could change one file and have it control several others.
phpBB does something like > 'L_TOPICS' => $lang['Topics'], in the php pages and the variable is referenced from a lang_main.php file. The templages use {TOPICS} pulling again from the language file. My problem again as a newb I have not been able to decipher where and how they are calling in the info.
So I am looking for a jumpstart ... if anyone who has an extra minute or two to mentor another newbie and understands what I am attempting to accomplish could please provide me with much needed guidance I would greatly appreciate it.
Thanks.
Posted: Wed Mar 08, 2006 11:12 am
by feyd
This task is probably a bit, maybe more, over the head of most newbs. However if you insist, phpBB uses a variant of the Smarty template engine. The "{TOPICS}" are template variables passed in via calling one of several assignment functions that the template class provides. phpBB often calls Template::assign_vars() and Template::assign_block_vars() which fill in data for those template variables you see in the templates.
Posted: Wed Mar 08, 2006 11:13 am
by matthijs
Google "introduction tutorial php" and/or buy a good introductionary php book, like PHP for the world wide web from Larry Ulman. If you start to understand the basics, you can check out the many code examples and tutorials on these forums. Then when you start to write your own scripts, post them here and there might be people who can take a look at your code.
Good luck!
[edit:] I'm definately have to learn to type faster if I ever want to keep up with feyd

o well, i'd better not even try

Posted: Wed Mar 08, 2006 11:23 am
by mrPibb
I figured I would get a RTFM response or two

...
I would much rather jump right in and start coding, I seldom read manuals, new game - play it, new desk build it, you know learn as I go. Sure I end up playing for a few more hours, or end up with spare screws, but I learn from those mistakes and the second time around I get it perfect.
Another angle of what I want to accomplish > I want to have my php filex (index.php) for example use template files (index_header.tpl) && (index_footer.tpl) etc; and have those templates reference {WORD123} {WORDXYZ} variables from a language file (mysite_language.php) ...
I shall look into this smarty engine. Thanks.
Posted: Wed Mar 08, 2006 11:27 am
by matthijs
I figured I would get a RTFM response or two
you're welcome
Anyway, don't forget to at least read about security issues before putting scripts on a live server. You don't want your pages be hacked/misused/etc etc
Posted: Wed Mar 08, 2006 12:36 pm
by a94060
matthijs wrote:I figured I would get a RTFM response or two
you're welcome
Anyway, don't forget to at least read about security issues before putting scripts on a live server. You don't want your pages be hacked/misused/etc etc
if you use any SQL that is passed from users,make sure you read about SQL injection.

Posted: Wed Mar 08, 2006 3:43 pm
by mrPibb
I discovered a nice "little" class put together by Brian Lozier - its called bTemplate. It seems to do what I want, but in ~140 lines of code instead of dozens of pages like other template managers do. Very simple implementation too
