Home > Article > Backend Development > Basic incomplete modification tutorial of style template_PHP tutorial
With my little experience, I hope it can be a reference for friends who are new to template modification.
Regarding template modification, I quote a sentence from the star's signature "It is important to learn HTML well" :)
A style, in addition to changing pictures and colors, then going in-depth is to modify the template.
Template is HTML language plus PHP variables, these two things are in it.
You can first enter the template editor in the system settings and open a template at will, such as viewthread_post. Personally, I feel that this template is the most important, followed by the index header footer and which part of the forum each template is. I believe you have more experience with it. You will know it naturally, and as the name implies, you can see a lot. Index, header, and footer are what you see when you enter the forum. viewthread_post is what we see when browsing posts one by one.
You can also find out the corresponding template you want to modify from the current address of the forum. When we look at each post, the address in IE is http"//***/viewthread.php?tid=, if you want to modify this page, you need to find the viewthread category of the template; there are many small categories in it. viewthread_post is one of them, it is about posts, and the others are forum jumps. It's transferred, the signature is related, etc. Don't worry about it. We just modify the template, don't go too in-depth.
Without further ado, modifying the template is straightforward and uses the web page creation tool. Dreamweaver, DW's visualization is very convenient. The code is above and the preview window is below. Let's take the template viewthread_post as an example. Copy all your viewthread_post template code into the code window of DW and you can see it clearly in the preview window below. Go to the frame and variables of a post. There are only these two things in
...$ip is the picture of the IP, and only the owner and the administrator will see this picture; $stars is for each member. Stars; $avatar is the avatar... etc. To modify the template, you often need to change the way and position of these variables in the web page. At this time, you can open another IE window, a forum post, and look at the forum posts. Compare it with the variables in the frames in the DW preview window, and you will know what the corresponding variables are displayed in the forum posts. Or you can delete a few variables in the template and confirm the changes, and then refresh the forum to see. You will know if there are any changes or what is missing.
Some common problems in the forum need to be modified. For example, the forum legend needs to be modified. The corresponding template is enough. When the forum legend shows that the address is in index.PHP, then look for it in this category. You can tell from the name that it is the template index_whosonline. Just find the relevant part and add it. If you don't know HTML, don't you know how to follow it? Just follow the instructions of Mozhu and the administrator for the gourd painting. There is also adding signature lines, etc.
It seems to be far away, and I will talk about style below.
Once you have a preliminary understanding of templates, first find a ready-made template and try modifying it. For example, if the style of VBB is good, save the webpage as (of course a page you think is good, and also the post part), then open it with DW,
we only need a post part Now, just delete the unnecessary things in the preview window, delete and delete again, and finally only keep the frame of the post we want, and then delete the redundant ones, such as the content of the original post, posting time, etc. Just keep a clean page (of course, create a new DW window in advance to open the original template of viewthread_post and look at this) and then bring in the variables in the viewthread_post template of Discuz! one by one to see which variables are placed in Wherever is suitable, of course the location according to the original VBB arrangement is the best. Replacement completed.
Look at what has been added, the frame width percentage, etc. or what you have done, what you need to modify because of different forums, etc. When you're almost done, copy and paste the code in the code window into your forum to cover your viewthread_post template, then refresh to see your results (note that the image path must be correct and uploaded to your space at the same time). Is there anything wrong? Keep revising and revising.
Some of the codes may show yellow error codes when you paste them into DW. Do not delete them. Keep them for their own purposes. It depends on the specific situation.
This is just an example of the viewthread_post template. The purpose is mainly to get familiar with and modify the template. I believe that after more exposure, you will be familiar with these. In the future, you should be able to modify the template and create a new style yourself. It went very smoothly. Do more original work of your own. . . Regarding the index part, that's it. However, please note that a page of the forum requires a combination of several templates. Don't look at and modify templates individually. Sometimes you need to consider the overall situation of a category. Also, beautifying forums usually involves adding framed pictures. The effect of beautification is immediate, but the impact on speed also needs to be considered. If you are very concerned about speed, adding an extra picture will have an impact. But a style is also very important to the impression a forum gives people. Not much to say about this.
A complete style, some details, a good match of the scroll bar color of the forum, plus a set of suitable mouse pointers (both require IE6.0 support) LOGO, etc., so that the forum can achieve a unified and harmonious effect.
Everything in the template is based on the combination of HTML language and variables, so I emphasize again that it is very important to learn HTML well. If you understand a little HTML language, I believe you don’t need to read what I wrote. To go deeper, you need to know some PHP, at least the basic syntax. For example, "In PHP, you need to add quotes before quotation marks." I only understand this now :D
I heard from Big C that in the future, the new version (the current one is already) will use multiple templates, and the current template structure may be There has been a slight change. At that time, a forum can use multiple styles without being limited to modifying the template and not using others. In infinite admiration...