Main Page
Creating html templates(For Html developers) How the template system works(For PHP developers) Creating Html Templates There are a few basic things you need to do in order to create a new html template. 1. Create the template page. 2. Make sure your your template file has a ".php" extension. 3. Put the new template file in the "templates" directory. 4. make the appropriate changes in the "cnfg_vars.php" file. Creating the template page Create your html template file, insert the php tags that are listed below where you want the associated behavior. Make sure that the template file has a .php extension. Your template file should be named something like myTemplate.php as opposed to myTemplate.html or myTemplate.htm . This is really a php file! But for all intents and purposes you can regard it as an html file with a few special tags in it and a .php extension in the name. Make sure your template file has a ".php" extension This has already been covered, but it can't be stressed enough. Put the new template file in the "templates" directory Make sure your new template file is in the "templates" directory which you should have already defined the path to in "path_cnfg.php". Make the appropriate changes in the "cnfg_vars.php" file Once you have created a new html template you need to let D.E. Classifieds know to use it. You do this by going into "cnfg_vars.php" and changing the value of the appropriate variable. All variables pertaining to template file names will be prefixed with "tmplt_" . After the "tmplt_" prefix will be the name of one of the pages of the application. For instance "add_item.php" is the name of the page that D.E. Classifieds uses when someone choose to add an item to the database. "add_item.php" is not the template file, but the actual php that is invoked in the application and that does most of the work. If you wanted to change the look of "add_item.php" you would set "tmplt_add_item" to the name of your new template files. Example: $cnfg['tmplt_add_item'] = "myNewTemplate.php"; If you wanted to change the look of your home page you would change the value of "tmplt_index". Example: $cnfg['tmplt_index'] = "homePageTemplate.php"; If you want to change which template file a particular page of the application uses, but aren't sure what the name of the page is. Just navigate through the site to the page in question and look in the location bar of your browser. The name of the page will be something like index.php or add_item.php. If there is a question mark and stuff following it, don't worry about that stuff, it's extra stuff that the application uses. The name of the file comes before the question mark. Example: http://myclassifiedsite.com/classifieds/search.php?doSearch=1 If the above is what you see in the location bar, then the name of the file for the current page is "search.php". Now you should know the basics of creating a template file. Using the predefined tags These are the tags that the application uses to actually do stuff. If you create a template file but don't put any of these tags in it, it will just sit there and not do anything but display the html that you put in it. Most of these tags are optional, but at least one is mandatory, that is " <?php content($content); ?> ". The quotation marks are only used to distinguish the tag from the rest of the words in the sentence. Quotation marks should not be present in actual usage. A brief description of how the " <?php content($content); ?> " tag works. What the " <?php content($content); ?> " does depends on which page is currently being served. If you are at the home page then the " <?php content($content); ?> " tag will display the Ideally, you will be able to copy and paste the tags below into your html templates. You may have to copy the tags that are lower down on the page rather than copying the linked tags. Some text editors may paste the linked tags as underlined html links. Either way, you should copy the tag that you want to use directly from this page. |